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
class eSelection(object): | |
""" Enum for selection convertion. """ | |
object = 0 | |
face = 1 | |
edge = 2 | |
vert = 3 |
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 getActive(): | |
""" Check current selection to find if we're currently only selecting a specific component. """ | |
if all(isinstance(x, pm.MeshFace) for x in pm.selected()): | |
return eSelection.face | |
if all(isinstance(x, pm.MeshEdge) for x in pm.selected()): | |
return eSelection.edge | |
if all(isinstance(x, pm.MeshVertex) for x in pm.selected()): |
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
# Replace selection with transform, for all selected vertices. | |
pm.select( [shape.getTransform() for shape in pm.ls(pm.polyListComponentConversion( fromVertex = True ))], replace = True ) |
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
""" | |
Count the number of scriptCtx in scene, checking only default named ones. | |
""" | |
import pymel.core as pm | |
def countScriptCtx(): | |
count = 0 | |
mel_command = 'scriptCtx -ex "scriptCtx{}"' |
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
# python | |
""" | |
Snippets for dealing with Modo's Selection Service | |
""" | |
__author__ = "AndreasR" |
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
""" | |
Test to see that the official p4 api can be executed multithreadded | |
""" | |
# Get time so we can cause a delay, and uniform to set it to a random float, | |
from time import sleep | |
from random import uniform |
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
import modo | |
# Anonymous function to wrap the lx query | |
is_visible = lambda item: bool(lx.eval('layer.setVisibility {} ?'.format(item.id))) | |
def get_visible_meshes(): | |
meshes = modo.Scene().items(itype='mesh') # Get all mesh items in scene | |
return [mesh for mesh in meshes if is_visible(mesh)] |
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
# python | |
""" | |
Modo script to print all fire and forget scripts for the given kit to log. | |
Example:: | |
@list_kit_scripts.py my_kit |
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
""" | |
Functions for editing the texel density | |
https://80.lv/articles/textel-density-tutorial/ | |
""" | |
import math | |
import maya.cmds as mc |