Ejemplo n.º 1
0
    def __init__(self):
        """Creates a new model for a character description, including the required UI."""

        app = wx.GetApp()
        glCanvas = app.getGLCanvas()

        self._container = glCanvas.addGLUITool(GLUtils.GLUIContainer)
        self._container.setVisible(False)

        self._optionsObservable = PyUtils.Observable()

        self._sizer = GLUtils.GLUIBoxSizer(GLUtils.GLUI_HORIZONTAL)
        self._container.setSizer(self._sizer)
        self.reset()

        self._toolSet = ToolSet(app.getToolPanel(), self)
    def __init__(self, nbEditors = 5):
        self._nbEditors = nbEditors
        
        app = wx.GetApp()
        app.addControllerObserver(self)
        
        app = wx.GetApp()
        glCanvas = app.getGLCanvas()
        
        self._container = glCanvas.addGLUITool( GLUtils.GLUIContainer )

        self._sizer = GLUtils.GLUIBoxSizer(GLUtils.GLUI_HORIZONTAL)
        self._container.setSizer(self._sizer)

        self._optionsObservable = PyUtils.Observable()

        self._create()

        self._toolSet = ToolSet(app.getToolPanel(), self)
Ejemplo n.º 3
0
    def __init__(self,
                 appTitle="Simbicon Application",
                 fps=30.0,
                 dt=1 / 2000.0,
                 glCanvasSize=wx.DefaultSize,
                 size=wx.DefaultSize,
                 redirect=False,
                 filename=None,
                 useBestVisual=False,
                 clearSigInt=True,
                 showConsole=True):
        """
        appTitle is the window title
        fps is the desired number of frames per seconds
        dt is the desired simulation timestep
        :see: wx.BasicApp.__init__`
        """

        wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)

        # No annoying error logging window
        wx.Log.SetActiveTarget(wx.LogStderr())

        import UI

        # Setup the main window style
        style = wx.DEFAULT_FRAME_STYLE
        if size == wx.DefaultSize:
            size = wx.GetDisplaySize()
            size.height *= 0.75
            size.width *= 0.75
            if glCanvasSize == wx.DefaultSize:
                style |= wx.MAXIMIZE

        # Setup the environment for the python interactive console
        consoleEnvironment = {"wx": wx, "Physics": Physics, "Utils": Utils}
        exec "from MathLib import *\n" + \
             "app = wx.GetApp()\n" + \
             "from PyUtils import load" in consoleEnvironment, consoleEnvironment

        # Create the main window
        self._frame = UI.MainWindow(None,
                                    -1,
                                    appTitle,
                                    size=size,
                                    style=style,
                                    fps=fps,
                                    glCanvasSize=glCanvasSize,
                                    showConsole=showConsole,
                                    consoleEnvironment=consoleEnvironment)

        # Define GL callbacks
        self._glCanvas = self._frame.getGLCanvas()
        self._glCanvas.addDrawCallback(self.draw)
        self._glCanvas.addPostDrawCallback(self.postDraw)
        self._glCanvas.addOncePerFrameCallback(self.advanceAnimation)
        self._glCanvas.setDrawAxes(False)
        self._glCanvas.setPrintLoad(True)
        self._glCanvas.setCameraTargetFunction(self.cameraTargetFunction)

        self._glCanvas.setDrawGround(False)

        # Get the tool panel
        self._toolPanel = self._frame.getToolPanel()

        # Show the application
        self._frame.Show()

        # Set-up starting state
        self._dt = dt
        self._drawShadows = True
        self._simulationSecondsPerSecond = 1  # 1 = real time, 2 = twice real time, 1/2 = half real time
        self._animationRunning = False
        self._cameraFollowCharacter = False
        self._drawCollisionVolumes = False
        self._followedCharacter = None  # Pointer to focused character
        self._captureScreenShots = False
        self._printStepReport = True
        self._screenShotNumber = 0
        self._worldOracle = Core.WorldOracle()
        self._worldOracle.initializeWorld(Physics.world())
        self._kinematicMotion = False

        # Set-up starting list of characters and controllers
        self._characters = []

        # Define the observables
        self._controllerList = ObservableList()
        self._characterObservable = PyUtils.Observable()
        self._animationObservable = PyUtils.Observable()
        self._cameraObservable = PyUtils.Observable()
        self._optionsObservable = PyUtils.Observable()

        self._COMObservable = PyUtils.Observable()

        self._curveList = ObservableList()
        self._snapshotTree = SnapshotBranch()

        self._showAbstractView = False
        self._showAbstractViewSkeleton = False
        self._showBodyFrame = False
        self._showCDPrimitives = False
        self._showColors = False
        self._showFrictionParticles = False
        self._showJoints = False
        self._showMesh = True
        self._showMinBDGSphere = False
        self._showCenterOfMass = True

        self._COMErrorScale = 0.01

        params = [
            3.75162180e-04, 1.70361201e+00, -7.30441228e-01, -6.22795336e-01,
            3.05330848e-01
        ]
        fps = 100

        # params = [0, 0, 0, 0, 0]

        # fps = 100.0
        # model_order = (50, 50)
        # params = [0.00019815056771797725, 1.9687785869242351, -0.9709165752219967, -0.565841931234043, 0.3226849680645409]

        self._armaX = ArmaProcess(params[0], params[1:3], params[3:5], fps)
        self._armaY = ArmaProcess(params[0], params[1:3], params[3:5], fps)
        self._armaZ = ArmaProcess(params[0], params[1:3], params[3:5], fps)
