Пример #1
0
 def updateRigMetaData(self, data):
     """
     Add some meta data to the rig being built
     """
     if not self.rig:
         self.log.error('Cannot update rig meta data, no rig is set')
         return
     meta.updateMetaData(self.rig, RIG_METACLASS, data)
Пример #2
0
 def createRigStructure(self):
     # create a new rig
     self.rig = createRigNode(self.blueprint.rigName)
     # add some additional meta data
     meta.updateMetaData(
         self.rig, RIG_METACLASS,
         dict(
             version=BLUEPRINT_VERSION,
             blueprintFile=self.blueprintFile,
         ))
Пример #3
0
    def buildGenerator(self):
        """
        This is the main iterator for performing all build operations.
        It runs all BuildSteps and BuildActions in order.
        """
        currentActionIndex = 0
        totalActionCount = 0

        yield dict(index=currentActionIndex, total=totalActionCount)

        # create a new rig
        self.rig = createRigNode(self.blueprint.rigName)
        # add some additional meta data
        meta.updateMetaData(
            self.rig, RIG_METACLASS,
            dict(
                version=BLUEPRINT_VERSION,
                blueprintFile=self.blueprintFile,
            ))

        yield dict(index=currentActionIndex, total=totalActionCount)

        # recursively iterate through all build actions
        allActions = list(self.blueprint.actionIterator())
        totalActionCount = len(allActions)
        for currentActionIndex, (step, action) in enumerate(allActions):
            # TODO: yield actions in groups so we can know how many are in each step?
            path = step.getFullPath()
            self.log.info('[{0}/{1}] {path}'.format(currentActionIndex + 1,
                                                    totalActionCount,
                                                    path=path))

            # run the action
            action.rig = self.rig
            try:
                action.run()
            except Exception as error:
                self._onError(step, action, error)

            # return progress
            yield dict(index=currentActionIndex, total=totalActionCount)

        # delete all blueprint nodes
        for node in Blueprint.getAllBlueprintNodes():
            pm.delete(node)
        pm.select(cl=True)

        yield dict(index=currentActionIndex,
                   total=totalActionCount,
                   finish=True)
Пример #4
0
    def buildGenerator(self):
        """
        This is the main iterator for performing all build operations.
        It recursively traverses all BuildItems and runs them.
        """
        currentStep = 0
        totalSteps = 0

        yield dict(current=currentStep, total=totalSteps)

        # create a new rig
        self.rig = createRigNode(self.blueprint.rigName)
        # add some additional meta data
        meta.updateMetaData(
            self.rig, RIG_METACLASS,
            dict(
                version=BLUEPRINT_VERSION,
                blueprintFile=self.blueprintFile,
            ))

        yield dict(current=currentStep, total=totalSteps)

        # recursively iterate through all build items
        allActions = list(self.blueprint.actionIterator())
        totalSteps = len(allActions)
        for currentStep, (action, path) in enumerate(allActions):
            _path = path + ' - ' if path else ''
            self.log.info('[{0}/{1}] {path}{name}'.format(
                currentStep + 1,
                totalSteps,
                path=_path,
                name=action.getDisplayName()))
            # run the action
            action.rig = self.rig
            try:
                action.run()
            except Exception as error:
                self._onError(action, error)
            # return progress
            yield dict(current=currentStep, total=totalSteps)

        # delete the default blueprint node if it exists
        if pm.cmds.objExists(BLUEPRINT_NODENAME):
            pm.cmds.delete(BLUEPRINT_NODENAME)

        yield dict(current=currentStep, total=totalSteps, finish=True)