def onLoad( self ): self.viewSelectedOnly = True self.container = self.requestDockWindow( title = 'PaintCanvas' ) self.window = window = self.container.addWidgetFromFile( _getModulePath('PaintCanvasEditor.ui') ) self.canvas = MOCKEditCanvas( window.containerPreview ) self.canvas.loadScript( _getModulePath('PaintCanvasEditor.lua'), { '_module': self } ) self.canvas.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding ) self.toolbarMain = QtWidgets.QToolBar( window.containerBottom ) self.toolbarMain.setOrientation( Qt.Horizontal ) layoutPreview = QtWidgets.QVBoxLayout( window.containerPreview ) layoutPreview.setSpacing( 0 ) layoutPreview.setContentsMargins( 0 , 0 , 0 , 0 ) layoutPreview.addWidget( self.canvas ) layoutBottom = QtWidgets.QVBoxLayout( window.containerBottom ) layoutBottom.setSpacing( 0 ) layoutBottom.setContentsMargins( 0 , 0 , 0 , 0 ) layoutBottom.addWidget( self.toolbarMain ) self.addToolBar( 'paintcanvas_main', self.toolbarMain ) self.addTool( 'paintcanvas_main/find_paintcanvas', icon = 'find', label = 'Find PaintCanvas' ) self.addTool( 'paintcanvas_main/----' ) self.addTool( 'paintcanvas_main/tool_pen', widget = SceneToolButton( 'paintcanvas_pen', icon = 'paintcanvas/pen', label = 'Pen' ) ) self.addTool( 'paintcanvas_main/tool_eraser', widget = SceneToolButton( 'paintcanvas_eraser', icon = 'paintcanvas/eraser', label = 'Eraser' ) ) self.addTool( 'paintcanvas_main/----' ) self.addTool( 'paintcanvas_main/tool_clear', label = 'Clear', icon = 'paintcanvas/clear' ) signals.connect( 'selection.changed', self.onSceneSelectionChanged ) self.targetPaintCanvas = None
def onLoad(self): self.mainToolBar = self.addToolBar( 'deckcanvas_tools', self.getMainWindow().requestToolBar('deckcanvas_tools')) self.addTool('deckcanvas_tools/tool_pen', widget=SceneToolButton('deckcanvas_pen', label='Deck Canvas Editor', icon='deckcanvas/pen')) self.addTool('deckcanvas_tools/toggle_item_bounds_visible', label='Toggle Item Bounds', icon='deckcanvas/layer', type='check') self.findTool('deckcanvas_tools/toggle_item_bounds_visible').setValue( True) self.delegate = MOAILuaDelegate(self) self.delegate.load(_getModulePath('DeckCanvasEditor.lua')) signals.connect('selection.changed', self.onSelectionChanged) self.toolWindow = self.requestToolWindow('DeckCanvasEditor', title='DeckCanvas', size=(120, 40), minSize=(120, 40)) self.targetCanvas = None
def onLoad(self): self.mainToolBar = self.addToolBar( 'waypoint_graph_editor', self.getMainWindow().requestToolBar('waypoint_graph_editor')) toolManager = self.getModule('scene_tool_manager') self.addTool('waypoint_graph_editor/waypoint_tool', widget=SceneToolButton('waypoint_tool', label='Waypoint Editor', icon='tools/waypoint'))
def onLoad( self ): self.mainToolBar = self.addToolBar( 'path_editor', self.getMainWindow().requestToolBar( 'path_editor' ) ) toolManager = self.getModule( 'scene_tool_manager' ) self.addTool( 'path_editor/path_tool', widget = SceneToolButton( 'path_tool', label = 'Path Editor', icon = 'tools/path' ) )
def onLoad( self ): self.mainToolBar = self.addToolBar( 'physics_tools', self.getMainWindow().requestToolBar( 'physics_tools' ) ) toolManager = self.getModule( 'scene_tool_manager' ) self.addTool( 'physics_tools/shape_editor', widget = SceneToolButton( 'physics_shape_editor', label = 'Physics Shape Editor', icon = 'tools/box2d' ) )
def onLoad(self): self.toolWindow = self.requestToolWindow('ManipulatorManager', title='Manipulators', size=(200, 180), minSize=(200, 180)) self.tree = self.toolWindow.addWidget(ManipulatorTargetTreeWidget()) self.addTool('scene_view_tools/----') self.addTool('scene_view_tools/tool_manipulator', widget=SceneToolButton('manipulator_launcher', icon='tools/manipulator', label='Manipulator')) signals.connect('selection.changed', self.onSelectionChanged) self.targetShapeCanvas = None
def onLoad( self ): self.toolWindow = self.requestToolWindow( 'ShapeCanvasEditor', title = 'Shape Canvas', size = (200,180), minSize = (200,180) ) self.targetShapeCanvas = None # self.delegate = MOAILuaDelegate( self ) # self.delegate.load( _getModulePath( 'ShapeCanvasEditor.lua' ) ) signals.connect( 'selection.changed', self.onSelectionChanged ) self.mainToolBar = self.addToolBar( 'shape_canvas_tools_top', self.getMainWindow().requestToolBar( 'shape_canvas_tools_top' ) ) self.addTool( 'shape_canvas_tools_top/shape_editor', widget = SceneToolButton( 'shape_canvas_editor', label = 'Shape Canvas Editor', icon = 'tools/shape' ) ) toolbar = self.toolWindow.addToolBar() self.addToolBar( 'shape_canvas_editor', toolbar ) self.addTool( 'shape_canvas_editor/add_point', label = 'Add Point', icon = 'tools/shape_point' ) self.addTool( 'shape_canvas_editor/add_rect', label = 'Add Rect', icon = 'tools/shape_rect' ) self.addTool( 'shape_canvas_editor/add_circle', label = 'Add Circle', icon = 'tools/shape_circle' ) self.addTool( 'shape_canvas_editor/add_poly', label = 'Add Polygon', icon = 'tools/shape_polygon' ) self.addTool( 'shape_canvas_editor/----' ) self.addTool( 'shape_canvas_editor/remove', label = 'Remove', icon = 'remove' ) self.addTool( 'shape_canvas_editor/----' ) self.addTool( 'shape_canvas_editor/clear', label = 'Clear', icon = 'clear' ) self.tree = self.toolWindow.addWidget( ShapeItemTreeWidget() )
def onLoad(self): self.targetSceneNode = None self.targetScene = None self.previousDragData = None self.window = self.requestDocumentWindow(title='Scene', icon='scene') self.gizmoManagerWidget = None self.toolbar = self.window.addToolBar() self.toolbar.setFixedHeight(24) self.toolbar.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.addToolBar('scene_view_config', self.toolbar) self.canvasFrame = self.window.addWidget(SceneViewCanvasFrame()) self.canvas = self.canvasFrame.canvas self.canvas.loadScript(_getModulePath('SceneViewScript.lua')) self.canvas.parentView = self self.canvas.setDelegateEnv('_giiSceneView', self) ##----------------------------------------------------------------## self.sceneInfoBox = self.window.addWidget(QtWidgets.QLabel()) self.sceneInfoBox.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.sceneInfoBox.setMinimumSize(10, 18) self.sceneInfoBox.setContentsMargins(10, 0, 0, 0) self.updateTimer = None self.updatePending = False self.previewing = False self.previewUpdateTimer = False signals.connect('entity.modified', self.onEntityModified) signals.connect('entity.gizmo_changed', self.onEntityGizmoChanged) signals.connect('asset.post_import_all', self.onAssetReimport) signals.connect('scene.open', self.onSceneOpen) signals.connect('scene.close', self.onSceneClose) signals.connect('scene.change', self.onSceneUpdate) signals.connect('scene.update', self.onSceneUpdate) signals.connect('selection.changed', self.onSelectionChanged) signals.connect('animator.start', self.onAnimatorStart) signals.connect('animator.stop', self.onAnimatorStop) signals.connect('preview.resume', self.onPreviewResume) signals.connect('preview.pause', self.onPreviewStop) signals.connect('preview.stop', self.onPreviewStop) signals.connect('script.reload', self.onScriptReload) ##----------------------------------------------------------------## self.addShortcut('scene_view', 'F', 'scene_editor/focus_selection') self.addShortcut('scene_view', '/', self.toggleDebugLines) self.addShortcut('scene_view', 'ctrl+;', self.toggleRootGizmoVisibility) self.addShortcut(self.canvas, 'Delete', 'scene_editor/remove_entity') self.addShortcut(self.canvas, 'Backspace', 'scene_editor/remove_entity') self.addShortcut(self.canvas, 'ctrl+/', 'scene_editor/toggle_entity_visibility') self.addShortcut(self.canvas, 'ctrl+x', self.cutEntityToClipboard) self.addShortcut(self.canvas, 'ctrl+c', self.copyEntityToClipboard) self.addShortcut(self.canvas, 'ctrl+v', self.pasteEntityFromClipboard, 'sibling') self.addShortcut(self.canvas, 'ctrl+alt+v', self.pasteEntityFromClipboard, 'into') self.addShortcut(self.canvas, 'Escape', self.clearSelection) ##----------------------------------------------------------------## self.mainToolBar = self.addToolBar( 'scene_view_tools', self.getMainWindow().requestToolBar('view_tools')) self.addTool('scene_view_tools/tool_selection', widget=SceneToolButton('scene_view_selection', icon='tools/selection', label='Selection')) self.addTool('scene_view_tools/tool_translation', widget=SceneToolButton('scene_view_translation', icon='tools/translation', label='Translation')) self.addTool('scene_view_tools/tool_rotation', widget=SceneToolButton('scene_view_rotation', icon='tools/rotation', label='Rotation')) self.addTool('scene_view_tools/tool_scale', widget=SceneToolButton('scene_view_scale', icon='tools/scale', label='Scale')) self.addTool('scene_view_tools/----') self.addTool('scene_view_tools/tool_manipulator', widget=SceneToolButton('scene_view_manipulator', icon='tools/manipulator', label='Manipulator')) # ##----------------------------------------------------------------## # self.alignToolBar = self.addToolBar( 'scene_view_tools_align', # self.getMainWindow().requestToolBar( 'view_tools_align' ) # ) # self.addTool( 'scene_view_tools_align/align_bottom', # label = 'Align Bottom', # icon = 'tools/align-bottom-edges', # command = 'align_entities', # command_args = dict( mode = 'align_bottom' ), # ) # self.addTool( 'scene_view_tools_align/align_top', # label = 'Align Top', # icon = 'tools/align-top-edges', # command = 'align_entities', # command_args = dict( mode = 'align_top' ), # ) # self.addTool( 'scene_view_tools_align/align_vcenter', # label = 'Align V Center', # icon = 'tools/align-vertical-centers', # command = 'align_entities', # command_args = dict( mode = 'align_vcenter' ), # ) # self.addTool( 'scene_view_tools_align/align_left', # label = 'Align Left', # icon = 'tools/align-left-edges', # command = 'align_entities', # command_args = dict( mode = 'align_left' ), # ) # self.addTool( 'scene_view_tools_align/align_right', # label = 'Align Right', # icon = 'tools/align-right-edges', # command = 'align_entities', # command_args = dict( mode = 'align_right' ), # ) # self.addTool( 'scene_view_tools_align/align_hcenter', # label = 'Align H Center', # icon = 'tools/align-horizontal-centers', # command = 'align_entities', # command_args = dict( mode = 'align_hcenter' ), # ) # self.addTool( 'scene_view_tools_align/----' ) # self.addTool( 'scene_view_tools_align/push_together_left', # label = 'Push Left', # icon = 'tools/push-together-left', # command = 'align_entities', # command_args = dict( mode = 'push_together_left' ), # ) # self.addTool( 'scene_view_tools_align/push_together_right', # label = 'Push right', # icon = 'tools/push-together-right', # command = 'align_entities', # command_args = dict( mode = 'push_together_right' ), # ) # self.addTool( 'scene_view_tools_align/push_together_top', # label = 'Push top', # icon = 'tools/push-together-top', # command = 'align_entities', # command_args = dict( mode = 'push_together_top' ), # ) # self.addTool( 'scene_view_tools_align/push_together_bottom', # label = 'Push bottom', # icon = 'tools/push-together-bottom', # command = 'align_entities', # command_args = dict( mode = 'push_together_bottom' ), # ) #config tool self.addTool( 'scene_view_config/copy_url', label='get URL', icon='@', ) self.addTool('scene_view_config/----') self.addTool( 'scene_view_config/copy_framebuffer', label='Copy Framebuffer', icon='clipboard', ) self.addTool( 'scene_view_config/locate_scene_asset', label='Locate Scene Asset', icon='search', ) self.addTool('scene_view_config/----') self.addTool( 'scene_view_config/gizmo_visible_manager', label='Gizmo', icon='gizmo-all', ) self.addTool('scene_view_config/toggle_snap_grid', label='snap', icon='magnet', type='check') self.addTool('scene_view_config/toggle_grid', label='grid', icon='grid', type='check') self.gridWidthSpinBox = QtWidgets.QSpinBox() self.gridWidthSpinBox.setRange(10, 1000) self.gridWidthSpinBox.valueChanged.connect(self.onGridWidthChange) self.gridWidthSpinBox.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) self.toolbar.addWidget(self.gridWidthSpinBox) self.gridHeightSpinBox = QtWidgets.QSpinBox() self.gridHeightSpinBox.setRange(10, 1000) self.gridHeightSpinBox.valueChanged.connect(self.onGridHeightChange) self.gridHeightSpinBox.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) self.toolbar.addWidget(self.gridHeightSpinBox) self.toolbar.addSeparator() self.cursorInfoBox = CursorInfoBox() self.cursorInfoBox.parentView = self self.toolbar.addWidget(self.cursorInfoBox) self.cursorInfoBox.setMousePos(0, 0) self.cursorInfoBox.setZoom(1) self.cursorInfoBox.show()
def onLoad( self ): self.viewSelectedOnly = True self.container = self.requestDockWindow( title = 'Tilemap' ) self.window = window = self.container.addWidgetFromFile( _getModulePath('TileMapEditor.ui') ) self.canvas = MOAIEditCanvas( window.containerCanvas ) self.canvas.loadScript( _getModulePath('TileMapEditor.lua'), { '_module': self } ) self.toolbarLayers = QtGui.QToolBar( window.containerLayers ) self.toolbarLayers.setOrientation( Qt.Horizontal ) self.toolbarLayers.setMaximumHeight( 20 ) self.toolbarMain = QtGui.QToolBar( window.containerCanvas ) self.toolbarMain.setOrientation( Qt.Horizontal ) # self.toolbarMain.setIconSize( 32 ) self.treeLayers = TileMapLayerTreeWidget( window.containerLayers, editable = True ) self.treeLayers.parentModule = self self.treeLayers.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding ) self.listTerrain = TileMapTerrainList( window.containerLayers, editable = False, mode = 'list' ) self.listTerrain.parentModule = self self.listTerrain.setFixedHeight( 70 ) self.listTerrain.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed ) self.listCodeTile = CodeTilesetList( window.containerLayers, editable = False, mode = 'list' ) self.listCodeTile.parentModule = self self.listCodeTile.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding ) self.listCodeTile.hide() self.canvas.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding ) canvasLayout = QtGui.QVBoxLayout( window.containerCanvas ) canvasLayout.setSpacing( 0 ) canvasLayout.setMargin( 0 ) layersLayout = QtGui.QVBoxLayout( window.containerLayers ) layersLayout.setSpacing( 0 ) layersLayout.setMargin( 0 ) canvasLayout.addWidget( self.canvas ) canvasLayout.addWidget( self.listTerrain ) canvasLayout.addWidget( self.listCodeTile ) canvasLayout.addWidget( self.toolbarMain ) layersLayout.addWidget( self.toolbarLayers ) layersLayout.addWidget( self.treeLayers ) self.addToolBar( 'tilemap_layers', self.toolbarLayers ) self.addToolBar( 'tilemap_main', self.toolbarMain ) self.addTool( 'tilemap_layers/add_layer', label = 'Add', icon = 'add' ) self.addTool( 'tilemap_layers/remove_layer', label = 'Remove', icon = 'remove' ) self.addTool( 'tilemap_layers/layer_up', label = 'up', icon = 'arrow-up' ) self.addTool( 'tilemap_layers/layer_down', label = 'down', icon = 'arrow-down' ) self.addTool( 'tilemap_layers/----' ) self.addTool( 'tilemap_layers/edit_property',label = 'edit', icon = 'settings' ) self.addTool( 'tilemap_layers/----' ) self.addTool( 'tilemap_layers/inc_subdiv', label = 'subD+' ) self.addTool( 'tilemap_layers/dec_subdiv', label = 'subD-' ) self.addTool( 'tilemap_layers/----' ) self.addTool( 'tilemap_layers/view_selected_only', label = 'View Selected Only', type='check' ) self.addTool( 'tilemap_main/tool_pen', widget = SceneToolButton( 'tilemap_pen', icon = 'tilemap/pen', label = 'Pen' ) ) self.addTool( 'tilemap_main/tool_terrain', widget = SceneToolButton( 'tilemap_terrain', icon = 'tilemap/terrain', label = 'Terrain' ) ) self.addTool( 'tilemap_main/tool_eraser', widget = SceneToolButton( 'tilemap_eraser', icon = 'tilemap/eraser', label = 'Eraser' ) ) self.addTool( 'tilemap_main/tool_fill', widget = SceneToolButton( 'tilemap_fill', icon = 'tilemap/fill', label = 'Fill' ) ) self.addTool( 'tilemap_main/----' ) self.addTool( 'tilemap_main/tool_random', label = 'Random', icon = 'tilemap/random', type = 'check' ) self.addTool( 'tilemap_main/----' ) self.addTool( 'tilemap_main/tool_clear', label = 'Clear', icon = 'tilemap/clear' ) signals.connect( 'selection.changed', self.onSceneSelectionChanged ) self.targetTileMap = None self.targetTileMapLayer = None
def onLoad( self ): self.previousDragData = None self.window = self.requestDocumentWindow( title = 'Scene', icon = 'scene' ) self.toolbar = self.window.addToolBar() self.addToolBar( 'scene_view_config', self.toolbar ) self.canvas = self.window.addWidget( SceneViewCanvas() ) self.canvas.loadScript( _getModulePath('SceneViewScript.lua') ) self.canvas.parentView = self self.canvas.setDelegateEnv( '_giiSceneView', self ) self.updateTimer = None self.updatePending = False self.previewing = False self.previewUpdateTimer = False signals.connect( 'entity.modified', self.onEntityModified ) signals.connect( 'asset.post_import_all', self.onAssetReimport ) signals.connect( 'scene.open', self.onSceneOpen ) signals.connect( 'scene.close', self.onSceneClose ) signals.connect( 'scene.change', self.onSceneUpdate ) signals.connect( 'scene.update', self.onSceneUpdate ) signals.connect( 'selection.changed', self.onSelectionChanged ) signals.connect( 'animator.start', self.onAnimatorStart ) signals.connect( 'animator.stop', self.onAnimatorStop ) signals.connect( 'preview.resume', self.onPreviewResume ) signals.connect( 'preview.pause', self.onPreviewStop ) signals.connect( 'preview.stop', self.onPreviewStop ) signals.connect( 'external_player.start', self.onExternRun ) ##----------------------------------------------------------------## self.addShortcut( 'main', 'F', 'scene_editor/focus_selection' ) self.addShortcut( 'main', '/', self.toggleDebugLines ) self.addShortcut( self.canvas, 'Delete', 'scene_editor/remove_entity' ) ##----------------------------------------------------------------## self.mainToolBar = self.addToolBar( 'scene_view_tools', self.getMainWindow().requestToolBar( 'view_tools' ) ) self.addTool( 'scene_view_tools/tool_selection', widget = SceneToolButton( 'scene_view_selection', icon = 'tools/selection', label = 'Selection' ) ) self.addTool( 'scene_view_tools/tool_translation', widget = SceneToolButton( 'scene_view_translation', icon = 'tools/translation', label = 'Translation' ) ) self.addTool( 'scene_view_tools/tool_rotation', widget = SceneToolButton( 'scene_view_rotation', icon = 'tools/rotation', label = 'Rotation' ) ) self.addTool( 'scene_view_tools/tool_scale', widget = SceneToolButton( 'scene_view_scale', icon = 'tools/scale', label = 'Scale' ) ) ##----------------------------------------------------------------## self.alignToolBar = self.addToolBar( 'scene_view_tools_align', self.getMainWindow().requestToolBar( 'view_tools_align' ) ) self.addTool( 'scene_view_tools_align/align_bottom', label = 'Align Bottom', icon = 'tools/align-bottom-edges', command = 'align_entities', command_args = dict( mode = 'align_bottom' ), ) self.addTool( 'scene_view_tools_align/align_top', label = 'Align Top', icon = 'tools/align-top-edges', command = 'align_entities', command_args = dict( mode = 'align_top' ), ) self.addTool( 'scene_view_tools_align/align_vcenter', label = 'Align V Center', icon = 'tools/align-vertical-centers', command = 'align_entities', command_args = dict( mode = 'align_vcenter' ), ) self.addTool( 'scene_view_tools_align/align_left', label = 'Align Left', icon = 'tools/align-left-edges', command = 'align_entities', command_args = dict( mode = 'align_left' ), ) self.addTool( 'scene_view_tools_align/align_right', label = 'Align Right', icon = 'tools/align-right-edges', command = 'align_entities', command_args = dict( mode = 'align_right' ), ) self.addTool( 'scene_view_tools_align/align_hcenter', label = 'Align H Center', icon = 'tools/align-horizontal-centers', command = 'align_entities', command_args = dict( mode = 'align_hcenter' ), ) self.addTool( 'scene_view_tools_align/----' ) self.addTool( 'scene_view_tools_align/push_together_left', label = 'Push Left', icon = 'tools/push-together-left', command = 'align_entities', command_args = dict( mode = 'push_together_left' ), ) self.addTool( 'scene_view_tools_align/push_together_right', label = 'Push right', icon = 'tools/push-together-right', command = 'align_entities', command_args = dict( mode = 'push_together_right' ), ) self.addTool( 'scene_view_tools_align/push_together_top', label = 'Push top', icon = 'tools/push-together-top', command = 'align_entities', command_args = dict( mode = 'push_together_top' ), ) self.addTool( 'scene_view_tools_align/push_together_bottom', label = 'Push bottom', icon = 'tools/push-together-bottom', command = 'align_entities', command_args = dict( mode = 'push_together_bottom' ), ) #config tool self.addTool( 'scene_view_config/toggle_gizmo_visible', label = 'toggle gizmo', icon = 'gizmo-all', type = 'check' ) self.addTool( 'scene_view_config/toggle_snap_grid', label = 'snap', icon = 'magnet', type = 'check' ) self.addTool( 'scene_view_config/toggle_grid', label = 'grid', icon = 'grid', type = 'check' ) self.gridWidthSpinBox = QtGui.QSpinBox() self.gridWidthSpinBox.setRange( 10, 1000 ) self.gridWidthSpinBox.valueChanged.connect( self.onGridWidthChange ) self.gridWidthSpinBox.setButtonSymbols( QtGui.QAbstractSpinBox.NoButtons ) self.toolbar.addWidget( self.gridWidthSpinBox ) self.gridHeightSpinBox = QtGui.QSpinBox() self.gridHeightSpinBox.setRange( 10, 1000 ) self.gridHeightSpinBox.valueChanged.connect( self.onGridHeightChange ) self.gridHeightSpinBox.setButtonSymbols( QtGui.QAbstractSpinBox.NoButtons ) self.toolbar.addWidget( self.gridHeightSpinBox )