Ejemplo n.º 4
0
    def __init__(self,
                 appTitle="Simbicon Application",
                 fps=30.0,
                 dt=1 / 2000.0,
                 glCanvasSize=wx.DefaultSize,
                 size=wx.DefaultSize,
                 redirect=False,
                 filename=None,
                 useBestVisual=False,
                 clearSigInt=True,
                 showConsole=True):
        """
        appTitle is the window title
        fps is the desired number of frames per seconds
        dt is the desired simulation timestep
        :see: wx.BasicApp.__init__`
        """

        wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)

        # No annoying error logging window
        wx.Log.SetActiveTarget(wx.LogStderr())

        import UI

        # Setup the main window style
        style = wx.DEFAULT_FRAME_STYLE
        if size == wx.DefaultSize:
            size = wx.GetDisplaySize()
            size.height *= 0.75
            size.width *= 0.75
            if glCanvasSize == wx.DefaultSize:
                style |= wx.MAXIMIZE

        # Setup the environment for the python interactive console
        consoleEnvironment = {"wx": wx, "Physics": Physics, "Utils": Utils}
        exec "from MathLib import *\n" + \
             "app = wx.GetApp()\n" + \
             "from PyUtils import load" in consoleEnvironment, consoleEnvironment

        # Create the main window
        self._frame = UI.MainWindow(None,
                                    -1,
                                    appTitle,
                                    size=size,
                                    style=style,
                                    fps=fps,
                                    glCanvasSize=glCanvasSize,
                                    showConsole=showConsole,
                                    consoleEnvironment=consoleEnvironment)

        # Define GL callbacks
        self._glCanvas = self._frame.getGLCanvas()
        self._glCanvas.addDrawCallback(self.draw)
        self._glCanvas.addPostDrawCallback(self.postDraw)
        self._glCanvas.addOncePerFrameCallback(self.advanceAnimation)
        self._glCanvas.setDrawAxes(False)
        self._glCanvas.setPrintLoad(True)
        self._glCanvas.setCameraTargetFunction(self.cameraTargetFunction)

        # Get the tool panel
        self._toolPanel = self._frame.getToolPanel()

        # Show the application
        self._frame.Show()

        # Set-up starting state
        self._dt = dt
        self._drawShadows = True
        self._simulationSecondsPerSecond = 1  # 1 = real time, 2 = twice real time, 1/2 = half real time
        self._animationRunning = False
        self._cameraFollowCharacter = False
        self._drawCollisionVolumes = False
        self._followedCharacter = None  # Pointer to focused character
        self._captureScreenShots = False
        self._printStepReport = True
        self._screenShotNumber = 0
        self._worldOracle = Core.WorldOracle()
        self._worldOracle.initializeWorld(Physics.world())
        self._kinematicMotion = False

        # Set-up starting list of characters and controllers
        self._characters = []

        # Define the observables
        self._controllerList = ObservableList()
        self._characterObservable = PyUtils.Observable()
        self._animationObservable = PyUtils.Observable()
        self._cameraObservable = PyUtils.Observable()
        self._optionsObservable = PyUtils.Observable()
        self._curveList = ObservableList()
        self._snapshotTree = SnapshotBranch()