Exemple #1
0
 def onFilterRequestDelete(self, node):
     if requestConfirm('Confirm Deletion', 'Delete this filter (group)?'):
         node.remove()
     self.setSearchFilter(None)
     self.saveFilterConfig()
     self.searchFilterWidget.rebuild()
     self.treeSearch.rebuild()
Exemple #2
0
	def onAsseotFilterRequestDelete( self, node ):
		if requestConfirm( 'Confirm Deletion', 'Delete this filter (group)?' ):
			node.remove()
		self.setAssetFilter( None )
		self.module.saveFilterConfig()
		self.assetFilterWidget.rebuild()
		self.treeFilter.rebuild()
Exemple #3
0
 def makeProto(self):
     selection = self.getSelection()
     if not selection: return
     if len(selection) > 1:
         return alertMessage(
             'multiple entities cannot be converted into Proto')
     target = selection[0]
     if not target: return
     if requestConfirm('convert proto', 'Convert this Entity into Proto?'):
         self.doCommand('scene_editor/make_proto', entity=target)
         self.tree.refreshNodeContent(target)
Exemple #4
0
	def makeProto( self ):
		selection = self.getSelection()
		if not selection: return
		if len( selection ) > 1:
			return alertMessage( 'multiple entities cannot be converted into Proto' )
		target = selection[0]
		if not target: return
		if requestConfirm( 'convert proto', 'Convert this Entity into Proto?' ):
			self.doCommand( 'scene_editor/make_proto', 
				entity = target
			)
			self.tree.refreshNodeContent( target )
Exemple #5
0
	def syncSelection( self ):
		assetBrowser = app.getModule( 'asset_browser' )
		if assetBrowser:
			entries = self.enumerateSearch( include_deprecated = True )
			objects = [ entry.getObject() for entry in entries ]
			for node in assetBrowser.getItemSelection():
				if node in objects:
					if node.isDeprecated():
						if not requestConfirm( 'Deprecated Asset', 'applying DEPRECATED asset, confirm?', 'warning' ):
							return False
					return self.setValue( node )
		alertMessage( 'No matched asset', 'No matched asset selected' )
Exemple #6
0
    def onClose(self):
        if self.dataDirty:
            res = requestConfirm('data modified!', 'save scene before close?')
            if res == None:  #cancel
                return False

            elif res == True:  #save
                self.onActionSave()

            elif res == False:  #no save
                self.resetData()
        self.parentModule.removeInstance(self)
        return True
Exemple #7
0
	def onClose( self ):
		if self.dataDirty:
			res = requestConfirm( 'data modified!', 'save scene before close?' )
			if res == None: #cancel
				return False

			elif res == True:   #save
				self.onActionSave()

			elif res == False: #no save
				self.resetData()
		self.parentModule.removeInstance( self )
		return True
Exemple #8
0
    def closeScene(self):
        if not self.activeSceneNode: return True
        if self.sceneDirty:
            res = requestConfirm('scene modified!', 'save scene before close?')
            if res == True:  #save
                self.saveScene()
            elif res == None:  #cancel
                return
            elif res == False:  #no save
                pass

        self.markSceneDirty(False)
        self.tree.clear()
        self.getApp().clearCommandStack('scene_editor')
        self.getSelectionManager().removeSelection(self.getActiveScene())
        signals.emitNow('scene.close', self.activeSceneNode)
        self.delegate.safeCallMethod('editor', 'closeScene')
        self.activeSceneNode = None
        return True
Exemple #9
0
	def closeScene( self ):
		if not self.activeSceneNode: return True
		if self.sceneDirty:
			res = requestConfirm( 'scene modified!', 'save scene before close?' )
			if res == True:   #save
				self.saveScene()
			elif res == None: #cancel
				return
			elif res == False: #no save
				pass

		self.markSceneDirty( False )
		self.tree.clear()
		self.getApp().clearCommandStack( 'scene_editor' )
		self.getSelectionManager().removeSelection( self.getActiveScene() )
		signals.emitNow( 'scene.close', self.activeSceneNode )
		self.delegate.safeCallMethod( 'editor', 'closeScene' )		
		self.activeSceneNode = None
		return True
