示例#1
0
    def __init__(self, name):

        Profiler.getInstance().push("Construct SpineClavRig:" + name)
        super(SpineClavRig, self).__init__(name)

        # Add Components to Layers
        spineComponent = SpineComponentRig("spine", self)
        spineComponent.loadData(data={
            'cogPosition': Vec3(0.0, 11.1351, -0.1382),
            'spine01Position': Vec3(0.0, 11.1351, -0.1382),
            'spine02Position': Vec3(0.0, 11.8013, -0.1995),
            'spine03Position': Vec3(0.0, 12.4496, -0.3649),
            'spine04Position': Vec3(0.0, 13.1051, -0.4821),
            'numDeformers': 4
        })

        clavicleLeftComponentGuide = ClavicleComponentGuide("clavicleGuide",
            data={
                  "location": "L",
                  "clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
                  "clavicleUpVXfo": Xfo(Vec3(0.0, 1.0, 0.0)),
                  "clavicleEndXfo": Xfo(Vec3(2.27, 15.295, -0.753))
                 })

        clavicleLeftComponent = ClavicleComponentRig("clavicle", self)
        clavicleLeftComponent.loadData(data=clavicleLeftComponentGuide.getRigBuildData())

        # Clavicle to Spine
        vertebraeOutputs = spineComponent.getOutputByName('spineVertebrae')
        clavicleLeftSpineEndInput = clavicleLeftComponent.getInputByName('spineEnd')
        clavicleLeftSpineEndInput.setConnection(vertebraeOutputs)
        clavicleLeftSpineEndInput.setIndex(2)

        Profiler.getInstance().pop()
示例#2
0
    def __init__(self, name='neck', parent=None, data=None):

        Profiler.getInstance().push("Construct Neck Component:" + name)
        super(NeckComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # ========

        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.neckCtrl = Control('neck', parent=self.ctrlCmpGrp, shape="sphere")
        self.neckEndCtrl = Control('neckEnd', parent=self.ctrlCmpGrp, shape="sphere")

        if data is None:
            data = {
                    "name": name,
                    "location": "M",
                    "neckPosition": Vec3(0.0, 16.5572, -0.6915),
                    "neckEndPosition": Vec3(0.0, 17.4756, -0.421)
                   }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#3
0
文件: rig.py 项目: hoorayfor3d/Kraken
    def loadRigDefinition(self, jsonData):
        """Load a rig definition from a JSON structure.

        Arguments:
        jsonData -- dict, the JSON data containing the rig definition.

        Return:
        True if successful.

        """

        Profiler.getInstance().push("loadRigDefinition:" + self.getName())

        krakenSystem = KrakenSystem.getInstance()

        if 'name' in jsonData:
            self.setName(jsonData['name'])

        if 'components' in jsonData:
            self._loadComponents(jsonData['components'])

            if 'connections' in jsonData:
                self._makeConnections(jsonData['connections'])


        if 'graphPositions' in jsonData:
            self._loadGraphPositions(jsonData['graphPositions'])

        Profiler.getInstance().pop()
示例#4
0
    def __init__(self, name='head', parent=None, data=None):

        Profiler.getInstance().push("Construct Head Guide Component:" + name)
        super(HeadComponentGuide, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="cube")
        self.headEndCtrl = Control('headEnd', parent=self.ctrlCmpGrp, shape="sphere")
        self.eyeLeftCtrl = Control('eyeLeft', parent=self.ctrlCmpGrp, shape="sphere")
        self.eyeRightCtrl = Control('eyeRight', parent=self.ctrlCmpGrp, shape="sphere")
        self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")

        if data is None:
            data = {
                    "name": name,
                    "location": "M",
                    "headPosition": Vec3(0.0, 17.4756, -0.421),
                    "headEndPosition": Vec3(0.0, 19.5, -0.421),
                    "eyeLeftPosition": Vec3(0.3497, 18.0878, 0.6088),
                    "eyeRightPosition": Vec3(-0.3497, 18.0878, 0.6088),
                    "jawPosition": Vec3(0.0, 17.613, -0.2731)
                   }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#5
0
    def __init__(self, name='head', parent=None, data=None):

        Profiler.getInstance().push("Construct Head Guide Component:" + name)
        super(HeadComponentGuide, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="cube")
        self.headEndCtrl = Control('headEnd', parent=self.ctrlCmpGrp, shape="sphere")
        self.eyeLeftCtrl = Control('eyeLeft', parent=self.ctrlCmpGrp, shape="sphere")
        self.eyeRightCtrl = Control('eyeRight', parent=self.ctrlCmpGrp, shape="sphere")
        self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")

        if data is None:
            data = {
                    "name": name,
                    "location": "M",
                    "headPosition": Vec3(0.0, 17.4756, -0.421),
                    "headEndPosition": Vec3(0.0, 19.5, -0.421),
                    "eyeLeftPosition": Vec3(0.3497, 18.0878, 0.6088),
                    "eyeRightPosition": Vec3(-0.3497, 18.0878, 0.6088),
                    "jawPosition": Vec3(0.0, 17.613, -0.2731)
                   }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#6
0
    def __init__(self, name='clavicle', parent=None, data=None):

        Profiler.getInstance().push("Construct Clavicle Guide Component:" + name)
        super(ClavicleComponentGuide, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Guide Controls
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.clavicleCtrl = Control('clavicle', parent=self.ctrlCmpGrp, shape="sphere")
        self.clavicleUpVCtrl = Control('clavicleUpV', parent=self.ctrlCmpGrp, shape="triangle")
        self.clavicleUpVCtrl.setColor('red')
        self.clavicleEndCtrl = Control('clavicleEnd', parent=self.ctrlCmpGrp, shape="sphere")

        if data is None:
            data = {
                    "name": name,
                    "location": "L",
                    "clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
                    "clavicleUpVXfo": Xfo(Vec3(0.0, 1.0, 0.0)),
                    "clavicleEndXfo": Xfo(Vec3(2.27, 15.295, -0.753))
                   }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#7
0
文件: rig.py 项目: hoorayfor3d/Kraken
    def _makeConnections(self, connectionsJson):

        Profiler.getInstance().push("__makeConnections")

        for connectionData in connectionsJson:

            sourceComponentDecoratedName, outputName = connectionData['source'].split('.')
            targetComponentDecoratedName, inputName = connectionData['target'].split('.')

            sourceComponent = self.getChildByDecoratedName(sourceComponentDecoratedName)
            if sourceComponent is None:
                raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
                    connectionData['target']+". Source component not found:" + sourceComponentDecoratedName)

            targetComponent = self.getChildByDecoratedName(targetComponentDecoratedName)
            if targetComponent is None:
                raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
                    connectionData['target']+". Target component not found:" + targetComponentDecoratedName)

            outputPort = sourceComponent.getOutputByName(outputName)
            if outputPort is None:
                raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
                    connectionData['target']+". Output '" + outputName + "' not found on Component:" + sourceComponent.getPath())

            inputPort = targetComponent.getInputByName(inputName)
            if inputPort is None:
                raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
                    connectionData['target']+". Input '" + inputName + "' not found on Component:" + targetComponent.getPath())

            inputPort.setConnection(outputPort)
            inputPort.setIndex(connectionData.get('targetIndex', 0))

        Profiler.getInstance().pop()
