This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide2 import QtWidgets, QtCore | |
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin | |
from maya import OpenMayaUI | |
# Compatability | |
try: | |
long | |
except NameError: | |
long = int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds, mel | |
from contextlib import contextmanager | |
from mayakit.tags import tag, untag, query, search, message, unmessage, connect | |
@contextmanager | |
def selection(nodes=None): | |
old_selection = cmds.ls(sl=True) | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, division, print_function | |
from tinyrpc import spawn, init_maya | |
# Simple rpc example | |
# Opens rpc on localhost at port 8000 using the current python interpreter | |
rpc = spawn() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
extraclick.py | |
============== | |
Make Armin Ronacher's excellent click library even more excellent. | |
- ListOption: click.Option subclass with a custom parser that eats all | |
arguments until the next option is found. This allows for the same sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def regenerator(generator_fn): | |
'''A decorator for generators. When a generator is yielded, it's | |
items are yielded one by one. This allows generators to be recursive | |
without requiring the yield from syntax of Python 3.3+. | |
Examples: | |
>>> @regenerator | |
... def count_down(number): | |
... if number < 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
This module tests the circumstances under which a directory's st_mtime changes. | |
Precision is determined by the current file system. On Windows with NTFS the | |
tests will pass when the time between changes is as low as 0.01 seconds. If | |
you set the INTERVAL to 0 you'll discover how inconsistent the tests become. | |
On Unix based systems with other file systems the time between changes must | |
increase in order for the tests to pass, in the worst case up to 2 seconds. | |
Runs with a default SLEEP_INTERVAL of 0.1 seconds. You can pass a different |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Extract particles as polySpheres. | |
Supports: | |
position, rotationPP, rgbPP, and radiusPP | |
''' | |
from maya import cmds | |
class Sphere(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import psutil | |
def get_parent_process(ok_names, limit=10): | |
'''Walk up the process tree until we find a process we like. | |
Arguments: | |
ok_names: Return the first one of these processes that we find | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds | |
def simple_collision_check(obj_xform, collider_shape): | |
''' | |
Create a node network that checks whether an objects xform is colliding with a mesh. Returns a condition node where outputX, Y, and Z are 1 | |
for colliding and 0 when not colliding. | |
:param obj_xform: Path to object transform | |
:param collider_shape: Path to mesh transform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
f-strings backport...sorta | |
========================== | |
What it looks like:: | |
>>> x = 'Hello, World...' | |
>>> f('{x}') | |
'Hello, World...' |
NewerOlder