Beispiel #1
0
    def onStart(self):
        self.updateTimer = self.getMainWindow().startTimer(
            60, self.onUpdateTimer)
        self.updateTimer.stop()

        signals.connect('app.activate', self.onAppActivate)
        signals.connect('app.deactivate', self.onAppDeactivate)
Beispiel #2
0
    def onLoad(self):
        self.window = self.requestDockWindow('SceneToolBox',
                                             title='Tools',
                                             size=(120, 120),
                                             minSize=(120, 120),
                                             dock='bottom')
        ui = self.window.addWidgetFromFile(_getModulePath('SceneToolBox.ui'))
        self.window.setStayOnTop(True)
        self.window.show()
        self.window.setObjectName('SceneToolBox')

        self.treeCategory = SceneToolCategoryTreeWidget(
            multiple_selection=False, editable=False, drag_mode='internal')
        treeLayout = QtGui.QVBoxLayout(ui.containerTree)
        treeLayout.addWidget(self.treeCategory)
        treeLayout.setMargin(0)
        treeLayout.setSpacing(0)
        self.treeCategory.parentModule = self

        self.listTools = SceneToolListWidget()
        listLayout = QtGui.QVBoxLayout(ui.containerList)
        listLayout.addWidget(self.listTools)
        listLayout.setMargin(0)
        listLayout.setSpacing(0)
        self.listTools.parentModule = self
        self.listTools.setIconSize(QtCore.QSize(64, 64))
        # self.listTools.setGridSize( QtCore.QSize( 80, 6464 ) )

        self.currentCategory = None
        self.currentTool = None
        self.refreshingTools = False

        signals.connect('tool.change', self.onSceneToolChanged)
        signals.connect('tool_category.update', self.onSceneToolCategoryUpdate)
Beispiel #3
0
    def onLoad(self):
        self.mainToolBar = self.addToolBar(
            'component_preview',
            self.getMainWindow().requestToolBar('component_preview'))

        self.addTool('component_preview/toggle_component_preview',
                     label='Component Preview',
                     icon='component_preview',
                     type='check')

        self.addTool('component_preview/toggle_component_child_preview',
                     label='Preview Children',
                     icon='component_preview_children',
                     type='check')

        self.addTool('component_preview/toggle_component_preview_autostop',
                     label='Auto Stop',
                     icon='component_preview_autostop',
                     type='check')

        self.addTool('component_preview/component_preview_reset',
                     label='Reset',
                     icon='component_preview_reset')

        self.addTool('component_preview/component_preview_clear',
                     label='Clear',
                     icon='component_preview_clear')
        signals.connect('scene.open', self.onSceneOpen)
        signals.connect('selection.changed', self.onSceneSelectionChanged)
        self.previewEnabled = True
        self.preivewChildren = True
        self.autostop = True
Beispiel #4
0
    def onLoad(self):
        #UI
        self.windowTitle = 'Layers'
        self.window = self.requestDockWindow('LayerManager',
                                             title='Layers',
                                             size=(120, 120),
                                             minSize=(120, 120),
                                             dock='left')

        #Components
        self.treeFilter = self.window.addWidget(GenericTreeFilter(),
                                                expanding=False)
        self.tree = self.window.addWidget(
            LayerTreeWidget(self.window,
                            multiple_selection=False,
                            sorting=False,
                            editable=True,
                            drag_mode='internal'))
        self.tree.hasSoloLayer = False
        self.treeFilter.setTargetTree(self.tree)

        self.tool = self.addToolBar('layer_manager', self.window.addToolBar())
        self.delegate = MOAILuaDelegate(self)
        self.delegate.load(_getModulePath('LayerManager.lua'))

        self.addTool('layer_manager/add', label='add', icon='add')
        self.addTool('layer_manager/remove', label='remove', icon='remove')
        self.addTool('layer_manager/up', label='up', icon='arrow-up')
        self.addTool('layer_manager/down', label='down', icon='arrow-down')

        #SIGNALS
        signals.connect('moai.clean', self.onMoaiClean)
Beispiel #5
0
    def onLoad(self):
        self.AKUReady = False
        signals.tryConnect('console.exec', self.execConsole)

        #send asset sync signals
        signals.connect('asset.imported_all', self.onAssetImported)

        self.initContext()
        self.setWorkingDirectory(self.getProject().getPath())
        self.initGLContext()
Beispiel #6
0
    def __init__(self, owner=None, **option):
        self.scriptPath = None
        self.scriptEnv = None
        self.owner = owner
        self.name = option.get('name', None)

        self.extraSymbols = {}
        self.clearLua()
        signals.connect('moai.clean', self.clearLua)
        if option.get('autoReload', True):
            signals.connect('moai.reset', self.reload)
Beispiel #7
0
    def onLoad(self):
        #UI
        self.windowTitle = 'Devices'
        self.window = self.requestDockWindow('DeviceBrowser',
                                             title='Devices',
                                             size=(120, 120),
                                             minSize=(120, 120),
                                             dock='left')

        #Components
        self.tree = self.window.addWidget(
            DeviceTreeWidget(self.window,
                             multiple_selection=False,
                             sorting=True,
                             editable=False,
                             drag_mode=False))

        self.tree.module = self

        self.tool = self.addToolBar('device_browser', self.window.addToolBar())
        self.addTool('device_browser/clear_data', label='Clear Data')
        self.addTool('device_browser/debug', label='Debug')
        signals.connect('device.connected', self.onDeviceConnected)
        signals.connect('device.disconnected', self.onDeviceDisconnected)
        signals.connect('device.activated', self.onDeviceActivated)
        signals.connect('device.deactivated', self.onDeviceDeactivated)

        self.activeDevice = None
Beispiel #8
0
	def onLoad( self ):		
		#UI
		self.windowTitle = 'Devices'
		self.window = self.requestDockWindow( 'DeviceBrowser',
			title     = 'Devices',
			size      = (120,120),
			minSize   = (120,120),
			dock      = 'left'
			)

		#Components
		self.tree = self.window.addWidget( 
			DeviceTreeWidget(
				self.window,
				multiple_selection = False,
				sorting            = True,
				editable           = False,
				drag_mode          = False
				)
			)

		self.tree.module = self

		self.tool = self.addToolBar( 'device_browser', self.window.addToolBar() )
		self.addTool( 'device_browser/clear_data',    label = 'Clear Data' )
		self.addTool( 'device_browser/debug',    label = 'Debug' )
		signals.connect( 'device.connected', self.onDeviceConnected )
		signals.connect( 'device.disconnected', self.onDeviceDisconnected )
		signals.connect( 'device.activated', self.onDeviceActivated )
		signals.connect( 'device.deactivated', self.onDeviceDeactivated )

		self.activeDevice = None
Beispiel #9
0
	def onLoad(self):		
		self.observer=Observer()
		self.observer.start()
		
		signals.connect( 'file.moved',    self.onFileMoved )
		signals.connect( 'file.added',    self.onFileCreated )
		signals.connect( 'file.removed',  self.onFileDeleted )
		signals.connect( 'file.modified', self.onFileModified )
Beispiel #10
0
    def onLoad(self):
        self.observer = Observer()
        self.observer.start()

        signals.connect('file.moved', self.onFileMoved)
        signals.connect('file.added', self.onFileCreated)
        signals.connect('file.removed', self.onFileDeleted)
        signals.connect('file.modified', self.onFileModified)
