当前位置: 首页>>代码示例>>Python>>正文


Python kraken_system.KrakenSystem类代码示例

本文整理汇总了Python中kraken.core.kraken_system.KrakenSystem的典型用法代码示例。如果您正苦于以下问题:Python KrakenSystem类的具体用法?Python KrakenSystem怎么用?Python KrakenSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KrakenSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reloadAllComponents

    def reloadAllComponents(self):
        krakenUIWidget = self.window().krakenUI
        graphViewWidget = krakenUIWidget.graphViewWidget

        # Sync and Store Graph Data
        graphViewWidget.synchGuideRig()
        rigData = graphViewWidget.guideRig.getData()

        # Create New Rig And Reload All Components.
        graphViewWidget.newRigPreset()
        KrakenSystem.getInstance().reloadAllComponents()

        # Load Saved Data And Update Widget
        graphViewWidget.guideRig.loadRigDefinition(rigData)
        graphViewWidget.graphView.displayGraph(graphViewWidget.guideRig)
开发者ID:Leopardob,项目名称:Kraken,代码行数:15,代码来源:kraken_menu.py

示例2: _loadComponents

    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()
开发者ID:Leopardob,项目名称:Kraken,代码行数:27,代码来源:rig.py

示例3: loadRigDefinition

    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()
开发者ID:Leopardob,项目名称:Kraken,代码行数:30,代码来源:rig.py

示例4: __init__

    def __init__(self, parent):
        super(ContextualNodeList, self).__init__(parent)

        self.setFixedSize(250, 200)

        self.searchLineEdit = SearchLineEdit(self)
        self.searchLineEdit.setObjectName('contextNodeListSearchLine')
        # self.searchLineEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.searchLineEdit.setFocus()

        self.nodesList = NodeList(self)

        self.ks = KrakenSystem.getInstance()
        self.ks.loadComponentModules()

        self.componentClassNames = []
        for componentClassName in sorted(self.ks.getComponentClassNames()):
            cmpCls = self.ks.getComponentClass(componentClassName)
            if cmpCls.getComponentType() != 'Guide':
                continue

            self.componentClassNames.append(componentClassName)

        self.nodes = None
        self.showClosestNames()
        self.searchLineEdit.textEdited.connect(self.showClosestNames)
        self.nodesList.itemClicked.connect(self.createNode)

        self.setIndex(0)

        grid = QtGui.QGridLayout()
        grid.addWidget(self.searchLineEdit, 0, 0)
        grid.addWidget(self.nodesList, 1, 0)
        self.setLayout(grid)
开发者ID:Leopardob,项目名称:Kraken,代码行数:34,代码来源:contextual_node_list.py

示例5: __init__

    def __init__(self, parent):
        super(ComponentLibrary, self).__init__(parent)

        self.setMinimumWidth(175)

        self.searchLineEdit = QtGui.QLineEdit(parent)
        self.searchLineEdit.setObjectName('contextNodeListSearchLine')
        self.searchLineEdit.setFocusPolicy(QtCore.Qt.ClickFocus)

        self.nodesList = NodeList(self)

        self.ks = KrakenSystem.getInstance()
        self.ks.loadComponentModules()

        self.componentClassNames = []
        for componentClassName in sorted(self.ks.getComponentClassNames()):
            cmpCls = self.ks.getComponentClass(componentClassName)
            if cmpCls.getComponentType() != 'Guide':
                continue

            self.componentClassNames.append(componentClassName)

        self.nodes = None
        self.showClosestNames()
        self.searchLineEdit.textEdited.connect(self.showClosestNames)

        self.setIndex(0)

        grid = QtGui.QGridLayout()
        grid.addWidget(self.searchLineEdit, 0, 0)
        grid.addWidget(self.nodesList, 1, 0)
        self.setLayout(grid)
开发者ID:hoorayfor3d,项目名称:Kraken,代码行数:32,代码来源:component_library.py

示例6: loadRigDefinition

    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()
开发者ID:hoorayfor3d,项目名称:Kraken,代码行数:29,代码来源:rig.py

