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)
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)
def sendCommandBatch(self): conn = NimbleConnection.getConnection() return conn.mayaBatch(self._batch)
def getNimbleConnection(cls, inMaya =None, forceCreate =None): NimbleEnvironment.inMaya(override=inMaya) try: return NimbleConnection.getConnection(forceCreate=forceCreate) except Exception: raise
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)
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)