Beispiel #11
0
    def onLoad(self):
        #UI
        self.window = self.requestDockWindow('GlobalObjectManager',
                                             title='Global Objects',
                                             size=(120, 120),
                                             minSize=(120, 120),
                                             dock='left')

        #Components
        self.treeFilter = self.window.addWidget(GenericTreeFilter(),
                                                expanding=False)
        self.tree = self.window.addWidget(
            GlobalObjectTreeWidget(multiple_selection=True,
                                   editable=True,
                                   drag_mode='internal'))
        self.treeFilter.setTargetTree(self.tree)

        self.tool = self.addToolBar('global_object_manager',
                                    self.window.addToolBar())
        self.delegate = MOAILuaDelegate(self)
        self.delegate.load(_getModulePath('GlobalObjectManager.lua'))

        # self.creatorMenu=self.addMenu(
        # 	'global_object_create',
        # 	{ 'label':'Create Global Object' }
        # 	)

        self.addTool('global_object_manager/add', label='Add', icon='add')
        self.addTool('global_object_manager/remove',
                     label='Remove',
                     icon='remove')
        self.addTool('global_object_manager/clone',
                     label='Clone',
                     icon='clone')
        self.addTool('global_object_manager/add_group',
                     label='Add Group',
                     icon='add_folder')
        self.addTool('global_object_manager/----')
        self.addTool('global_object_manager/refresh',
                     label='Refresh',
                     icon='refresh')

        # self.addMenuItem( 'main/find/find_global_object',
        # 	dict( label = 'Find In Global Objects', shortcut = 'ctrl+alt+f' ) )

        #SIGNALS
        signals.connect('moai.clean', self.onMoaiClean)

        signals.connect('global_object.added', self.onObjectAdded)
        signals.connect('global_object.removed', self.onObjectRemoved)
        signals.connect('global_object.renamed', self.onObjectRenamed)

        if self.getModule('introspector'):
            from . import GlobalObjectNodeEditor

        registerSearchEnumerator(globalObjectNameSearchEnumerator)
        registerSearchEnumerator(globalObjectSearchEnumerator)
Beispiel #12
0
	def onLoad( self ):
		self.window = self.requestDockWindow( 'SceneToolBox',
			title     = 'Tools',
			size      = (120,120),
			minSize   = (120,120),
			dock      = 'bottom'
		)
		ui = self.window.addWidgetFromFile(
			_getModulePath('SceneToolBox.ui')
		)
		self.window.setStayOnTop( True )
		self.window.show()
		self.window.setObjectName( 'SceneToolBox' )

		self.treeCategory = SceneToolCategoryTreeWidget( 
					multiple_selection = False,
					editable           = False,
					drag_mode          = 'internal'
				)
		treeLayout = QtGui.QVBoxLayout( ui.containerTree )
		treeLayout.addWidget( self.treeCategory )
		treeLayout.setMargin( 0 )
		treeLayout.setSpacing( 0 )
		self.treeCategory.parentModule = self

		self.listTools = SceneToolListWidget()
		listLayout = QtGui.QVBoxLayout( ui.containerList )
		listLayout.addWidget( self.listTools )
		listLayout.setMargin( 0 )
		listLayout.setSpacing( 0 )
		self.listTools.parentModule = self
		self.listTools.setIconSize( QtCore.QSize( 64, 64 ) )
		# self.listTools.setGridSize( QtCore.QSize( 80, 6464 ) )

		self.currentCategory = None
		self.currentTool     = None
		self.refreshingTools = False
		
		signals.connect( 'tool.change',  self.onSceneToolChanged )
		signals.connect( 'tool_category.update',  self.onSceneToolCategoryUpdate )
Beispiel #13
0
	def __init__(self, module):
		assert(module)
		self.module=module
		signals.connect('debug.enter', self.onDebugEnter)
		signals.connect('debug.exit', self.onDebugExit)
		signals.connect('debug.info', self.onDebugInfo)
		self.busy=False
Beispiel #14
0
 def __init__(self, module):
     assert (module)
     self.module = module
     signals.connect('debug.enter', self.onDebugEnter)
     signals.connect('debug.exit', self.onDebugExit)
     signals.connect('debug.info', self.onDebugInfo)
     self.busy = False
Beispiel #15
0
	def onLoad( self ):
		#UI
		self.window = self.requestDockWindow( 'GlobalObjectManager',
			title     = 'Global Objects',
			size      = (120,120),
			minSize   = (120,120),
			dock      = 'left'
			)

		#Components
		self.tree = self.window.addWidget( 
				GlobalObjectTreeWidget( 
					multiple_selection = True,
					editable           = True,
					drag_mode          = 'internal'
				)
			)

		self.tool = self.addToolBar( 'global_object_manager', self.window.addToolBar() )
		self.delegate = MOAILuaDelegate( self )
		self.delegate.load( _getModulePath( 'GlobalObjectManager.lua' ) )

		# self.creatorMenu=self.addMenu(
		# 	'global_object_create',
		# 	{ 'label':'Create Global Object' }
		# 	)

		self.addTool( 'global_object_manager/add',    label = 'Add', icon = 'add' )
		self.addTool( 'global_object_manager/remove', label = 'Remove', icon = 'remove' )
		self.addTool( 'global_object_manager/clone',  label = 'Clone', icon = 'clone' )
		self.addTool( 'global_object_manager/add_group',    label = 'Add Group', icon = 'add_folder' )
		self.addTool( 'global_object_manager/----' )
		self.addTool( 'global_object_manager/refresh',    label = 'Refresh', icon = 'refresh' )
		
		# self.addMenuItem( 'main/find/find_global_object', 
		# 	dict( label = 'Find In Global Objects', shortcut = 'ctrl+alt+f' ) )

		#SIGNALS
		signals.connect( 'moai.clean', self.onMoaiClean )

		signals.connect( 'global_object.added',   self.onObjectAdded )
		signals.connect( 'global_object.removed', self.onObjectRemoved )
		signals.connect( 'global_object.renamed', self.onObjectRenamed )

		if self.getModule('introspector'):
			import GlobalObjectNodeEditor

		registerSearchEnumerator( globalObjectNameSearchEnumerator )
		registerSearchEnumerator( globalObjectSearchEnumerator )
Beispiel #16
0
	def onLoad( self ):
		#UI
		self.windowTitle = 'Layers'
		self.window = self.requestDockWindow( 'LayerManager',
			title     = 'Layers',
			size      = (120,120),
			minSize   = (120,120),
			dock      = 'left'
			)

		#Components
		self.treeFilter = self.window.addWidget( GenericTreeFilter() )
		self.tree = self.window.addWidget( 
			LayerTreeWidget(
				self.window,
				multiple_selection = False,
				sorting            = False,
				editable           = True,
				drag_mode          = 'internal'
				)
			)
		self.tree.hasSoloLayer = False
		self.treeFilter.setTargetTree( self.tree )

		self.tool = self.addToolBar( 'layer_manager', self.window.addToolBar() )
		self.delegate = MOAILuaDelegate( self )
		self.delegate.load( _getModulePath( 'LayerManager.lua' ) )

		self.addTool( 'layer_manager/add',    label = 'add',  icon = 'add' )
		self.addTool( 'layer_manager/remove', label = 'remove', icon = 'remove' )
		self.addTool( 'layer_manager/up',     label = 'up', icon = 'arrow-up' )
		self.addTool( 'layer_manager/down',   label = 'down', icon = 'arrow-down' )

		
		#SIGNALS
		signals.connect( 'moai.clean', self.onMoaiClean )
Beispiel #17
0
    def onLoad(self):
        #UI
        self.window = self.requestDockWindow('CommandHistoryView',
                                             title='History',
                                             size=(100, 50),
                                             minSize=(50, 50),
                                             dock='left')

        #Components
        self.listHistory = self.window.addWidget(
            CommandHistoryListWidget(multiple_selection=False,
                                     editable=False,
                                     drag_mode=False))
        self.listHistory.parentModule = self

        signals.connect('command.new', self.onCommandNew)
        signals.connect('command.redo', self.onCommandRedo)
        signals.connect('command.undo', self.onCommandUndo)
Beispiel #18
0
	def onLoad( self ):
		#UI
		self.window = self.requestDockWindow( 'CommandHistoryView',
			title     = 'History',
			size      = (100,50),
			minSize   = (50,50),
			dock      = 'left'
			)

		#Components
		self.listHistory = self.window.addWidget( 
				CommandHistoryListWidget( 
					multiple_selection = False,
					editable           = False,
					drag_mode          = False
				)
			)
		self.listHistory.parentModule = self

		signals.connect( 'command.new',  self.onCommandNew )
		signals.connect( 'command.redo', self.onCommandRedo )
		signals.connect( 'command.undo', self.onCommandUndo )
Beispiel #19
0
	def onLoad( self ):
		signals.connect( 'app.start', self.postStart )
		return True
