Exemple #1
0
    def BuildLayoutActions(self):
        """Add tools, set long help strings and bind toolbar events."""
        actns = [
            ActionItem('Editor',
                       os.path.join('data', 'images',
                                    'application-sidebar-list.png'),
                       self.OnLayout,
                       ID_LAYOUT_EDITOR,
                       kind=wx.ITEM_RADIO),
            ActionItem('Game',
                       os.path.join('data', 'images', 'layout-game.png'),
                       self.OnLayout,
                       ID_LAYOUT_GAME,
                       kind=wx.ITEM_RADIO),
            ActionItem('Both',
                       os.path.join('data', 'images', 'layout-both.png'),
                       self.OnLayout,
                       ID_LAYOUT_BOTH,
                       kind=wx.ITEM_RADIO)
        ]

        # Create layout toolbar
        self.tbLayout = CustomAuiToolBar(self, -1)
        self.tbLayout.SetToolBitmapSize(TBAR_ICON_SIZE)
        self.tbLayout.AddSpacer(
            0
        )  # Need to insert a null object here or the radio buttons don't seem to work (win7 at least).
        self.tbLayout.AppendActionItems(actns)
        self.tbLayout.ToggleTool(ID_LAYOUT_EDITOR, True)
        self.tbLayout.Realize()
Exemple #2
0
 def BuildPlaybackToolBar(self):
     """Build playback toolbar."""
     dirPath = os.path.join(os.path.split(__file__)[0], 'images')
     playbackActns = [
         ActionItem('Play', os.path.join(dirPath, 'play.png'), self.OnPlay,
                    ID_PLAY, 'Play'),
         ActionItem('Pause', os.path.join(dirPath, 'pause.png'),
                    self.OnPause, ID_PAUSE, 'Pause')
     ]
     self.tbPlay = CustomAuiToolBar(self.ui,
                                    -1,
                                    style=wx.aui.AUI_TB_DEFAULT_STYLE)
     self.tbPlay.SetToolBitmapSize(TBAR_ICON_SIZE)
     self.tbPlay.AppendActionItems(playbackActns)
Exemple #3
0
 def BuildFileActions( self ):
     """Add tools, set long help strings and bind toolbar events."""
     commonActns = [
         ActionItem( 'New', os.path.join( 'data', 'images', 'document.png' ), self.OnFileNew, ID_FILE_NEW ),
         ActionItem( 'Open', os.path.join( 'data', 'images', 'folder-horizontal-open.png' ), self.OnFileOpen, ID_FILE_OPEN ),
         ActionItem( 'Save', os.path.join( 'data', 'images', 'disk-black.png' ), self.OnFileSave, ID_FILE_SAVE ),
         ActionItem( 'Save As', os.path.join( 'data', 'images', 'disk-black-pencil.png' ), self.OnFileSaveAs, ID_FILE_SAVE_AS ),
     ]
     
     # Create file menu
     self.mFile = CustomMenu()
     self.mFile.AppendActionItems( commonActns, self )
     self.mFile.AppendSeparator()
     self.mFile.AppendActionItem( ActionItem( 'Import...', '', self.OnFileImport, ID_FILE_IMPORT ), self )
     
     # Create project actions as a submenu
     self.mProj = CustomMenu()
     actns = [
         ActionItem( 'New...', '', self.OnFileNewProject, ID_PROJ_NEW ),
         ActionItem( 'Set...', '', self.OnFileSetProject, ID_PROJ_SET ),
         ActionItem( 'Build...', '', self.OnFileBuildProject, ID_PROJ_BUILD )
     ]
     self.mProj.AppendActionItems( actns, self )
     self.mFile.AppendMenu( ID_FILE_PROJ, '&Project', self.mProj )
     
     # Create file toolbar
     self.tbFile = CustomAuiToolBar( self, -1, style=wx.aui.AUI_TB_DEFAULT_STYLE )
     self.tbFile.SetToolBitmapSize( TBAR_ICON_SIZE )
     self.tbFile.AppendActionItems( commonActns )
     self.tbFile.Realize()
Exemple #4
0
 def BuildWindowMenu( self ):
     """Build show / hide controls for panes."""
     self.mPnl = CustomMenu()
     
     self.mWind = CustomMenu()
     self.mWind.AppendMenu( ID_WIND_PANEL, '&Panel', self.mPnl )
     self.mWind.AppendActionItem( ActionItem( 'Preferences', '', self.OnShowPreferences, ID_WIND_PREFERENCES ), self )
