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)
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)
def buildArm(mode='guide'): Profiler.getInstance().push("arm_build") guideContainer = Container('armGuide') armGuide = ArmComponentGuide("arm", parent=guideContainer) armGuide.loadData({ "name": "Arm", "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 }) if mode == 'guide': builder = plugins.getBuilder() builder.build(guideContainer) elif mode == 'rig': synchronizer = plugins.getSynchronizer() synchronizer.setTarget(guideContainer) synchronizer.sync() armGuideData = armGuide.getRigBuildData() rigContainer = Container('armRig') arm = ArmComponent(parent=rigContainer) arm.loadData(armGuideData) builder = plugins.getBuilder() builder.build(rigContainer) else: LogMessage('Invalid mode set') Profiler.getInstance().pop() if __name__ == "__main__": print Profiler.getInstance().generateReport() else: if mode == 'guide': logHierarchy(armGuide) elif mode == 'rig': logHierarchy(arm)
def buildArm(mode='guide'): Profiler.getInstance().push("arm_build") guideContainer = Container('armGuide') armGuide = ArmComponentGuide("arm", parent=guideContainer) armGuide.loadData({ "name": "Arm", "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 }) if mode == 'guide': builder = plugins.getBuilder() builder.build(guideContainer) elif mode == 'rig': synchronizer = plugins.getSynchronizer() synchronizer.setTarget(guideContainer) synchronizer.sync() armGuideData = armGuide.getRigBuildData() rigContainer = Container('armRig') arm = ArmComponent(parent=rigContainer) arm.loadData(armGuideData) builder = plugins.getBuilder() builder.build(rigContainer) else: LogMessage('Invalid mode set') Profiler.getInstance().pop() if __name__ == "__main__": print Profiler.getInstance().generateReport() else: if mode == 'guide': for each in armGuide.getItems().values(): # Only log hierarchy for Layer objects as Layers in this test are added to # the component since there is no rig object. if each.isTypeOf('Layer'): logHierarchy(each) elif mode == 'rig': for each in arm.getItems().values(): # Only log hierarchy for Layer objects as Layers in this test are added to # the component since there is no rig object. if each.isTypeOf('Layer'): logHierarchy(each)
def buildGuideRig(self): try: logger.info('Building Guide') self.window().setCursor(QtCore.Qt.WaitCursor) # self.window().statusBar().showMessage('Building Guide') initConfigIndex = self.window().krakenMenu.configsWidget.currentIndex() # Append "_guide" to rig name when building guide if self.guideRig.getName().endswith('_guide') is False: self.guideRig.setName(self.guideRig.getName() + '_guide') if self.window().preferences.getPreferenceValue('delete_existing_rigs'): if self._guideBuilder: self._guideBuilder.deleteBuildElements() self._guideBuilder = plugins.getBuilder() self._guideBuilder.build(self.guideRig) logger.inform('Guide Rig Build Success') self.window().krakenMenu.setCurrentConfig(initConfigIndex) except: logger.exception('Error Building') finally: self.window().setCursor(QtCore.Qt.ArrowCursor)
def KrakenBuildGuideFromRig_Execute(sceneRig): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins from kraken.helpers.utility_methods import prepareToSave, prepareToLoad if sceneRig == None and si.Interactive is True: pickSceneRig = si.PickElement(constants.siModelFilter, "Kraken: Pick Rig", "Kraken: Pick Rig") if pickSceneRig('ButtonPressed') == 0: pass else: pickedSceneRig = pickSceneRig('PickedElement') if pickedSceneRig.Properties('krakenRig') is None: log( "Kraken: Picked object is not the top node of a Kraken Rig!", 4) return False sceneRig = pickedSceneRig else: if sceneRig.Properties('krakenRig') is None: log( "Kraken: 'sceneRig' argument is not the top node of a Kraken Rig!", 4) return False if sceneRig.Properties('krakenRigData') is None: log("Kraken: 'sceneRig' does not have a 'krakenRigData' property!", 4) return False guideData = sceneRig.Properties('krakenRigData').Value rig = Rig() jsonData = json.loads(guideData) jsonData = prepareToLoad(jsonData) rig.loadRigDefinition(jsonData) rig.setName(rig.getName()) builtRig = None progressBar = None try: progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Rig: " + rig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(rig) finally: if progressBar is not None: progressBar.Visible = False return builtRig
def buildRig(self): try: self.window().setCursor(QtCore.Qt.WaitCursor) self.window().statusBar.showMessage('Building Rig') initConfigIndex = self.window().krakenMenu.configsWidget.currentIndex() self.synchGuideRig() rigBuildData = self.guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '')) if self.window().preferences.getPreferenceValue('delete_existing_rigs'): if self._builder: self._builder.deleteBuildElements() self._builder = plugins.getBuilder() self._builder.build(rig) logger.inform('Rig Build Success') self.window().krakenMenu.setCurrentConfig(initConfigIndex) except Exception as e: logger.exception('Error Building') finally: self.window().setCursor(QtCore.Qt.ArrowCursor)
def doIt(self, argList): selObjects = self.parseArgs(argList) if selObjects.length() < 1: OpenMaya.MGlobal.displayWarning('Kraken: No objects selected, Build Guide From Rig cancelled.') return False firstObj = OpenMaya.MObject() selObjects.getDependNode(0, firstObj) firstObjDepNode = maya.OpenMaya.MFnDependencyNode(firstObj) if firstObjDepNode.hasAttribute('krakenRig') is False: OpenMaya.MGlobal.displayWarning('Kraken: Selected object is not the top node of a Kraken Rig!') return False guideData = firstObjDepNode.findPlug("krakenRigData").asString() rig = Rig() jsonData = json.loads(guideData) jsonData = prepareToLoad(jsonData) rig.loadRigDefinition(jsonData) rig.setName(rig.getName()) builder = plugins.getBuilder() builtRig = builder.build(rig) # return builtRig return None
def doIt(self, argList): selObjects = self.parseArgs(argList) if selObjects.length() < 1: OpenMaya.MGlobal.displayWarning('Kraken: No objects selected, Build Rig cancelled.') return False firstObj = OpenMaya.MObject() selObjects.getDependNode(0, firstObj) firstObjDepNode = maya.OpenMaya.MFnDependencyNode(firstObj) if firstObjDepNode.hasAttribute('krakenRig') is False: OpenMaya.MGlobal.displayWarning('Kraken: Selected object is not the top node of a Kraken Rig!') return False guideName = firstObjDepNode.name() guideRig = BipedGuideRig(guideName) synchronizer = plugins.getSynchronizer() if guideRig.getName().endswith('_guide') is False: guideRig.setName(guideRig.getName() + '_guide') synchronizer.setTarget(guideRig) synchronizer.sync() rigBuildData = guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '_rig')) builder = plugins.getBuilder() builtRig = builder.build(rig) return builtRig
def buildRig(self): try: self.window().statusBar().showMessage('Building Rig') initConfigIndex = self.window().krakenMenu.configsWidget.currentIndex() self.synchGuideRig() rigBuildData = self.guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '')) builder = plugins.getBuilder() builder.build(rig) self.window().krakenMenu.setCurrentConfig(initConfigIndex) except Exception as e: # Add the callstak to the log callstack = traceback.format_exc() print callstack self.reportMessage('Error Building', level='error', exception=e)
def buildArm(mode='guide'): Profiler.getInstance().push("arm_build") guideContainer = Container('armGuide') armGuide = ArmComponentGuide("arm", parent=guideContainer) armGuide.loadData({ "name": "L_Arm", "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)), "bicepFKCtrlSize": 1.75, "forearmFKCtrlSize": 1.5 }) if mode == 'guide': builder = plugins.getBuilder() builder.build(guideContainer) elif mode == 'rig': synchronizer = plugins.getSynchronizer() synchronizer.setTarget(guideContainer) synchronizer.sync() armGuideData = armGuide.getGuideData() rigContainer = Container('armRig') arm = ArmComponent(parent=rigContainer) arm.loadData(armGuideData) builder = plugins.getBuilder() builder.build(rigContainer) else: LogMessage('Invalid mode set') Profiler.getInstance().pop() if __name__ == "__main__": print Profiler.getInstance().generateReport() else: if mode == 'guide': logHierarchy(armGuide) elif mode == 'rig': logHierarchy(arm)
def KrakenBuildGuideFromRig_Execute(sceneRig): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins from kraken.helpers.utility_methods import prepareToSave, prepareToLoad if sceneRig == None and si.Interactive is True: pickSceneRig = si.PickElement(constants.siModelFilter, "Kraken: Pick Rig", "Kraken: Pick Rig") if pickSceneRig('ButtonPressed') == 0: pass else: pickedSceneRig = pickSceneRig('PickedElement') if pickedSceneRig.Properties('krakenRig') is None: log("Kraken: Picked object is not the top node of a Kraken Rig!", 4) return False sceneRig = pickedSceneRig else: if sceneRig.Properties('krakenRig') is None: log("Kraken: 'sceneRig' argument is not the top node of a Kraken Rig!", 4) return False if sceneRig.Properties('krakenRigData') is None: log("Kraken: 'sceneRig' does not have a 'krakenRigData' property!", 4) return False guideData = sceneRig.Properties('krakenRigData').Value rig = Rig() jsonData = json.loads(guideData) jsonData = prepareToLoad(jsonData) rig.loadRigDefinition(jsonData) rig.setName(rig.getName()) builtRig = None progressBar = None try: progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Rig: " + rig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(rig) finally: if progressBar is not None: progressBar.Visible = False return builtRig
def BuildKrakenRig_Execute(rigFilePath): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins if rigFilePath == "" and si.Interactive is True: fileBrowser = XSIUIToolkit.FileBrowser fileBrowser.DialogTitle = "Select a Kraken Rig File" fileBrowser.InitialDirectory = si.ActiveProject3.Path fileBrowser.Filter = "Kraken Rig (*.krg)|*.krg||" fileBrowser.ShowOpen() fileName = fileBrowser.FilePathName if fileName != "": rigFilePath = fileName else: log("User Cancelled.", 4) return False elif rigFilePath == "" and si.Interactive is False: log("No rig file path specified in batch mode!", 2) return False guideRig = Rig() guideRig.loadRigDefinitionFile(rigFilePath) rigBuildData = guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(guideRig.getName().replace('_guide', '')) builtRig = None progressBar = None try: progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Rig: " + rig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(rig) finally: if progressBar is not None: progressBar.Visible = False return builtRig
def doIt(self, args): result = pm.promptDialog(title='Kraken: Build Biped', message='Rig Name', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', text='Biped') if result == 'OK': guideName = pm.promptDialog(query=True, text=True) guideName.replace(' ', '') guideName += '_guide' guideRig = BipedGuideRig(guideName) builder = plugins.getBuilder() OpenMaya.MGlobal.displayInfo('Kraken: Building Guide Rig: ' + guideName) try: main_window = pm.ui.Window(pm.MelGlobals.get('gMainWindow')) main_win_width = pm.window(main_window, query=True, width=True) buildMsgWin = pm.window("KrakenBuildBipedWin", title="Kraken: Build Biped", width=200, height=100, sizeable=False, titleBar=False, leftEdge=(main_win_width / 2) - 100) buildMsglayout = pm.verticalLayout(spacing=10) buildMsgText = pm.text('Kraken: Building Biped') buildMsglayout.redistribute() buildMsgWin.show() pm.refresh() builtRig = builder.build(guideRig) return builtRig finally: if pm.window("KrakenBuildBipedWin", exists=True) is True: pm.deleteUI(buildMsgWin) else: OpenMaya.MGlobal.displayWarning( 'Kraken: Build Guide Rig Cancelled!')
def doIt(self, args): result = pm.promptDialog(title='Kraken: Build Biped', message='Rig Name', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', text='Biped') if result == 'OK': guideName = pm.promptDialog(query=True, text=True) guideName.replace(' ', '') guideName += '_guide' guideRig = BipedGuideRig(guideName) builder = plugins.getBuilder() OpenMaya.MGlobal.displayInfo('Kraken: Building Guide Rig: ' + guideName) try: main_window = pm.ui.Window(pm.MelGlobals.get('gMainWindow')) main_win_width = pm.window(main_window, query=True, width=True) buildMsgWin = pm.window("KrakenBuildBipedWin", title="Kraken: Build Biped", width=200, height=100, sizeable=False, titleBar=False, leftEdge=(main_win_width / 2) - 100) buildMsglayout = pm.verticalLayout(spacing=10) buildMsgText = pm.text('Kraken: Building Biped') buildMsglayout.redistribute() buildMsgWin.show() pm.refresh() builtRig = builder.build(guideRig) return builtRig finally: if pm.window("KrakenBuildBipedWin", exists=True) is True: pm.deleteUI(buildMsgWin) else: OpenMaya.MGlobal.displayWarning('Kraken: Build Guide Rig Cancelled!')
def buildRig(self): try: self.window().statusBar().showMessage('Building Rig') self.synchGuideRig() rigBuildData = self.guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '')) builder = plugins.getBuilder() builder.build(rig) except Exception as e: print traceback.format_exc() statusBar = self.window().statusBar() warningLabel = QtGui.QLabel('Error Building: ' + ', '.join([x for x in e.args])) warningLabel.setMaximumWidth(200) warningLabel.setStyleSheet( "QLabel { border-radius: 3px; background-color: #AA0000}") def addWarning(): self.window().statusBar().clearMessage() statusBar.addWidget(warningLabel, 1) statusBar.repaint() timer.start() def endWarning(): timer.stop() statusBar.removeWidget(warningLabel) statusBar.repaint() self.window().statusBar().showMessage('Ready', 2000) timer = QtCore.QTimer() timer.setInterval(2000) timer.timeout.connect(endWarning) addWarning()
def main(): options, args = argOpts() ks = KrakenSystem.getInstance() numConfigs = len(ks.registeredConfigs) if options.config: directory, file = os.path.split(options.config) filebase, ext = os.path.splitext(file) sys.path = [directory] + sys.path # prepend exec("import " + filebase) if len(ks.registeredConfigs) > numConfigs: configName = next(reversed(ks.registeredConfigs)) print("Using config %s from %s" % (configName, options.config)) ks.getConfigClass(configName).makeCurrent() else: print("Failed to use config in %s" % options.config) exit() guideRig = Rig() guideRig.loadRigDefinitionFile(args[0]) rig = Rig() rig.loadRigDefinition(guideRig.getRigBuildData()) builder = plugins.getBuilder() builder.setOutputFolder(args[1]) config = builder.getConfig() config.setMetaData('RigTitle', os.path.split(args[0])[1].partition('.')[0]) if options.constants: config.setMetaData('UseRigConstants', True) if options.numframes: config.setMetaData('ProfilingFrames', options.numframes) if options.logfile: config.setMetaData('ProfilingLogFile', options.logfile) if options.extensionname: config.setMetaData('RigTitle', options.extensionname) builder.build(rig)
def main(): os.environ['KRAKEN_DCC'] = 'KL' options, args = argOpts() ks = KrakenSystem.getInstance() numConfigs = len(ks.registeredConfigs) if options.config: directory, file = os.path.split(options.config) filebase, ext = os.path.splitext(file) sys.path = [directory] + sys.path # prepend exec("import " + filebase) if len(ks.registeredConfigs) > numConfigs: configName = next(reversed(ks.registeredConfigs)) print ("Using config %s from %s" % (configName, options.config)) ks.getConfigClass(configName).makeCurrent() else: print ("Failed to use config in %s" % options.config) exit() guideRig = Rig() guideRig.loadRigDefinitionFile(args[0]) rig = Rig() rig.loadRigDefinition(guideRig.getRigBuildData()) builder = plugins.getBuilder() builder.setOutputFolder(args[1]) config = builder.getConfig() config.setMetaData('RigTitle', os.path.split(args[0])[1].partition('.')[0]) if options.constants: config.setMetaData('UseRigConstants', True) if options.numframes: config.setMetaData('ProfilingFrames', options.numframes) if options.logfile: config.setMetaData('ProfilingLogFile', options.logfile) builder.build(rig)
def buildRig(self): try: self.window().statusBar().showMessage('Building Rig') self.synchGuideRig() rigBuildData = self.guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '')) builder = plugins.getBuilder() builder.build(rig) except Exception as e: print traceback.format_exc() statusBar = self.window().statusBar() warningLabel = QtGui.QLabel('Error Building: ' + ', '.join([x for x in e.args])) warningLabel.setMaximumWidth(200) warningLabel.setStyleSheet("QLabel { border-radius: 3px; background-color: #AA0000}") def addWarning(): self.window().statusBar().clearMessage() statusBar.addWidget(warningLabel, 1) statusBar.repaint() timer.start() def endWarning(): timer.stop() statusBar.removeWidget(warningLabel) statusBar.repaint() self.window().statusBar().showMessage('Ready', 2000) timer = QtCore.QTimer() timer.setInterval(2000) timer.timeout.connect(endWarning) addWarning()
def BuildKrakenGuide_Execute(rigFilePath): if rigFilePath == "" and si.Interactive is True: fileBrowser = XSIUIToolkit.FileBrowser fileBrowser.DialogTitle = "Select a Kraken Rig File" fileBrowser.InitialDirectory = si.ActiveProject3.Path fileBrowser.Filter = "Kraken Rig (*.krg)|*.krg||" fileBrowser.ShowOpen() fileName = fileBrowser.FilePathName if fileName != "": rigFilePath = fileName else: log("User Cancelled.", 4) return False elif rigFilePath == "" and si.Interactive is False: log("No rig file path specified in batch mode!", 2) return False guideRig = Rig() guideRig.loadRigDefinitionFile(rigFilePath) builtRig = None progressBar = None try: progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Guide: " + guideRig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(guideRig) finally: if progressBar is not None: progressBar.Visible = False return builtRig
def buildGuideRig(self): try: self.window().statusBar().showMessage('Building Guide') initConfigIndex = self.window().krakenMenu.configsWidget.currentIndex() builder = plugins.getBuilder() if self.guideRig.getName().endswith('_guide') is False: self.guideRig.setName(self.guideRig.getName() + '_guide') builder.build(self.guideRig) self.window().krakenMenu.setCurrentConfig(initConfigIndex) except Exception as e: # Add the callstak to the log callstack = traceback.format_exc() print callstack self.reportMessage('Error Building', level='error', exception=e)
def KrakenBuildBipedGuide_Execute(): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins from kraken_examples.biped.biped_guide_rig import BipedGuideRig builtRig = None result = si.XSIInputbox("Rig Name", "Kraken: Build Biped", "Biped") if result != "": guideName = result guideName.replace(' ', '') guideName += '_guide' progressBar = None try: guideRig = BipedGuideRig(guideName) progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Guide: " + guideRig.getName( ) progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(guideRig) finally: if progressBar is not None: progressBar.Visible = False else: log('Kraken: Build Guide Rig Cancelled!', 4) return False return builtRig
def KrakenBuildBipedGuide_Execute(): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins from kraken_examples.biped.biped_guide_rig import BipedGuideRig builtRig = None result = si.XSIInputbox("Rig Name", "Kraken: Build Biped", "Biped") if result != "": guideName = result guideName.replace(' ', '') guideName += '_guide' progressBar = None try: guideRig = BipedGuideRig(guideName) progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Guide: " + guideRig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(guideRig) finally: if progressBar is not None: progressBar.Visible = False else: log('Kraken: Build Guide Rig Cancelled!', 4) return False return builtRig
footRightGlobalSrtInput = footRightComponentGuide.getInputByName('globalSRT') footRightGlobalSrtInput.setConnection(mainSrtOffsetOutput) footRightIkHandleInput = footRightComponentGuide.getInputByName('ikHandle') footRightIkHandleInput.setConnection(legRightIkHandleOutput) footRightLegEndInput = footRightComponentGuide.getInputByName('legEnd') footRightLegEndInput.setConnection(legRightLegEndOutput) footRightLegEndFKInput = footRightComponentGuide.getInputByName('legEndFK') footRightLegEndFKInput.setConnection(legRightLegEndFKOutput) Profiler.getInstance().pop() if __name__ == "__main__": from kraken import plugins try: Profiler.getInstance().push('biped_guide_build') bipedGuide = BipedGuideRig('Biped_guide') builder = plugins.getBuilder() builder.build(bipedGuide) finally: Profiler.getInstance().pop() print Profiler.getInstance().generateReport()
def KrakenBuildBipedRig_Execute(bipedGuide): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins from kraken_examples.biped.biped_guide_rig import BipedGuideRig guideName = "Biped" if bipedGuide == None and si.Interactive is True: pickGuide = si.PickElement(constants.siModelFilter, "Kraken: Pick Guide Rig", "Kraken: Pick Guide Rig") if pickGuide('ButtonPressed') == 0: pass else: pickedGuide = pickGuide('PickedElement') if pickedGuide.Properties('krakenRig') is None: log( "Kraken: Picked object is not the top node of a Kraken Rig!", 4) return False guideName = pickedGuide.Name else: if bipedGuide.Properties('krakenRig') is None: log( "Kraken: 'bipedGuide' argument is not the top node of a Kraken Rig!", 4) return False guideName = bipedGuide.Name guideRig = BipedGuideRig(guideName) synchronizer = plugins.getSynchronizer() if guideRig.getName().endswith('_guide') is False: guideRig.setName(guideRig.getName() + '_guide') synchronizer.setTarget(guideRig) synchronizer.sync() rigBuildData = guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '_rig')) builtRig = None progressBar = None try: progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Rig: " + rig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(rig) finally: if progressBar is not None: progressBar.Visible = False return builtRig
def KrakenBuildBipedRig_Execute(bipedGuide): # Deffered importing: We can only import the kraken modules after the # plugin has loaded, as it configures the python import paths on load. from kraken.core.objects.rig import Rig from kraken import plugins from kraken_examples.biped.biped_guide_rig import BipedGuideRig guideName = "Biped" if bipedGuide == None and si.Interactive is True: pickGuide = si.PickElement(constants.siModelFilter, "Kraken: Pick Guide Rig", "Kraken: Pick Guide Rig") if pickGuide('ButtonPressed') == 0: pass else: pickedGuide = pickGuide('PickedElement') if pickedGuide.Properties('krakenRig') is None: log("Kraken: Picked object is not the top node of a Kraken Rig!", 4) return False guideName = pickedGuide.Name else: if bipedGuide.Properties('krakenRig') is None: log("Kraken: 'bipedGuide' argument is not the top node of a Kraken Rig!", 4) return False guideName = bipedGuide.Name guideRig = BipedGuideRig(guideName) synchronizer = plugins.getSynchronizer() if guideRig.getName().endswith('_guide') is False: guideRig.setName(guideRig.getName() + '_guide') synchronizer.setTarget(guideRig) synchronizer.sync() rigBuildData = guideRig.getRigBuildData() rig = Rig() rig.loadRigDefinition(rigBuildData) rig.setName(rig.getName().replace('_guide', '_rig')) builtRig = None progressBar = None try: progressBar = XSIUIToolkit.ProgressBar progressBar.Caption = "Building Kraken Rig: " + rig.getName() progressBar.CancelEnabled = False progressBar.Visible = True builder = plugins.getBuilder() builtRig = builder.build(rig) finally: if progressBar is not None: progressBar.Visible = False return builtRig