Beispiel #20
0
    def onLoad(self):
        self.window = self.requestDockWindow('GamePreview',
                                             title='Game Preview',
                                             dock=False,
                                             toolWindow=False)

        self.running = False
        self.paused = False

        self.updateTimer = None
        self.window.setFocusPolicy(Qt.StrongFocus)

        signals.connect('app.activate', self.onAppActivate)
        signals.connect('app.deactivate', self.onAppDeactivate)

        signals.connect('debug.enter', self.onDebugEnter)
        signals.connect('debug.exit', self.onDebugExit)
        signals.connect('debug.stop', self.onDebugStop)

        # signals.connect( 'game.pause',     self.onGamePause )
        # signals.connect( 'game.resume',    self.onGameResume )
        signals.connect('moai.reset', self.onMoaiReset)

        signals.connect('module.loaded', self.onModuleLoaded)

        self.menu = self.addMenu('main/preview', dict(label='Game'))

        self.menu.addChild(
            [
                {
                    'name': 'start_game',
                    'label': 'Resume Preview',
                    'shortcut': 'meta+]'
                },
                {
                    'name': 'pause_game',
                    'label': 'Pause Preview',
                    'shortcut': 'meta+shit+]'
                },
                {
                    'name': 'stop_game',
                    'label': 'Stop Preview',
                    'shortcut': 'meta+['
                },
                '----',
                {
                    'name': 'start_external_scene',
                    'label': 'Run Scene',
                    'shortcut': 'meta+alt+]'
                },
                {
                    'name': 'start_external_game',
                    'label': 'Run Game',
                    'shortcut': 'meta+alt+shift+]'
                },
                '----',
                {
                    'name': 'stay_on_top',
                    'label': 'Stay On Top',
                    'type': 'check',
                    'checked': self.getWorkspaceConfig('stay_on_top')
                },
                {
                    'name': 'pause_on_leave',
                    'label': 'Pause On Leave',
                    'type': 'check',
                    'checked': self.getWorkspaceConfig('pause_on_leave')
                },
                # '----',
                # {'name':'reset_moai',     'label':'RESET MOAI', 'shortcut':'Ctrl+Shift+R'}
            ],
            self)

        # label = QtWidgets.QLabel()
        # label.setMinimumSize( 300, 20 )
        # label.setMaximumSize( 300, 20 )
        # self.toolbar.addWidget( label )
        # self.labelScreen = label
        self.onMoaiReset()

        ##----------------------------------------------------------------##
        self.previewToolBar = self.addToolBar(
            'game_preview_tools',
            self.getMainWindow().requestToolBar('game_preview_tools'))

        # self.addTool(	'game_preview_tools/play',
        # 	widget = SceneToolButton( 'scene_view_selection',
        # 		icon = 'tools/selection',
        # 		label = 'Selection'
        # 		)
        # 	)

        # self.addTool(	'game_preview_tools/stop',
        # 	widget = SceneToolButton( 'scene_view_translation',
        # 		icon = 'tools/translation',
        # 		label = 'Translation'
        # 		)
        # 	)

        self.addTool(
            'game_preview_tools/run_external',
            label='Play External',
            icon='tools/run_external',
        )

        self.addTool(
            'game_preview_tools/run_game_external',
            label='Play Game External',
            icon='tools/run_game_external',
        )

        self.enableMenu('main/preview/pause_game', False)
        self.enableMenu('main/preview/stop_game', False)
Beispiel #21
0
    def onLoad(self):
        #UI
        self.windowTitle = 'Scenegraph'
        self.container = self.requestDockWindow('SceneGraphEditor',
                                                title='Scenegraph',
                                                size=(200, 200),
                                                minSize=(200, 200),
                                                dock='left')

        #Components
        self.treeFilter = self.container.addWidget(GenericTreeFilter(
            self.container),
                                                   expanding=False)
        self.tree = self.container.addWidget(
            SceneGraphTreeWidget(self.container,
                                 sorting=True,
                                 editable=True,
                                 multiple_selection=True,
                                 drag_mode='internal'))
        self.treeFilter.setTargetTree(self.tree)
        self.tree.module = self
        self.tool = self.addToolBar('scene_graph', self.container.addToolBar())
        self.delegate = MOAILuaDelegate(self)
        self.delegate.load(getModulePath('SceneGraphEditor.lua'))

        self.entityCreatorMenu = self.addMenu('main/scene/entity_create',
                                              {'label': 'Create Entity'})

        self.componentCreatorMenu = self.addMenu('main/scene/component_create',
                                                 {'label': 'Create Component'})

        #menu
        self.addMenuItem('main/file/open_scene',
                         dict(label='Open Scene', shortcut='ctrl+shift+o'))

        self.addMenuItem('main/file/close_scene',
                         dict(label='Close Scene', shortcut='Ctrl+W'))
        self.addMenuItem('main/scene/save_scene',
                         dict(label='Save', shortcut='Ctrl+S'))
        self.addMenuItem('main/scene/locate_scene_asset',
                         dict(label='Locate Scene Asset'))

        self.addMenu('main/scene/----')

        self.addMenu('component_context', dict(label='Selected Component'))
        self.addMenuItem('component_context/remove_component',
                         dict(label='Remove'))

        self.addMenuItem('component_context/----')

        self.addMenuItem('component_context/copy_component',
                         dict(label='Copy'))
        self.addMenuItem('component_context/paste_component',
                         dict(label='Paste Component Here'))
        self.addMenuItem('component_context/----')

        self.addMenuItem('component_context/move_component_up',
                         dict(label='Move Up'))

        self.addMenuItem('component_context/move_component_down',
                         dict(label='Move Down'))

        self.addMenuItem('component_context/----')
        self.addMenuItem('component_context/edit_component_alias',
                         dict(label='Edit Alias'))

        self.addMenu('main/entity', dict(label='Entity'))
        self.addMenuItem('main/entity/add_empty_entity',
                         dict(label='Create Empty', shortcut='ctrl+alt+N'))
        self.addMenuItem('main/entity/add_entity',
                         dict(label='Create', shortcut='ctrl+shift+N'))
        self.addMenuItem('main/entity/----')
        self.addMenuItem('main/entity/group_entity',
                         dict(label='Group Entites', shortcut='ctrl+G'))
        self.addMenuItem(
            'main/entity/create_group',
            dict(label='Create Empty Group', shortcut='ctrl+shift+G'))
        self.addMenuItem('main/entity/----')
        self.addMenuItem(
            'main/entity/load_prefab',
            dict(label='Load Prefab', shortcut='ctrl+alt+shift+N'))
        self.addMenuItem(
            'main/entity/load_prefab_in_container',
            dict(label='Load Prefab In Container', shortcut='ctrl+shift+='))
        self.addMenuItem('main/entity/----')
        self.addMenuItem('main/entity/remove_entity', dict(label='Remove'))
        self.addMenuItem('main/entity/clone_entity',
                         dict(label='Clone', shortcut='ctrl+d'))
        self.addMenuItem('main/entity/----')
        self.addMenuItem('main/entity/add_component',
                         dict(label='Add Component', shortcut='ctrl+alt+='))
        self.addMenuItem('main/entity/assign_layer',
                         dict(label='Assign Layer', shortcut='ctrl+alt+L'))
        self.addMenuItem('main/entity/toggle_visibility',
                         dict(label='Toggle Visibility', shortcut='ctrl+/'))
        self.addMenuItem('main/entity/freeze_entity_pivot',
                         dict(label='Freeze Pivot'))

        self.addMenuItem('main/entity/----')
        self.addMenuItem('main/find/find_entity',
                         dict(label='Find In Scene', shortcut='ctrl+f'))
        self.addMenuItem('main/find/find_entity_in_group',
                         dict(label='Find In Group', shortcut='ctrl+shift+f'))
        self.addMenuItem('main/find/find_entity_group',
                         dict(label='Find Group', shortcut='ctrl+alt+f'))

        #Toolbars
        self.addTool('scene_graph/select_scene',
                     label='Select Scene',
                     icon='settings')
        self.addTool('scene_graph/----')
        self.addTool('scene_graph/create_group',
                     label='+ Group',
                     icon='add_folder')
        self.addTool('scene_graph/----')
        self.addTool('scene_graph/make_proto',
                     label='Convert To Proto',
                     icon='proto_make')
        self.addTool('scene_graph/create_proto_instance',
                     label='Create Proto Instance',
                     icon='proto_instantiate')
        self.addTool('scene_graph/create_proto_container',
                     label='Create Proto Container',
                     icon='proto_container')
        self.addTool('scene_graph/----')
        self.addTool('scene_graph/fold_all', label='F')
        self.addTool('scene_graph/unfold_all', label='U')
        self.addTool('scene_graph/refresh_tree', label='R')
        # self.addTool( 'scene_graph/load_prefab', label = '+ P' )
        # self.addTool( 'scene_graph/save_prefab', label = '>>P' )

        self.addTool('scene/refresh', label='refresh', icon='refresh')

        #SIGNALS
        signals.connect('moai.clean', self.onMoaiClean)

        signals.connect('scene.clear', self.onSceneClear)
        signals.connect('scene.change', self.onSceneChange)

        signals.connect('selection.changed', self.onSelectionChanged)
        signals.connect('selection.hint', self.onSelectionHint)

        signals.connect('preview.start', self.onPreviewStart)
        signals.connect('preview.stop', self.onPreviewStop)

        # signals.connect( 'animator.start',     self.onAnimatorStart     )
        # signals.connect( 'animator.stop' ,     self.onAnimatorStop      )

        signals.connect('entity.added', self.onEntityAdded)
        signals.connect('entity.removed', self.onEntityRemoved)
        signals.connect('entity.renamed', self.onEntityRenamed)
        signals.connect('entity.modified', self.onEntityModified)
        signals.connect('entity.visible_changed', self.onEntityVisibleChanged)
        signals.connect('entity.pickable_changed',
                        self.onEntityPickableChanged)

        signals.connect('prefab.unlink', self.onPrefabUnlink)
        signals.connect('prefab.relink', self.onPrefabRelink)
        signals.connect('proto.unlink', self.onPrefabUnlink)
        signals.connect('proto.relink', self.onPrefabRelink)

        signals.connect('app.ready', self.postAppReady)

        signals.connect('component.added', self.onComponentAdded)
        signals.connect('component.removed', self.onComponentRemoved)

        signals.connect('project.presave', self.preProjectSave)

        registerSearchEnumerator(sceneObjectSearchEnumerator)
        registerSearchEnumerator(entityNameSearchEnumerator)
        registerSearchEnumerator(componentNameSearchEnumerator)
        registerSearchEnumerator(layerNameSearchEnumerator)
