def __init__(self): if self.window is None: self.window = 'MtoALightManager' self.listElements = [] self.column = '' callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'directionalLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'pointLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'spotLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'areaLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'aiAreaLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'aiSkyDomeLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'aiPhotometricLight', applyToExisting=False) callbacks.addAttributeChangedCallback(self.meshTranslatorChanged, 'mesh', 'aiTranslator', applyToExisting=True) callbacks.addNodeRemovedCallback(self.deleteLight, 'directionalLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'pointLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'spotLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'areaLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'aiAreaLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'aiSkyDomeLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'aiPhotometricLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteMeshLight, 'mesh', applyToExisting=False) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'directionalLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'pointLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'spotLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'areaLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'aiAreaLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'aiSkyDomeLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'aiPhotometricLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback(self.refreshUI), 'mesh', applyToExisting=True)
def installCallbacks(): _sgAliasesCallbacks = callbacks.SceneLoadCallbackQueue() _sgAliasesCallbacks.addCallback(createAliases, passArgs=True) callbacks.addNodeAddedCallback(_sgAliasesCallbacks, 'shadingEngine', applyToExisting=True, apiArgs=False) if not pm.about(batch=True): callbacks.addAttributeChangedCallback(_aovOptionsChangedCallbacks, 'aiOptions', 'aovList', context=pm.api.MNodeMessage.kConnectionMade | pm.api.MNodeMessage.kConnectionBroken, applyToExisting=True)
def installCallbacks(): """ install all callbacks """ # certain scenes fail to execute this callback: #callbacks.addAttributeChangedCallback(_rendererChanged, 'renderGlobals', 'currentRenderer') if pm.about(batch=True): callbacks.addAttributeChangedCallback(_rendererChanged, 'renderGlobals', 'currentRenderer') else: pm.scriptJob(attributeChange=['defaultRenderGlobals.currentRenderer', _rendererChanged] ) pm.scriptJob(event =['SceneOpened', _rendererChanged] ) import mtoa.aovs as aovs aovs.installCallbacks()
def installCallbacks(): _sgAliasesCallbacks = callbacks.SceneLoadCallbackQueue() _sgAliasesCallbacks.addCallback(createAliases, passArgs=True) callbacks.addNodeAddedCallback(_sgAliasesCallbacks, 'shadingEngine', applyToExisting=True, apiArgs=False) if not pm.about(batch=True): callbacks.addAttributeChangedCallback( _aovOptionsChangedCallbacks, 'aiOptions', 'aovList', context=pm.api.MNodeMessage.kConnectionMade | pm.api.MNodeMessage.kConnectionBroken, applyToExisting=True)
def installCallbacks(): """ install all callbacks """ # certain scenes fail to execute this callback: #callbacks.addAttributeChangedCallback(_rendererChanged, 'renderGlobals', 'currentRenderer') if pm.about(batch=True): callbacks.addAttributeChangedCallback(_rendererChanged, 'renderGlobals', 'currentRenderer') else: pm.scriptJob(attributeChange=[ 'defaultRenderGlobals.currentRenderer', _rendererChanged ]) pm.scriptJob(event=['SceneOpened', _rendererChanged]) import mtoa.aovs as aovs aovs.installCallbacks()
def __init__(self): if self.window is None: self.window = 'MtoALightManager' self.listElements = [] self.column = '' callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'directionalLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'pointLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'spotLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'areaLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'aiAreaLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'aiSkyDomeLight', applyToExisting=False) callbacks.addNodeAddedCallback(callbacks.Callback(self.refreshUI), 'aiPhotometricLight', applyToExisting=False) callbacks.addAttributeChangedCallback(self.meshTranslatorChanged, 'mesh', 'aiTranslator', applyToExisting=True) callbacks.addNodeRemovedCallback(self.deleteLight, 'directionalLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'pointLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'spotLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'areaLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'aiAreaLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'aiSkyDomeLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteLight, 'aiPhotometricLight', applyToExisting=False) callbacks.addNodeRemovedCallback(self.deleteMeshLight, 'mesh', applyToExisting=False) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'directionalLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'pointLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'spotLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'areaLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'aiAreaLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'aiSkyDomeLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'aiPhotometricLight', applyToExisting=True) callbacks.addNameChangedCallback(callbacks.Callback( self.refreshUI), 'mesh', applyToExisting=True)
self.addControl("aiCastShadows") self.addControl("aiShadowDensity") self.addSeparator() self.addControl("aiResolution") self.addSeparator() self.commonLightAttributes() templates.registerTranslatorUI(AreaLightTemplate, "areaLight") # Actually currently connecting the other way round, filter's decayRate # to light's decay type which might be the best idea """ def lightDecayChanged(decayPlug, *args): "called to sync first found lightDecay filter when decayRate changes" # fnCam = om.MFnCamera(transPlug.node()) # currTrans = transPlug.asString() #orthoPlug = fnCam.findPlug('orthographic') # isOrtho = orthoPlug.asBool() print "lightDecayChanged", decayPlug.name(), decayPlug.asInt() print "filters", lightTemplate.LightTemplate.getConnectedLightFilters() # aiLightDecay print "Adding attribute changed callback for lights" callbacks.addAttributeChangedCallback(lightDecayChanged, 'pointLight', 'decayRate') callbacks.addAttributeChangedCallback(lightDecayChanged, 'spotLight', 'decayRate') callbacks.addAttributeChangedCallback(lightDecayChanged, 'areaLight', 'decayRate') callbacks.addAttributeChangedCallback(lightDecayChanged, 'aiAreaLight', 'decayRate')
self.addControl("aiShadowDensity") self.addSeparator() self.addControl("aiResolution") self.addSeparator() self.commonLightAttributes() templates.registerTranslatorUI(AreaLightTemplate, "areaLight") # Actually currently connecting the other way round, filter's decayRate # to light's decay type which might be the best idea """ def lightDecayChanged(decayPlug, *args): "called to sync first found lightDecay filter when decayRate changes" # fnCam = om.MFnCamera(transPlug.node()) # currTrans = transPlug.asString() #orthoPlug = fnCam.findPlug('orthographic') # isOrtho = orthoPlug.asBool() print "lightDecayChanged", decayPlug.name(), decayPlug.asInt() print "filters", lightTemplate.LightTemplate.getConnectedLightFilters() # aiLightDecay print "Adding attribute changed callback for lights" callbacks.addAttributeChangedCallback(lightDecayChanged, 'pointLight', 'decayRate') callbacks.addAttributeChangedCallback(lightDecayChanged, 'spotLight', 'decayRate') callbacks.addAttributeChangedCallback(lightDecayChanged, 'areaLight', 'decayRate') callbacks.addAttributeChangedCallback(lightDecayChanged, 'aiAreaLight', 'decayRate')