示例#8
0
    def __init__(self, name='InsectLeg', parent=None, data=None):

        Profiler.getInstance().push("Construct InsectLeg Guide Component:" + name)
        super(InsectLegComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
        self.numJoints = IntegerAttribute('numJoints', value=5, minValue=2, maxValue=20, parent=guideSettingsAttrGrp)
        self.numJoints.setValueChangeCallback(self.updateNumLegControls)

        self.jointCtrls = []
        if data is None:
            numJoints = self.numJoints.getValue()
            jointPositions = self.generateGuidePositions(numJoints)

            for i in xrange(numJoints):
                self.jointCtrls.append(Control('leg' + str(i + 1).zfill(2), parent=self.ctrlCmpGrp, shape="sphere"))

            data = {
               "location": "L",
               "jointPositions": jointPositions,
               "numJoints": self.numJoints.getValue()
              }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#9
0
    def __init__(self, name='head', parent=None):

        Profiler.getInstance().push("Construct Head Guide Component:" + name)
        super(FabriceHeadGuide, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="circle")
        self.headCtrl.rotatePoints(90.0, 0.0, 0.0)
        self.headCtrl.scalePoints(Vec3(3.5, 3.5, 3.5))

        self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")
        self.jawCtrl.alignOnZAxis()
        self.jawCtrl.scalePoints(Vec3(2.0, 0.5, 2.0))
        self.jawCtrl.alignOnYAxis(negative=True)
        self.jawCtrl.setColor('orange')

        data = {
            "name": name,
            "location": "M",
            "headXfo": Xfo(Vec3(0.0, 1.67, 1.75)),
            "headCtrlCrvData": self.headCtrl.getCurveData(),
            "jawPosition": Vec3(0.0, 1.2787, 2.0078),
            "jawCtrlCrvData": self.jawCtrl.getCurveData(),
        }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#10
0
    def _loadComponents(self, componentsJson):
        """Loads components from a JSON dict.

        Args:
            componentsJson (dict): Dictionary of components to load.

        """

        Profiler.getInstance().push("__loadComponents")

        krakenSystem = KrakenSystem.getInstance()

        for componentData in componentsJson:
            # trim off the class name to get the module path.
            modulePath = '.'.join(componentData['class'].split('.')[:-1])
            if modulePath is not "":
                importlib.import_module(modulePath)

            componentClass = krakenSystem.getComponentClass(
                componentData['class'])
            if 'name' in componentData:
                component = componentClass(name=componentData['name'],
                                           parent=self)
            else:
                component = componentClass(parent=self)
            component.loadData(componentData)

        Profiler.getInstance().pop()
示例#11
0
    def __init__(self, name='spine', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Spine Guide Component:" + name)
        super(SpineComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
        self.numDeformersAttr = IntegerAttribute('numDeformers', value=1, minValue=0, maxValue=20, parent=guideSettingsAttrGrp)

        # Guide Controls
        self.cog = Control('cogPosition', parent=self.ctrlCmpGrp, shape="sphere")
        self.cog.scalePoints(Vec3(1.2, 1.2, 1.2))
        self.cog.setColor('red')

        self.spine01Ctrl = Control('spine01Position', parent=self.ctrlCmpGrp, shape='sphere')
        self.spine02Ctrl = Control('spine02Position', parent=self.ctrlCmpGrp, shape='sphere')
        self.spine03Ctrl = Control('spine03Position', parent=self.ctrlCmpGrp, shape='sphere')
        self.spine04Ctrl = Control('spine04Position', parent=self.ctrlCmpGrp, shape='sphere')

        data = {
            'name': name,
            'location': 'M',
            'cogPosition': Vec3(0.0, 11.1351, -0.1382),
            'spine01Position': Vec3(0.0, 11.1351, -0.1382),
            'spine02Position': Vec3(0.0, 11.8013, -0.1995),
            'spine03Position': Vec3(0.0, 12.4496, -0.3649),
            'spine04Position': Vec3(0.0, 13.1051, -0.4821),
            'numDeformers': 6
        }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#12
0
    def build(self, kSceneItem):
        """Builds the supplied kSceneItem into a DCC representation.

        Args:
            kSceneItem (object): kraken kSceneItem object to build.

        Returns:
            object: The DCC scene item of the kSceneItem that was passed to the builder.

        """

        Profiler.getInstance().push("build:" + kSceneItem.getName())

        try:
            self._preBuild(kSceneItem)
            self._build(kSceneItem)

        finally:
            self._postBuild()

            # Clear Config when finished.
            self.config.clearInstance()

        Profiler.getInstance().pop()

        return self.getDCCSceneItem(kSceneItem)
示例#13
0
文件: rig.py 项目: Leopardob/Kraken
    def loadRigDefinition(self, jsonData):
        """Load a rig definition from a JSON structure.

        Args:
            jsonData (dict): JSON data containing the rig definition.

        Returns:
            bool: True if successful.

        """

        Profiler.getInstance().push("loadRigDefinition:" + self.getName())

        krakenSystem = KrakenSystem.getInstance()

        if 'name' in jsonData:
            self.setName(jsonData['name'])

        if 'components' in jsonData:
            self._loadComponents(jsonData['components'])

            if 'connections' in jsonData:
                self._makeConnections(jsonData['connections'])

        if 'metaData' in jsonData:

            for k, v in jsonData['metaData'].iteritems():
                self.setMetaData(k, v)

        Profiler.getInstance().pop()
示例#14
0
    def __init__(self, name='clavicle', parent=None, data=None):

        Profiler.getInstance().push("Construct Clavicle Guide Component:" +
                                    name)
        super(ClavicleComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        # Guide Controls
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.clavicleCtrl = Control('clavicle',
                                    parent=self.ctrlCmpGrp,
                                    shape="sphere")
        self.clavicleUpVCtrl = Control('clavicleUpV',
                                       parent=self.ctrlCmpGrp,
                                       shape="triangle")
        self.clavicleUpVCtrl.setColor('red')
        self.clavicleEndCtrl = Control('clavicleEnd',
                                       parent=self.ctrlCmpGrp,
                                       shape="sphere")

        if data is None:
            data = {
                "name": name,
                "location": "L",
                "clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
                "clavicleUpVXfo": Xfo(Vec3(0.0, 1.0, 0.0)),
                "clavicleEndXfo": Xfo(Vec3(2.27, 15.295, -0.753))
            }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#15
0
文件: rig.py 项目: Leopardob/Kraken
    def _loadComponents(self, componentsJson):
        """Loads components from a JSON dict.

        Args:
            componentsJson (dict): Dictionary of components to load.

        """


        Profiler.getInstance().push("__loadComponents")

        krakenSystem = KrakenSystem.getInstance()

        for componentData in componentsJson:
            # trim off the class name to get the module path.
            modulePath = '.'.join(componentData['class'].split('.')[:-1])
            if modulePath is not "":
                importlib.import_module(modulePath)

            componentClass = krakenSystem.getComponentClass(componentData['class'])
            if 'name' in componentData:
                component = componentClass(name=componentData['name'], parent=self)
            else:
                component = componentClass(parent=self)
            component.loadData(componentData)

        Profiler.getInstance().pop()
示例#16
0
    def __init__(self, name="mainSrt", parent=None, data=None):

        Profiler.getInstance().push("Construct MainSrt Guide Component:" + name)
        super(MainSrtComponentGuide, self).__init__(name, parent)

        # =========
        # Attributes
        # =========
        # Add Component Params to IK control
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.mainSrtSizeInputAttr = ScalarAttribute(
            "mainSrtSize", value=5.0, minValue=1.0, maxValue=50.0, parent=guideSettingsAttrGrp
        )

        # =========
        # Controls
        # =========

        # Guide Controls
        self.mainSrtCtrl = Control("mainSrt", parent=self.ctrlCmpGrp, shape="circle")

        if data is None:
            data = {
                "location": "M",
                "mainSrtSize": self.mainSrtSizeInputAttr.getValue(),
                "mainSrtXfo": Xfo(tr=Vec3(0.0, 0.0, 0.0)),
            }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#17
0
    def build(self, kSceneItem):
        """Builds the supplied kSceneItem into a DCC representation.

        Args:
            kSceneItem (object): kraken kSceneItem object to build.

        Returns:
            object: The DCC scene item of the kSceneItem that was passed to the builder.

        """

        Profiler.getInstance().push("build:" + kSceneItem.getName())

        try:
            self._preBuild(kSceneItem)
            self._build(kSceneItem)

        finally:
            self._postBuild()

            # Clear Config when finished.
            self.config.clearInstance()

        Profiler.getInstance().pop()

        return self.getDCCSceneItem(kSceneItem)
示例#18
0
    def __init__(self, name='limb', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct StretchyLimb Guide Component:" +
                                    name)
        super(StretchyLimbComponentGuide,
              self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.upperCtl = Control('upper',
                                parent=self.ctrlCmpGrp,
                                shape="sphere")
        self.lowerCtl = Control('lower',
                                parent=self.ctrlCmpGrp,
                                shape="sphere")
        self.endCtl = Control('end', parent=self.ctrlCmpGrp, shape="sphere")

        self.default_data = {
            "name": name,
            "location": "L",
            "upperXfo": Xfo(Vec3(0.9811, 9.769, -0.4572)),
            "lowerXfo": Xfo(Vec3(1.4488, 5.4418, -0.5348)),
            "endXfo": Xfo(Vec3(1.841, 1.1516, -1.237))
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#19
0
    def __init__(self, name='leg', parent=None, data=None):

        Profiler.getInstance().push("Construct Leg Guide Component:" + name)
        super(LegComponentGuide, self).__init__(name, parent)


        # =========
        # Controls
        # ========

        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.femurCtrl = Control('femur', parent=self.ctrlCmpGrp, shape="sphere")
        self.kneeCtrl = Control('knee', parent=self.ctrlCmpGrp, shape="sphere")
        self.ankleCtrl = Control('ankle', parent=self.ctrlCmpGrp, shape="sphere")
        self.toeCtrl = Control('toe', parent=self.ctrlCmpGrp, shape="sphere")
        self.toeTipCtrl = Control('toeTip', parent=self.ctrlCmpGrp, shape="sphere")

        if data is None:
            data = {
                    "name": name,
                    "location": "L",
                    "femurXfo": Xfo(Vec3(0.9811, 9.769, -0.4572)),
                    "kneeXfo": Xfo(Vec3(1.4488, 5.4418, -0.5348)),
                    "ankleXfo": Xfo(Vec3(1.841, 1.1516, -1.237)),
                    "toeXfo": Xfo(Vec3(1.85, 0.4, 0.25)),
                    "toeTipXfo": Xfo(Vec3(1.85, 0.4, 1.5))
                   }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#20
0
    def __init__(self, name='spine', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Spine Guide Component:" + name)
        super(SpineComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
        self.numDeformersAttr = IntegerAttribute('numDeformers', value=1, minValue=0, maxValue=20, parent=guideSettingsAttrGrp)

        # Guide Controls
        self.cog = Control('cogPosition', parent=self.ctrlCmpGrp, shape="sphere")
        self.cog.scalePoints(Vec3(1.2, 1.2, 1.2))
        self.cog.setColor('red')

        self.spine01Ctrl = Control('spine01Position', parent=self.ctrlCmpGrp, shape='sphere')
        self.spine02Ctrl = Control('spine02Position', parent=self.ctrlCmpGrp, shape='sphere')
        self.spine03Ctrl = Control('spine03Position', parent=self.ctrlCmpGrp, shape='sphere')
        self.spine04Ctrl = Control('spine04Position', parent=self.ctrlCmpGrp, shape='sphere')

        data = {
            'name': name,
            'location': 'M',
            'cogPosition': Vec3(0.0, 11.1351, -0.1382),
            'spine01Position': Vec3(0.0, 11.1351, -0.1382),
            'spine02Position': Vec3(0.0, 11.8013, -0.1995),
            'spine03Position': Vec3(0.0, 12.4496, -0.3649),
            'spine04Position': Vec3(0.0, 13.1051, -0.4821),
            'numDeformers': 6
        }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#21
0
    def __init__(self, name='limb', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct StretchyLimb Guide Component:" + name)
        super(StretchyLimbComponentGuide, self).__init__(name, parent, *args, **kwargs)


        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.upperCtl = Control('upper', parent=self.ctrlCmpGrp, shape="sphere")
        self.lowerCtl = Control('lower', parent=self.ctrlCmpGrp, shape="sphere")
        self.endCtl = Control('end', parent=self.ctrlCmpGrp, shape="sphere")

        self.default_data = {
                "name": name,
                "location": "L",
                "upperXfo": Xfo(Vec3(0.9811, 9.769, -0.4572)),
                "lowerXfo": Xfo(Vec3(1.4488, 5.4418, -0.5348)),
                "endXfo": Xfo(Vec3(1.841, 1.1516, -1.237))
               }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#22
0
    def __init__(self, name='Tentacle', parent=None, data=None):

        Profiler.getInstance().push("Construct Tentacle Guide Component:" + name)
        super(TentacleComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
        self.numJoints = IntegerAttribute('numJoints', value=5, minValue=2, maxValue=20, parent=guideSettingsAttrGrp)
        self.numJoints.setValueChangeCallback(self.updateNumControls)

        self.jointCtrls = []
        self.tentacleOutputs = []
        if data is None:
            numJoints = self.numJoints.getValue()
            jointPositions = self.generateGuidePositions(numJoints)

            for i in xrange(numJoints):
                self.jointCtrls.append(Control('tentacle' + str(i + 1).zfill(2), parent=self.ctrlCmpGrp, shape="sphere"))
                self.tentacleOutputs.append(ComponentOutput('tentacle' + str(i + 1).zfill(2), parent=self.outputHrcGrp))

            self.boneOutputs.setTarget(self.tentacleOutputs)

            data = {
               "location": "L",
               "jointPositions": jointPositions,
               "numJoints": self.numJoints.getValue()
              }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#23
0
    def loadRigDefinition(self, jsonData):
        """Load a rig definition from a JSON structure.

        Arguments:
        jsonData -- dict, the JSON data containing the rig definition.

        Return:
        True if successful.

        """

        Profiler.getInstance().push("loadRigDefinition:" + self.getName())

        krakenSystem = KrakenSystem.getInstance()

        if 'name' in jsonData:
            self.setName(jsonData['name'])

        if 'components' in jsonData:
            self._loadComponents(jsonData['components'])

            if 'connections' in jsonData:
                self._makeConnections(jsonData['connections'])

        if 'graphPositions' in jsonData:
            self._loadGraphPositions(jsonData['graphPositions'])

        Profiler.getInstance().pop()
示例#24
0
    def __init__(self, name='clavicle', parent=None):

        Profiler.getInstance().push("Construct Clavicle Guide Component:" + name)
        super(FabriceClavicleGuide, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Guide Controls
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.clavicleCtrl = Control('clavicle', parent=self.ctrlCmpGrp, shape="cube")
        self.clavicleCtrl.alignOnXAxis()
        self.clavicleCtrl.scalePoints(Vec3(1.0, 0.25, 0.25))

        data = {
                "name": name,
                "location": "L",
                "clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
                'clavicleCtrlCrvData': self.clavicleCtrl.getCurveData()
               }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#25
0
    def __init__(self, name='mainSrt', parent=None):

        Profiler.getInstance().push("Construct MainSrt Guide Component:" + name)
        super(MainSrtComponentGuide, self).__init__(name, parent)

        # =========
        # Attributes
        # =========
        # Add Component Params to IK control
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.mainSrtSizeInputAttr = ScalarAttribute('mainSrtSize', value=5.0, minValue=1.0, maxValue=50.0, parent=guideSettingsAttrGrp)

        # =========
        # Controls
        # =========

        # Guide Controls
        self.mainSrtCtrl = Control('mainSrt', parent=self.ctrlCmpGrp, shape="circle")

        data = {
                "location": 'M',
                "mainSrtSize": self.mainSrtSizeInputAttr.getValue(),
                "mainSrtXfo": Xfo(tr=Vec3(0.0, 0.0, 0.0))
               }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#26
0
    def __init__(self, name='head', parent=None):

        Profiler.getInstance().push("Construct Head Guide Component:" + name)
        super(FabriceHeadGuide, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="circle")
        self.headCtrl.rotatePoints(90.0, 0.0, 0.0)
        self.headCtrl.scalePoints(Vec3(3.5, 3.5, 3.5))

        self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")
        self.jawCtrl.alignOnZAxis()
        self.jawCtrl.scalePoints(Vec3(2.0, 0.5, 2.0))
        self.jawCtrl.alignOnYAxis(negative=True)
        self.jawCtrl.setColor('orange')

        data = {
                "name": name,
                "location": "M",
                "headXfo": Xfo(Vec3(0.0, 1.67, 1.75)),
                "headCtrlCrvData": self.headCtrl.getCurveData(),
                "jawPosition": Vec3(0.0, 1.2787, 2.0078),
                "jawCtrlCrvData": self.jawCtrl.getCurveData(),
               }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#27
0
    def loadRigDefinition(self, jsonData):
        """Load a rig definition from a JSON structure.

        Args:
            jsonData (dict): JSON data containing the rig definition.

        Returns:
            bool: True if successful.

        """

        Profiler.getInstance().push("loadRigDefinition:" + self.getName())

        krakenSystem = KrakenSystem.getInstance()

        if 'name' in jsonData:
            self.setName(jsonData['name'])

        if 'components' in jsonData:
            self._loadComponents(jsonData['components'])

            if 'connections' in jsonData:
                self._makeConnections(jsonData['connections'])

        if 'metaData' in jsonData:

            for k, v in jsonData['metaData'].iteritems():
                self.setMetaData(k, v)

        Profiler.getInstance().pop()
示例#28
0
    def __init__(self, name='foot', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Foot Component:" + name)
        super(FootComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.ankleCtrl = Control('ankle', parent=self.ctrlCmpGrp, shape="pin")

        self.toeCtrl = Control('toe', parent=self.ctrlCmpGrp, shape="pin")
        self.toeCtrl.rotatePoints(-90.0, 0.0, 0.0)

        self.toeTipCtrl = Control('toeTip',
                                  parent=self.ctrlCmpGrp,
                                  shape="pin")
        self.toeTipCtrl.rotatePoints(-90.0, 0.0, 0.0)

        self.backPivotCtrl = Control('backPivot',
                                     parent=self.ctrlCmpGrp,
                                     shape="axesHalfTarget")
        self.backPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.frontPivotCtrl = Control('frontPivot',
                                      parent=self.ctrlCmpGrp,
                                      shape="axesHalfTarget")
        self.frontPivotCtrl.rotatePoints(0.0, 180.0, 0.0)
        self.frontPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.outerPivotCtrl = Control('outerPivot',
                                      parent=self.ctrlCmpGrp,
                                      shape="axesHalfTarget")
        self.outerPivotCtrl.rotatePoints(0.0, -90.0, 0.0)
        self.outerPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.innerPivotCtrl = Control('innerPivot',
                                      parent=self.ctrlCmpGrp,
                                      shape="axesHalfTarget")
        self.innerPivotCtrl.rotatePoints(0.0, 90.0, 0.0)
        self.innerPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.default_data = {
            "name": name,
            "location": 'L',
            "ankleXfo": Xfo(Vec3(1.75, 1.15, -1.25)),
            "toeXfo": Xfo(Vec3(1.75, 0.4, 0.25)),
            "toeTipXfo": Xfo(Vec3(1.75, 0.4, 1.5)),
            "backPivotXfo": Xfo(Vec3(1.75, 0.0, -2.5)),
            "frontPivotXfo": Xfo(Vec3(1.75, 0.0, 2.0)),
            "outerPivotXfo": Xfo(Vec3(2.5, 0.0, -1.25)),
            "innerPivotXfo": Xfo(Vec3(1.0, 0.0, -1.25))
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#29
0
    def __init__(self, name='Clavicle', parent=None):

        Profiler.getInstance().push("Construct Clavicle Rig Component:" + name)
        super(FabriceClavicleRig, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Clavicle
        self.clavicleCtrlSpace = CtrlSpace('clavicle', parent=self.ctrlCmpGrp)
        self.clavicleCtrl = Control('clavicle', parent=self.clavicleCtrlSpace, shape="cube")
        self.clavicleCtrl.alignOnXAxis()


        # ==========
        # Deformers
        # ==========
        deformersLayer = self.getOrCreateLayer('deformers')
        defCmpGrp = ComponentGroup(self.getName(), self, parent=deformersLayer)
        self.ctrlCmpGrp.setComponent(self)

        self.clavicleDef = Joint('clavicle', parent=defCmpGrp)
        self.clavicleDef.setComponent(self)


        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs
        clavicleInputConstraint = PoseConstraint('_'.join([self.clavicleCtrl.getName(), 'To', self.spineEndInputTgt.getName()]))
        clavicleInputConstraint.setMaintainOffset(True)
        clavicleInputConstraint.addConstrainer(self.spineEndInputTgt)
        self.clavicleCtrlSpace.addConstraint(clavicleInputConstraint)

        # Constraint outputs
        clavicleConstraint = PoseConstraint('_'.join([self.clavicleOutputTgt.getName(), 'To', self.clavicleCtrl.getName()]))
        clavicleConstraint.addConstrainer(self.clavicleCtrl)
        self.clavicleOutputTgt.addConstraint(clavicleConstraint)


        # ===============
        # Add Splice Ops
        # ===============
        # Add Deformer Splice Op
        spliceOp = KLOperator('clavicleDeformerKLOp', 'PoseConstraintSolver', 'Kraken')
        self.addOperator(spliceOp)

        # Add Att Inputs
        spliceOp.setInput('drawDebug', self.drawDebugInputAttr)
        spliceOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Xfo Inputs
        spliceOp.setInput('constrainer', self.clavicleOutputTgt)

        # Add Xfo Outputs
        spliceOp.setOutput('constrainee', self.clavicleDef)

        Profiler.getInstance().pop()
示例#30
0
    def __init__(self, name='head', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Head Guide Component:" + name)
        super(HeadComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        sphereCtrl = Control('sphere', shape='sphere')
        sphereCtrl.scalePoints(Vec3(0.375, 0.375, 0.375))

        self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape='square')
        self.headCtrl.rotatePoints(90, 0, 0)
        self.headCtrl.translatePoints(Vec3(0.0, 0.5, 0.0))
        self.headCtrl.scalePoints(Vec3(1.8, 2.0, 2.0))

        self.eyeLeftCtrl = Control('eyeLeft',
                                   parent=self.headCtrl,
                                   shape='arrow_thin')
        self.eyeLeftCtrl.translatePoints(Vec3(0, 0, 0.5))
        self.eyeLeftCtrl.rotatePoints(0, 90, 0)
        self.eyeLeftCtrl.appendCurveData(sphereCtrl.getCurveData())

        self.eyeRightCtrl = Control('eyeRight',
                                    parent=self.headCtrl,
                                    shape='arrow_thin')
        self.eyeRightCtrl.translatePoints(Vec3(0, 0, 0.5))
        self.eyeRightCtrl.rotatePoints(0, 90, 0)
        self.eyeRightCtrl.appendCurveData(sphereCtrl.getCurveData())

        self.jawCtrl = Control('jaw', parent=self.headCtrl, shape='square')
        self.jawCtrl.rotatePoints(90, 0, 0)
        self.jawCtrl.rotatePoints(0, 90, 0)
        self.jawCtrl.translatePoints(Vec3(0.0, -0.5, 0.5))
        self.jawCtrl.scalePoints(Vec3(1.0, 0.8, 1.5))
        self.jawCtrl.setColor('orange')

        eyeXAlignOri = Quat()
        eyeXAlignOri.setFromAxisAndAngle(Vec3(0, 1, 0), Math_degToRad(-90))

        self.default_data = {
            "name": name,
            "location": "M",
            "headXfo": Xfo(Vec3(0.0, 17.5, -0.5)),
            "headCrvData": self.headCtrl.getCurveData(),
            "eyeLeftXfo": Xfo(tr=Vec3(0.375, 18.5, 0.5), ori=eyeXAlignOri),
            "eyeLeftCrvData": self.eyeLeftCtrl.getCurveData(),
            "eyeRightXfo": Xfo(tr=Vec3(-0.375, 18.5, 0.5), ori=eyeXAlignOri),
            "eyeRightCrvData": self.eyeRightCtrl.getCurveData(),
            "jawXfo": Xfo(Vec3(0.0, 17.875, -0.275)),
            "jawCrvData": self.jawCtrl.getCurveData()
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#31
0
    def __init__(self, name='head', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Head Guide Component:" + name)
        super(HeadComponentGuide, self).__init__(name, parent, *args, **kwargs)


        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)


        sphereCtrl = Control('sphere', shape='sphere')
        sphereCtrl.scalePoints(Vec3(0.375, 0.375, 0.375))

        self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape='square')
        self.headCtrl.rotatePoints(90, 0, 0)
        self.headCtrl.translatePoints(Vec3(0.0, 0.5, 0.0))
        self.headCtrl.scalePoints(Vec3(1.8, 2.0, 2.0))

        self.eyeLeftCtrl = Control('eyeLeft', parent=self.headCtrl, shape='arrow_thin')
        self.eyeLeftCtrl.translatePoints(Vec3(0, 0, 0.5))
        self.eyeLeftCtrl.rotatePoints(0, 90, 0)
        self.eyeLeftCtrl.appendCurveData(sphereCtrl.getCurveData())

        self.eyeRightCtrl = Control('eyeRight', parent=self.headCtrl, shape='arrow_thin')
        self.eyeRightCtrl.translatePoints(Vec3(0, 0, 0.5))
        self.eyeRightCtrl.rotatePoints(0, 90, 0)
        self.eyeRightCtrl.appendCurveData(sphereCtrl.getCurveData())

        self.jawCtrl = Control('jaw', parent=self.headCtrl, shape='square')
        self.jawCtrl.rotatePoints(90, 0, 0)
        self.jawCtrl.rotatePoints(0, 90, 0)
        self.jawCtrl.translatePoints(Vec3(0.0, -0.5, 0.5))
        self.jawCtrl.scalePoints(Vec3(1.0, 0.8, 1.5))
        self.jawCtrl.setColor('orange')

        eyeXAlignOri = Quat()
        eyeXAlignOri.setFromAxisAndAngle(Vec3(0, 1, 0), Math_degToRad(-90))

        self.default_data = {
            "name": name,
            "location": "M",
            "headXfo": Xfo(Vec3(0.0, 17.5, -0.5)),
            "headCrvData": self.headCtrl.getCurveData(),
            "eyeLeftXfo": Xfo(tr=Vec3(0.375, 18.5, 0.5), ori=eyeXAlignOri),
            "eyeLeftCrvData": self.eyeLeftCtrl.getCurveData(),
            "eyeRightXfo": Xfo(tr=Vec3(-0.375, 18.5, 0.5), ori=eyeXAlignOri),
            "eyeRightCrvData": self.eyeRightCtrl.getCurveData(),
            "jawXfo": Xfo(Vec3(0.0, 17.875, -0.275)),
            "jawCrvData": self.jawCtrl.getCurveData()
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#32
0
    def __init__(self, name='Hand', parent=None):

        Profiler.getInstance().push("Construct Hand Rig Component:" + name)
        super(HandComponentRig, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        # Hand
        self.handCtrlSpace = CtrlSpace('hand', parent=self.ctrlCmpGrp)
        self.handCtrl = Control('hand',
                                parent=self.handCtrlSpace,
                                shape="square")
        self.handCtrl.rotatePoints(0, 0, 90.0)
        self.handCtrl.lockScale(True, True, True)
        self.handCtrl.lockTranslation(True, True, True)

        # ==========
        # Deformers
        # ==========
        self.deformersLayer = self.getOrCreateLayer('deformers')
        self.defCmpGrp = ComponentGroup(self.getName(),
                                        self,
                                        parent=self.deformersLayer)
        self.addItem('defCmpGrp', self.defCmpGrp)

        self.handDef = Joint('hand', parent=self.defCmpGrp)
        self.handDef.setComponent(self)

        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs
        self.armEndInputConstraint = PoseConstraint('_'.join([
            self.handCtrlSpace.getName(), 'To',
            self.armEndInputTgt.getName()
        ]))
        self.armEndInputConstraint.setMaintainOffset(True)
        self.armEndInputConstraint.addConstrainer(self.armEndInputTgt)
        self.handCtrlSpace.addConstraint(self.armEndInputConstraint)

        # Constraint outputs
        self.handOutputConstraint = PoseConstraint('_'.join(
            [self.handOutputTgt.getName(), 'To',
             self.handCtrl.getName()]))
        self.handOutputConstraint.addConstrainer(self.handCtrl)
        self.handOutputTgt.addConstraint(self.handOutputConstraint)

        # Constraint deformers
        self.handDefConstraint = PoseConstraint('_'.join(
            [self.handDef.getName(), 'To',
             self.handCtrl.getName()]))
        self.handDefConstraint.addConstrainer(self.handCtrl)
        self.handDef.addConstraint(self.handDefConstraint)

        Profiler.getInstance().pop()
示例#33
0
    def __init__(self, name='leg', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Leg Guide Component:" + name)
        super(LegComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.femurCtrl = Control('femur',
                                 parent=self.ctrlCmpGrp,
                                 shape="sphere")
        self.kneeCtrl = Control('knee', parent=self.ctrlCmpGrp, shape="sphere")
        self.ankleCtrl = Control('ankle',
                                 parent=self.ctrlCmpGrp,
                                 shape="sphere")

        armGuideSettingsAttrGrp = AttributeGroup("DisplayInfo_ArmSettings",
                                                 parent=self.femurCtrl)
        self.armGuideDebugAttr = BoolAttribute('drawDebug',
                                               value=True,
                                               parent=armGuideSettingsAttrGrp)

        self.guideOpHost = Transform('guideOpHost', self.ctrlCmpGrp)

        # Guide Operator
        self.legGuideKLOp = KLOperator('guide', 'TwoBoneIKGuideSolver',
                                       'Kraken')
        self.addOperator(self.legGuideKLOp)

        # Add Att Inputs
        self.legGuideKLOp.setInput('drawDebug', self.armGuideDebugAttr)
        self.legGuideKLOp.setInput('rigScale', self.rigScaleInputAttr)

        # Add Source Inputs
        self.legGuideKLOp.setInput('root', self.femurCtrl)
        self.legGuideKLOp.setInput('mid', self.kneeCtrl)
        self.legGuideKLOp.setInput('end', self.ankleCtrl)

        # Add Target Outputs
        self.legGuideKLOp.setOutput('guideOpHost', self.guideOpHost)

        self.default_data = {
            "name": name,
            "location": "L",
            "createIKHandle": False,
            "femurXfo": Xfo(Vec3(1.0, 9.75, -0.5)),
            "kneeXfo": Xfo(Vec3(1.5, 5.5, -0.5)),
            "ankleXfo": Xfo(Vec3(1.75, 1.15, -1.25))
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#34
0
    def __init__(self, name='hand', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Hand Guide Component:" + name)
        super(HandComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # =========
        # Guide Controls
        self.guideSettingsAttrGrp = AttributeGroup("GuideSettings",
                                                   parent=self)
        self.digitNamesAttr = StringAttribute(
            'digitNames',
            value="thumb,index,middle,ring,pinky",
            parent=self.guideSettingsAttrGrp)
        self.digitNamesAttr.setValueChangeCallback(self.updateFingers)

        self.numJointsAttr = IntegerAttribute('numJoints',
                                              value=4,
                                              minValue=2,
                                              maxValue=20,
                                              parent=self.guideSettingsAttrGrp)
        self.numJointsAttr.setValueChangeCallback(self.resizeDigits)

        self.fingers = OrderedDict()

        self.handCtrl = Control('hand', parent=self.ctrlCmpGrp, shape="square")
        self.handCtrl.rotatePoints(0.0, 0.0, 90.0)
        self.handCtrl.scalePoints(Vec3(1.0, 0.75, 1.0))
        self.handCtrl.setColor('yellow')

        self.handGuideSettingsAttrGrp = AttributeGroup("Settings",
                                                       parent=self.handCtrl)
        self.ctrlShapeToggle = BoolAttribute(
            'ctrlShape_vis', value=False, parent=self.handGuideSettingsAttrGrp)
        self.handDebugInputAttr = BoolAttribute(
            'drawDebug', value=False, parent=self.handGuideSettingsAttrGrp)

        self.drawDebugInputAttr.connect(self.handDebugInputAttr)

        self.guideCtrlHrcGrp = HierarchyGroup('controlShapes',
                                              parent=self.ctrlCmpGrp)

        self.default_data = {
            "name": name,
            "location": "L",
            "handXfo": Xfo(Vec3(7.1886, 12.2819, 0.4906)),
            "digitNames": self.digitNamesAttr.getValue(),
            "numJoints": self.numJointsAttr.getValue(),
            "fingers": self.fingers
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#35
0
    def __init__(self, name='twist', parent=None):

        Profiler.getInstance().push('Construct Spine Guide Component:' + name)
        super(TwistComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup('GuideSettings', parent=self)
        self.numDeformersAttr = IntegerAttribute('numDeformers',
                                                 value=1,
                                                 minValue=0,
                                                 maxValue=20,
                                                 parent=guideSettingsAttrGrp)
        self.blendBiasAttr = ScalarAttribute('blendBias',
                                             value=0.0,
                                             minValue=0,
                                             maxValue=1.0,
                                             parent=guideSettingsAttrGrp)

        # Guide Controls
        triangleCtrl = Control('triangle', shape='triangle')
        triangleCtrl.rotatePoints(90, 0, 0)
        triangleCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))
        triangleCtrl.scalePoints(Vec3(1.0, 0.5, 1.0))
        triangleCtrl.translatePoints(Vec3(0.0, 1.25, 0.0))
        triangleCtrl.rotatePoints(0, 90, 0)

        self.originCtrl = Control('origin',
                                  parent=self.ctrlCmpGrp,
                                  shape='circle')
        self.originCtrl.rotatePoints(90, 0, 0)
        self.originCtrl.rotatePoints(0, 90, 0)
        self.originCtrl.appendCurveData(triangleCtrl.getCurveData())
        self.insertCtrl = Control('insert',
                                  parent=self.ctrlCmpGrp,
                                  shape='circle')
        self.insertCtrl.rotatePoints(90, 0, 0)
        self.insertCtrl.rotatePoints(0, 90, 0)
        self.insertCtrl.appendCurveData(triangleCtrl.getCurveData())

        self.default_data = {
            'name': name,
            'location': 'M',
            'blendBias': 0.5,
            'originXfo': Xfo(Vec3(0.0, 0.0, 0.0)),
            'insertXfo': Xfo(Vec3(5.0, 0.0, 0.0)),
            'numDeformers': 5
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#36
0
    def __init__(self, name='foot', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Foot Component:" + name)
        super(FootComponentGuide, self).__init__(name, parent, *args, **kwargs)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        # Guide Controls
        self.ankleCtrl = Control('ankle', parent=self.ctrlCmpGrp, shape="pin")

        self.toeCtrl = Control('toe', parent=self.ctrlCmpGrp, shape="pin")
        self.toeCtrl.rotatePoints(-90.0, 0.0, 0.0)

        self.toeTipCtrl = Control('toeTip', parent=self.ctrlCmpGrp, shape="pin")
        self.toeTipCtrl.rotatePoints(-90.0, 0.0, 0.0)

        self.backPivotCtrl = Control('backPivot', parent=self.ctrlCmpGrp, shape="axesHalfTarget")
        self.backPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.frontPivotCtrl = Control('frontPivot', parent=self.ctrlCmpGrp, shape="axesHalfTarget")
        self.frontPivotCtrl.rotatePoints(0.0, 180.0, 0.0)
        self.frontPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.outerPivotCtrl = Control('outerPivot', parent=self.ctrlCmpGrp, shape="axesHalfTarget")
        self.outerPivotCtrl.rotatePoints(0.0, -90.0, 0.0)
        self.outerPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.innerPivotCtrl = Control('innerPivot', parent=self.ctrlCmpGrp, shape="axesHalfTarget")
        self.innerPivotCtrl.rotatePoints(0.0, 90.0, 0.0)
        self.innerPivotCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))


        self.default_data = {
            "name": name,
            "location": 'L',
            "ankleXfo": Xfo(Vec3(1.75, 1.15, -1.25)),
            "toeXfo": Xfo(Vec3(1.75, 0.4, 0.25)),
            "toeTipXfo": Xfo(Vec3(1.75, 0.4, 1.5)),
            "backPivotXfo": Xfo(Vec3(1.75, 0.0, -2.5)),
            "frontPivotXfo": Xfo(Vec3(1.75, 0.0, 2.0)),
            "outerPivotXfo": Xfo(Vec3(2.5, 0.0, -1.25)),
            "innerPivotXfo": Xfo(Vec3(1.0, 0.0, -1.25))
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#37
0
    def __init__(self, name='Hand', parent=None):

        Profiler.getInstance().push("Construct Hand Rig Component:" + name)
        super(HandComponentRig, self).__init__(name, parent)


        # =========
        # Controls
        # =========
        # Hand
        self.handCtrlSpace = CtrlSpace('hand', parent=self.ctrlCmpGrp)
        self.handCtrl = Control('hand', parent=self.handCtrlSpace, shape="square")
        self.handCtrl.rotatePoints(0, 0, 90.0)
        self.handCtrl.lockScale(True, True, True)
        self.handCtrl.lockTranslation(True, True, True)


        # ==========
        # Deformers
        # ==========
        self.deformersLayer = self.getOrCreateLayer('deformers')
        self.defCmpGrp = ComponentGroup(self.getName(), self, parent=self.deformersLayer)
        self.addItem('defCmpGrp', self.defCmpGrp)

        self.handDef = Joint('hand', parent=self.defCmpGrp)
        self.handDef.setComponent(self)


        # ==============
        # Constrain I/O
        # ==============
        # Constraint inputs
        self.armEndInputConstraint = PoseConstraint('_'.join([self.handCtrlSpace.getName(), 'To', self.armEndInputTgt.getName()]))
        self.armEndInputConstraint.setMaintainOffset(True)
        self.armEndInputConstraint.addConstrainer(self.armEndInputTgt)
        self.handCtrlSpace.addConstraint(self.armEndInputConstraint)

        # Constraint outputs
        self.handOutputConstraint = PoseConstraint('_'.join([self.handOutputTgt.getName(), 'To', self.handCtrl.getName()]))
        self.handOutputConstraint.addConstrainer(self.handCtrl)
        self.handOutputTgt.addConstraint(self.handOutputConstraint)

        # Constraint deformers
        self.handDefConstraint = PoseConstraint('_'.join([self.handDef.getName(), 'To', self.handCtrl.getName()]))
        self.handDefConstraint.addConstrainer(self.handCtrl)
        self.handDef.addConstraint(self.handDefConstraint)

        Profiler.getInstance().pop()
示例#38
0
    def loadExtension(self, extension):
        """Loads the given extension and updates the registeredTypes cache.

        Args:
            extension (str): The name of the extension to load.

        """

        if extension not in self.loadedExtensions:
            Profiler.getInstance().push("loadExtension:" + extension)
            self.client.loadExtension(extension)
            self.registeredTypes = self.client.RT.types
            self.typeDescs = self.client.RT.getRegisteredTypes()
            # Cache the loaded extension so that we aviod refreshing the typeDescs cache(costly)
            self.loadedExtensions.append(extension)
            Profiler.getInstance().pop()
示例#39
0
    def loadExtension(self, extension):
        """Loads the given extension and updates the registeredTypes cache.

        Args:
            extension (str): The name of the extension to load.

        """

        if extension not in self.loadedExtensions:
            Profiler.getInstance().push("loadExtension:" + extension)
            self.client.loadExtension(extension)
            self.registeredTypes = self.client.RT.types
            self.typeDescs = self.client.RT.getRegisteredTypes()
            # Cache the loaded extension so that we aviod refreshing the typeDescs cache(costly)
            self.loadedExtensions.append(extension)
            Profiler.getInstance().pop()
示例#40
0
文件: rig.py 项目: yarwelp/Kraken
    def _makeConnections(self, connectionsJson):
        """Makes connections based on JSON dict.

        Args:
            connectionsJson (dict): Dictionary of connections to make.

        """

        Profiler.getInstance().push("__makeConnections")

        for connectionData in connectionsJson:

            sourceComponentDecoratedName, outputName = connectionData['source'].split('.')
            targetComponentDecoratedName, inputName = connectionData['target'].split('.')

            connectionFailure = False

            sourceComponent = self.getChildByDecoratedName(sourceComponentDecoratedName)
            if sourceComponent is None:
                print("Warning: Error making connection:" + connectionData['source'] + " -> " +
                      connectionData['target'] + ". Source component not found:" + sourceComponentDecoratedName)
                connectionFailure = True

            targetComponent = self.getChildByDecoratedName(targetComponentDecoratedName)
            if targetComponent is None:
                print("Warning: Error making connection:" + connectionData['source'] + " -> " +
                      connectionData['target'] + ". Target component not found:" + targetComponentDecoratedName)
                connectionFailure = True

            outputPort = sourceComponent.getOutputByName(outputName)
            if outputPort is None:
                print("Warning: Error making connection:" + connectionData['source'] + " -> " +
                      connectionData['target'] + ". Output '" + outputName + "' not found on Component:" + sourceComponent.getPath())
                connectionFailure = True

            inputPort = targetComponent.getInputByName(inputName)
            if inputPort is None:
                print("Warning: Error making connection:" + connectionData['source'] + " -> " +
                      connectionData['target'] + ". Input '" + inputName + "' not found on Component:" + targetComponent.getPath())
                connectionFailure = True

            if connectionFailure is False:
                inputPort.setConnection(outputPort, index = connectionData.get('targetIndex', 0))

        Profiler.getInstance().pop()
示例#41
0
    def __init__(self, name="arm", parent=None):

        Profiler.getInstance().push("Construct Arm Guide Component:" + name)
        super(ArmComponentGuide, self).__init__(name, parent)

        # ===========
        # Attributes
        # ===========
        # Add Component Params to IK control
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.bicepFKCtrlSizeInputAttr = ScalarAttribute(
            "bicepFKCtrlSize", value=1.75, minValue=0.0, maxValue=10.0, parent=guideSettingsAttrGrp
        )
        self.forearmFKCtrlSizeInputAttr = ScalarAttribute(
            "forearmFKCtrlSize", value=1.5, minValue=0.0, maxValue=10.0, parent=guideSettingsAttrGrp
        )

        # =========
        # Controls
        # =========
        # Guide Controls
        self.bicepCtrl = Control("bicepFK", parent=self.ctrlCmpGrp, shape="sphere")
        self.bicepCtrl.setColor("blue")
        self.forearmCtrl = Control("forearmFK", parent=self.ctrlCmpGrp, shape="sphere")
        self.forearmCtrl.setColor("blue")
        self.wristCtrl = Control("wristFK", parent=self.ctrlCmpGrp, shape="sphere")
        self.wristCtrl.setColor("blue")
        self.handCtrl = Control("hand", parent=self.ctrlCmpGrp, shape="cube")
        self.handCtrl.setColor("blue")

        data = {
            "name": name,
            "location": "L",
            "bicepXfo": Xfo(Vec3(2.27, 15.295, -0.753)),
            "forearmXfo": Xfo(Vec3(5.039, 13.56, -0.859)),
            "wristXfo": Xfo(Vec3(7.1886, 12.2819, 0.4906)),
            "handXfo": Xfo(tr=Vec3(7.1886, 12.2819, 0.4906), ori=Quat(Vec3(-0.0865, -0.2301, -0.2623), 0.9331)),
            "bicepFKCtrlSize": 1.75,
            "forearmFKCtrlSize": 1.5,
        }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#42
0
    def loadCoreClient(self):
        """Loads the Fabric Engine Core Client"""

        if self.client == None:
            Profiler.getInstance().push("loadCoreClient")

            try:
                imp.find_module('cmds')
                host = 'Maya'
            except ImportError:
                try:
                    imp.find_module('sipyutils')
                    host = 'Softimage'
                except ImportError:
                    host = 'Python'

            if host == "Python":
                self.client = FabricEngine.Core.createClient()

            elif host == "Maya":
                contextID = cmds.fabricSplice('getClientContextID')
                if contextID == '':
                    cmds.fabricSplice('constructClient')
                    contextID = cmds.fabricSplice('getClientContextID')

                # Pull out the Splice client.
                self.client = FabricEngine.Core.createClient({"contextID": contextID})

            elif host == "Softimage":
                from win32com.client.dynamic import Dispatch
                si = Dispatch("XSI.Application").Application
                contextID = si.fabricSplice('getClientContextID')
                if contextID == '':
                    si.fabricSplice('constructClient')
                    contextID = si.fabricSplice('getClientContextID')

                # Pull out the Splice client.
                self.client = FabricEngine.Core.createClient({"contextID": contextID})

            self.loadExtension('Math')

            # krakenDir = os.environ['KRAKEN_PATH']
            # self.client.DFG.host.addPresetDir('', 'Kraken', os.path.join(krakenDir, 'CanvasPresets'))

            Profiler.getInstance().pop()
示例#43
0
    def __init__(self, name='hand', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Hand Guide Component:" + name)
        super(HandComponentGuide, self).__init__(name, parent, *args, **kwargs)


        # =========
        # Controls
        # =========
        # Guide Controls
        self.guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
        self.digitNamesAttr = StringAttribute('digitNames', value="thumb,index,middle,ring,pinky", parent=self.guideSettingsAttrGrp)
        self.digitNamesAttr.setValueChangeCallback(self.updateFingers)

        self.numJointsAttr = IntegerAttribute('numJoints', value=4, minValue=2, maxValue=20, parent=self.guideSettingsAttrGrp)
        self.numJointsAttr.setValueChangeCallback(self.resizeDigits)

        self.fingers = OrderedDict()

        self.handCtrl = Control('hand', parent=self.ctrlCmpGrp, shape="square")
        self.handCtrl.rotatePoints(0.0, 0.0, 90.0)
        self.handCtrl.scalePoints(Vec3(1.0, 0.75, 1.0))
        self.handCtrl.setColor('yellow')

        self.handGuideSettingsAttrGrp = AttributeGroup("Settings", parent=self.handCtrl)
        self.ctrlShapeToggle = BoolAttribute('ctrlShape_vis', value=False, parent=self.handGuideSettingsAttrGrp)
        self.handDebugInputAttr = BoolAttribute('drawDebug', value=False, parent=self.handGuideSettingsAttrGrp)

        self.drawDebugInputAttr.connect(self.handDebugInputAttr)

        self.guideCtrlHrcGrp = HierarchyGroup('controlShapes', parent=self.ctrlCmpGrp)

        self.default_data = {
            "name": name,
            "location": "L",
            "handXfo": Xfo(Vec3(7.1886, 12.2819, 0.4906)),
            "digitNames": self.digitNamesAttr.getValue(),
            "numJoints": self.numJointsAttr.getValue(),
            "fingers": self.fingers
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#44
0
    def __init__(self, name='FKChain', parent=None, data=None):

        Profiler.getInstance().push("Construct FKCHain Guide Component:" +
                                    name)
        super(FKChainComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # =========
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
        self.numJoints = IntegerAttribute('numJoints',
                                          value=4,
                                          minValue=1,
                                          maxValue=20,
                                          parent=guideSettingsAttrGrp)
        self.numJoints.setValueChangeCallback(self.updateNumJointControls)

        self.jointCtrls = []
        if data is None:
            numJoints = self.numJoints.getValue()
            jointPositions = self.generateGuidePositions(numJoints)

            for i in xrange(numJoints + 1):
                if i == 0:
                    ctrlParent = self.ctrlCmpGrp
                else:
                    ctrlParent = self.jointCtrls[i - 1]

                newCtrl = Control('chain' + str(i + 1).zfill(2),
                                  parent=ctrlParent,
                                  shape="sphere")
                newCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))
                self.jointCtrls.append(newCtrl)

            data = {
                "location": "L",
                "jointPositions": jointPositions,
                "numJoints": self.numJoints.getValue()
            }

        self.loadData(data)

        Profiler.getInstance().pop()
示例#45
0
    def loadCoreClient(self):
        """Loads the Fabric Engine Core Client"""

        if self.client is None:
            Profiler.getInstance().push("loadCoreClient")

            client = getFabricClient()
            if client is None:
                options = {'reportCallback': fabricCallback, 'guarded': True}

                client = FabricEngine.Core.createClient(options)

            self.client = client

            self.loadExtension('Math')
            self.loadExtension('Kraken')
            self.loadExtension('KrakenForCanvas')

            Profiler.getInstance().pop()
示例#46
0
    def __init__(self, name='twist', parent=None):

        Profiler.getInstance().push('Construct Spine Guide Component:' + name)
        super(TwistComponentGuide, self).__init__(name, parent)

        # =========
        # Controls
        # ========
        guideSettingsAttrGrp = AttributeGroup('GuideSettings', parent=self)
        self.numDeformersAttr = IntegerAttribute('numDeformers', value=1, minValue=0, maxValue=20, parent=guideSettingsAttrGrp)
        self.blendBiasAttr = ScalarAttribute('blendBias', value=0.0, minValue=0, maxValue=1.0, parent=guideSettingsAttrGrp)

        # Guide Controls
        triangleCtrl = Control('triangle', shape='triangle')
        triangleCtrl.rotatePoints(90, 0, 0)
        triangleCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))
        triangleCtrl.scalePoints(Vec3(1.0, 0.5, 1.0))
        triangleCtrl.translatePoints(Vec3(0.0, 1.25, 0.0))
        triangleCtrl.rotatePoints(0, 90, 0)

        self.originCtrl = Control('origin', parent=self.ctrlCmpGrp, shape='circle')
        self.originCtrl.rotatePoints(90, 0, 0)
        self.originCtrl.rotatePoints(0, 90, 0)
        self.originCtrl.appendCurveData(triangleCtrl.getCurveData())
        self.insertCtrl = Control('insert', parent=self.ctrlCmpGrp, shape='circle')
        self.insertCtrl.rotatePoints(90, 0, 0)
        self.insertCtrl.rotatePoints(0, 90, 0)
        self.insertCtrl.appendCurveData(triangleCtrl.getCurveData())

        self.default_data = {
            'name': name,
            'location': 'M',
            'blendBias': 0.5,
            'originXfo': Xfo(Vec3(0.0, 0.0, 0.0)),
            'insertXfo': Xfo(Vec3(5.0, 0.0, 0.0)),
            'numDeformers': 5
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#47
0
    def __init__(self, name='clavicle', parent=None, *args, **kwargs):

        Profiler.getInstance().push("Construct Clavicle Guide Component:" + name)
        super(ClavicleComponentGuide, self).__init__(name, parent, *args, **kwargs)


        # =========
        # Controls
        # =========
        # Guide Controls
        guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)

        self.clavicleCtrl = Control('clavicle', parent=self.ctrlCmpGrp, shape="circle")
        self.clavicleCtrl.scalePoints(Vec3(0.75, 0.75, 0.75))
        self.clavicleCtrl.rotatePoints(0.0, 0.0, 90.0)

        self.clavicleGuideSettingsAttrGrp = AttributeGroup("Settings", parent=self.clavicleCtrl)
        self.handDebugInputAttr = BoolAttribute('drawDebug', value=False, parent=self.clavicleGuideSettingsAttrGrp)

        self.drawDebugInputAttr.connect(self.handDebugInputAttr)

        self.clavicleUpVCtrl = Control('clavicleUpV', parent=self.clavicleCtrl, shape="triangle")
        self.clavicleUpVCtrl.setColor('red')
        self.clavicleUpVCtrl.rotatePoints(-90.0, 0.0, 0.0)
        self.clavicleUpVCtrl.rotatePoints(0.0, 90.0, 0.0)
        self.clavicleUpVCtrl.scalePoints(Vec3(0.5, 0.5, 0.5))

        self.clavicleEndCtrl = Control('clavicleEnd', parent=self.ctrlCmpGrp, shape="cube")
        self.clavicleEndCtrl.scalePoints(Vec3(0.25, 0.25, 0.25))

        self.default_data = {
            "name": name,
            "location": "L",
            "clavicleXfo": Xfo(Vec3(0.15, 15.5, -0.5)),
            "clavicleUpVXfo": Xfo(Vec3(0.15, 16.5, -0.5)),
            "clavicleEndXfo": Xfo(Vec3(2.25, 15.5, -0.75))
        }

        self.loadData(self.default_data)

        Profiler.getInstance().pop()
示例#48
0
    def __init__(self, name):

        Profiler.getInstance().push("Construct SpineClavRig:" + name)
        super(SpineClavRig, self).__init__(name)

        # Add Components to Layers
        spineComponent = SpineComponentRig("spine", self)
        spineComponent.loadData(
            data={
                'cogPosition': Vec3(0.0, 11.1351, -0.1382),
                'spine01Position': Vec3(0.0, 11.1351, -0.1382),
                'spine02Position': Vec3(0.0, 11.8013, -0.1995),
                'spine03Position': Vec3(0.0, 12.4496, -0.3649),
                'spine04Position': Vec3(0.0, 13.1051, -0.4821),
                'numDeformers': 4
            })

        clavicleLeftComponentGuide = ClavicleComponentGuide("clavicleGuide")
        clavicleLeftComponentGuide.loadData({
            "location":
            "L",
            "clavicleXfo":
            Xfo(Vec3(0.1322, 15.403, -0.5723)),
            "clavicleUpVXfo":
            Xfo(Vec3(0.0, 1.0, 0.0)),
            "clavicleEndXfo":
            Xfo(Vec3(2.27, 15.295, -0.753))
        })

        clavicleLeftComponent = ClavicleComponentRig("clavicle", self)
        clavicleLeftComponent.loadData(
            data=clavicleLeftComponentGuide.getRigBuildData())

        # Clavicle to Spine
        vertebraeOutputs = spineComponent.getOutputByName('spineVertebrae')
        clavicleLeftSpineEndInput = clavicleLeftComponent.getInputByName(
            'spineEnd')
        clavicleLeftSpineEndInput.setConnection(vertebraeOutputs, index=2)

        Profiler.getInstance().pop()
示例#49
0
def buildBob(mode='guide'):

    Profiler.getInstance().push("bob_build")

    bobGuideRig = Rig("char_bob")
    bobGuideRig.loadRigDefinition(bob_guide_data)

    if mode == 'guide':
        builder = plugins.getBuilder()
        builder.build(bobGuideRig)

    elif mode == 'rig':
        synchronizer = plugins.getSynchronizer()
        synchronizer.setTarget(bobGuideRig)
        synchronizer.sync()

        bobRigData = bobGuideRig.getGuideData()
        bobRig = Rig()
        bobRig.loadRigDefinition(bobRigData)

        builder = plugins.getBuilder()
        builder.build(bobRig)

    else:
        print 'Invalid mode set'

    Profiler.getInstance().pop()

    if __name__ == "__main__":
        print Profiler.getInstance().generateReport()
    else:
        if mode == 'guide':
            logHierarchy(bobGuideRig)
        elif mode == 'rig':
            logHierarchy(bobRig)
示例#50
0
def buildBob(mode='guide'):

    Profiler.getInstance().push("bob_build")

    bobGuideRig = Rig("char_bob")
    bobGuideRig.loadRigDefinition(bob_guide_data)

    if mode == 'guide':
        builder = plugins.getBuilder()
        builder.build(bobGuideRig)

    elif mode == 'rig':
        synchronizer = plugins.getSynchronizer()
        synchronizer.setTarget(bobGuideRig)
        synchronizer.sync()

        bobRigData = bobGuideRig.getGuideData()
        bobRig = Rig()
        bobRig.loadRigDefinition(bobRigData)

        builder = plugins.getBuilder()
        builder.build(bobRig)

    else:
        LogMessage('Invalid mode set')

    Profiler.getInstance().pop()

    if __name__ == "__main__":
        print Profiler.getInstance().generateReport()
    else:
        if mode == 'guide':
            logHierarchy(bobGuideRig)
        elif mode == 'rig':
            logHierarchy(bobRig)
示例#51
0
    def writeRigDefinitionFile(self, filepath):
        """Load a rig definition from a file on disk.

        Args:
            filepath (str): The file path of the rig definition file.

        Returns:
            bool: True if successful.

        """

        Profiler.getInstance().push("writeRigDefinitionFile:" + filepath)

        jsonData = self.getData()

        # now preprocess the data ready for saving to disk.
        pureJSON = prepareToSave(jsonData)

        with open(filepath, 'w') as rigFile:
            rigFile.write(json.dumps(pureJSON, indent=2))

        Profiler.getInstance().pop()
示例#52
0
文件: rig.py 项目: hoorayfor3d/Kraken
    def writeGuideDefinitionFile(self, filepath):
        """Writes a rig definition to a file on disk.

        Arguments:
        filepath -- string, the file path of the rig definition file.

        Return:
        True if successful.

        """

        Profiler.getInstance().push("WriteGuideDefinitionFile:" + filepath)

        guideData = self.getRigBuildData()

        # now preprocess the data ready for saving to disk.
        pureJSON = prepareToSave(guideData)

        with open(filepath,'w') as rigDef:
            rigDef.write(json.dumps(pureJSON, indent=2))

        Profiler.getInstance().pop()
示例#53
0
    def loadCoreClient(self):
        """Loads the Fabric Engine Core Client"""

        if self.client is None:
            Profiler.getInstance().push("loadCoreClient")

            client = getFabricClient()
            if client is None:
                options = {
                    'reportCallback': fabricCallback,
                    'guarded': True
                }

                client = FabricEngine.Core.createClient(options)

            self.client = client

            self.loadExtension('Math')
            self.loadExtension('Kraken')
            self.loadExtension('KrakenForCanvas')

            Profiler.getInstance().pop()
示例#54
0
文件: rig.py 项目: Leopardob/Kraken
    def writeRigDefinitionFile(self, filepath):
        """Load a rig definition from a file on disk.

        Args:
            filepath (str): The file path of the rig definition file.

        Returns:
            bool: True if successful.

        """

        Profiler.getInstance().push("writeRigDefinitionFile:" + filepath)

        jsonData = self.getData()

        # now preprocess the data ready for saving to disk.
        pureJSON = prepareToSave(jsonData)

        with open(filepath,'w') as rigFile:
            rigFile.write(json.dumps(pureJSON, indent=2))

        Profiler.getInstance().pop()