Esempio n. 1
0
 def MirrorSelection(self, ObjectList):
     for eachObject in ObjectList:
         ObjectTransformDic = RMUncategorized.ObjectTransformDic(
             [eachObject])
         Side = self.NameConv.get_from_name(eachObject, "side")
         if Side == "R":
             OpositObject = self.NameConv.set_from_name(
                 eachObject, "L", "side")
             if cmds.objExists(OpositObject):
                 RMUncategorized.SetObjectTransformDic(
                     {OpositObject: ObjectTransformDic[eachObject]},
                     MirrorTranslateX=1,
                     MirrorTranslateY=1,
                     MirrorTranslateZ=-1,
                     MirrorRotateX=-1,
                     MirrorRotateY=-1,
                     MirrorRotateZ=1)
             else:
                 print 'object not found %s' % OpositObject
         else:
             OpositObject = self.NameConv.set_from_name(
                 eachObject, "R", "side")
             if cmds.objExists(OpositObject):
                 RMUncategorized.SetObjectTransformDic(
                     {OpositObject: ObjectTransformDic[eachObject]},
                     MirrorTranslateX=1,
                     MirrorTranslateY=1,
                     MirrorTranslateZ=-1,
                     MirrorRotateX=-1,
                     MirrorRotateY=-1,
                     MirrorRotateZ=1)
             else:
                 print 'object not found %s' % OpositObject
Esempio n. 2
0
 def GetTransformBtnPressed(self):
     selection = cmds.ls(sl=True)
     self.TramsformDic = RMUncategorized.ObjectTransformDic(selection)
     print "saving file to: %s" % (self.DiskCachePath)
     SaveDic = {'type': 'ObjectTransforms', 'data': self.TramsformDic}
     if not os.path.exists(self.Directory):
         os.makedirs(self.Directory)
     with open(self.DiskCachePath, 'w') as outfile:
         json.dump(SaveDic, outfile, sort_keys=True, indent=4)
Esempio n. 3
0
 def SaveTransformsBtnPressed(self):
     selection = cmds.ls(sl=True)
     self.TramsformDic = RMUncategorized.ObjectTransformDic(selection)
     SaveDic = {'type': 'ObjectTransforms', 'data': self.TramsformDic}
     if not os.path.exists(self.Directory):
         os.makedirs(self.Directory)
     fname = QFileDialog.getSaveFileName(
         parent=self,
         caption='Save Filename As',
         dir=unicode(self.Directory))  # self.Directory
     print fname
     with open(fname[0], 'w') as outfile:
         json.dump(SaveDic, outfile, sort_keys=True, indent=4)
Esempio n. 4
0
 def SetTransformBtnPressed(self):
     self.TramsformDic = {}
     with open(self.DiskCachePath, 'r') as outfile:
         OpenDic = json.load(outfile)
     if OpenDic != u'':
         if OpenDic.has_key('data') and OpenDic.has_key('type'):
             if OpenDic['type'] == str('ObjectTransforms'):
                 self.TramsformDic = OpenDic['data']
                 RMUncategorized.SetObjectTransformDic(self.TramsformDic)
                 print self.TramsformDic
             else:
                 print "File loaded not Valid"
     else:
         print "No File Selected"
Esempio n. 5
0
 def LoadTransformsBtnPressed(self):
     self.TramsformDic = {}
     fname = QFileDialog.getOpenFileName(parent=self,
                                         caption='Open file',
                                         dir=self.Directory)
     fname[0]
     with open(fname[0], 'r') as outfile:
         OpenDic = json.load(outfile)
     if OpenDic != u'':
         if OpenDic.has_key('data') and OpenDic.has_key('type'):
             if OpenDic['type'] == str('ObjectTransforms'):
                 self.TramsformDic = OpenDic['data']
                 RMUncategorized.SetObjectTransformDic(self.TramsformDic)
                 print "File Loaded succesfully"
                 print self.TramsformDic
             else:
                 print "File loaded not Valid"
     else:
         print "No File Selected"