示例7: setCurrentConfig

    def setCurrentConfig(self, index=None):
        if index is None:
            index = self.configsWidget.currentIndex()
        else:
            self.configsWidget.setCurrentIndex(index)

        if index == 0:
            Config.makeCurrent()
        else:
            ks = KrakenSystem.getInstance()
            configs = ks.getConfigClassNames()
            configClass = ks.getConfigClass(configs[index-1])
            configClass.makeCurrent()
开发者ID:Leopardob,项目名称:Kraken,代码行数:13,代码来源:kraken_menu.py

示例8: generateData

    def generateData(self):
        """Generates a dictionary with a tree structure of the component paths.

        Returns:
            True if successful

        """

        self.ks = KrakenSystem.getInstance()
        isSuccessful = self.ks.loadComponentModules()

        componentClassNames = []
        for componentClassName in sorted(self.ks.getComponentClassNames()):
            cmpCls = self.ks.getComponentClass(componentClassName)
            if cmpCls.getComponentType() != 'Guide':
                continue

            componentClassNames.append(componentClassName)


        self._data  = {'subDirs': {}, 'components': {}}

        for classItem in componentClassNames:

            nameSplit = classItem.rsplit('.', 1)

            className = nameSplit[-1]
            path = nameSplit[0].split('.')
            path.pop(len(path) - 1)

            parent = None
            for i, part in enumerate(path):

                if i == 0:
                    if part not in self._data['subDirs'].keys():
                        self._data['subDirs'][part] = {'subDirs': {}, 'components': {}}

                    parent = self._data['subDirs'][part]

                    continue

                if part in parent['subDirs'].keys():
                        parent = parent['subDirs'][part]
                        continue

                parent['subDirs'][part] = {'subDirs': {}, 'components': {}}
                parent = parent['subDirs'][part]

            parent['components'][className] = classItem

        return isSuccessful
开发者ID:AbedSHP,项目名称:Kraken,代码行数:51,代码来源:component_library.py

示例9: showEvent

    def showEvent(self, event):

        krakenSystem = KrakenSystem.getInstance()
        krakenSystem.loadCoreClient()
        krakenSystem.loadExtension('Kraken')

        # Need to wait until window is shown before we update the statusBar with messages
        if hasattr(self, "error_loading_startup"):

            if self.error_loading_startup:
                logger.error('Error Loading Modules')
            else:
                logger.info('Success Loading Modules')

            delattr(self, "error_loading_startup")
开发者ID:AbedSHP,项目名称:Kraken,代码行数:15,代码来源:kraken_ui.py

示例10: dropEvent

    def dropEvent(self, event):
        textParts = event.mimeData().text().split(':')
        if textParts[0] == 'KrakenComponent':
            componentClassName = textParts[1]

            # Add a component to the rig placed at the given position.
            dropPosition = self.mapToScene(event.pos())

            # construct the node and add it to the graph.
            krakenSystem = KrakenSystem.getInstance()
            componentClass = krakenSystem.getComponentClass( componentClassName )
            component = componentClass(parent=self.getRig())
            component.setGraphPos(Vec2(dropPosition.x(), dropPosition.y()))
            self.addNode(KNode(self, component) )

            event.acceptProposedAction()
        else:
            super(GraphView, self).dropEvent(event)
开发者ID:hoorayfor3d,项目名称:Kraken,代码行数:18,代码来源:kgraph_view.py

示例11: main

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)
开发者ID:AbedSHP,项目名称:Kraken,代码行数:44,代码来源:presetGen.py

示例12:

        # Update number of deformers and outputs
        self.setNumDeformers(numDeformers)

        # Updating constraint to use the updated last output.
        self.tailEndOutputConstraint.setConstrainer(self.tailOutputs[-1], index=0)

        # ============
        # Set IO Xfos
        # ============

        # ====================
        # Evaluate Splice Ops
        # ====================
        # evaluate the spine op so that all the output transforms are updated.
        self.bezierTailKLOp.evaluate()

        # evaluate the constraint op so that all the joint transforms are updated.
        self.deformersToOutputsKLOp.evaluate()

        # evaluate the constraints to ensure the outputs are now in the correct location.
        self.tailBaseHandleInputConstraint.evaluate()
        self.tailBaseOutputConstraint.evaluate()
        self.tailEndOutputConstraint.evaluate()



