Python maya.OpenMaya.MFnDependencyNode() Examples
The following are 26
code examples of maya.OpenMaya.MFnDependencyNode().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
maya.OpenMaya
, or try the search function
.
Example #1
Source File: node_utils.py From spore with MIT License | 6 votes |
def get_dynamic_attributes(mObject): """ return all dynamic attributes of a node """ result = [] mFnDep = om.MFnDependencyNode() objFn = om.MFnDependencyNode(mObject) refObj = mFnDep.create(objFn.typeName()) refFn = om.MFnDependencyNode(refObj) if (objFn.attributeCount() > refFn.attributeCount()): for i in range(refFn.attributeCount(), objFn.attributeCount()): attr = objFn.attribute(i) attrFn = om.MFnAttribute(attr) result.append(attrFn.name()) mDagMod = om.MDagModifier() mDagMod.deleteNode(refObj) return result
Example #2
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 6 votes |
def attrChangeCallback(self, msg, plug, otherPlug, clientData): incomingDirection = (OpenMaya.MNodeMessage.kIncomingDirection & msg) == OpenMaya.MNodeMessage.kIncomingDirection attributeSet = (OpenMaya.MNodeMessage.kAttributeSet & msg) == OpenMaya.MNodeMessage.kAttributeSet isCorrectAttribute = (plug.attribute() == instanceAlongCurveLocator.instanceCountAttr) isCorrectAttribute = isCorrectAttribute or (plug.attribute() == instanceAlongCurveLocator.instancingModeAttr) isCorrectAttribute = isCorrectAttribute or (plug.attribute() == instanceAlongCurveLocator.instanceLengthAttr) isCorrectAttribute = isCorrectAttribute or (plug.attribute() == instanceAlongCurveLocator.maxInstancesByLengthAttr) isCorrectAttribute = isCorrectAttribute or (plug.attribute() == instanceAlongCurveLocator.curveStartAttr) isCorrectAttribute = isCorrectAttribute or (plug.attribute() == instanceAlongCurveLocator.curveEndAttr) isCorrectNode = OpenMaya.MFnDependencyNode(plug.node()).typeName() == kPluginNodeName try: if isCorrectNode and isCorrectAttribute and attributeSet and incomingDirection: self.updateInstanceConnections() except: sys.stderr.write('Failed trying to update instances. stack trace: \n') sys.stderr.write(traceback.format_exc())
Example #3
Source File: mayauserprops.py From cross3d with MIT License | 6 votes |
def keys(self): # TODO MIKE: I had to do a try except here for the the object called "|groundPlane_transform". # It's apparently always in the scene and error with that line. try: keys = cmds.listAttr(cross3d.SceneWrapper._mObjName(self._nativePointer), userDefined=True) if keys: return keys except ValueError: pass return [] # http://forums.cgsociety.org/showthread.php?t=888612 # Note: I was unable to find a way to identify userDefined keys in the following method # so I used the maya.cmds method. If possible this finish this method and replace the # above code. #depNode = om.MFnDependencyNode(mObj) #total = depNode.attributeCount() #count = 0 #while count < total: # attr = depNode.attribute(count) # plug = om.MPlug(mObj, attr) # count += 1 # print count, attr.apiTypeStr(), plug.name()
Example #4
Source File: mayascenewrapper.py From cross3d with MIT License | 5 votes |
def _hasAttribute(cls, mObj, name): with ExceptionRouter(): depNode = om.MFnDependencyNode(mObj) return depNode.hasAttribute(name)
Example #5
Source File: capi.py From fossil with BSD 3-Clause "New" or "Revised" License | 5 votes |
def asMObject(node): ''' Return API 2.0 dependency node from the given pynode or string. ''' _list = OpenMaya.MSelectionList() if isinstance(node, basestring): _list.add( node ) else: _list.add( node.name() ) return OpenMaya.MFnDependencyNode( _list.getDependNode( 0 ) )
Example #6
Source File: swingtwist.py From cmt with MIT License | 5 votes |
def redoIt(self): self.clearResult() self._dgmod.doIt() fn_node = OpenMaya.MFnDependencyNode(self._node_mobject) if self._name and self._name != "swingTwist#": name = fn_node.setName(self._name) else: name = fn_node.name() self.setResult(name)
Example #7
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 5 votes |
def getSortedCurveAxisArray(mObject, curveAxisHandleArray, count): axisHandles = [] expectedHandleCount = OpenMaya.MFnDependencyNode(mObject).findPlug(instanceAlongCurveLocator.curveAxisHandleCountAttr).asInt() for i in xrange(min(expectedHandleCount, curveAxisHandleArray.elementCount())): curveAxisHandleArray.jumpToArrayElement(i) parameterHandle = curveAxisHandleArray.inputValue().child(instanceAlongCurveLocator.curveAxisHandleAttr.parameter) angleHandle = curveAxisHandleArray.inputValue().child(instanceAlongCurveLocator.curveAxisHandleAttr.angle) axisHandles.append((i, parameterHandle.asDouble(), angleHandle.asDouble())) def getKey(item): return item[1] return sorted(axisHandles, key=getKey)
Example #8
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 5 votes |
def __init__(self): OpenMayaMPx.MPxManipContainer.__init__(self) self.nodeFn = OpenMaya.MFnDependencyNode()
Example #9
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 5 votes |
def findShadingGroup(self, dagPath): # Search in children first before extending to shape for child in xrange(dagPath.childCount()): childDagPath = OpenMaya.MDagPath() fnDagNode = OpenMaya.MFnDagNode(dagPath.child(child)) fnDagNode.getPath(childDagPath) fnSet = self.findShadingGroup(childDagPath) if fnSet is not None: return fnSet if self.hasShapeBelow(dagPath): dagPath.extendToShape() fnDepNode = OpenMaya.MFnDependencyNode(dagPath.node()) instPlugArray = fnDepNode.findPlug("instObjGroups") instPlugArrayElem = instPlugArray.elementByLogicalIndex(dagPath.instanceNumber()) if instPlugArrayElem.isConnected(): connectedPlugs = OpenMaya.MPlugArray() instPlugArrayElem.connectedTo(connectedPlugs, False, True) if connectedPlugs.length() == 1: sgNode = connectedPlugs[0].node() if sgNode.hasFn(OpenMaya.MFn.kSet): return OpenMaya.MFnSet(sgNode) return None
Example #10
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 5 votes |
def postConstructor(self): OpenMaya.MFnDependencyNode(self.thisMObject()).setName("instanceAlongCurveLocatorShape#") self.callbackId = OpenMaya.MNodeMessage.addAttributeChangedCallback(self.thisMObject(), self.attrChangeCallback) self.updateInstanceConnections() # Find original SG to reassign it to instance
Example #11
Source File: sticker.py From NodeSticker with MIT License | 5 votes |
def _parse_nodes(target): """Internal function for getting MFnDependencyNode""" mfn_nodes = list() sel_list = oldOm.MSelectionList() for path in target: sel_list.add(path) for i in range(len(target)): mobj = oldOm.MObject() sel_list.getDependNode(i, mobj) mfn_nodes.append(oldOm.MFnDependencyNode(mobj)) return mfn_nodes
Example #12
Source File: sticker.py From NodeSticker with MIT License | 5 votes |
def reveal(): """Reveal custom icon from previous saved scene Can use with scene open callback for auto display custom icon saved from previous session. """ sel_list = oldOm.MSelectionList() ns_list = [""] + oldOm.MNamespace.getNamespaces(":", True) for ns in ns_list: if ns in (":UI", ":shared"): continue try: sel_list.add(ns + ":*." + ICON_ATTRIBUTE) except RuntimeError: pass for i in range(sel_list.length()): mobj = oldOm.MObject() sel_list.getDependNode(i, mobj) node = oldOm.MFnDependencyNode(mobj) plug = node.findPlug(ICON_ATTRIBUTE) icon_path = plug.asString() try: node.setIcon(os.path.expandvars(icon_path)) except RuntimeError: pass
Example #13
Source File: onionSkinRendererCore.py From onionSkinRenderer with MIT License | 5 votes |
def isPlugInteresting(self, plug, targetPlug): mfn_dep = oldOm.MFnDependencyNode(plug.node()) return plug == mfn_dep.findPlug(targetPlug, True) # ---------------- # INTERFACE FUNCTIONS # add a frame to display relative to current time slider position
Example #14
Source File: mayascenewrapper.py From cross3d with MIT License | 5 votes |
def _mObjName(cls, nativeObject, fullName=True): """ A Maya Helper that returns the name of a object, because OpenMaya can't expose the name in a single call. :param nativeObject: The OpenMaya.MObject to get the name of :param fullName: If True return the Name(Full Path), else return the displayName. Defaults to True :return: nativeObject's name as a string """ with ExceptionRouter(): if cls._isDagNode(nativeObject): dagPath = om.MDagPath.getAPathTo(nativeObject) if fullName: return dagPath.fullPathName() return dagPath.partialPathName().split("|")[-1] return om.MFnDependencyNode(nativeObject).name() #-------------------------------------------------------------------------------- # cross3d private methods #--------------------------------------------------------------------------------
Example #15
Source File: mayascenewrapper.py From cross3d with MIT License | 5 votes |
def _getPlug(cls, mObj, name): """ For a given OpenMaya.MObject return the OpenMaya.MPlug object with that attribute name. If the property does not exist, raises "RuntimeError: (kInvalidParameter): Cannot find item of required type" :param mObj: The source MObject :param name: The name of the attribute to get from mObj. :return: A OpenMaya.MPlug object """ with ExceptionRouter(): depNode = om.MFnDependencyNode(mObj) attr = depNode.attribute(name) return om.MPlug(mObj, attr)
Example #16
Source File: node_utils.py From spore with MIT License | 5 votes |
def connect_to_instancer(transform_node, spore_node): """ connect a transform's matrix attribute to a instancer node that is connected to the given spore node """ # get instancer's inputHierarchy plug instancer_node = get_instancer(spore_node, False) dg_fn = om.MFnDependencyNode(instancer_node) in_plug = dg_fn.findPlug('inputHierarchy') # get transform's matrix plug transform_node = get_mobject_from_name(transform_node) dag_fn = om.MFnDagNode(transform_node) matrix_plug = dag_fn.findPlug('matrix') # get first free plug and connect plug_id = in_plug.numElements() + 1 dag_mod = om.MDagModifier() dag_mod.connect(matrix_plug, in_plug.elementByLogicalIndex(plug_id)) dag_mod.doIt()
Example #17
Source File: node_utils.py From spore with MIT License | 5 votes |
def get_instanced_geo(spore_node): """ return a list of dag pathes of geometry transformes that are connected to the spore node's instancer @param spore_node str: the name of the spore node @return: list of string or None if no instancer is connected """ node_fn = get_dgfn_from_dagpath(spore_node) instance_plug = node_fn.findPlug('instanceData') plugs = om.MPlugArray() instancer_plugs = om.MPlugArray() instance_geo = [] if not instance_plug.isNull(): if instance_plug.connectedTo(plugs, False, True): node = plugs[0].node() node_fn = om.MFnDagNode(node) inst_geo_plug = node_fn.findPlug('inputHierarchy') if not inst_geo_plug.isNull(): for i in xrange(inst_geo_plug.numConnectedElements()): input_plug = inst_geo_plug.elementByPhysicalIndex(i) if input_plug.connectedTo(instancer_plugs, True, True): geo_plug = instancer_plugs[0] geo_node = geo_plug.node() instance_geo.append(om.MFnDagNode(geo_node).fullPathName()) dg_node_fn = om.MFnDependencyNode(node) instancer_node = dg_node_fn.name() return instance_geo
Example #18
Source File: node_utils.py From spore with MIT License | 5 votes |
def get_dgfn_from_dagpath(dagpath): """ return the functionset for the given dagpath """ m_object = get_mobject_from_name(dagpath) return om.MFnDependencyNode(m_object)
Example #19
Source File: instance_data.py From spore with MIT License | 5 votes |
def initialize_data(self): """ get cache data from the sporeNode's instanceData plug/ :param instance_data_plug MPlug: instanceData plug """ node_fn = om.MFnDependencyNode(self.node) self.data_plug = node_fn.findPlug('instanceData') self.data_object = self.data_plug.asMObject() array_attr_fn = om.MFnArrayAttrsData(self.data_object) self.position = array_attr_fn.vectorArray('position') self.scale = array_attr_fn.vectorArray('scale') self.rotation = array_attr_fn.vectorArray('rotation') self.instance_id = array_attr_fn.intArray('objectIndex') self.visibility = array_attr_fn.intArray('visibility') self.normal = array_attr_fn.vectorArray('normal') self.tangent = array_attr_fn.vectorArray('tangent') self.u_coord = array_attr_fn.doubleArray('u_coord') self.v_coord = array_attr_fn.doubleArray('v_coord') self.poly_id = array_attr_fn.intArray('poly_id') self.color = array_attr_fn.vectorArray('color') self.unique_id = array_attr_fn.intArray('unique_id') # TODO - set bb # get position as numpy array for i in xrange(self.position.length()): position = [[self.position[i].x, self.position[i].y, self.position[i].z]] self.np_position = np.append(self.np_position, position, axis=0) self.logger.debug('Initialize InstanceData object for: {}'.format(self.node_name))
Example #20
Source File: instance_data.py From spore with MIT License | 5 votes |
def __init__(self, node): log_lvl = sys._global_spore_dispatcher.spore_globals['LOG_LEVEL'] self.logger = logging_util.SporeLogger(__name__, log_lvl) dg_fn = om.MFnDependencyNode(node) self.node_name = dg_fn.name() self.node = node # TODO - hold on to selection list instead of mobj # self.bounding_box = None self.state = None self.data_plug = om.MPlug() self.data_object = om.MObject() # instance data attributes self.position = om.MVectorArray() self.scale = om.MVectorArray() self.rotation = om.MVectorArray() self.instance_id = om.MIntArray() self.visibility = om.MIntArray() self.normal = om.MVectorArray() self.tangent = om.MVectorArray() self.u_coord = om.MDoubleArray() self.v_coord = om.MDoubleArray() self.poly_id = om.MIntArray() self.color = om.MVectorArray() self.unique_id = om.MIntArray() self.exclusive_paint = [] # collect points for kd tree self.np_position = np.empty((0,3), float) self.tree = None self.logger.info('Instanciate new InstanceData object for: {}'.format(self.node_name))
Example #21
Source File: spore_command.py From spore with MIT License | 5 votes |
def redoIt(self): """ redo """ self.dag_mod_transform.doIt() self.dag_mod_spore.doIt() self.dag_mod_instancer.doIt() # get result result = [] dg_fn = om.MFnDependencyNode(self.spore) result.append(dg_fn.name()) dag_fn = om.MFnDagNode(self.instancer) result.append(dag_fn.fullPathName()) self.clearResult() self.setResult(result)
Example #22
Source File: spore_sampler.py From spore with MIT License | 4 votes |
def get_settings(self): """ get emit attributes from node """ # get sample settings from the spore node # shouldn use maya commands here but i was lazy self.node_name = om.MFnDependencyNode(self.target).name() self.mode = cmds.getAttr('{}.emitType'.format(self.node_name)) self.use_tex = cmds.getAttr('{}.emitFromTexture'.format(self.node_name)) self.num_samples = cmds.getAttr('{}.numSamples'.format(self.node_name)) self.cell_size = cmds.getAttr('{}.cellSize'.format(self.node_name)) self.min_radius = cmds.getAttr('{}.minRadius'.format(self.node_name)) self.min_radius_2d = cmds.getAttr('{}.minRadius2d'.format(self.node_name)) self.align_modes = ['normal', 'world', 'object', 'stroke'] self.align_id = cmds.getAttr('{}.alignTo'.format(self.node_name)) self.strength = cmds.getAttr('{}.strength'.format(self.node_name)) self.min_rot = cmds.getAttr('{}.minRotation'.format(self.node_name))[0] self.max_rot = cmds.getAttr('{}.maxRotation'.format(self.node_name))[0] self.uni_scale = cmds.getAttr('{}.uniformScale'.format(self.node_name)) self.min_scale = cmds.getAttr('{}.minScale'.format(self.node_name))[0] self.max_scale = cmds.getAttr('{}.maxScale'.format(self.node_name))[0] self.min_offset = cmds.getAttr('{}.minOffset'.format(self.node_name)) self.max_offset = cmds.getAttr('{}.maxOffset'.format(self.node_name)) self.min_altitude = cmds.getAttr('{}.minAltitude'.format(self.node_name)) self.max_altitude = cmds.getAttr('{}.maxAltitude'.format(self.node_name)) self.min_altitude_fuzz = cmds.getAttr('{}.minAltitudeFuzz'.format(self.node_name)) self.max_altitude_fuzz = cmds.getAttr('{}.maxAltitudeFuzz'.format(self.node_name)) self.min_slope = cmds.getAttr('{}.minSlope'.format(self.node_name)) self.max_slope = cmds.getAttr('{}.maxSlope'.format(self.node_name)) self.slope_fuzz = cmds.getAttr('{}.slopeFuzz'.format(self.node_name)) sel = cmds.textScrollList('instanceList', q=True, si=True) seed = cmds.getAttr('{}.seed'.format(self.node_name)) if sel: object_index = [int(s.split(' ')[0].strip('[]:')) for s in sel] else: elements = cmds.textScrollList('instanceList', q=True, ai=True) if not elements: raise RuntimeError('No instance geometry selected') object_index = [int(e.split(' ')[0].strip('[]:')) for e in elements] self.ids = object_index # set the random seed and initialize the Points object self.set_seed(seed)
Example #23
Source File: mayascenewrapper.py From cross3d with MIT License | 4 votes |
def _createAttribute(cls, mObj, name, dataType=None, shortName=None, default=None): """ Create a attribute on the provided object. Returns the attribute name and shortName. You should provide dataType or default when calling this method so a valid dataType is selected. MayaSceneWrapper._normalizeAttributeName is called on name to ensure it is storing the attribute with a valid attribute name. If shortName is not provided, the name will have MayaSceneWrapper._normalizeAttributeShortName called on it. :param mObj: The OpenMaya.MObject to create the attribute on :param name: The name used to access the attribute :param dataType: The type of data to store in the attribute. Defaults to None. :param shortName: The shortName used by scripting. Defaults to None. :param default: The default value assigned to the attribute. Defaults to None. :return: (name, short name) Because the attribute name and shortName are normalized, this returns the actual names used for attribute names. """ name = cls._normalizeAttributeName(name) if dataType == None and default != None: dataType == cls._getAttributeDataType(default) if dataType == om.MFnData.kInvalid: # No vaid dataType was found, default to None so we can handle it diffrently dataType == None cross3d.logger.debug('Unable To determine the attribute type.\n{}'.format(str(default))) if dataType == None: # MCH 09/17/14 # TODO Evaluate if this is a valid default? dataType = om.MFnData.kAny with ExceptionRouter(): if shortName == None: shortName = cls._normalizeAttributeShortName(name, uniqueOnObj=mObj) depNode = om.MFnDependencyNode(mObj) sAttr = om.MFnTypedAttribute() if False: #if default: # TODO: Handle creating the default object attr = sAttr.create(name, shortName, dataType, default) else: attr = sAttr.create(name, shortName, dataType) # TODO MIKE: Problem with "|groundPlane_transform". try: depNode.addAttribute(attr) except RuntimeError: pass return name, shortName
Example #24
Source File: node_utils.py From spore with MIT License | 4 votes |
def get_connected_in_mesh(spore_node, as_string=True): """ get the full path name or mDagPath of the shape node connected to the given spore node """ # TODO - error when node name is not unique! if isinstance(spore_node, str) or isinstance(spore_node, unicode): node_fn = get_dgfn_from_dagpath(spore_node) elif isinstance(spore_node, om.MObject): node_fn = om.MFnDependencyNode(spore_node) else: raise TypeError( 'Expected type. Requires string or MObject, got: {}'.format( type(spore_node) ) ) inmesh_plug = node_fn.findPlug('inMesh') in_mesh = om.MDagPath() if not inmesh_plug.isNull(): plugs = om.MPlugArray() if inmesh_plug.connectedTo(plugs, True, False): input_node = plugs[0].node() if input_node.hasFn(om.MFn.kMesh): om.MDagPath.getAPathTo(input_node, in_mesh) if in_mesh.isValid(): if as_string: return in_mesh.fullPathName() else: return in_mesh else: raise RuntimeError('Invalid connectedion to: {}'.format(in_mesh.fullPathName())) else: raise RuntimeError('inMesh plug is not connected to a poly mesh') else: raise RuntimeError('spore nodes\'s inMesh plug is not connected') else: try: inmesh_plug = '{}.{}'.format(inmesh_plug.node(), inmesh_plug.name()) except: pass raise RuntimeError( 'Invalid plug does not refer to an attribute: {}\n ' 'invalid connection?'.format(inmesh_plug) )
Example #25
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 4 votes |
def __init__(self, mObject, dataBlock, rampAttr, normalize, instanceCount): self.ramp = OpenMaya.MRampAttribute(OpenMaya.MPlug(mObject, rampAttr.ramp)) self.rampOffset = dataBlock.inputValue(rampAttr.rampOffset).asFloat() self.rampRandomAmplitude = dataBlock.inputValue(rampAttr.rampRandomAmplitude).asFloat() self.rampAmplitude = dataBlock.inputValue(rampAttr.rampAmplitude).asFloat() self.rampRepeat = dataBlock.inputValue(rampAttr.rampRepeat).asFloat() if normalize: self.rampAxis = dataBlock.inputValue(rampAttr.rampAxis.compound).asVector().normal() else: self.rampAxis = dataBlock.inputValue(rampAttr.rampAxis.compound).asVector() self.useDynamicAmplitudeValues = False amplitudePlug = OpenMaya.MPlug(mObject, rampAttr.rampAmplitude) if amplitudePlug.isConnected(): # Get connected input plugs connections = OpenMaya.MPlugArray() amplitudePlug.connectedTo(connections, True, False) # Find input transform if connections.length() == 1: node = connections[0].node() nodeFn = OpenMaya.MFnDependencyNode(node) resultColors = OpenMaya.MFloatVectorArray() resultTransparencies = OpenMaya.MFloatVectorArray() uValues = OpenMaya.MFloatArray(instanceCount, 0.0) vValues = OpenMaya.MFloatArray(instanceCount, 0.0) # Sample a line, for more user flexibility for i in xrange(instanceCount): uValues.set(i / float(instanceCount), i) vValues.set(i / float(instanceCount), i) # For now... then we can just use the plug (TODO) if(node.hasFn(OpenMaya.MFn.kTexture2d)): OpenMayaRender.MRenderUtil.sampleShadingNetwork(nodeFn.name() + ".outColor", instanceCount, False, False, OpenMaya.MFloatMatrix(), None, uValues, vValues, None, None, None, None, None, resultColors, resultTransparencies) self.rampAmplitudeValues = [] self.useDynamicAmplitudeValues = True for i in xrange(resultColors.length()): self.rampAmplitudeValues.append(resultColors[i].length() / math.sqrt(3)) # Ramps base offset
Example #26
Source File: spore_node.py From spore with MIT License | 4 votes |
def compute(self, plug, data): this_node = self.thisMObject() if plug == self.a_instance_data: # if the node has yet not been in initialized create the instance # data attribute and read all point if some exist if not self._state: self.initialize_state(plug, data) # cache geometry is_cached = data.inputValue(self.a_geo_cached).asBool() if not is_cached: # check if there is another spore node that already has a cache # object for the current inmesh # note: this does not ensure that the cache is up to date! found = False for key, node in sys._global_spore_tracking_dir.iteritems(): other_in_mesh = node_utils.get_connected_in_mesh(node.thisMObject()) in_mesh = node_utils.get_connected_in_mesh(self.thisMObject()) if in_mesh == other_in_mesh and node != self: self.geo_cache = node.geo_cache # check if the cache is still valid if self.geo_cache.validate_cache(): found = True else: in_mesh = node_utils.get_connected_in_mesh(self.thisMObject(), False) self.geo_cache.flush_cache() self.geo_cache.cache_geometry(in_mesh) # if the cache is invalid break, since we need to recache break # if no cache was found start creating a new one if not found: in_mesh = node_utils.get_connected_in_mesh(self.thisMObject(), False) self.geo_cache.cache_geometry(in_mesh) # set cached to true node_fn = om.MFnDependencyNode(self.thisMObject()) cached_plug = node_fn.findPlug('geoCached') cached_plug.setBool(True) is_delete = data.inputValue(self.a_clear).asBool() if is_delete: self._state.clear() node_fn = om.MFnDependencyNode(self.thisMObject()) clear_plug = node_fn.findPlug('clear') clear_plug.setBool(False) data.setClean(self.a_instance_data)