Beispiel #22
0
	def onLoad(self):
		self.window = self.requestDockWindow(
			'GamePreview',
			title = 'Game Preview',
			dock  = 'right'
			)

		self.canvas = self.window.addWidget(
				GamePreviewCanvas( self.window )
			)
		self.canvas.startRefreshTimer( self.nonActiveFPS )
		self.paused = None
		
		tool = self.window.addWidget( QtGui.QToolBar( self.window ), expanding = False )
		self.qtool = tool
		self.toolbar = self.addToolBar( 'game_preview', tool )

		self.canvas.module = self

		self.updateTimer = None
		self.window.setFocusPolicy(Qt.StrongFocus)
		
		signals.connect( 'app.activate',   self.onAppActivate )
		signals.connect( 'app.deactivate', self.onAppDeactivate )
		
		signals.connect( 'debug.enter',    self.onDebugEnter )
		signals.connect( 'debug.exit',     self.onDebugExit )
		signals.connect( 'debug.stop',     self.onDebugStop )
		
		# signals.connect( 'game.pause',     self.onGamePause )
		# signals.connect( 'game.resume',    self.onGameResume )
		signals.connect( 'moai.reset',     self.onMoaiReset )
		
		self.menu = self.addMenu( 'main/preview', dict( label = 'Game' ) )

		self.menu.addChild([
				{'name':'start_game',  'label':'Resume Preview', 'shortcut':'meta+]' },
				{'name':'pause_game',  'label':'Pause Preview',  'shortcut':'meta+shit+]' },
				{'name':'stop_game',   'label':'Stop Preview',   'shortcut':'meta+[' },
				'----',
				{'name':'start_external_scene',  'label':'Run Scene',  'shortcut':'meta+alt+]' },
				{'name':'start_external_game',   'label':'Run Game',  'shortcut':'meta+alt+shift+]' },
				'----',
				{'name':'pause_on_leave', 'label':'Pause On Leave', 'type':'check', 'checked':self.getConfig('pause_on_leave')},
				# '----',
				# {'name':'reset_moai',     'label':'RESET MOAI', 'shortcut':'Ctrl+Shift+R'}
			], self)

		# label = QtGui.QLabel()
		# label.setMinimumSize( 300, 20 )
		# label.setMaximumSize( 300, 20 )
		# self.toolbar.addWidget( label )
		# self.labelScreen = label
		# self.addTool( 'game_preview/----' )
		# self.addTool( 'game_preview/toggle_stay_top', label = 'Stay Top', type = 'check' )
		self.addTool( 'game_preview/switch_screen_profile', label = 'Screen Profile' )
		self.onMoaiReset()

		##----------------------------------------------------------------##
		self.previewToolBar = self.addToolBar( 'game_preview_tools', 
			self.getMainWindow().requestToolBar( 'view_tools' )
			)

		# self.addTool(	'game_preview_tools/play',
		# 	widget = SceneToolButton( 'scene_view_selection',
		# 		icon = 'tools/selection',
		# 		label = 'Selection'
		# 		)
		# 	)

		# self.addTool(	'game_preview_tools/stop',
		# 	widget = SceneToolButton( 'scene_view_translation',
		# 		icon = 'tools/translation',
		# 		label = 'Translation'
		# 		)
		# 	)

		self.addTool(	'game_preview_tools/run_external',
			label = 'Play External',
			icon = 'tools/run_external',
			)

		self.addTool(	'game_preview_tools/run_game_external',
			label = 'Play Game External',
			icon = 'tools/run_game_external',
			)

		self.enableMenu( 'main/preview/pause_game',  False )
		self.enableMenu( 'main/preview/stop_game',   False )