Esempio n. 6
0
def AddRibbon(SknJointStructure,
              SknParentGroup,
              currentTwists,
              ToDeleteNodes,
              LookAtAxis="Y"):
    NameConv = nameConvention.NameConvention()
    ObjectTransformDiclist = RMUncategorized.ObjectTransformDic(currentTwists)
    for i in ToDeleteNodes:
        if cmds.objExists(i):
            cmds.delete(i)
    RMUncategorized.SetObjectTransformDic(ObjectTransformDiclist)

    TJArm = RMTwistJoints.RMTwistJoints()
    TJArm.RMCreateTwistJoints(SknJointStructure[0],
                              SknJointStructure[1],
                              NumberOfTB=2,
                              LookAtAxis=LookAtAxis)

    constraintTJArm = cmds.parentConstraint(SknParentGroup,
                                            TJArm.TwistControlResetPoint,
                                            mo=True)[0]
    constraintTJArm = NameConv.rename_based_on_base_name(
        SknJointStructure[1], constraintTJArm, {})

    Ribbon = RMRibbon.RMRibbon()
    Ribbon.RibbonCreation(SknJointStructure[0],
                          SknJointStructure[1],
                          foliculeNumber=4)

    for index in range(len(currentTwists)):
        cmds.parentConstraint(Ribbon.jointStructure[index],
                              currentTwists[index],
                              mo=True)
    for index in range(len(Ribbon.resetControls)):
        cmds.parentConstraint(TJArm.TwistJoints[index],
                              Ribbon.resetControls[index],
                              mo=True)

    cmds.addAttr(Ribbon.controls[0],
                 at="float",
                 ln="Volume",
                 hnv=1,
                 hxv=1,
                 h=0,
                 k=1,
                 smn=-10,
                 smx=10)
    cmds.addAttr(Ribbon.controls[1],
                 at="float",
                 ln="VolumeUp",
                 hnv=1,
                 hxv=1,
                 h=0,
                 k=1,
                 smn=-10,
                 smx=10)
    cmds.addAttr(Ribbon.controls[1],
                 at="float",
                 ln="VolumeLow",
                 hnv=1,
                 hxv=1,
                 h=0,
                 k=1,
                 smn=-10,
                 smx=10)
    cmds.addAttr(Ribbon.controls[2],
                 at="float",
                 ln="Volume",
                 hnv=1,
                 hxv=1,
                 h=0,
                 k=1,
                 smn=-10,
                 smx=10)

    RMRigTools.RMConnectWithLimits('%s.Volume' % Ribbon.controls[0],
                                   '%s.scaleY' % currentTwists[0],
                                   [[-10, 0], [0, 1], [10, 4]])
    RMRigTools.RMConnectWithLimits('%s.Volume' % Ribbon.controls[0],
                                   '%s.scaleZ' % currentTwists[0],
                                   [[-10, 0], [0, 1], [10, 4]])
    RMRigTools.RMConnectWithLimits('%s.VolumeUp' % Ribbon.controls[1],
                                   '%s.scaleY' % currentTwists[1],
                                   [[-10, 0], [0, 1], [10, 4]])
    RMRigTools.RMConnectWithLimits('%s.VolumeUp' % Ribbon.controls[1],
                                   '%s.scaleZ' % currentTwists[1],
                                   [[-10, 0], [0, 1], [10, 4]])
    RMRigTools.RMConnectWithLimits('%s.VolumeLow' % Ribbon.controls[1],
                                   '%s.scaleY' % currentTwists[2],
                                   [[-10, 0], [0, 1], [10, 4]])
    RMRigTools.RMConnectWithLimits('%s.VolumeLow' % Ribbon.controls[1],
                                   '%s.scaleZ' % currentTwists[2],
                                   [[-10, 0], [0, 1], [10, 4]])

    RMRigTools.RMConnectWithLimits('%s.Volume' % Ribbon.controls[2],
                                   '%s.scaleY' % currentTwists[3],
                                   [[-10, 0], [0, 1], [10, 4]])
    RMRigTools.RMConnectWithLimits('%s.Volume' % Ribbon.controls[2],
                                   '%s.scaleZ' % currentTwists[3],
                                   [[-10, 0], [0, 1], [10, 4]])
Esempio n. 7
0
 def ResetTransformBtnPressed(self):
     selection = cmds.ls(sl=True)
     RMUncategorized.ResetPostoZero(selection)