Exemple #5
0
 def BuildXformActions( self ):
     """Add tools, set long help strings and bind toolbar events."""
     fn = self.OnXformSetActiveGizmo
     actns = [
         ActionItem( 'Select', os.path.join( 'data', 'images', 'select.png' ), fn, ID_XFORM_SEL, kind=wx.ITEM_RADIO ),
         ActionItem( 'Move', os.path.join( 'data', 'images', 'move.png' ), fn, ID_XFORM_POS, kind=wx.ITEM_RADIO ),
         ActionItem( 'Rotate', os.path.join( 'data', 'images', 'rotate.png' ), fn, ID_XFORM_ROT, kind=wx.ITEM_RADIO ),
         ActionItem( 'Scale', os.path.join( 'data', 'images', 'scale.png' ), fn, ID_XFORM_SCL, kind=wx.ITEM_RADIO ),
         ActionItem( 'World Transform', os.path.join( 'data', 'images', 'globe.png' ), fn, ID_XFORM_WORLD, kind=wx.ITEM_CHECK )
     ]
     
     # Create xform toolbar
     self.tbXform = CustomAuiToolBar( self, -1, style=wx.aui.AUI_TB_DEFAULT_STYLE )
     self.tbXform.SetToolBitmapSize( TBAR_ICON_SIZE )
     self.tbXform.AddSpacer( 0 )   # Need to insert a null object here or the radio buttons don't seem to work (win7 at least).
     self.tbXform.AppendActionItems( actns )
     self.tbXform.Realize()
Exemple #6
0
    def BuildEditActions(self):
        """Add tools, set long help strings and bind toolbar events."""
        commonActns = [
            ActionItem('Undo',
                       os.path.join('data', 'images', 'arrow-curve-flip.png'),
                       self.OnSingleCommand, ID_EDIT_UNDO),
            ActionItem('Redo', os.path.join('data', 'images',
                                            'arrow-curve.png'),
                       self.OnSingleCommand, ID_EDIT_REDO)
        ]

        grpActns = [
            ActionItem('Group', '', self.OnSingleCommand, ID_EDIT_GROUP),
            ActionItem('Ungroup', '', self.OnSingleCommand, ID_EDIT_UNGROUP)
        ]

        pntActns = [
            ActionItem('Parent', '', self.OnSingleCommand, ID_EDIT_PARENT),
            ActionItem('Unparent', '', self.OnSingleCommand, ID_EDIT_UNPARENT)
        ]

        # Create edit menu
        self.mEdit = CustomMenu()
        self.mEdit.AppendActionItems(commonActns, self)
        self.mEdit.AppendSeparator()
        self.mEdit.AppendActionItems(grpActns, self)
        #self.mEdit.AppendSeparator()
        #self.mEdit.AppendActionItems( pntActns, self )

        # Create edit toolbar
        self.tbEdit = CustomAuiToolBar(self, -1)
        self.tbEdit.SetToolBitmapSize(TBAR_ICON_SIZE)
        self.tbEdit.AppendActionItems(commonActns)
        self.tbEdit.Realize()
Exemple #7
0
 def BuildModifyActions( self ):
     """Add tools, set long help strings and bind toolbar events."""
     actns = [
         ActionItem( 'Engage Physics', os.path.join( 'data', 'images', 'point.png' ), self.OnEngagePhysics, ID_MODIFY_PHYSICS, kind=wx.ITEM_CHECK )
     ]
     
     # Create edit menu
     self.mModify = CustomMenu()
     self.mModify.AppendActionItems( actns, self )
     
     # Create edit toolbar
     self.tbModify = CustomAuiToolBar( self, -1, style=wx.aui.AUI_TB_DEFAULT_STYLE )
     self.tbModify.SetToolBitmapSize( TBAR_ICON_SIZE )
     self.tbModify.AppendActionItems( actns )
     self.tbModify.Realize()
