当前位置: 首页>>代码示例>>Python>>正文


Python PyUtils.wrapCopy方法代码示例

本文整理汇总了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
开发者ID:MontyThibault,项目名称:cartwheel-3d-Research-Modifications,代码行数:34,代码来源:Model.py

示例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                
开发者ID:MontyThibault,项目名称:cartwheel-3d-Research-Modifications,代码行数:25,代码来源:SnapshotTree.py


注:本文中的PyUtils.wrapCopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。