Example #1
0
    def runPythonImport(self,
                        modulePackage,
                        methodName=None,
                        className=None,
                        runInMaya=None,
                        **kwargs):
        """ Executes the specified import through Nimble in the specified run mode.

            modulePackage:  (String) An absolute (dot-syntax) formatted import to the module you
                            wish to be executed. This module will be imported by Maya and must be
                            on its sys.path.

            [methodName]:   (String) An optional function name to be executed within the module. If
                            a class name is specified this method will be called on an instance of
                            the specified class. If no class name is specified the method will be
                            called directly on the module.

            [className]:    (String) An optional class name of a class to import within the
                            specified module. The class will be imported from the module and
                            instantiated.

            [runInMaya]:    If True the import will be executed within Maya. If False the import
                            will be executed outside of Maya on the remote end of the Nimble
                            connection. The default value of None will use the current global
                            setting, which can be set by the nimble.enablePythonTestMode()
                            top-level function and defaults to runInMaya = True, i.e. test mode
                            is disabled.

            Returns a NimbleResponseData object with the results of the script execution. """

        payload = {
            'module': modulePackage,
            'method': methodName,
            'class': className,
            'kwargs': kwargs
        }

        if NimbleEnvironment.inMaya():
            return MayaRouter.runPythonImport(payload)

        if (not NimbleEnvironment.TEST_REMOTE_MODE
            ) if runInMaya is None else runInMaya:
            return self._send(
                NimbleData(kind=DataKindEnum.PYTHON_IMPORT, payload=payload))
        else:
            return MayaRouter.runPythonImport(payload)
Example #2
0
    def _send(self, nimbleData):
        """Doc..."""

        if NimbleEnvironment.inMaya():
            return MayaRouter.processRequest(nimbleData)

        result = self._sendRemote(nimbleData)
        time.sleep(0.0001)
        return result
Example #3
0
    def _send(self, nimbleData):
        """Doc..."""

        if NimbleEnvironment.inMaya():
            return MayaRouter.processRequest(nimbleData)

        result = self._sendRemote(nimbleData)
        time.sleep(0.0001)
        return result
Example #4
0
    def runPythonImport(self, modulePackage, methodName =None, className=None, runInMaya =None, **kwargs):
        """ Executes the specified import through Nimble in the specified run mode.

            modulePackage:  (String) An absolute (dot-syntax) formatted import to the module you
                            wish to be executed. This module will be imported by Maya and must be
                            on its sys.path.

            [methodName]:   (String) An optional function name to be executed within the module. If
                            a class name is specified this method will be called on an instance of
                            the specified class. If no class name is specified the method will be
                            called directly on the module.

            [className]:    (String) An optional class name of a class to import within the
                            specified module. The class will be imported from the module and
                            instantiated.

            [runInMaya]:    If True the import will be executed within Maya. If False the import
                            will be executed outside of Maya on the remote end of the Nimble
                            connection. The default value of None will use the current global
                            setting, which can be set by the nimble.enablePythonTestMode()
                            top-level function and defaults to runInMaya = True, i.e. test mode
                            is disabled.

            Returns a NimbleResponseData object with the results of the script execution. """

        payload = {
            'module':modulePackage,
            'method':methodName,
            'class':className,
            'kwargs':kwargs}

        if NimbleEnvironment.inMaya():
            return MayaRouter.runPythonImport(payload)

        if (not NimbleEnvironment.TEST_REMOTE_MODE) if runInMaya is None else runInMaya:
            return self._send(NimbleData(kind=DataKindEnum.PYTHON_IMPORT, payload=payload))
        else:
            return MayaRouter.runPythonImport(payload)