Ejemplo n.º 1
0
 def get():
     if CommandMap.cmd_map:
         return CommandMap.cmd_map
     clone_cmd = commands.Clone('', '')
     CommandMap.cmd_map = {
         'filter': commands.Filter('', ''),
         'update': commands.Update('', ''),
         'increment': commands.Increment('', ''),
         'new_entry': commands.Insert('', ''),
         'del_entry': commands.Delete('', ''),
         'sort': commands.Sort('', ''),
         'next_browser': commands.NextBrowser('', ''),
         'prev_browser': commands.PreviousBrowser('', ''),
         'resize': commands.Resize('', ''),
         'edit': commands.Edit('', ''),
         'select': commands.Select('', ''),
         'ls': commands.ShowBuffers('', ''),
         'clone': clone_cmd,
         'clone!': clone_cmd,
         'bd': commands.RemoveTable('', ''),
         'b': commands.SwitchTable('', ''),
         'b#': commands.SwitchTable('', ''),
         'mksession': commands.SaveSession('', ''),
         'ldsession': commands.LoadSession('', ''),
         'paste': commands.Paste('', ''),
         'del_char': commands.SendSignal(signals.Signal.DELETE_CHAR, '',
                                         ''),
         'press_enter': commands.SendSignal(signals.Signal.PRESS_ENTER, '',
                                            ''),
     }
     return CommandMap.cmd_map
Ejemplo n.º 2
0
 def OnMouse1Up( self ):
     """
     Handle mouse button 1 up event. Stop the drag select operation if the
     marquee is running, otherwise stop the transform operation if a gizmo
     is being used.
     """
     if self.selection.marquee.IsRunning():
         cmds.Select( self.selection.StopDragSelect() )
     elif self.gizmoMgr.IsDragging() or self.gizmo:
         self.StopTransform()
Ejemplo n.º 3
0
 def FinishInit( self ):
     base.FinishInit()
     
     # Create project manager
     self.project = Project( self )
     base.project = self.project
     self.frame.SetProjectPath( self.frame.cfg.Read( 'projDirPath' ) )
     
     # Create grid
     self.SetupGrid()
     
     # Create frame rate meter
     self.frameRate = p3d.FrameRate()
     
     # Create shading mode keys
     dsp = p3d.DisplayShading()
     dsp.accept( '4', dsp.Wireframe )
     dsp.accept( '5', dsp.Shade )
     dsp.accept( '6', dsp.Texture )
     
     # Set up gizmos
     self.SetupGizmoManager()
     
     # Bind mouse events
     self.accept( 'mouse1', self.OnMouse1Down )
     self.accept( 'shift-mouse1', self.OnMouse1Down, [True] )
     self.accept( 'control-mouse1', self.OnMouse1Down )
     self.accept( 'mouse2', self.OnMouse2Down )
     self.accept( 'mouse1-up', self.OnMouse1Up )
     self.accept( 'mouse2-up', self.OnMouse2Up )
     
     # Create selection manager
     self.selection = Selection(
         camera=base.edCamera, 
         root2d=base.edRender2d, 
         win=base.win, 
         mouseWatcherNode=base.edMouseWatcherNode 
     )
     base.selection = self.selection
     
     # Create our managers.
     self.assetMgr = AssetManager()
     self.dDropMgr = DragDropManager()
     self.actnMgr = actions.Manager()
     
     # Bind events
     self.accept( 'z', self.Undo )
     self.accept( 'shift-z', self.Redo )
     self.accept( 'f', self.FrameSelection )
     self.accept( 'del', lambda fn: cmds.Remove( fn() ), [self.selection.Get] )
     self.accept( 'backspace', lambda fn: cmds.Remove( fn() ), [self.selection.Get] )
     self.accept( 'control-d', lambda fn: cmds.Duplicate( fn() ), [self.selection.Get] )
     self.accept( 'control-g', lambda fn: cmds.Group( fn() ), [self.selection.Get] )
     self.accept( 'control-s', self.frame.OnFileSave, [None] )
     self.accept( 'arrow_up', lambda fn: cmds.Select( fn() ), [self.selection.SelectParent] )
     self.accept( 'arrow_down', lambda fn: cmds.Select( fn() ), [self.selection.SelectChild] )
     self.accept( 'arrow_left', lambda fn: cmds.Select( fn() ), [self.selection.SelectPrev] )
     self.accept( 'arrow_right', lambda fn: cmds.Select( fn() ), [self.selection.SelectNext] )
     self.accept( 'projectFilesModified', self.OnProjectFilesModified )
     
     # Create a "game"
     self.game = editor.Base()
     self.game.OnInit()
     
     # Start with a new scene
     self.CreateScene()
     self.doc.OnRefresh()
     
     return True