from kraken.core.kraken_system import KrakenSystem
ks = KrakenSystem.getInstance()
ks.registerComponent(FabriceTailGuide)
ks.registerComponent(FabriceTailRig)
开发者ID:Leopardob,项目名称:Kraken,代码行数:30,代码来源:fabrice_tail.py

示例13: pasteSettings

    def pasteSettings(self, pos, mirrored=False, createConnectionsToExistingNodes=True):

        clipboardData = self.__class__._clipboardData

        krakenSystem = KrakenSystem.getInstance()
        delta = pos - clipboardData['copyPos']
        self.clearSelection()
        pastedComponents = {}
        nameMapping = {}

        for componentData in clipboardData['components']:
            componentClass = krakenSystem.getComponentClass(componentData['class'])
            component = componentClass(parent=self.__rig)
            decoratedName = componentData['name'] + component.getNameDecoration()
            nameMapping[decoratedName] = decoratedName
            if mirrored:
                config = Config.getInstance()
                mirrorMap = config.getNameTemplate()['mirrorMap']
                component.setLocation(mirrorMap[componentData['location']])
                nameMapping[decoratedName] = componentData['name'] + component.getNameDecoration()
                component.pasteData(componentData, setLocation=False)
            else:
                component.pasteData(componentData, setLocation=True)
            graphPos = component.getGraphPos()
            component.setGraphPos(Vec2(graphPos.x + delta.x(), graphPos.y + delta.y()))
            node = KNode(self, component)
            self.addNode(node)
            self.selectNode(node, False)

            # save a dict of the nodes using the orignal names
            pastedComponents[nameMapping[decoratedName]] = component


        for connectionData in clipboardData['connections']:
            sourceComponentDecoratedName, outputName = connectionData['source'].split('.')
            targetComponentDecoratedName, inputName = connectionData['target'].split('.')

            sourceComponent = None

            # The connection is either between nodes that were pasted, or from pasted nodes
            # to unpasted nodes. We first check that the source component is in the pasted group
            # else use the node in the graph.
            if sourceComponentDecoratedName in nameMapping:
                sourceComponent = pastedComponents[nameMapping[sourceComponentDecoratedName]]
            else:
                if not createConnectionsToExistingNodes:
                    continue

                # When we support copying/pasting between rigs, then we may not find the source
                # node in the target rig.
                if not self.hasNode(sourceComponentDecoratedName):
                    continue
                node = self.getNode(sourceComponentDecoratedName)
                sourceComponent = node.getComponent()

            targetComponentDecoratedName = nameMapping[targetComponentDecoratedName]
            targetComponent = pastedComponents[targetComponentDecoratedName]

            outputPort = sourceComponent.getOutputByName(outputName)
            inputPort = targetComponent.getInputByName(inputName)

            inputPort.setConnection(outputPort)
            self.connectPorts(
                srcNode=sourceComponent.getDecoratedName(), outputName=outputPort.getName(),
                tgtNode=targetComponent.getDecoratedName(), inputName=inputPort.getName()
            )
开发者ID:AbedSHP,项目名称:Kraken,代码行数:66,代码来源:kgraph_view.py

示例14: createLayout