Beispiel #23
0
	def onLoad( self ):
		#UI
		self.windowTitle = 'Scenegraph'
		self.container = self.requestDockWindow( 'SceneGraphEditor',
			title     = 'Scenegraph',
			size      = (200,200),
			minSize   = (200,200),
			dock      = 'left'
			)

		#Components
		self.treeFilter = self.container.addWidget(
			GenericTreeFilter(
				self.container
			),
			expanding = False
		)
		self.tree = self.container.addWidget( 
				SceneGraphTreeWidget( 
					self.container,
					sorting  = True,
					editable = True,
					multiple_selection = True,
					drag_mode = 'internal'
				)
			)
		self.treeFilter.setTargetTree( self.tree )
		self.tree.module = self
		self.tool = self.addToolBar( 'scene_graph', self.container.addToolBar() )
		self.delegate = MOAILuaDelegate( self )
		self.delegate.load( getModulePath( 'SceneGraphEditor.lua' ) )

		self.entityCreatorMenu=self.addMenu(
			'main/scene/entity_create',
			{ 'label':'Create Entity' }
			)

		self.componentCreatorMenu=self.addMenu(
			'main/scene/component_create',
			{ 'label':'Create Component' }
			)


		#menu
		self.addMenuItem(
			'main/file/open_scene', 
			dict( label = 'Open Scene', shortcut = 'ctrl+shift+o' )
			)

		self.addMenuItem( 'main/file/close_scene', 
			dict( label = 'Close Scene', shortcut = 'Ctrl+W' )
			)
		self.addMenuItem( 'main/scene/save_scene',
			dict( label = 'Save', shortcut = 'Ctrl+S' )
			)
		self.addMenuItem( 'main/scene/locate_scene_asset',
			dict( label = 'Locate Scene Asset' )
			)

		self.addMenu( 'main/scene/----' )
		
		self.addMenu( 'component_context', dict( label = 'Selected Component' ) )
		self.addMenuItem( 'component_context/remove_component', 
			dict( label = 'Remove' )
			)

		self.addMenuItem( 'component_context/----' )
		
		self.addMenuItem( 'component_context/copy_component', 
			dict( label = 'Copy' )
			)
		self.addMenuItem( 'component_context/paste_component', 
			dict( label = 'Paste Component Here' )
			)
		self.addMenuItem( 'component_context/----' )
		
		self.addMenuItem( 'component_context/move_component_up', 
			dict( label = 'Move Up' )
			)

		self.addMenuItem( 'component_context/move_component_down', 
			dict( label = 'Move Down' )
			)
		

		self.addMenu( 'main/entity', dict( label = 'Entity' ) )
		self.addMenuItem( 'main/entity/add_empty_entity',    dict( label = 'Create Empty', shortcut = 'ctrl+alt+N' ) )
		self.addMenuItem( 'main/entity/add_entity',          dict( label = 'Create',       shortcut = 'ctrl+shift+N' ) )
		self.addMenuItem( 'main/entity/----' )
		self.addMenuItem( 'main/entity/group_entity',        dict( label = 'Group Entites',    shortcut = 'ctrl+G' ) )
		self.addMenuItem( 'main/entity/create_group',        dict( label = 'Create Empty Group',    shortcut = 'ctrl+shift+G' ) )
		self.addMenuItem( 'main/entity/----' )
		self.addMenuItem( 'main/entity/load_prefab',         dict( label = 'Load Prefab', shortcut = 'ctrl+alt+shift+N' ) )
		self.addMenuItem( 'main/entity/load_prefab_in_container', dict( label = 'Load Prefab In Container', shortcut = 'ctrl+shift+=' ) )
		self.addMenuItem( 'main/entity/----' )
		self.addMenuItem( 'main/entity/remove_entity',       dict( label = 'Remove'  ) )
		self.addMenuItem( 'main/entity/clone_entity',        dict( label = 'Clone',  shortcut = 'ctrl+d' ) )
		self.addMenuItem( 'main/entity/----' )
		self.addMenuItem( 'main/entity/add_component',       dict( label = 'Add Component', shortcut = 'ctrl+alt+=' ) )
		self.addMenuItem( 'main/entity/assign_layer',        dict( label = 'Assign Layer', shortcut = 'ctrl+alt+L' ) )
		self.addMenuItem( 'main/entity/toggle_visibility',   dict( label = 'Toggle Visibility', shortcut = 'ctrl+/' ) )
		self.addMenuItem( 'main/entity/freeze_entity_pivot', dict( label = 'Freeze Pivot' ) )

		self.addMenuItem( 'main/entity/----' )
		self.addMenuItem( 'main/find/find_entity', dict( label = 'Find In Scene', shortcut = 'ctrl+f' ) )
		self.addMenuItem( 'main/find/find_entity_in_group', dict( label = 'Find In Group', shortcut = 'ctrl+shift+f' ) )
		self.addMenuItem( 'main/find/find_entity_group', dict( label = 'Find Group', shortcut = 'ctrl+alt+f' ) )

		#Toolbars
		self.addTool( 'scene_graph/select_scene',    label ='Select Scene', icon = 'settings' )
		self.addTool( 'scene_graph/----'  )
		self.addTool( 'scene_graph/create_group',    label ='+ Group', icon = 'add_folder' )
		self.addTool( 'scene_graph/----'  )
		self.addTool( 'scene_graph/make_proto',    label = 'Convert To Proto', icon = 'proto_make' )
		self.addTool( 'scene_graph/create_proto_instance',    label = 'Create Proto Instance', icon = 'proto_instantiate' )
		self.addTool( 'scene_graph/create_proto_container',    label = 'Create Proto Container', icon = 'proto_container' )
		self.addTool( 'scene_graph/----'  )
		self.addTool( 'scene_graph/fold_all',    label = 'F' )
		self.addTool( 'scene_graph/unfold_all',  label = 'U' )
		self.addTool( 'scene_graph/refresh_tree',  label = 'R' )
		# self.addTool( 'scene_graph/load_prefab', label = '+ P' )
		# self.addTool( 'scene_graph/save_prefab', label = '>>P' )

		self.addTool( 'scene/refresh', label = 'refresh', icon='refresh' )

		#SIGNALS
		signals.connect( 'moai.clean',        self.onMoaiClean        )

		signals.connect( 'scene.clear',       self.onSceneClear      )
		signals.connect( 'scene.change',      self.onSceneChange     )

		signals.connect( 'selection.changed', self.onSelectionChanged )
		signals.connect( 'selection.hint',    self.onSelectionHint    )

		signals.connect( 'preview.start',     self.onPreviewStart     )
		signals.connect( 'preview.stop' ,     self.onPreviewStop      )

		# signals.connect( 'animator.start',     self.onAnimatorStart     )
		# signals.connect( 'animator.stop' ,     self.onAnimatorStop      )

		signals.connect( 'entity.added',      self.onEntityAdded      )
		signals.connect( 'entity.removed',    self.onEntityRemoved    )
		signals.connect( 'entity.renamed',    self.onEntityRenamed    )
		signals.connect( 'entity.modified',    self.onEntityModified    )
		signals.connect( 'entity.visible_changed',    self.onEntityVisibleChanged )
		signals.connect( 'entity.pickable_changed',   self.onEntityPickableChanged )


		signals.connect( 'prefab.unlink',     self.onPrefabUnlink    )
		signals.connect( 'prefab.relink',     self.onPrefabRelink    )
		signals.connect( 'proto.unlink',      self.onPrefabUnlink    )
		signals.connect( 'proto.relink',      self.onPrefabRelink    )

		signals.connect( 'app.ready', self.postAppReady )


		signals.connect( 'component.added',   self.onComponentAdded   )
		signals.connect( 'component.removed', self.onComponentRemoved )

		signals.connect( 'project.presave',   self.preProjectSave )

		registerSearchEnumerator( sceneObjectSearchEnumerator )
		registerSearchEnumerator( entityNameSearchEnumerator )
		registerSearchEnumerator( componentNameSearchEnumerator )
		registerSearchEnumerator( layerNameSearchEnumerator )
Beispiel #24
0
	def onLoad( self ):
		signals.connect( 'app.start', self.postStart )
		return True
Beispiel #25
0
##----------------------------------------------------------------##
class CodeBoxFieldEditor( LongTextFieldEditor ):	
	def startEdit( self ):
		editor = getCodeBoxEditorWidget()
		pos        = QtGui.QCursor.pos()
		editor.move( pos )
		restrainWidgetToScreen( editor )
		editor.startEdit( self, self.text )
		editor.show()
		editor.raise_()
		editor.setFocus()

##----------------------------------------------------------------##
class CodeBoxFieldEditorFactory( FieldEditorFactory ):
	def getPriority( self ):
		return 10

	def build( self, parentEditor, field, context = None ):
		dataType  = field._type
		if dataType != str: return None
		widget = field.getOption( 'widget', None )
		if widget == 'codebox':
			editor = CodeBoxFieldEditor( parentEditor, field )
			return editor
		return None

signals.connect( 'app.pre_start', getCodeBoxEditorWidget )

