def _setSpringLimitation(self, constraint, limitVector, limitType, axis, i): limitValue = limitVector[i] #self._convertCoordinate(limitVector[i], limitType, axis) args = (constraint, limitType, axis) #if limitValue > 0.0 or limitValue < 0.0: # この行が必要かどうかの判断がつかない maya.cmds.setAttr("%s.%sSpringEnabled%s" % args, 1) maya.cmds.setAttr("%s.%sSpringStiffness%s" % args, limitValue) util.setFloat(constraint, "default%sSpringStiffness%s" % (limitType.title(), axis), limitValue)
def _setParams(self, shape, param): maya.cmds.setAttr("%s.mass" % shape, param.mass) maya.cmds.setAttr("%s.linearDamping" % shape, param.linear_damping) maya.cmds.setAttr("%s.friction" % shape, param.friction) maya.cmds.setAttr("%s.angularDamping" % shape, param.angular_damping) maya.cmds.setAttr("%s.restitution" % shape, param.restitution) util.setFloat(shape, "defaultMass", param.mass) util.setFloat(shape, "defaultLinearDamping", param.linear_damping) util.setFloat(shape, "defaultFriction", param.friction) util.setFloat(shape, "defaultAngularDamping", param.angular_damping) util.setFloat(shape, "defaultRestitution", param.restitution)
def generate(self, jointNames): bones = self.mmdData.bones for i in range(len(bones)): establishFlag = False if bones[i].getExternalRotationFlag(): self._makeExpression(bones, jointNames, i, "rotate") establishFlag = True if bones[i].getExternalTranslationFlag(): self._makeExpression(bones, jointNames, i, "translate") establishFlag = True util.setFloat(jointNames[i], "establishFactor", bones[i].effect_factor) eIndex = bones[i].effect_index util.setString(jointNames[i], "establishParent", jointNames[eIndex]) util.setBoolean(jointNames[i], "enableEstablish", establishFlag)
def _setParameters(self, collider, param): maya.cmds.setAttr("%s.mass" % collider, param.mass) param.linear_damping = self._checkedSetAttr(collider, param.linear_damping, "linear_damping") maya.cmds.setAttr("%s.linearDamping" % collider, param.linear_damping) param.friction = self._checkedSetAttr(collider, param.friction, "friction") maya.cmds.setAttr("%s.friction" % collider, param.friction) param.angular_damping = self._checkedSetAttr(collider, param.angular_damping, "angular_damping") maya.cmds.setAttr("%s.angularDamping" % collider, param.angular_damping) param.restitution = self._checkedSetAttr(collider, param.restitution, "restitution") maya.cmds.setAttr("%s.restitution" % collider, param.restitution) util.setFloat(collider, "defaultMass", param.mass) util.setFloat(collider, "defaultLinearDamping", param.linear_damping) util.setFloat(collider, "defaultFriction", param.friction) util.setFloat(collider, "defaultAngularDamping", param.angular_damping) util.setFloat(collider, "defaultRestitution", param.restitution)
def _setColliderSize(self, shape, rigid): maya.cmds.setAttr("%s.autoFit" % shape, 0) shapeSize = rigid.shape_size if rigid.shape_type == 0: # sphere maya.cmds.setAttr("%s.colliderShapeType" % shape, 2) maya.cmds.setAttr("%s.radius" % shape, shapeSize[0]) util.setFloat(shape, "defaultRadius", shapeSize[0]) elif rigid.shape_type == 1: # box maya.cmds.setAttr("%s.colliderShapeType" % shape, 1) maya.cmds.setAttr("%s.extentsX" % shape, shapeSize[0] * 2) maya.cmds.setAttr("%s.extentsY" % shape, shapeSize[1] * 2) maya.cmds.setAttr("%s.extentsZ" % shape, shapeSize[2] * 2) util.setFloat(shape, "defaultExtentsX", shapeSize[0] * 2) util.setFloat(shape, "defaultExtentsY", shapeSize[1] * 2) util.setFloat(shape, "defaultExtentsZ", shapeSize[2] * 2) elif rigid.shape_type == 2: # capsule maya.cmds.setAttr("%s.colliderShapeType" % shape, 3) maya.cmds.setAttr("%s.radius" % shape, shapeSize[0]) maya.cmds.setAttr("%s.length" % shape, shapeSize[1] + shapeSize[0] * 2) util.setFloat(shape, "defaultRadius", shapeSize[0]) util.setFloat(shape, "defaultLength", shapeSize[1] + shapeSize[0] * 2)