def initialize(cls): unitFn = om.MFnUnitAttribute() VectorHelperNode.radius = unitFn.create("radius", "r", om.MFnUnitAttribute.kDistance) unitFn.channelBox = True unitFn.default = om.MDistance(0.1) unitFn.setMin(om.MDistance(0)) om.MPxNode.addAttribute(VectorHelperNode.radius) numericFn = om.MFnNumericAttribute() VectorHelperNode.origin = numericFn.createPoint("origin", "o") numericFn.channelBox = True om.MPxNode.addAttribute(VectorHelperNode.origin) VectorHelperNode.target = numericFn.createPoint("target", "t") numericFn.channelBox = True om.MPxNode.addAttribute(VectorHelperNode.target) VectorHelperNode.colorR = numericFn.create("colorR", "cr", om.MFnNumericData.kFloat, 1) numericFn.channelBox = True om.MPxNode.addAttribute(VectorHelperNode.colorR) VectorHelperNode.colorG = numericFn.create("colorG", "cg", om.MFnNumericData.kFloat, 0) numericFn.channelBox = True om.MPxNode.addAttribute(VectorHelperNode.colorG) VectorHelperNode.colorB = numericFn.create("colorB", "cb", om.MFnNumericData.kFloat, 0) numericFn.channelBox = True om.MPxNode.addAttribute(VectorHelperNode.colorB)
def get_attribute_default_value(plug): """ Get the default value for the given plug :param plug: Plug for the attribute :type plug: om.MPlug :return: Default value of the attribute found on the plug :rtype: float or None """ attr = plug.attribute() api = attr.apiType() if api == om.MFn.kNumericAttribute: typeFn = om.MFnNumericAttribute(attr) return float(typeFn.default) if api in [om.MFn.kDoubleLinearAttribute, om.MFn.kFloatLinearAttribute]: typeFn = om.MFnUnitAttribute(attr) default = om.MDistance(typeFn.default) return default.value if api in [om.MFn.kDoubleAngleAttribute, om.MFn.kFloatAngleAttribute]: typeFn = om.MFnUnitAttribute(attr) default = om.MAngle(typeFn.default) return default.value return None
def initialize(): unitFn = om.MFnUnitAttribute() footPrint.size = unitFn.create( "size", "sz", om.MFnUnitAttribute.kDistance ) unitFn.default = om.MDistance(1.0) om.MPxNode.addAttribute( footPrint.size )
def initialize(cls): unitFn = om.MFnUnitAttribute() AngleHelperNode.radius1 = unitFn.create("radius1", "r1", om.MFnUnitAttribute.kDistance) unitFn.channelBox = True unitFn.default = om.MDistance(0) unitFn.setMin(om.MDistance(0)) om.MPxNode.addAttribute(AngleHelperNode.radius1) AngleHelperNode.radius2 = unitFn.create("radius2", "r2", om.MFnUnitAttribute.kDistance) unitFn.default = om.MDistance(1) unitFn.setMin(om.MDistance(0)) unitFn.channelBox = True om.MPxNode.addAttribute(AngleHelperNode.radius2) AngleHelperNode.angle1 = unitFn.create("angle1", "a1", om.MFnUnitAttribute.kAngle) unitFn.default = om.MAngle(0) unitFn.channelBox = True om.MPxNode.addAttribute(AngleHelperNode.angle1) AngleHelperNode.angle2 = unitFn.create("angle2", "a2", om.MFnUnitAttribute.kAngle) unitFn.default = om.MAngle(0) unitFn.channelBox = True om.MPxNode.addAttribute(AngleHelperNode.angle2) numericFn = om.MFnNumericAttribute() AngleHelperNode.colorR = numericFn.create("colorR", "cr", om.MFnNumericData.kFloat, 1) numericFn.channelBox = True om.MPxNode.addAttribute(AngleHelperNode.colorR) AngleHelperNode.colorG = numericFn.create("colorG", "cg", om.MFnNumericData.kFloat, 0) numericFn.channelBox = True om.MPxNode.addAttribute(AngleHelperNode.colorG) AngleHelperNode.colorB = numericFn.create("colorB", "cb", om.MFnNumericData.kFloat, 0) numericFn.channelBox = True om.MPxNode.addAttribute(AngleHelperNode.colorB)
def initialize(): # MFnUnitAttribute Function set for creating and working with angle, distance and time attributes # in this case we want to work with distance. unitFn = OpenMaya.MFnUnitAttribute() footPrint.size = unitFn.create('size', 'sz', OpenMaya.MFnUnitAttribute.kDistance) unitFn.default = OpenMaya.MDistance(1.0) # add new attributes, this method can only be launched on the static initialize OpenMaya.MPxNode.addAttribute(footPrint.size)
def pythonTypeToMayaType(dataType, value): if dataType == attrtypes.kMFnDataMatrixArray: return map(om2.MMatrix, value) elif attrtypes.kMFnDataVectorArray: return map(om2.MVector, value) elif dataType == attrtypes.kMFnUnitAttributeDistance: return om2.MDistance(value) elif dataType == attrtypes.kMFnUnitAttributeAngle: return om2.MAngle(value, om2.MAngle.kDegrees) elif dataType == attrtypes.kMFnUnitAttributeTime: return om2.MTime(value) return value
def setUnitAttr(plug, value, obj): apiType = obj.apiType() if apiType in [ api2.MFn.kDoubleLinearAttribute, api2.MFn.kFloatLinearAttribute ]: unit = api2.MDistance.uiUnit() val = api2.MDistance(value, unit=unit) return plug.setMDistance(val) elif apiType in [ api2.MFn.kDoubleAngleAttribute, api2.MFn.kFloatAngleAttribute ]: unit = api2.MAngle.uiUnit() val = api2.MAngle(value, unit=unit) return plug.setMAngle(val) elif apiType == api2.MFn.kTimeAttribute: unit = api2.MTime.uiUnit() val = api2.MTime(value, unit=unit) return plug.setMTime(val) return None
def setPlugValue(plug, value): """ Sets the given plug's value to the passed in value. :param plug: MPlug, The node plug. :param value: type, Any value of any data type. """ if plug.isArray: count = plug.evaluateNumElements() if count != len(value): return for i in range(count): setPlugValue(plug.elementByPhysicalIndex(i), value[i]) return elif plug.isCompound: count = plug.numChildren() if count != len(value): return for i in range(count): setPlugValue(plug.child(i), value[i]) return obj = plug.attribute() if obj.hasFn(om2.MFn.kUnitAttribute): attr = om2.MFnUnitAttribute(obj) ut = attr.unitType() if ut == om2.MFnUnitAttribute.kDistance: plug.setMDistance(om2.MDistance(value)) elif ut == om2.MFnUnitAttribute.kTime: plug.setMTime(om2.MTime(value)) elif ut == om2.MFnUnitAttribute.kAngle: plug.setMAngle(om2.MAngle(value)) elif obj.hasFn(om2.MFn.kNumericAttribute): attr = om2.MFnNumericAttribute(obj) at = attr.numericType() if at in (om2.MFnNumericData.k2Double, om2.MFnNumericData.k2Float, om2.MFnNumericData.k2Int, om2.MFnNumericData.k2Long, om2.MFnNumericData.k2Short, om2.MFnNumericData.k3Double, om2.MFnNumericData.k3Float, om2.MFnNumericData.k3Int, om2.MFnNumericData.k3Long, om2.MFnNumericData.k3Short, om2.MFnNumericData.k4Double): data = om2.MFnNumericData().create(value) plug.setMObject(data.object()) elif at == om2.MFnNumericData.kDouble: plug.setDouble(value) elif at == om2.MFnNumericData.kFloat: plug.setFloat(value) elif at == om2.MFnNumericData.kBoolean: plug.setBool(value) elif at == om2.MFnNumericData.kChar: plug.setChar(value) elif at in (om2.MFnNumericData.kInt, om2.MFnNumericData.kInt64, om2.MFnNumericData.kLong, om2.MFnNumericData.kLast): plug.setInt(value) elif at == om2.MFnNumericData.kShort: plug.setInt(value) elif obj.hasFn(om2.MFn.kEnumAttribute): plug.setInt(value) elif obj.hasFn(om2.MFn.kTypedAttribute): attr = om2.MFnTypedAttribute(obj) at = attr.attrType() if at == om2.MFnData.kMatrix: mat = om2.MFnMatrixData().create(om2.MMatrix(value)) plug.setMObject(mat) elif at == om2.MFnData.kString: plug.setString(value) elif obj.hasFn(om2.MFn.kMatrixAttribute): mat = om2.MFnMatrixData().create(om2.MMatrix(value)) plug.setMObject(mat) elif obj.hasFn(om2.MFn.kMessageAttribute) and isinstance(value, om2.MPlug): # connect the message attribute connectPlugs(plug, value) else: raise ValueError( "Currently we don't support dataType ->{} contact the developers to get this implemented" .format(obj.apiTypeStr))
def setPlugInfoFromDict(plug, **kwargs): """Sets the standard plug settings via a dict. :param plug: The Plug to change :type plug: om2.MPlug :param kwargs: currently includes, default, min, max, softMin, softMin, value, Type, channelBox, keyable, locked. :type kwargs: dict .. code-block:: python data = { "Type": 5, # attrtypes.kType "channelBox": true, "default": 1.0, "isDynamic": true, "keyable": true, "locked": false, "max": 99999, "min": 0.0, "name": "scale", "softMax": None, "softMin": None, "value": 1.0, "children": [{}] # in the same format as the parent info } somePLug = om2.MPlug() setPlugInfoFromDict(somePlug, **data) """ children = kwargs.get("children", []) # just to ensure we dont crash we check to make sure the requested plug is a compound. if plug.isCompound: # cache the childCount childCount = plug.numChildren() if not children: #not a huge fan of doing a deepcopy just to deal with modifying the value/default further down children = [copy.deepcopy(kwargs) for i in xrange(childCount)] # now iterate the children data which contains a dict which is in the format for i, childInfo in enumerate(children): # it's possible that no data was passed for this child so skip if not childInfo: continue # ensure the child index exists if i in range(childCount): # modify the value and default value if we passed one in, this is done because the # children would support a single value over and compound i.e kNumeric3Float value = childInfo.get("value") defaultValue = childInfo.get("default") if value is not None and i in range(len(value)): childInfo["value"] = value[i] if defaultValue is not None and i in range( len(defaultValue)): childInfo["default"] = defaultValue[i] setPlugInfoFromDict(plug.child(i), **childInfo) else: # now iterate the children data which contains a dict which is in the format for i, childInfo in enumerate(children): # it's possible that no data was passed for this child so skip if not childInfo: continue # ensure the child index exists if i in range(childCount): setPlugInfoFromDict(plug.child(i), **childInfo) default = kwargs.get("default") min = kwargs.get("min") max = kwargs.get("max") softMin = kwargs.get("softMin") softMax = kwargs.get("softMax") value = kwargs.get("value") Type = kwargs.get("Type") # certain data types require casting i.e MDistance if default is not None and Type is not None: if Type == attrtypes.kMFnDataString: default = om2.MFnStringData().create(default) elif Type == attrtypes.kMFnDataMatrix: default = om2.MMatrix(default) value = om2.MMatrix(value) elif Type == attrtypes.kMFnUnitAttributeAngle: default = om2.MAngle(default, om2.MAngle.kRadians) value = om2.MAngle(value, om2.MAngle.kRadians) elif Type == attrtypes.kMFnUnitAttributeDistance: default = om2.MDistance(default) value = om2.MDistance(value) elif Type == attrtypes.kMFnUnitAttributeTime: default = om2.MTime(default) value = om2.MTime(value) try: setPlugDefault(plug, default) except Exception: logger.error("Failed to set plug default values: {}".format( plug.name()), exc_info=True, extra={"data": default}) if value is not None and not plug.attribute().hasFn(om2.MFn.kMessageAttribute) and not plug.isCompound and not \ plug.isArray: setPlugValue(plug, value) if min is not None: setMin(plug, min) if max is not None: setMax(plug, max) if softMin is not None: setSoftMin(plug, softMin) if softMax is not None: setSoftMax(plug, softMax) plug.isChannelBox = kwargs.get("channelBox", False) plug.isKeyable = kwargs.get("keyable", False) plug.isLocked = kwargs.get("locked", False)
def addAttribute(node, longName, shortName, attrType=attrtypes.kMFnNumericDouble, isArray=False, apply=True): """This function uses the api to create attributes on the given node, currently WIP but currently works for string,int, float, bool, message, matrix. if the attribute exists a ValueError will be raised. :param node: MObject :param longName: str, the long name for the attribute :param shortName: str, the shortName for the attribute :param attrType: attribute Type, attrtypes constants :param apply: if False the attribute will be immediately created on the node else just return the attribute instance :rtype: om.MObject """ if hasAttribute(node, longName): raise ValueError("Node -> '%s' already has attribute -> '%s'" % (nameFromMObject(node), longName)) aobj = None attr = None if attrType == attrtypes.kMFnNumericDouble: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kDouble) elif attrType == attrtypes.kMFnNumericFloat: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kFloat) elif attrType == attrtypes.kMFnNumericBoolean: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kBoolean) elif attrType == attrtypes.kMFnNumericInt: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kInt) elif attrType == attrtypes.kMFnNumericShort: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kShort) elif attrType == attrtypes.kMFnNumericLong: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kLong) elif attrType == attrtypes.kMFnNumericByte: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kByte) elif attrType == attrtypes.kMFnNumericChar: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kChar) elif attrType == attrtypes.kMFnNumericAddr: attr = om2.MFnNumericAttribute() aobj = attr.createAddr(longName, shortName) elif attrType == attrtypes.kMFnkEnumAttribute: attr = om2.MFnEnumAttribute() aobj = attr.create(longName, shortName) elif attrType == attrtypes.kMFnCompoundAttribute: attr = om2.MFnCompoundAttribute() aobj = attr.create(longName, shortName) elif attrType == attrtypes.kMFnMessageAttribute: attr = om2.MFnMessageAttribute() aobj = attr.create(longName, shortName) elif attrType == attrtypes.kMFnDataString: attr = om2.MFnTypedAttribute() stringData = om2.MFnStringData().create("") aobj = attr.create(longName, shortName, om2.MFnData.kString, stringData) elif attrType == attrtypes.kMFnUnitAttributeDistance: attr = om2.MFnUnitAttribute() aobj = attr.create(longName, shortName, om2.MDistance()) elif attrType == attrtypes.kMFnUnitAttributeAngle: attr = om2.MFnUnitAttribute() aobj = attr.create(longName, shortName, om2.MAngle()) elif attrType == attrtypes.kMFnUnitAttributeTime: attr = om2.MFnUnitAttribute() aobj = attr.create(longName, shortName, om2.MTime()) elif attrType == attrtypes.kMFnDataMatrix: attr = om2.MFnMatrixAttribute() aobj = attr.create(longName, shortName) elif attrType == attrtypes.kMFnDataFloatArray: attr = om2.MFnFloatArray() aobj = attr.create(longName, shortName) elif attrType == attrtypes.kMFnDataDoubleArray: data = om2.MFnDoubleArrayData().create(om2.MDoubleArray()) attr = om2.MFnTypedAttribute() aobj = attr.create(longName, shortName, om2.MFnData.kDoubleArray, data) elif attrType == attrtypes.kMFnDataIntArray: data = om2.MFnIntArrayData().create(om2.MIntArray()) attr = om2.MFnTypedAttribute() aobj = attr.create(longName, shortName, om2.MFnData.kIntArray, data) elif attrType == attrtypes.kMFnDataPointArray: data = om2.MFnPointArrayData().create(om2.MPointArray()) attr = om2.MFnTypedAttribute() aobj = attr.create(longName, shortName, om2.MFnData.kPointArray, data) elif attrType == attrtypes.kMFnDataVectorArray: data = om2.MFnVectorArrayData().create(om2.MVectorArray()) attr = om2.MFnTypedAttribute() aobj = attr.create(longName, shortName, om2.MFnData.kVectorArray, data) elif attrType == attrtypes.kMFnDataStringArray: data = om2.MFnStringArrayData().create(om2.MStringArray()) attr = om2.MFnTypedAttribute() aobj = attr.create(longName, shortName, om2.MFnData.kStringArray, data) elif attrType == attrtypes.kMFnDataMatrixArray: data = om2.MFnMatrixArrayData().create(om2.MMatrixArray()) attr = om2.MFnTypedAttribute() aobj = attr.create(longName, shortName, om2.MFnData.kMatrixArray, data) elif attrType == attrtypes.kMFnNumericInt64: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kInt64) elif attrType == attrtypes.kMFnNumericLast: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.kLast) elif attrType == attrtypes.kMFnNumeric2Double: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k2Double) elif attrType == attrtypes.kMFnNumeric2Float: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k2Float) elif attrType == attrtypes.kMFnNumeric2Int: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k2Int) elif attrType == attrtypes.kMFnNumeric2Long: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k2Long) elif attrType == attrtypes.kMFnNumeric2Short: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k2Short) elif attrType == attrtypes.kMFnNumeric3Double: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k3Double) elif attrType == attrtypes.kMFnNumeric3Float: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k3Float) elif attrType == attrtypes.kMFnNumeric3Int: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k3Int) elif attrType == attrtypes.kMFnNumeric3Long: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k3Long) elif attrType == attrtypes.kMFnNumeric3Short: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k3Short) elif attrType == attrtypes.kMFnNumeric4Double: attr = om2.MFnNumericAttribute() aobj = attr.create(longName, shortName, om2.MFnNumericData.k4Double) if aobj is not None and apply: attr.array = isArray mod = om2.MDGModifier() mod.addAttribute(node, aobj) mod.doIt() return attr
def _setPlugValue(self, *value, **kwds): if u"plug" in kwds: # todo: type check plug = kwds["plug"] _obj = plug.attribute() else: plug = self._MPlug _obj = self._MObject _apitype = _obj.apiType() _value = value _value0 = value[0] if len(_value) == 1: if isinstance(_value0, (list, tuple)): _value = _value0 elif isinstance(_value0, Vector): _value = (_value0.x, _value0.y, _value0.z) elif isinstance(_value0, EulerRotation): _value = (_value0.x, _value0.y, _value0.z) elif isinstance(_value0, Matrix): _value = (v for i, v in enumerate(_value0)) if _apitype in [ om.MFn.kAttribute3Double, om.MFn.kAttribute3Float, om.MFn.kAttribute2Double, om.MFn.kAttribute2Float, om.MFn.kAttribute4Double ]: if plug.isArray: raise MetanRuntimeError( u"The attribute '{0}' is a multi.".format(plug.name())) else: _count = plug.numChildren() if len(_value) != _count: raise MetanArgumentError( u"{0} elements are required for this attribute (given {1})" .format(_count, len(_value))) if not kwds.get("api"): _childtype = plug.child(0).attribute().apiType() if _childtype in [ om.MFn.kDoubleLinearAttribute, om.MFn.kFloatLinearAttribute ]: distance_unit = om.MDistance.uiUnit() _value = [ om.MDistance(_va, om.MDistance.kCentimeters).asUnits( distance_unit) for _va in _value ] cmds.setAttr(plug.name(), *_value) elif _childtype in [ om.MFn.kDoubleAngleAttribute, om.MFn.kFloatAngleAttribute ]: angle_unit = om.MAngle.uiUnit() if angle_unit == om.MAngle.kDegrees: _value = [math.degrees(agl) for agl in _value] cmds.setAttr(plug.name(), *_value) else: cmds.setAttr(plug.name(), *_value) return for i in range(_count): _plug = plug.child(i) kwds["plug"] = _plug self._setPlugValue(_value[i], **kwds) elif _apitype in [ om.MFn.kDoubleLinearAttribute, om.MFn.kFloatLinearAttribute ]: if kwds.get(u"api"): plug.setDouble(_value0) else: distance_unit = om.MDistance.uiUnit() _distance = om.MDistance(_value0, om.MDistance.kCentimeters) _value0 = _distance.asUnits(distance_unit) cmds.setAttr(plug.name(), _value0) elif _apitype == om.MFn.kNumericAttribute: _mfnattr = om.MFnNumericAttribute(_obj) _type = _mfnattr.numericType() if _type == om.MFnNumericData.kBoolean: if kwds.get(u"api"): plug.setBool(_value0) return elif _type in [ om.MFnNumericData.kShort, om.MFnNumericData.kInt, om.MFnNumericData.kLong, om.MFnNumericData.kByte ]: if kwds.get(u"api"): plug.setInt(_value0) return elif _type in [ om.MFnNumericData.kFloat, om.MFnNumericData.kDouble, om.MFnNumericData.kAddr ]: if kwds.get(u"api"): plug.setDouble(_value0) return cmds.setAttr(plug.name(), _value0) elif _apitype in [ om.MFn.kDoubleAngleAttribute, om.MFn.kFloatAngleAttribute ]: if kwds.get(u"api"): plug.setDouble(_value0) else: angle_unit = om.MAngle.uiUnit() if angle_unit == om.MAngle.kDegrees: _value0 = math.degrees(_value0) cmds.setAttr(plug.name(), _value0) elif _apitype == om.MFn.kEnumAttribute: if kwds.get(u"api"): plug.setDouble(_value0) else: cmds.setAttr(plug.name(), _value0) elif _apitype == om.MFn.kTypedAttribute: _mfnattr = om.MFnTypedAttribute(_obj) _type = _mfnattr.attrType() if _type == om.MFnData.kString: if kwds.get(u"api"): plug.setString(unicode(_value0)) else: cmds.setAttr(plug.name(), unicode(_value0), type="string") elif _type == om.MFnData.kMatrix: if plug.isArray: raise MetanRuntimeError( u"The attribute '{0}' is a multi.".format(plug.name())) else: if not kwds.get("api"): cmds.setAttr(plug.name(), *_value, type="matrix") else: if _value.__class__.__name__ == u"generator": plug.setMObject(om.MFnMatrixData().create( Matrix([v for v in _value]))) else: plug.setMObject(om.MFnMatrixData().create( Matrix(_value))) elif _apitype == om.MFn.kCompoundAttribute: _count = plug.numChildren() if len(_value) != _count: raise MetanArgumentError( u"{0} elements are required for this attribute (given {1})" .format(_count, len(_value))) if not kwds.get("api"): _childtype = plug.child(0).attribute().apiType() if _childtype in [ om.MFn.kDoubleLinearAttribute, om.MFn.kFloatLinearAttribute ]: distance_unit = om.MDistance.uiUnit() _value = [ om.MDistance( _va, om.MDistance.kCentimeters).asUnits(distance_unit) for _va in _value ] cmds.setAttr(plug.name(), *_value) elif _childtype in [ om.MFn.kDoubleAngleAttribute, om.MFn.kFloatAngleAttribute ]: angle_unit = om.MAngle.uiUnit() if angle_unit == om.MAngle.kDegrees: _value = [math.degrees(agl) for agl in _value] cmds.setAttr(plug.name(), *_value) else: cmds.setAttr(plug.name(), *_value) return for i in range(_count): _plug = plug.child(i) kwds["plug"] = _plug self._setPlugValue(_value[i], **kwds)