registerFieldEditorFactory( CodeBoxFieldEditorFactory() )
Beispiel #26
0
	def onLoad( self ):
		self.configPath = self.getProject().getConfigPath( _DEPLOY_CONFIG_FILE )
		#UI
		self.container = self.requestDocumentWindow( 'DeployManager',
			title     = 'Deployment Manager',
			allowDock = False,
			minSize   = ( 300, 300 ),
			maxSize   = ( 300, 300 )
			)

		#Components
		self.window = self.container.addWidgetFromFile( _getModulePath('DeployManager.ui') )

		self.delegate = MOAILuaDelegate( self )
		self.delegate.load( _getModulePath( 'DeployManager.lua' ) )

		#scene tree
		layout = QtGui.QVBoxLayout()
		self.window.containerSceneTree.setLayout( layout )
		layout.setSpacing( 0 )
		layout.setMargin( 0 )

		self.treeScene = DeploySceneTree( 
			self.window.containerSceneTree,
			editable = True,
			sorting  = False,
			multiple_selection = False
			)
		self.treeScene.manager = self
		layout.addWidget( self.treeScene )

		sceneToolbar = QtGui.QToolBar( self.window.containerSceneTree )
		layout.addWidget( sceneToolbar )
		self.sceneTool = self.addToolBar( 'deploy_scene', sceneToolbar )
		self.addTool( 'deploy_scene/add_scene',         label = 'add'     ,icon = 'add'    )
		self.addTool( 'deploy_scene/remove_scene',      label = 'remove'  ,icon = 'remove' )
		self.addTool( 'deploy_scene/move_up_scene',     label = 'up'      ,icon = 'arrow-up'     )
		self.addTool( 'deploy_scene/move_down_scene',   label = 'down'    ,icon = 'arrow-down'   )
		self.addTool( 'deploy_scene/----' )
		self.addTool( 'deploy_scene/edit_scene',   label = 'change target scene' ,icon = 'pencil'   )
		self.addTool( 'deploy_scene/----' )
		self.addTool( 'deploy_scene/set_entry_scene',   label = 'set as entry' ,icon = 'flag'   )

		#deploy target tree
		layout = QtGui.QVBoxLayout()
		self.window.containerTargetTree.setLayout( layout )
		layout.setSpacing( 0 )		
		layout.setMargin( 0 )

		self.treeTarget = DeployTargetTree( 
			self.window.containerTargetTree,
			editable = True,
			multiple_selection = False
			)
		self.treeTarget.manager = self
		layout.addWidget( self.treeTarget )

		targetToolbar = QtGui.QToolBar( self.window.containerTargetTree )
		layout.addWidget( targetToolbar )
		self.targetTool = self.addToolBar( 'deploy_target', targetToolbar )
		self.addTool( 'deploy_target/add_target',    label = '+' )
		self.addTool( 'deploy_target/remove_target', label = '-' )

		#target property
		self.propertyTarget = addWidgetWithLayout(
			PropertyEditor( self.window.containerTargetProp )
		)

		#menu
		self.addMenuItem( 'main/file/----' )
		self.addMenuItem( 'main/file/deploy_manager', 
			dict( label = 'Deploy Manager', shortcut = 'F11' )
			)

		self.addMenuItem( 'main/file/deploy_build', 
			dict( label = 'Deploy Build', shortcut = 'Ctrl+F11' )
			)
		
		
		# self.container.show()
		self.window.buttonOK.clicked.connect( self.onButtonOK )

		#other
		registerSearchEnumerator( deployTargetSearchEnumerator )

		signals.connect( 'project.pre_deploy', self.preDeploy )
		signals.connect( 'project.deploy', self.onDeploy )
		signals.connect( 'project.post_deploy', self.postDeploy )
Beispiel #27
0
 def onLoad(self):
     self.sceneSelectionManager = SelectionManager('scene')
     self.assetSelectionManager = SelectionManager('asset')
     signals.connect('app.start', self.postStart)
     return True
Beispiel #28
0
    def onLoad(self):
        # UI
        self.windowTitle = "Animator"
        self.window = self.requestDockWindow(
            "AnimatorView", title="Animator", size=(120, 120), minSize=(120, 120), dock="bottom"
        )

        self.widget = AnimatorWidget()
        self.window.addWidget(self.widget)
        self.toolbarTarget = self.addToolBar("animator_target", self.widget.toolbarTarget)
        self.toolbarClips = self.addToolBar("animator_clips", self.widget.toolbarClips)
        self.toolbarPlay = self.addToolBar("animator_play", self.widget.toolbarPlay)
        self.toolbarTrack = self.addToolBar("animator_track", self.widget.toolbarTrack)
        # self.toolbarEdit  = self.addToolBar( 'animator_play',  self.widget.toolbarEdit )

        signals.connect("scene.close", self.onSceneClose)
        signals.connect("scene.save", self.preSceneSave)
        signals.connect("scene.saved", self.postSceneSave)

        # addWidgetWithLaytut( toolbar,
        # 	self.widget.containerEditTool )
        self.addTool("animator_target/change_context", label="Change Context", icon="in")
        self.addTool("animator_target/save_data", label="Save Data", icon="save")

        self.addTool("animator_clips/add_clip_group", label="add group", icon="add_folder")
        self.addTool("animator_clips/add_clip", label="add", icon="add")
        self.addTool("animator_clips/remove_clip", label="remove", icon="remove")
        self.addTool("animator_clips/clone_clip", label="clone", icon="clone")

        self.addTool("animator_play/goto_start", label="to start", icon="rewind")
        # self.addTool( 'animator_play/prev_key',   label = 'prev key',      icon = 'previous' )
        self.addTool("animator_play/stop", label="stop", icon="stop")
        self.addTool("animator_play/play", label="play", icon="play", type="check")
        # self.addTool( 'animator_play/next_key',   label = 'next key',      icon = 'next' )
        self.addTool("animator_play/goto_end", label="to end", icon="fast_forward")
        self.addTool("animator_play/----")
        self.addTool("animator_play/toggle_repeat", label="toggle repeat", icon="repeat", type="check")

        # SIGNALS
        self.addTool("animator_track/add_track_group", label="add group", icon="add_folder")
        self.addTool("animator_track/add_track", label="add", icon="add")
        self.addTool("animator_track/remove_track", label="remove", icon="remove")

        #
        signals.connect("selection.changed", self.onSceneSelectionChanged)

        self.delegate = MOAILuaDelegate(self)
        self.delegate.load(_getModulePath("AnimatorView.lua"))

        self.widget.setOwner(self)

        # playback
        self.previewing = False
        self.setEditing(False)

        self.targetAnimator = None
        self.targetClip = None
        self.targetAnimatorData = None
        self.currentTrack = None

        self.previewing = False
        self.previewLoop = False
        self.previewTime = 0.0
        self.previewStep = 1.0 / 60.0

        self.previewTimer = QtCore.QTimer(self.widget)
        self.previewTimer.setInterval(1000.0 / 65)
        self.previewTimer.stop()

        self.previewTimer.timeout.connect(self.onPreviewTimer)
Beispiel #29
0
	def onLoad( self ):
		#UI
		self.windowTitle = 'Animator'
		self.window = self.requestDockWindow( 'AnimatorView',
			title     = 'Animator',
			size      = (120,120),
			minSize   = (120,120),
			dock      = 'bottom'
			)
		
		self.widget = AnimatorWidget()
		self.window.addWidget( self.widget )
		self.toolbarTarget = self.addToolBar( 'animator_target', self.widget.toolbarTarget )
		self.toolbarClips  = self.addToolBar( 'animator_clips', self.widget.toolbarClips )
		self.toolbarPlay   = self.addToolBar( 'animator_play',  self.widget.toolbarPlay )
		self.toolbarTrack  = self.addToolBar( 'animator_track', self.widget.toolbarTrack )
		# self.toolbarEdit  = self.addToolBar( 'animator_play',  self.widget.toolbarEdit )

		signals.connect( 'scene.close', self.onSceneClose )
		signals.connect( 'scene.save', self.preSceneSave )
		signals.connect( 'scene.saved', self.postSceneSave )

		# addWidgetWithLaytut( toolbar,
		# 	self.widget.containerEditTool )
		self.addTool( 'animator_target/change_context', label = 'Change Context', icon = 'in' )
		self.addTool( 'animator_target/save_data', label = 'Save Data', icon = 'save' )

		self.addTool( 'animator_clips/add_clip_group',   label = 'add group',    icon = 'add_folder' )
		self.addTool( 'animator_clips/add_clip',    label = 'add',    icon = 'add' )
		self.addTool( 'animator_clips/remove_clip', label = 'remove', icon = 'remove' )
		self.addTool( 'animator_clips/clone_clip', label = 'clone', icon = 'clone' )


		self.addTool( 'animator_play/goto_start', label = 'to start',  icon = 'rewind' )
		# self.addTool( 'animator_play/prev_key',   label = 'prev key',      icon = 'previous' )
		self.addTool( 'animator_play/stop',       label = 'stop',      icon = 'stop' )
		self.addTool( 'animator_play/play',       label = 'play',      icon = 'play',  type = 'check' )
		# self.addTool( 'animator_play/next_key',   label = 'next key',      icon = 'next' )
		self.addTool( 'animator_play/goto_end',   label = 'to end',    icon = 'fast_forward' )
		self.addTool( 'animator_play/toggle_repeat',  label = 'toggle repeat',  icon = 'repeat', type = 'check' )
		self.comboPreviewSpeed = QtGui.QComboBox()
		self.comboPreviewSpeed.addItems([ e[0] for e in PREVIEW_SPEED_OPTIONS ] )			
		self.comboPreviewSpeed.setCurrentIndex( 4 ) #1x
		self.comboPreviewSpeed.currentIndexChanged.connect( self.onPreviewSpeedChange )
		self.addTool( 'animator_play/preview_speed', widget = self.comboPreviewSpeed )
		
		#SIGNALS
		self.addTool( 'animator_track/locate_target', label = 'locate', icon = 'find' )
		self.addTool( 'animator_track/----' )
		self.addTool( 'animator_track/add_track_group',    label = 'add group',    icon = 'add_folder' )
		self.addTool( 'animator_track/add_track',    label = 'add',    icon = 'add' )
		self.addTool( 'animator_track/remove_track', label = 'remove', icon = 'remove' )

		#
		signals.connect( 'selection.changed', self.onSceneSelectionChanged )

		self.delegate = MOAILuaDelegate( self )
		self.delegate.load( _getModulePath( 'AnimatorView.lua' ) )

		self.widget.setOwner( self )

		#playback
		self.previewing = False
		self.setEditing( False )

		self.targetAnimator     = None
		self.targetClip         = None
		self.targetAnimatorData = None
		self.currentTrack       = None

		self.previewing  = False
		self.previewLoop = False
		self.previewTime = 0.0
		self.previewStep = 1.0/60.0

		self.previewTimer  = QtCore.QTimer( self.widget )
		self.previewTimer.setInterval( 1000.0/65 )
		self.previewTimer.stop()

		self.previewTimer.timeout.connect( self.onPreviewTimer )