Exemple #10
0
	def onTool( self, tool ):
		id = tool.getName()
		if id == 'remove':
			pass
			#app.doCommand( 'scene_editor/shape_canvas_remove' )
			
		elif id == 'clear':
			if requestConfirm( 'Clear shape canvas', 'Confirm to delete all shapes?' ):
				app.doCommand( 'scene_editor/shape_canvas_clear' )

		elif id == 'add_point':
			app.doCommand( 'scene_editor/shape_canvas_clear' )

		elif id == 'add_rect':
			pass

		elif id == 'add_circle':
			pass
			
		elif id == 'add_poly':
			pass
Exemple #11
0
 def onListRequestDelete(self):
     if requestConfirm('delete asset package/folder',
                       'Confirm to delete asset(s)?'):
         for node in self.getItemSelection():
             node.deleteFile()
Exemple #12
0
	def onAsseotFilterRequestDelete( self, node ):
		if requestConfirm( 'Confirm Deletion', 'Delete this filter (group)?' ):
			node.remove()
		self.module.saveFilterConfig()
		self.assetFilterWidget.rebuild()
Exemple #13
0
	def onListRequestDelete( self ):
		if requestConfirm( 'delete asset package/folder', 'Confirm to delete asset(s)?' ):
			for node in self.getItemSelection():
				node.deleteFile()
Exemple #14
0
	def onMenu(self, menuNode):
		name = menuNode.name

		if name in ('deploy_set', 'deploy_disallow', 'deploy_unset'):
			if name   == 'deploy_set':      newstate = True
			elif name == 'deploy_disallow': newstate = False
			elif name == 'deploy_unset':    newstate = None
			s = self.currentContextInstance.getItemSelection()
			for n in s:
				if isinstance(n,AssetNode):
					n.setDeployState(newstate)

		elif name == 'check_asset_remote':
			self.checkRemoteFile( self.currentContextInstance )

		elif name == 'refresh_remote':
			app.getAssetLibrary().scanRemoteFiles()
			alertMessage( 'OK', 'Remote files refreshed', 'info' )
					
		elif name == 'reimport':
			if self.currentContextSource == 'tree':
				targetNode = self.currentContextTargetNode
				if targetNode:
					targets = [ targetNode ]
				else:
					targets = []
			else:
				targets = self.currentContextInstance.getItemSelection()
			for targetNode in targets:
				if isinstance( targetNode, AssetNode ):
					targetNode.markModified()
			app.getAssetLibrary().importModifiedAssets()

		elif name == 'clone':
			pass

		elif name == 'remove':
			pass

		elif name == 'show_in_browser':
			n = self.currentContextTargetNode
			if isinstance( n, AssetNode ):
				n.showInBrowser()

		elif name == 'show_meta_data':
			n = self.currentContextTargetNode
			if isinstance( n, AssetNode ):
				path = n.getMetaDataFilePath()
				if path and os.path.exists( path ):
					AssetUtils.showFileInBrowser(path)
				else:
					if requestConfirm( 'No Metadata', 'Create an empty file?' ):
						if not n.metadata:
							n.setMetaData( 'key', 'value' )
						n.metaDataDirty = True
						n.saveMetaDataTable()
						AssetUtils.showFileInBrowser(path)

		elif name == 'open_in_system':
			for n in self.currentContextInstance.getItemSelection():
				if isinstance( n, AssetNode ):
					n.openInSystem()
					break

		elif name == 'copy_node_path':
			text = ''
			for n in self.currentContextInstance.getItemSelection():
				if text: text += '\n'
				text += n.getNodePath()
			setClipboardText( text )

		elif name == 'refresh_thumbnail':
			text = ''
			for n in self.currentContextInstance.getItemSelection():
				n.clearThumbnails()
				for instance in self.instances.values():
					view = instance.getCurrentView()
					view.refreshNodeContent( n )

		elif name == 'create_asset':
			requestSearchView( 
				info    = 'select asset type to create',
				context = 'asset_creator',
				type    = 'scene',
				on_selection = self.createAsset
			)

		elif name == 'create_folder':
			self.createAsset( 'folder' )

		elif name == 'find_asset':
			requestSearchView( 
				info    = 'search for asset',
				context = 'asset',
				on_test      = self.selectAsset,
				on_selection = self.selectAsset
				)

		elif name == 'find_asset_folder':
			requestSearchView( 
				info    = 'search for asset',
				context = 'asset_folder',
				on_test      = self.selectAsset,
				on_selection = self.selectAsset
				)

		elif name == 'open_asset':
			requestSearchView( 
				info    = 'open asset',
				context = 'asset',
				on_test      = self.selectAsset,
				on_selection = self.openAsset
				)

		elif name == 'new_asset_search':
			self.createAssetSearch()