public static bool initializer() { MFnEnumAttribute enumAttr = new MFnEnumAttribute(); // Create the layerType attribute and define its enum values. // exCameraSet.layerTypeAttr = enumAttr.create("layerType", "lt", 0); enumAttr.addField("Mono", 0); enumAttr.addField("Left", 1); enumAttr.addField("Right", 2); // Make this attribute a multi so it can store a value per camera layer. // enumAttr.isArray = true; return true; }
public static bool initializer() { MFnEnumAttribute enumAttr = new MFnEnumAttribute(); // Create the layerType attribute and define its enum values. // exCameraSet.layerTypeAttr = enumAttr.create("layerType", "lt", 0); enumAttr.addField("Mono", 0); enumAttr.addField("Left", 1); enumAttr.addField("Right", 2); // Make this attribute a multi so it can store a value per camera layer. // enumAttr.isArray = true; return(true); }
public static void initialize() // // Description // // Attribute (static) initialization. // { MFnNumericAttribute numAttr = new MFnNumericAttribute(); MFnEnumAttribute enumAttr = new MFnEnumAttribute(); MFnTypedAttribute typedAttr = new MFnTypedAttribute(); // ----------------------- INPUTS ------------------------- size = numAttr.create("size", "sz", MFnNumericData.Type.kDouble, 1.0); numAttr.isArray = false; numAttr.usesArrayDataBuilder = false; numAttr.isHidden = false; numAttr.isKeyable = true; addAttribute(size); shapeType = enumAttr.create("shapeType", "st", 0); enumAttr.addField("cube", 0); enumAttr.addField("sphere", 1); enumAttr.isHidden = false; enumAttr.isKeyable = true; addAttribute(shapeType); inputMesh = typedAttr.create("inputMesh", "im", MFnData.Type.kMesh); typedAttr.isHidden = true; addAttribute(inputMesh); // ----------------------- OUTPUTS ------------------------- outputSurface = typedAttr.create("outputSurface", "os", new MTypeId(apiMeshData.id)); typedAttr.isWritable = false; addAttribute(outputSurface); // ---------- Specify what inputs affect the outputs ---------- // attributeAffects(inputMesh, outputSurface); attributeAffects(size, outputSurface); attributeAffects(shapeType, outputSurface); }
public static void InitializeAnimClips() { var tAttr = new MFnTypedAttribute(); var nAttr = new MFnNumericAttribute(); var cAttr = new MFnCompoundAttribute(); var eAttr = new MFnEnumAttribute(); Name = tAttr.create("animClipName", "acn", MFnData.Type.kString); addAttribute(Name); Start = nAttr.create("animClipStart", "acs", MFnNumericData.Type.kInt); nAttr.setMin(0); addAttribute(Start); End = nAttr.create("animClipEnd", "ace", MFnNumericData.Type.kInt); nAttr.setMin(0); addAttribute(End); Type = eAttr.create("animClipType", "act"); foreach (var entry in AnimationData.NameToId) { eAttr.addField(entry.Key, (short)entry.Value); //TODO check performance } eAttr.setDefault(0); addAttribute(Type); LoopingFlag = nAttr.create("animClipLooping", "acl", MFnNumericData.Type.kBoolean); nAttr.setDefault(true); addAttribute(LoopingFlag); LowPriorityFlag = nAttr.create("animClipLowPriority", "aclp", MFnNumericData.Type.kBoolean); nAttr.setDefault(false); addAttribute(LowPriorityFlag); RepetitionsMin = nAttr.create("animClipRepMin", "acrepmin", MFnNumericData.Type.kFloat); nAttr.setDefault((float)0); nAttr.setMin(0); addAttribute(RepetitionsMin); RepetitionsMax = nAttr.create("animClipRepMax", "acrepmax", MFnNumericData.Type.kFloat); nAttr.setDefault((float)0); nAttr.setMin(0); addAttribute(RepetitionsMax); BlendingFlag = nAttr.create("animClipBlending", "acb", MFnNumericData.Type.kBoolean); nAttr.setDefault(true); addAttribute(BlendingFlag); BlendTimeStart = nAttr.create("animClipBlendTimeStart", "acbts", MFnNumericData.Type.kInt); nAttr.setDefault(150); nAttr.setMin(0); addAttribute(BlendTimeStart); BlendTimeEnd = nAttr.create("animClipBlendTimeEnd", "acbte", MFnNumericData.Type.kInt); nAttr.setDefault(150); nAttr.setMin(0); addAttribute(BlendTimeEnd); Rarity = nAttr.create("animClipRarity", "acra", MFnNumericData.Type.kFloat); nAttr.setDefault((float)100); nAttr.setMin(0); nAttr.setMax(100); addAttribute(Rarity); Export = nAttr.create("exportAnimClip", "eac", MFnNumericData.Type.kBoolean); nAttr.setDefault(true); addAttribute(Export); AnimClips = cAttr.create("animClips", "clips"); cAttr.addChild(Name); cAttr.addChild(Start); cAttr.addChild(End); cAttr.addChild(Type); cAttr.addChild(LoopingFlag); cAttr.addChild(LowPriorityFlag); cAttr.addChild(RepetitionsMin); cAttr.addChild(RepetitionsMax); cAttr.addChild(BlendingFlag); cAttr.addChild(BlendTimeStart); cAttr.addChild(BlendTimeEnd); cAttr.addChild(Rarity); cAttr.addChild(Export); cAttr.isArray = true; addAttribute(AnimClips); }