Beispiel #30
0
    def onLoad(self):
        #UI
        self.windowTitle = 'Animator'
        self.window = self.requestDockWindow('AnimatorView',
                                             title='Animator',
                                             size=(120, 120),
                                             minSize=(120, 120),
                                             dock='bottom',
                                             icon='play')

        self.widget = AnimatorWidget()
        self.window.addWidget(self.widget)
        self.toolbarTarget = self.addToolBar('animator_target',
                                             self.widget.toolbarTarget)
        self.toolbarClips = self.addToolBar('animator_clips',
                                            self.widget.toolbarClips)
        self.toolbarPlay = self.addToolBar('animator_play',
                                           self.widget.toolbarPlay)
        self.toolbarTrack = self.addToolBar('animator_track',
                                            self.widget.toolbarTrack)
        self.toolbarClipTree = self.addToolBar('animator_clip_tree',
                                               self.widget.toolbarClipTree)
        # self.toolbarEdit  = self.addToolBar( 'animator_play',  self.widget.toolbarEdit )

        signals.connect('scene.close', self.onSceneClose)
        signals.connect('scene.save', self.preSceneSave)
        signals.connect('scene.saved', self.postSceneSave)

        # addWidgetWithLaytut( toolbar,
        # 	self.widget.containerEditTool )
        self.addTool('animator_target/find_animator',
                     label='Find Animator',
                     icon='find')
        self.addTool('animator_target/change_animator',
                     label='Edit Selected Animator',
                     icon='in')
        # self.addTool( 'animator_target/close_animator', label = 'Close Animator', icon = 'in' )
        self.addTool('animator_target/----')
        self.addTool('animator_target/save_data',
                     label='Save Data',
                     icon='save')
        self.addTool('animator_target/----')
        self.addTool('animator_target/extra', label='Extra', icon='dots')

        #
        self.addTool('animator_clips/add_clip_group',
                     label='add group',
                     icon='add_folder')
        self.addTool('animator_clips/add_clip', label='add', icon='add')
        self.addTool('animator_clips/add_clip_tree',
                     label='add tree',
                     icon='add_clip_tree')
        # self.addTool( 'animator_clips/add_clip_list',   label = 'add list',    icon = 'add_clip_list' )
        self.addTool('animator_clips/----')
        self.addTool('animator_clips/remove_clip',
                     label='remove',
                     icon='remove')
        self.addTool('animator_clips/clone_clip', label='clone', icon='clone')

        #
        self.addTool('animator_play/goto_start',
                     label='to start',
                     icon='rewind')
        self.addTool('animator_play/stop', label='stop', icon='stop')
        self.addTool('animator_play/play',
                     label='play',
                     icon='play',
                     type='check')
        self.addTool('animator_play/goto_end',
                     label='to end',
                     icon='fast_forward')
        self.addTool('animator_play/toggle_repeat',
                     label='toggle repeat',
                     icon='repeat',
                     type='check')

        self.comboPreviewSpeed = QtWidgets.QComboBox()
        self.comboPreviewSpeed.addItems([e[0] for e in PREVIEW_SPEED_OPTIONS])
        self.comboPreviewSpeed.setCurrentIndex(4)  #1x
        self.comboPreviewSpeed.currentIndexChanged.connect(
            self.onPreviewSpeedChange)
        self.addTool('animator_play/preview_speed',
                     widget=self.comboPreviewSpeed)

        #
        self.addTool('animator_clip_tree/stop_tree', label='stop', icon='stop')
        self.addTool('animator_clip_tree/play_tree',
                     label='play',
                     icon='play',
                     type='check')
        self.addTool('animator_clip_tree/----', )
        self.addTool('animator_clip_tree/add_clip_tree_node',
                     label='Add node',
                     icon='add')
        self.addTool('animator_clip_tree/remove_clip_tree_node',
                     label='Remove node',
                     icon='remove')

        #SIGNALS
        self.addTool('animator_track/fold_tracks',
                     label='fold all',
                     icon='collapse')
        self.addTool('animator_track/unfold_tracks',
                     label='unfold all',
                     icon='expand')
        self.addTool('animator_track/----')
        self.addTool('animator_track/locate_target',
                     label='locate',
                     icon='find')
        self.addTool('animator_track/retarget',
                     label='retarget',
                     icon='compose')
        self.addTool('animator_track/----')
        self.addTool('animator_track/add_track_group',
                     label='add group',
                     icon='add_folder')
        self.addTool('animator_track/add_track', label='add', icon='add')
        self.addTool('animator_track/remove_track',
                     label='remove',
                     icon='remove')

        #
        self.addShortcut(self.widget, 'Space', self.togglePreview)
        self.addShortcut(self.widget, 'shift+Space', self.restartPreview)
        self.addShortcut(self.widget, 'Escape', self.resetPreview)

        signals.connect('selection.changed', self.onSceneSelectionChanged)

        self.delegate = MOAILuaDelegate(self)
        self.delegate.load(_getModulePath('AnimatorView.lua'))

        self.widget.setOwner(self)

        #playback
        self.previewing = False
        self.setEditing(False)
        self.setReadOnly(False)

        self.targetAnimator = None
        self.targetClip = None
        self.targetAnimatorData = None
        self.currentTrack = None

        self.previewing = False
        self.previewLoop = False
        self.previewTime = 0.0
        self.previewStep = 1.0 / 60.0

        self.previewTimer = QtCore.QTimer()
        self.previewTimer.setTimerType(Qt.PreciseTimer)
        # self.previewTimer  = self.addTimer()
        self.previewTimer.setInterval(1000.0 / 65)
        self.previewTimer.stop()
        self.previewTimer.timeout.connect(self.onPreviewTimer)
Beispiel #31
0
 def onStart(self):
     signals.connect('asset.register', self.onAssetRegister)
     signals.connect('asset.unregister', self.onAssetUnregister)
     signals.connect('asset.modified', self.onAssetModified)
     self.loadRegistry()
