Skip to content

Instantly share code, notes, and snippets.

View yamahigashi's full-sized avatar

yamahigashi

View GitHub Profile
@yamahigashi
yamahigashi / check_maximum_influence.py
Created June 30, 2015 09:17
check max influence and select these vertex. for Maya
import maya.cmds as cmds
import maya.mel as mel
DEFAULT_MAXIMUM_INFULENCE = 5
##############################################################################
#1頂点に影響するジョイントの上限チェックする
##############################################################################
def check_maximum_influence(max=DEFAULT_MAXIMUM_INFULENCE):
res = []
@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:
# -*- 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
@yamahigashi
yamahigashi / generate_typeshed.py
Last active April 9, 2023 17:49
Typeshed generator for `maya.cmds.__init__.pyi` from maya CommandsPython html pages.
# pylint: disable=C0326,W0125,line-too-long
"""The typeshed generator for `maya.cmds` module from CommandsPython html pages.
Usage:
Download the documentation files from [ADN](https://knowledge.autodesk.com/support/maya/getting-started/caas/simplecontent/content/maya-documentation.html)
Run this script.
`$ python generate_typeshed.py inupt_folder output '
`$ python generate_typeshed.py autodesk-maya-user-guide-2020.1.htm-ade-2.1.enu/CommandsPython maya.cmds.__init__.pyi'
"""
@yamahigashi
yamahigashi / toggleAnimCurveIsolation.mel
Last active November 9, 2022 12:48
toggle anim curve isolation state for Autodesk #maya Graph Editor
// mel
proc doToggleAnimCurveIsolation(string $outliner, string $ed)
// C:/Program Files/Autodesk/Maya2016.5/scripts/others/isolateAnimCurve.mel 参照
{
global int $gUnisolateJobNum;
if ($gUnisolateJobNum > 0) {
# -*- coding: utf-8 -*-
###############################################################################
import sys
import textwrap
import maya.cmds as cmds
import maya.mel as mel
import maya.api.OpenMayaUI as omui
# import gml_maya.decorator as deco
@yamahigashi
yamahigashi / except_result.rst
Created April 12, 2017 08:45
Except annotation as restrcturedText

MAYA sampleメニュー 解説

Animation

Mirror Selected (animation):

no description

# -*- coding: utf-8 -*-
###############################################################################
import textwrap
import functools
import maya.cmds as cmds
import maya.mel as mel
from logging import ( # noqa:F401 pylint: disable=unused-import, wrong-import-order
StreamHandler,
# -*- coding: utf-8 -*-
"""Resize gameExporter's frame range textfields width of animation clips tab."""
import PySide2
def get_maya_main_window():
for obj in PySide2.QtWidgets.QApplication.topLevelWidgets():
if obj.objectName() == 'MayaWindow':
return obj
@yamahigashi
yamahigashi / redirect_log.py
Created September 15, 2020 05:39
Context manager for redirecting Autodesk Maya's logging to given file path, to use as `with` statement.
from contextlib import contextmanager
from pathlib import Path
@contextmanager
def redirect_log(logfile_path):
# type: (Text) -> Generator[None, None, None]
"""Function: Context manager for redirecting maya's log to given path, to use as `with` statement.
Scenario: giving None to logfile_path