本文整理汇总了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