コード例 #1
0
def getConnection(inMaya =None, forceCreate =False):
    """ Retrieves a communication connection object from the connection pool, which is used for
        sending commands to the remote nimble server.

        :param inMaya | boolean
            Whether or not the server is being run in Maya. By default this is determined
            automatically by the Nimble environment settings. However, in some cases the
            determination can be incorrect if your external or Maya Python interpreters have been
            modified to fool the environment test. In such cases this may need to be explicitly
            set.

        :param forceCreate | boolean
            If True a new connection will be created even if one already exists and is available.
            This should rarely be used but can be useful in multi-threaded situations where sharing
            a single connection could be harmful.

        :return NimbleConnection
            A NimbleConnection instance opened and ready for issuing commands to the remote server.
    """

    NimbleEnvironment.inMaya(override=inMaya)
    return NimbleConnection.getConnection(forceCreate=forceCreate)
コード例 #2
0
def getConnection(inMaya=None, forceCreate=False):
    """ Retrieves a communication connection object from the connection pool, which is used for
        sending commands to the remote nimble server.

        :param inMaya | boolean
            Whether or not the server is being run in Maya. By default this is determined
            automatically by the Nimble environment settings. However, in some cases the
            determination can be incorrect if your external or Maya Python interpreters have been
            modified to fool the environment test. In such cases this may need to be explicitly
            set.

        :param forceCreate | boolean
            If True a new connection will be created even if one already exists and is available.
            This should rarely be used but can be useful in multi-threaded situations where sharing
            a single connection could be harmful.

        :return NimbleConnection
            A NimbleConnection instance opened and ready for issuing commands to the remote server.
    """

    NimbleEnvironment.inMaya(override=inMaya)
    return NimbleConnection.getConnection(forceCreate=forceCreate)
コード例 #3
0
 def sendCommandBatch(self):
     conn = NimbleConnection.getConnection()
     return conn.mayaBatch(self._batch)
コード例 #4
0
def _handleExit():
    NimbleConnection.closeConnectionPool()
    stopServer()
コード例 #5
0
 def getNimbleConnection(cls, inMaya =None, forceCreate =None):
     NimbleEnvironment.inMaya(override=inMaya)
     try:
         return NimbleConnection.getConnection(forceCreate=forceCreate)
     except Exception:
         raise
コード例 #6
0
 def getNimbleConnection(cls, inMaya =None, forceCreate =None):
     NimbleEnvironment.inMaya(override=inMaya)
     try:
         return NimbleConnection.getConnection(forceCreate=forceCreate)
     except Exception:
         raise
コード例 #7
0
def _handleExit():
    NimbleConnection.closeConnectionPool()
    stopServer()
コード例 #8
0
 def sendCommandBatch(self):
     conn = NimbleConnection.getConnection()
     return conn.mayaBatch(self._batch)
コード例 #9
0
from __future__ import print_function, absolute_import, unicode_literals, division

from nimble.connection.NimbleConnection import NimbleConnection

connection = None
try:
    from maya import cmds
except Exception:
    connection = NimbleConnection.getConnection()

# Create a sphere
sphereName, sphereShape = connection.maya(
    'sphere') if connection else cmds.sphere()

# Move the created sphere to x=10
connection.maya('move', 10, 0, 0, sphereName) if connection else cmds.move(
    10, 0, 0, sphereName)
コード例 #10
0
ファイル: scratch.py プロジェクト: sernst/Nimble
from __future__ import print_function, absolute_import, unicode_literals, division

from nimble.connection.NimbleConnection import NimbleConnection

connection = None
try:
    from maya import cmds
except Exception:
    connection = NimbleConnection.getConnection()

# Create a sphere
sphereName, sphereShape = connection.maya('sphere') if connection else cmds.sphere()

# Move the created sphere to x=10
connection.maya('move', 10, 0, 0, sphereName) if connection else cmds.move(10, 0, 0, sphereName)