This file contains hidden or 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 automatic_display_flag(node, index): | |
"""When connecting input, this script will change the display flag is the input connected has the display flag on""" | |
try: | |
if node.input(index): | |
if node.input(index).isDisplayFlagSet(): | |
node.setDisplayFlag(True) | |
if node.input(index).isRenderFlagSet(): | |
node.setRenderFlag(True) | |
except Exception: | |
pass |
This file contains hidden or 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 hou | |
import canvaseventtypes | |
def follow_flags(parent, child): | |
if parent.isDisplayFlagSet(): | |
child.setDisplayFlag(True) | |
if parent.isRenderFlagSet(): | |
child.setRenderFlag(True) |
This file contains hidden or 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 maya.cmds as cmds | |
emetteur = cmds.emitter(type='surface', rate=10, scaleRateByObjectSize=False, needParentUV=True, | |
cycleEmission='none', speed=1, speedRandom=0, normalSpeed=1, tangentSpeed=0, | |
maxDistance=0, minDistance=0, dx=1, dy=0, dz=0, spread=0) | |
particules = cmds.nParticle() | |
cmds.evalDeferred(lambda: cmds.disconnectAttr(particules[1] + ".internalOpacityRamp", particules[1] + ".opacityPP"), lowestPriority=True) | |
# Meme chose que la ligne precedente mais passe par une string au lieu d'un lambda. | |
# cmds.evalDeferred('cmds.disconnectAttr("{}.internalOpacityRamp","{}.opacityPP")'.format(particules[1], particules[1]), lowestPriority=True) |
This file contains hidden or 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 maya.cmds as cmds | |
def getSGsFromMaterial(shader): | |
if cmds.ls(shader, materials=True): | |
nodes = [i.split('.')[0] for i in cmds.connectionInfo(shader +'.outColor', destinationFromSource=True)] # Faster than cmds.listConnections(shader, type="shadingEngine") | |
shadingGroups = [i for i in nodes if cmds.nodeType(i) == 'shadingEngine'] | |
return shadingGroups | |
return [] | |
def getShaderAssignation(shader): |