當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。