本文整理匯總了Python中PyUtils.wrapCopy方法的典型用法代碼示例。如果您正苦於以下問題:Python PyUtils.wrapCopy方法的具體用法?Python PyUtils.wrapCopy怎麽用?Python PyUtils.wrapCopy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyUtils
的用法示例。
在下文中一共展示了PyUtils.wrapCopy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create
# 需要導入模塊: import PyUtils [as 別名]
# 或者: from PyUtils import wrapCopy [as 別名]
def create(self):
"""Creates the instant character based on the available description. Attach a reasonable controller, if available."""
app = wx.GetApp()
try:
wrappedController = PyUtils.wrapCopy( app.getController(0) )
except IndexError:
wrappedController = None
try:
character = app.getCharacter(0)
previousMass = character.getMass()
except IndexError:
previousMass = None
app.deleteAllObjects()
PyUtils.load( "RigidBodies.FlatGround" )
character = self._characterDescription.createCharacter()
character.computeMass()
app.addCharacter(character)
if wrappedController is not None:
controller = wrappedController.createAndFillObject(None, character)
if previousMass is not None:
massRatio = character.getMass() / previousMass
controller.scaleGains( massRatio )
app.addController(controller)
controller.setStance( Core.LEFT_STANCE )
self.connectController()
return character
示例2: __init__
# 需要導入模塊: import PyUtils [as 別名]
# 或者: from PyUtils import wrapCopy [as 別名]
def __init__(self, parentBranch):
"""Takes a shot of a world, add it to the specified branch."""
super(Snapshot,self).__init__()
self._time = time.localtime()
# Save the world
world = Physics.world()
self._worldState = Utils.DynamicArrayDouble()
world.getState( self._worldState )
# Save the controllers
app = wx.GetApp()
self._controllers = []
for i in range(app.getControllerCount()):
controller = app.getController(i)
controllerState = Core.SimBiControllerState()
controller.getControllerState( controllerState )
self._controllers.append( (controllerState, PyUtils.wrapCopy( controller )) )
self._parentBranch = parentBranch
self._childBranches = []
self._activeIndex = -1