Exemple #8
0
    def BuildViewMenu(self):
        """Build the view menu."""
        viewActns = [
            ActionItem('Grid',
                       '',
                       self.OnViewGrid,
                       ID_VIEW_GRID,
                       kind=wx.ITEM_CHECK)
        ]

        camActns = [
            ActionItem('Top',
                       '',
                       self.OnViewCamera,
                       ID_VIEW_TOP,
                       args=(0, -90)),
            ActionItem('Bottom',
                       '',
                       self.OnViewCamera,
                       ID_VIEW_BOTTOM,
                       args=(0, 90)),
            ActionItem('Left',
                       '',
                       self.OnViewCamera,
                       ID_VIEW_LEFT,
                       args=(-90, 0)),
            ActionItem('Right',
                       '',
                       self.OnViewCamera,
                       ID_VIEW_RIGHT,
                       args=(90, 0)),
            ActionItem('Front',
                       '',
                       self.OnViewCamera,
                       ID_VIEW_FRONT,
                       args=(0, 0)),
            ActionItem('Back',
                       '',
                       self.OnViewCamera,
                       ID_VIEW_BACK,
                       args=(-180, 0))
        ]
        self.mCameras = CustomMenu()
        self.mCameras.AppendActionItems(camActns, self)

        # Append to view menu
        self.mView = CustomMenu()
        self.mView.AppendActionItems(viewActns, self)
        self.mView.AppendSeparator()
        self.mView.AppendSubMenu(self.mCameras, '&Camera')
Exemple #9
0
    def BuildCreateMenu(self):
        """Build the create menu."""
        lightActns = [
            ActionItem('Ambient', '', self.OnCreate, args='AmbientLight'),
            ActionItem('Point', '', self.OnCreate, args='PointLight'),
            ActionItem('Directional',
                       '',
                       self.OnCreate,
                       args='DirectionalLight'),
            ActionItem('Spot', '', self.OnCreate, args='Spotlight')
        ]
        mLights = CustomMenu()
        mLights.AppendActionItems(lightActns, self)

        collActns = [
            ActionItem('Node', '', self.OnCreate, args='CollisionNode'),
            ActionItem('Box', '', self.OnCreate, args='CollisionBox'),
            ActionItem('Ray', '', self.OnCreate, args='CollisionRay'),
            ActionItem('Sphere', '', self.OnCreate, args='CollisionSphere'),
            ActionItem('Inverse Sphere',
                       '',
                       self.OnCreate,
                       args='CollisionInvSphere'),
            ActionItem('Tube', '', self.OnCreate, args='CollisionTube')
        ]
        mColl = CustomMenu()
        mColl.AppendActionItems(collActns, self)

        texActns = [
            ActionItem('Texture', '', self.OnCreate, args='Texture')  #,
            #ActionItem( 'Texture Stage', '', self.OnCreate, args='TextureStage' )
        ]
        mTex = CustomMenu()
        mTex.AppendActionItems(texActns, self)

        shaActns = [ActionItem('Shader', '', self.OnCreate, args='Shader')]
        mSha = CustomMenu()
        mSha.AppendActionItems(shaActns, self)

        bltActions = [
            ActionItem('World', '', self.OnCreate, args='BulletWorld'),
            ActionItem('Debug Node', '', self.OnCreate,
                       args='BulletDebugNode'),
            ActionItem('Rigid Body Node',
                       '',
                       self.OnCreate,
                       args='BulletRigidBodyNode'),
            ActionItem('Character Controller Node',
                       '',
                       self.OnCreate,
                       args='BulletCharacterControllerNode'),
            ActionItem('Box Shape', '', self.OnCreate, args='BulletBoxShape'),
            ActionItem('Plane Shape',
                       '',
                       self.OnCreate,
                       args='BulletPlaneShape'),
            ActionItem('Capsule Shape',
                       '',
                       self.OnCreate,
                       args='BulletCapsuleShape')
        ]
        mBlt = CustomMenu()
        mBlt.AppendActionItems(bltActions, self)

        self.mCreate = CustomMenu()
        self.mCreate.AppendActionItem(
            ActionItem('Panda Node', '', self.OnCreate, args='PandaNode'),
            self)
        self.mCreate.AppendActionItem(
            ActionItem('Actor', '', self.OnCreateActor), self)
        self.mCreate.AppendActionItem(
            ActionItem('Fog', '', self.OnCreate, args='Fog'), self)
        self.mCreate.AppendSubMenu(mColl, '&Collision')
        self.mCreate.AppendSubMenu(mLights, '&Lights')
        self.mCreate.AppendSubMenu(mTex, '&Texture')
        self.mCreate.AppendSubMenu(mSha, '&Shader')
        self.mCreate.AppendSubMenu(mBlt, '&Bullet')
        self.mCreate.AppendSeparator()
        self.mCreate.AppendActionItem(
            ActionItem('Prefab', '', self.OnCreatePrefab), self)