Beispiel #32
0
    def onLoad(self):
        self.window = self.requestDockWindow('GamePreview',
                                             title='Game Preview',
                                             dock='right')

        self.canvas = self.window.addWidget(GamePreviewCanvas(self.window))
        self.canvas.startRefreshTimer(self.nonActiveFPS)
        self.paused = None

        tool = self.window.addWidget(QtGui.QToolBar(self.window),
                                     expanding=False)
        self.qtool = tool
        self.toolbar = self.addToolBar('game_preview', tool)

        self.canvas.module = self

        self.updateTimer = None
        self.window.setFocusPolicy(Qt.StrongFocus)

        signals.connect('app.activate', self.onAppActivate)
        signals.connect('app.deactivate', self.onAppDeactivate)

        signals.connect('debug.enter', self.onDebugEnter)
        signals.connect('debug.exit', self.onDebugExit)
        signals.connect('debug.stop', self.onDebugStop)

        # signals.connect( 'game.pause',     self.onGamePause )
        # signals.connect( 'game.resume',    self.onGameResume )
        signals.connect('moai.reset', self.onMoaiReset)

        self.menu = self.addMenu('main/preview', dict(label='Game'))

        self.menu.addChild(
            [
                {
                    'name': 'start_game',
                    'label': 'Resume Preview',
                    'shortcut': 'meta+]'
                },
                {
                    'name': 'pause_game',
                    'label': 'Pause Preview',
                    'shortcut': 'meta+shit+]'
                },
                {
                    'name': 'stop_game',
                    'label': 'Stop Preview',
                    'shortcut': 'meta+['
                },
                '----',
                {
                    'name': 'start_external_scene',
                    'label': 'Run Scene',
                    'shortcut': 'meta+alt+]'
                },
                {
                    'name': 'start_external_game',
                    'label': 'Run Game',
                    'shortcut': 'meta+alt+shift+]'
                },
                '----',
                {
                    'name': 'pause_on_leave',
                    'label': 'Pause On Leave',
                    'type': 'check',
                    'checked': self.getConfig('pause_on_leave')
                },
                # '----',
                # {'name':'reset_moai',     'label':'RESET MOAI', 'shortcut':'Ctrl+Shift+R'}
            ],
            self)

        # label = QtGui.QLabel()
        # label.setMinimumSize( 300, 20 )
        # label.setMaximumSize( 300, 20 )
        # self.toolbar.addWidget( label )
        # self.labelScreen = label
        # self.addTool( 'game_preview/----' )
        # self.addTool( 'game_preview/toggle_stay_top', label = 'Stay Top', type = 'check' )
        self.addTool('game_preview/switch_screen_profile',
                     label='Screen Profile')
        self.onMoaiReset()

        ##----------------------------------------------------------------##
        self.previewToolBar = self.addToolBar(
            'game_preview_tools',
            self.getMainWindow().requestToolBar('view_tools'))

        # self.addTool(	'game_preview_tools/play',
        # 	widget = SceneToolButton( 'scene_view_selection',
        # 		icon = 'tools/selection',
        # 		label = 'Selection'
        # 		)
        # 	)

        # self.addTool(	'game_preview_tools/stop',
        # 	widget = SceneToolButton( 'scene_view_translation',
        # 		icon = 'tools/translation',
        # 		label = 'Translation'
        # 		)
        # 	)

        self.addTool(
            'game_preview_tools/run_external',
            label='Play External',
            icon='tools/run_external',
        )

        self.addTool(
            'game_preview_tools/run_game_external',
            label='Play Game External',
            icon='tools/run_game_external',
        )

        self.enableMenu('main/preview/pause_game', False)
        self.enableMenu('main/preview/stop_game', False)
Beispiel #33
0
    def onLoad(self):
        #UI
        self.container = self.requestDockWindow('ScenePortalManager',
                                                title='Scene Portals',
                                                size=(120, 120),
                                                minSize=(120, 120),
                                                dock='left',
                                                toolWindow=False)

        self.window = window = self.container.addWidgetFromFile(
            _getModulePath('container.ui'))

        #Components
        leftLayout = QtWidgets.QVBoxLayout(window.containerLeft)
        leftLayout.setSpacing(0)
        leftLayout.setContentsMargins(0, 0, 0, 0)

        rightLayout = QtWidgets.QVBoxLayout(window.containerRight)
        rightLayout.setSpacing(0)
        rightLayout.setContentsMargins(0, 0, 0, 0)

        self.treeGraphsFilter = GenericTreeFilter(window.containerRight)
        self.treeGraphsFilter.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Fixed)
        self.treeGraphs = ScenePortalGraphListWidget(window.containerLeft)
        self.treeGraphsFilter.setTargetTree(self.treeGraphs)
        self.treeGraphs.setIndentation(0)
        self.toolbarGraph = QtWidgets.QToolBar(window.containerLeft)
        self.toolbarGraph.setOrientation(Qt.Horizontal)
        self.toolbarGraph.setMaximumHeight(32)

        self.graphView = ScenePortalGraphView(parent=window.containerRight,
                                              use_gl=False,
                                              antialias=True)

        leftLayout.addWidget(self.toolbarGraph)
        leftLayout.addWidget(self.treeGraphsFilter)
        leftLayout.addWidget(self.treeGraphs)

        rightLayout.addWidget(self.graphView)

        self.addToolBar('scene_portal_graph', self.toolbarGraph)
        self.addTool('scene_portal_graph/refresh',
                     label='Refresh',
                     icon='refresh')
        self.addTool('scene_portal_graph/----')
        self.addTool('scene_portal_graph/add_graph', label='Add', icon='add')
        self.addTool('scene_portal_graph/remove_graph',
                     label='Remove',
                     icon='remove')

        self.addMenuItem('main/scene/rebuild_portal_registry',
                         dict(label='Rebuild Portal Data'))

        self.addMenuItem('main/scene/portal_jump',
                         dict(label='Portal Jump', shortcut='Ctrl+Alt+J'))

        signals.connect('selection.changed', self.onSelectionChanged)
        signals.connect('scene.change', self.onSceneChange)

        self.portalRegistry = None
        self.showAllScenePortals = False
        self.updatingSelection = False
Beispiel #34
0
    def onLoad(self):
        self.configPath = self.getProject().getConfigPath(_DEPLOY_CONFIG_FILE)
        #UI
        self.container = self.requestDocumentWindow('DeployManager',
                                                    title='Deployment Manager',
                                                    allowDock=False,
                                                    minSize=(300, 300),
                                                    maxSize=(300, 300))

        #Components
        self.window = self.container.addWidgetFromFile(
            _getModulePath('DeployManager.ui'))

        self.delegate = MOAILuaDelegate(self)
        self.delegate.load(_getModulePath('DeployManager.lua'))

        #scene tree
        layout = QtGui.QVBoxLayout()
        self.window.containerSceneTree.setLayout(layout)
        layout.setSpacing(0)
        layout.setMargin(0)

        self.treeScene = DeploySceneTree(self.window.containerSceneTree,
                                         editable=True,
                                         sorting=False,
                                         multiple_selection=False)
        self.treeScene.manager = self
        layout.addWidget(self.treeScene)

        sceneToolbar = QtGui.QToolBar(self.window.containerSceneTree)
        layout.addWidget(sceneToolbar)
        self.sceneTool = self.addToolBar('deploy_scene', sceneToolbar)
        self.addTool('deploy_scene/add_scene', label='add', icon='add')
        self.addTool('deploy_scene/remove_scene',
                     label='remove',
                     icon='remove')
        self.addTool('deploy_scene/move_up_scene', label='up', icon='arrow-up')
        self.addTool('deploy_scene/move_down_scene',
                     label='down',
                     icon='arrow-down')
        self.addTool('deploy_scene/----')
        self.addTool('deploy_scene/edit_scene',
                     label='change target scene',
                     icon='pencil')
        self.addTool('deploy_scene/----')
        self.addTool('deploy_scene/set_entry_scene',
                     label='set as entry',
                     icon='flag')

        #deploy target tree
        layout = QtGui.QVBoxLayout()
        self.window.containerTargetTree.setLayout(layout)
        layout.setSpacing(0)
        layout.setMargin(0)

        self.treeTarget = DeployTargetTree(self.window.containerTargetTree,
                                           editable=True,
                                           multiple_selection=False)
        self.treeTarget.manager = self
        layout.addWidget(self.treeTarget)

        targetToolbar = QtGui.QToolBar(self.window.containerTargetTree)
        layout.addWidget(targetToolbar)
        self.targetTool = self.addToolBar('deploy_target', targetToolbar)
        self.addTool('deploy_target/add_target', label='+')
        self.addTool('deploy_target/remove_target', label='-')

        #target property
        self.propertyTarget = addWidgetWithLayout(
            PropertyEditor(self.window.containerTargetProp))

        #menu
        self.addMenuItem('main/file/----')
        self.addMenuItem('main/file/deploy_manager',
                         dict(label='Deploy Manager', shortcut='F11'))

        self.addMenuItem('main/file/deploy_build',
                         dict(label='Deploy Build', shortcut='Ctrl+F11'))

        # self.container.show()
        self.window.buttonOK.clicked.connect(self.onButtonOK)

        #other
        registerSearchEnumerator(deployTargetSearchEnumerator)

        signals.connect('project.pre_deploy', self.preDeploy)
        signals.connect('project.deploy', self.onDeploy)
        signals.connect('project.post_deploy', self.postDeploy)