Skip to content

Instantly share code, notes, and snippets.

View yamahigashi's full-sized avatar

Takayoshi Matsumoto yamahigashi

View GitHub Profile
def load_hik_animation_into_current_character(source_file_path=None, character=None):
if not source_file_path:
source_file_path = cmds.fileDialog2(
fileFilter="Scene Files (*.ma *.mb *.fbx);;Maya ASCII (*.ma);;Maya Binary (*.mb);;Fbx file(*.fbx)",
fileMode=1,
caption="Select animation source file.",
)
if not source_file_path:
# -*- coding: UTF-8 -*-
# ======================================================================
import os
from maya import cmds
from maya import mel
if False:
# For type annotation
from typing import Dict, List, Tuple, Pattern, Callable, Any, Text # NOQA
import maya.api.OpenMaya as om
import maya.api.OpenMayaUI as omui
# ======================================================================
SLIM_MASK = omui.M3dView.kDisplayTextures + omui.M3dView.kDisplayMeshes + omui.M3dView.kDisplayGrid
ALL_MASK = omui.M3dView.kDisplayEverything
def hoge(mask):
import ctypes
class MEMORYSTATUSEX(ctypes.Structure):
_fields_ = [
('dwLength', ctypes.c_ulong),
('dwMemoryLoad', ctypes.c_ulong),
('ullTotalPhys', ctypes.c_ulonglong),
('ullAvailPhys', ctypes.c_ulonglong),
@yamahigashi
yamahigashi / select_opposite.py
Last active January 29, 2018 02:15
Select opposite nodes currentry selected for Autodesk Maya.
import re
from maya.api import OpenMaya as OpenMaya2
def select_opposite():
# type: () -> None
y = OpenMaya2.MGlobal.getActiveSelectionList()
sel_strings = y.getSelectionStrings()
@yamahigashi
yamahigashi / auto_enable_vp2.py
Created January 25, 2018 05:11
Enable viewport2.0 with antialias on opening secen for Autodesk Maya.
from textwrap import dedent
from maya import OpenMaya as om
from maya import cmds
from maya import mel
def auto_enable_vp2(arg):
force_vp2_cmd = dedent("""
string $panels[] = `getPanel -type modelPanel`;
@yamahigashi
yamahigashi / add_corner_widget_to_maya_main_menu.py
Last active September 15, 2023 03:31
Add corner widget to maya main menu bar.
from Qt import QtWidgets
def getMayaMainWindow():
# type: () -> QtWidgets.QWidget
for obj in QtWidgets.qApp.topLevelWidgets():
if obj.objectName() == 'MayaWindow':
return obj
else:
#!/usr/bin/env python
# -'''- coding: utf-8 -'''-
import os
import sys
from PySide2 import QtQuickWidgets
from PySide2.QtCore import QUrl
import maya.mel as mel
import maya.cmds as cmds
import_command = "DoraSkinWeightImport( \"{name}.dsw\", $gDoraSkinWeightImpExp_ImpMode, 0, 1, 0.001)"
all = [x for x in cmds.ls(sl=True)]
for x in all:
cmds.select(x)
mel.eval(import_command.format(name=x))
@yamahigashi
yamahigashi / except_result.rst
Created April 12, 2017 08:45
Except annotation as restrcturedText

MAYA sampleメニュー 解説

Animation

Mirror Selected (animation):
no description