#.........这里部分代码省略.........
        self.saveAsAction = self.fileMenu.addAction('&Save As...')
        self.saveAsAction.setShortcut('Ctrl+Shift+S')
        self.saveAsAction.setObjectName("saveAsAction")

        self.fileMenu.addSeparator()
        self.recentFilesMenu = self.fileMenu.addMenu('&Recent Files')

        self.fileMenu.addSeparator()

        self.closeAction = self.fileMenu.addAction('&Close')
        self.closeAction.setShortcut('Ctrl+W')
        self.closeAction.setObjectName("closeAction")

        # Edit Menu
        self.editMenu = self.menuBar.addMenu('&Edit')
        self.copyAction = self.editMenu.addAction('&Copy')
        self.copyAction.setShortcut('Ctrl+C')
        self.pasteAction = self.editMenu.addAction('&Paste')
        self.pasteAction.setShortcut('Ctrl+V')
        self.pasteConnectedAction = self.editMenu.addAction('Paste Connected')
        self.pasteConnectedAction.setShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.SHIFT + QtCore.Qt.Key_V))
        self.editMenu.addSeparator()
        self.pasteMirroredAction = self.editMenu.addAction('Paste Mirrored')
        self.pasteMirroredConnectedAction = self.editMenu.addAction('Paste Mirrored Connected')
        self.editMenu.addSeparator()
        self.editAddBackdropAction = self.editMenu.addAction('Add &Backdrop')
        self.editMenu.addSeparator()
        self.editRigNameAction = self.editMenu.addAction('&Rig Name')
        self.editRigNameAction.setObjectName("editRigNameAction")
        self.editMenu.addSeparator()
        self.editPreferencesAction = self.editMenu.addAction('&Preferences...')
        self.editPreferencesAction.setObjectName("editPreferencesAction")

        # Build Menu
        self.buildMenu = self.menuBar.addMenu('&Build')
        self.buildGuideAction = self.buildMenu.addAction('Build &Guide')
        self.buildGuideAction.setShortcut('Ctrl+G')
        self.buildGuideAction.setObjectName("buildGuideAction")

        self.buildRigAction = self.buildMenu.addAction('Build &Rig')
        self.buildRigAction.setShortcut('Ctrl+B')
        self.buildRigAction.setObjectName("buildRigAction")

        # Tools Menu
        self.toolsMenu = self.menuBar.addMenu('&Tools')
        self.reloadComponentsAction = self.toolsMenu.addAction('Reload Component Modules')

        # View Menu
        self.viewMenu = self.menuBar.addMenu('&View')
        self.compLibAction = self.viewMenu.addAction('Component &Library')
        self.compLibAction.setShortcut('Ctrl+Tab')
        self.snapToGridAction = self.viewMenu.addAction('&Snap To Grid')
        self.snapToGridAction.setCheckable(True)

        # Help Menu
        self.helpMenu = self.menuBar.addMenu('&Help')
        self.onlineHelpAction = self.helpMenu.addAction('Online &Help')
        self.onlineHelpAction.setShortcut('Ctrl+H')

        # Logo
        logoWidget = QtGui.QLabel()
        logoWidget.setObjectName('logoWidget')
        logoWidget.setMinimumHeight(20)
        logoWidget.setMinimumWidth(110)

        logoPixmap = QtGui.QPixmap(':/images/KrakenUI_Logo.png')
        logoWidget.setPixmap(logoPixmap)

        # Config Widget
        self.configsParent = QtGui.QFrame(self)
        self.configsParent.setObjectName('configParent')
        self.configsParent.setFrameStyle(QtGui.QFrame.NoFrame)
        self.configsParent.setMinimumWidth(160)

        self.configsLayout = QtGui.QVBoxLayout()
        self.configsLayout.setContentsMargins(0, 0, 0, 0)
        self.configsLayout.setSpacing(0)

        self.configsWidget = QtGui.QComboBox()
        self.configsWidget.setAutoFillBackground(True)
        self.configsWidget.setObjectName('configWidget')
        self.configsWidget.setMinimumWidth(160)
        self.configsWidget.addItem('Default Config')

        self.configsLayout.addWidget(self.configsWidget)
        self.configsParent.setLayout(self.configsLayout)

        configs = KrakenSystem.getInstance().getConfigClassNames()
        for config in configs:
            self.configsWidget.addItem(config.split('.')[-1])

        self.rigNameLabel = RigNameLabel('Rig Name:')

        # Add Widgets
        self.menuLayout.addWidget(logoWidget, 0)
        self.menuLayout.addWidget(self.menuBar, 3)
        self.menuLayout.addWidget(self.configsParent, 0)
        self.menuLayout.addWidget(self.rigNameLabel, 0)

        self.setLayout(self.menuLayout)
开发者ID:Leopardob,项目名称:Kraken,代码行数:101,代码来源:kraken_menu.py

示例15: showEvent

    def showEvent(self, event):

        krakenSystem = KrakenSystem.getInstance()
        krakenSystem.loadCoreClient()
        krakenSystem.loadExtension('Kraken')
开发者ID:Leopardob,项目名称:Kraken,代码行数:5,代码来源:kraken_ui.py


注:本文中的kraken.core.kraken_system.KrakenSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。