Exemple #1
0
	def importAsset(self, node, reload = False ):
		if node.isVirtual(): return
		node.assetType = 'msprite'
		node.groupType = None
		node.setBundle()

		#atlas
		atlasFile = node.getCacheFile( 'atlas' )
		# node.setObjectFile( 'atlas', atlasFile )
		
		#define
		defFile = node.getCacheFile( 'def' )
		node.setObjectFile( 'def', defFile )

		packedDefFile = node.getCacheFile( 'packed_def' )
		node.setObjectFile( 'packed_def', packedDefFile )

		proj = MSpriteProject()
		#traverse path
		filePath = node.getFilePath()
		nodePath = node.getNodePath()
		proj.loadFolder( node.getAbsFilePath() )

		#TODO: let texture library handle atlas
		absAtlas = AssetLibrary.get().getAbsProjectPath( atlasFile )
		absDef = AssetLibrary.get().getAbsProjectPath( defFile )
		absPackDef = AssetLibrary.get().getAbsProjectPath( packedDefFile )
		data = proj.save( absAtlas, absDef )
		JSONHelper.saveMsgPack( data, absPackDef )


		atlasNode = node.affirmChildNode( node.getBaseName() + '_texture', 'texture', manager = 'asset_manager.texture' )
		atlasNode.setWorkspaceData( 'source', atlasFile )
		app.getModule( 'texture_library' ).scheduleImport( atlasNode )

		if node.getMetaData( 'build_sub_deck', False ):
			if data:
				for animIdx, animData in data[ 'anims' ].items():
					print(( 'sub node', animData[ 'name' ] ))
					deprecated = animData.get( 'deprecated', False )					
					subNode = node.affirmChildNode( animData[ 'name' ], 'deck2d.msprite_seq', manager = self )
					subNode.setInternalDeprecated( deprecated )
		
		return True
Exemple #2
0
    def importAsset(self, node, reload=False):
        filePath = node.getAbsFilePath()
        name, ext = os.path.splitext(filePath)
        if ext in ['.ttf', '.otf', '.ttc']:
            node.assetType = 'font_ttf'
            node.setObjectFile('font', node.getFilePath())

        elif ext == '.fnt':
            #TODO: font validation
            node.assetType = 'font_bmfont'
            node.setObjectFile('font', node.getFilePath())
            base = os.path.dirname(node.getNodePath())
            lib = AssetLibrary.get()
            n = 0
            for tex in getFntTexture(filePath):
                texPath = base + '/' + tex
                texNode = lib.getAssetNode(texPath)
                if not texNode:
                    logging.warn('BMFont texture not found: ' + texPath)
                    continue
                n += 1
                depName = 'tex-%d' % n
                node.addDependency(depName, texNode)

        elif ext == '.pfnt':
            node.assetType = 'font_pfont'
            node.setObjectFile('font', node.getFilePath())
            base = os.path.dirname(node.getNodePath())
            lib = AssetLibrary.get()
            texPath = node.getPath() + '.png'
            texNode = lib.getAssetNode(texPath)
            if not texNode:
                logging.warn('PFont texture not found: ' + texPath)
            node.addDependency('tex', texNode)

        return True
Exemple #3
0
	def createAsset(self, name, contextNode, assetType):
		ext = '.stylesheet'
		filename = name + ext

		if contextNode.isType( 'folder' ):
			nodepath = contextNode.getChildPath(filename)
			print nodepath
		else:
			nodepath = contextNode.getSiblingPath(filename)

		fullpath = AssetLibrary.get().getAbsPath( nodepath )
		modelName = _MOCK.Model.findName( 'StyleSheet' )
		assert( modelName )
		_MOCK.createEmptySerialization( fullpath, modelName )
		return nodepath
Exemple #4
0
    def createAsset(self, name, contextNode, assetType):
        ext = '.stylesheet'
        filename = name + ext

        if contextNode.isType('folder'):
            nodepath = contextNode.getChildPath(filename)
            print nodepath
        else:
            nodepath = contextNode.getSiblingPath(filename)

        fullpath = AssetLibrary.get().getAbsPath(nodepath)
        modelName = _MOCK.Model.findName('StyleSheet')
        assert (modelName)
        _MOCK.createEmptySerialization(fullpath, modelName)
        return nodepath
Exemple #5
0
		#TODO: need convert PNG		
		defFile = node.getCacheFile('def')
		
		result = importer.call(
			'convertAuroraSprite', 
			node.getAbsFilePath(),
			getProjectPath( defFile )
			)

		node.setObjectFile( 'def', defFile )
		
		#add depedency
		#TODO: ADD texture dependency

		#add child nodes
		#_frames
		node.createChildNode( 'frames', 'quadlists', manager = self )
		#anim clips
		# print(result, result.animations)
		# #TODO:
		# for key, ani in result.animations.items():
		# 	node.createChildNode( ani.name, 'animclip', manager = self )

		return True

AuroraSpriteAssetManager().register()

AssetLibrary.get().setAssetIcon( 'animclip',      'clip' )
AssetLibrary.get().setAssetIcon( 'quadlists',     'cell' )
AssetLibrary.get().setAssetIcon( 'aurora_sprite', 'clip' )
Exemple #6
0
            logging.warn('excel version not supported for %s' %
                         node.getFilePath())
            return False

        data = convertWorkbookToData(workbook)
        if not data:
            logging.warn('no data converted from xls: %s' % node.getFilePath())
            return False
        cachePath = node.getCacheFile('data')

        if not jsonHelper.trySaveJSON(data, cachePath):
            logging.warn('failed saving xls data: %s' % cachePath)
            return False

        node.assetType = 'data_xls'
        node.setObjectFile('data', cachePath)
        node.groupType = 'package'
        for id, sheet in data.items():
            node.affirmChildNode(id, 'data_sheet', manager=self)
        return True

    def editAsset(self, node):
        if node.isVirtual():
            return self.editAsset(node.getParent())
        node.openInSystem()


DataXLSAssetManager().register()
AssetLibrary.get().setAssetIcon('data_xls', 'data')
AssetLibrary.get().setAssetIcon('data_sheet', 'data')
Exemple #7
0
from gii.core import AssetManager, AssetLibrary, getProjectPath, app

##----------------------------------------------------------------##
class DataJSONAssetManager(AssetManager):
	def getName(self):
		return 'asset_manager.data_json'

	def getMetaType( self ):
		return 'script'

	def acceptAssetFile(self, filepath):
		if not os.path.isfile(filepath): return False		
		name, ext = os.path.splitext(filepath)
		if not ext in ['.json']: return False
		try:
			fp = open( filepath, 'r' )
			text = fp.read()
			json.loads( text )
		except Exception, e:
			return False
		return True

	def importAsset(self, node, reload = False ):
		node.assetType = 'data_json'
		node.setObjectFile( 'data', node.getFilePath() )
		return True

DataJSONAssetManager().register()
AssetLibrary.get().setAssetIcon( 'data_json', 'data' )
Exemple #8
0
import os.path

from gii.core import AssetManager, AssetLibrary, app, JSONHelper
from .DataYAMLAsset import DataYAMLAssetManager

class AssetMapAssetManager( DataYAMLAssetManager ):
	def getName(self):
		return 'asset_manager.asset_map'

	def acceptAssetFile(self, filepath):
		if not os.path.isfile(filepath): return False		
		name, ext = os.path.splitext(filepath)
		return ext in ['.asset_map' ]

	def importAsset(self, node, reload = False ):
		imported = super( AssetMapAssetManager, self ).importAsset( node, reload )
		node.assetType = 'asset_map'
		return imported

AssetMapAssetManager().register()
AssetLibrary.get().setAssetIcon( 'asset_map',  'asset_map' )
Exemple #9
0
    def importAsset(self, node, reload=False):
        if node.isVirtual(): return
        node.assetType = 'deck_pack'
        node.groupType = 'package'

        output = node.getCacheFile('export', is_dir=True)
        node.setObjectFile('export', output)

        proj = PSDDeckPackProject()
        proj.setDefaultProcessor('mquad')

        proj.loadPSD(node.getAbsFilePath())
        proj.save(output + '/', 'decks', (2048, 2048))

        #import
        jsonPath = output + '/decks.json'
        pack = jsonHelper.tryLoadJSON(jsonPath)
        for item in pack['decks']:
            name = item['name']
            deckType = item['type']
            node.affirmChildNode(item['name'], deckType, manager=self)

        return True


DeckPSDAssetManager().register()

AssetLibrary.get().setAssetIcon('deck_pack', 'pack')
AssetLibrary.get().setAssetIcon('deck2d.mquad', 'deck_mquad')
AssetLibrary.get().setAssetIcon('deck2d.mtileset', 'deck_mtileset')
Exemple #10
0
        if not os.path.isfile(filepath): return False
        if not filepath.endswith('.ntileset.psd'): return False
        return True

    def importAsset(self, node, reload=False):
        if node.isVirtual(): return
        node.assetType = 'named_tileset_pack'
        #atlas
        atlasFile = node.getCacheFile('atlas')
        node.setObjectFile('atlas', atlasFile)
        #define
        defFile = node.getCacheFile('def')
        node.setObjectFile('def', defFile)

        proj = TilesetProject()
        proj.loadPSD(node.getAbsFilePath())
        absAtlas, absDef = node.getAbsObjectFile(
            'atlas'), node.getAbsObjectFile('def')
        proj.save(absAtlas, absDef)
        #TODO: let texture library handle atlas
        pack = jsonHelper.tryLoadJSON(absDef)
        for item in pack['themes']:
            node.affirmChildNode(item['name'], 'named_tileset', manager=self)
        return True


NamedTilesetAssetManager().register()

AssetLibrary.get().setAssetIcon('named_tileset_pack', 'pack')
AssetLibrary.get().setAssetIcon('named_tileset', 'cell')
Exemple #11
0
		node.setObjectFile( 'export', output )
		# target = '-ios'
		target = '-pc'
		arglist = [ 
				fmodDesignerPath + '/' + _FMOD_DESIGNER_CL,
				target,
				'-p',
				'-b', output,
				node.getAbsFilePath()
			]
		try:
			subprocess.call( arglist )
		except Exception, e:
			logging.exception( e )

		#TODO:check bank files( delete banks unavailable )
		banks = project['banks']
		for name, bank in banks.items():
			pass

		self._traverseGroup( node, project )
		return True

FmodAssetManager().register()

AssetLibrary.get().setAssetIcon( 'fmod_project',   'fmod' )
AssetLibrary.get().setAssetIcon( 'fmod_group',     'fmod_group' )
AssetLibrary.get().setAssetIcon( 'fmod_event',     'audio' )


Exemple #12
0
    import os.path
    return os.path.dirname(__file__) + '/' + path


class CodeTilesetAssetManager(DataYAMLAssetManager):
    def getName(self):
        return 'asset_manager.code_tileset'

    def acceptAssetFile(self, filepath):
        if not os.path.isfile(filepath): return False
        if not filepath.endswith('.code_tileset'): return False
        return True

    def postDataLoad(self, node, data):
        tiles = data.get('tiles', None)
        if not tiles: return
        id = 0
        for key, value in list(tiles.items()):
            id += 1
            value['_id'] = id

    def importAsset(self, node, reload=False):
        imported = super(CodeTilesetAssetManager,
                         self).importAsset(node, reload)
        node.assetType = 'code_tileset'
        return imported


CodeTilesetAssetManager().register()
AssetLibrary.get().setAssetIcon('code_tileset', 'cell')
Exemple #13
0
        if node.isVirtual():
            return
        node.assetType = "deck_pack"
        node.groupType = "package"

        output = node.getCacheFile("export", is_dir=True)
        node.setObjectFile("export", output)

        proj = PSDDeckPackProject()
        proj.setDefaultProcessor("mquad")

        proj.loadPSD(node.getAbsFilePath())
        proj.save(output + "/", "decks", (2048, 2048))

        # import
        jsonPath = output + "/decks.json"
        pack = jsonHelper.tryLoadJSON(jsonPath)
        for item in pack["decks"]:
            name = item["name"]
            deckType = item["type"]
            node.affirmChildNode(item["name"], deckType, manager=self)

        return True


DeckPSDAssetManager().register()

AssetLibrary.get().setAssetIcon("deck_pack", "pack")
AssetLibrary.get().setAssetIcon("deck2d.mquad", "deck_mquad")
AssetLibrary.get().setAssetIcon("deck2d.mtileset", "deck_mtileset")
Exemple #14
0
import os.path
import json
import yaml

from gii.core import AssetManager, AssetLibrary, getProjectPath, app, jsonHelper
from helper.psd2tileset import TilesetProject
from DataYAMLAsset import DataYAMLAssetManager

def _getModulePath( path ):
	import os.path
	return os.path.dirname( __file__ ) + '/' + path


class CodeTilesetAssetManager(DataYAMLAssetManager):
	def getName(self):
		return 'asset_manager.code_tileset'
	
	def acceptAssetFile(self, filepath):
		if not os.path.isfile(filepath): return False		
		if not filepath.endswith( '.code_tileset' ): return False
		return True

	def importAsset(self, node, reload = False ):
		imported = super( CodeTilesetAssetManager, self ).importAsset( node, reload )
		node.assetType = 'code_tileset'
		return imported

CodeTilesetAssetManager().register()
AssetLibrary.get().setAssetIcon( 'code_tileset',  'cell' )
Exemple #15
0
import os.path
from gii.core import AssetManager, AssetLibrary, getProjectPath, app


def _getModulePath(path):
    import os.path
    return os.path.dirname(__file__) + '/' + path


class PexAssetManager(AssetManager):
    def getName(self):
        return 'asset_manager.pex'

    def acceptAssetFile(self, filepath):
        if not os.path.isfile(filepath): return False
        name, ext = os.path.splitext(filepath)
        if not ext in ['.pex']: return False
        return True

    def importAsset(self, node, reload=False):
        node.assetType = 'particle_pex'
        node.setObjectFile('def', node.getFilePath())
        return True


PexAssetManager().register()

AssetLibrary.get().setAssetIcon('particle_pex', 'pex')
Exemple #16
0
	def getMetaType( self ):
		return 'script'

	def acceptAssetFile(self, filepath):
		if not os.path.isfile(filepath): return False		
		name, ext = os.path.splitext(filepath)
		if not ext in ['.yaml']: return False		
		return True

	def importAsset(self, node, reload = False ):
		try:
			fp = open( node.getAbsFilePath(), 'r' )
			text = fp.read()
			data = yaml.load( text )
		except Exception, e:
			logging.warn( 'failed to parse yaml:%s' % node.getPath() )
			print e
			return False

		cachePath = node.getCacheFile( 'data' )
		if not jsonHelper.trySaveJSON( data, cachePath ):
			logging.warn( 'failed saving yaml data to json: %s' % cachePath )
			return False

		node.assetType = 'data_yaml'
		node.setObjectFile( 'data', cachePath )
		return True

DataYAMLAssetManager().register()
AssetLibrary.get().setAssetIcon( 'data_yaml', 'data' )
Exemple #17
0
        return 'script'

    def acceptAssetFile(self, filepath):
        if not os.path.isfile(filepath): return False
        name, ext = os.path.splitext(filepath)
        if not ext in ['.yaml']: return False
        return True

    def importAsset(self, node, reload=False):
        try:
            fp = open(node.getAbsFilePath(), 'r')
            text = fp.read()
            data = yaml.load(text)
        except Exception, e:
            logging.warn('failed to parse yaml:%s' % node.getPath())
            print e
            return False

        cachePath = node.getCacheFile('data')
        if not jsonHelper.trySaveJSON(data, cachePath):
            logging.warn('failed saving yaml data to json: %s' % cachePath)
            return False

        node.assetType = 'data_yaml'
        node.setObjectFile('data', cachePath)
        return True


DataYAMLAssetManager().register()
AssetLibrary.get().setAssetIcon('data_yaml', 'data')
Exemple #18
0
		if not workbook:
			logging.warn( 'excel version not supported for %s' % node.getFilePath() )
			return False

		data = convertWorkbookToData( workbook )
		if not data:
			logging.warn( 'no data converted from xls: %s' % node.getFilePath() )
			return False
		cachePath = node.getCacheFile( 'data' )
		
		if not jsonHelper.trySaveJSON( data, cachePath ):
			logging.warn( 'failed saving xls data: %s' % cachePath )
			return False

		node.assetType = 'data_xls'
		node.setObjectFile( 'data', cachePath )
		node.groupType = 'package'
		for id, sheet in data.items():
			node.affirmChildNode( id, 'data_sheet', manager = self )
		return True

	def editAsset(self, node):
		if node.isVirtual():
			return self.editAsset( node.getParent() )
		node.openInSystem()

DataXLSAssetManager().register()
AssetLibrary.get().setAssetIcon( 'data_xls',   'data' )
AssetLibrary.get().setAssetIcon( 'data_sheet', 'data' )

Exemple #19
0
##----------------------------------------------------------------##
class StyleSheetCreator(AssetCreator):
    def getAssetType(self):
        return 'stylesheet'

    def getLabel(self):
        return 'Style Sheet'

    def createAsset(self, name, contextNode, assetType):
        ext = '.stylesheet'
        filename = name + ext

        if contextNode.isType('folder'):
            nodepath = contextNode.getChildPath(filename)
            print nodepath
        else:
            nodepath = contextNode.getSiblingPath(filename)

        fullpath = AssetLibrary.get().getAbsPath(nodepath)
        modelName = _MOCK.Model.findName('StyleSheet')
        assert (modelName)
        _MOCK.createEmptySerialization(fullpath, modelName)
        return nodepath


##----------------------------------------------------------------##
StyleSheetAssetManager().register()
StyleSheetCreator().register()

AssetLibrary.get().setAssetIcon('stylesheet', 'text')
Exemple #20
0
            node.addDependency('tex', texNode)

        return True


FontAssetManager().register()


class PFontAssetManager(AssetManager):
    def getName(self):
        return 'asset_manager.pfont'

    def acceptAssetFile(self, filepath):
        if not os.path.isdir(filepath): return False
        name, ext = os.path.splitext(filepath)
        return ext in ['.pfont']

    def importAsset(self, node, reload=False):
        if node.isVirtual(): return
        node.assetType = 'font_pfont'
        node.groupType = None
        node.setBundle()
        node.setObjectFile('font', node.getFilePath())
        return True


PFontAssetManager().register()

AssetLibrary.get().setAssetIcon('font_ttf', 'font')
AssetLibrary.get().setAssetIcon('font_bmfont', 'font')
AssetLibrary.get().setAssetIcon('font_pfont', 'font')
Exemple #21
0
            except Exception as e:
                logging.warn('Failed importing dict csv:' + node.getPath())
                return False

        elif path.endswith('.list.csv'):
            try:
                data = loadCSVAsList(node.getAbsFilePath())
            except Exception as e:
                logging.warn('Failed importing list csv:' + node.getPath())
                return False

        else:
            try:
                data = loadPlainCSV(node.getAbsFilePath())
            except Exception as e:
                logging.warn('Failed importing plain csv:' + node.getPath())
                return False

        cachePath = node.getCacheFile('data')
        if not JSONHelper.trySaveJSON(data, cachePath):
            logging.warn('failed saving csv data to json: %s' % cachePath)
            return False

        node.assetType = 'data_csv'
        node.setObjectFile('data', cachePath)
        return True


DataCSVAssetManager().register()
AssetLibrary.get().setAssetIcon('data_csv', 'data')
Exemple #22
0
import os.path
from gii.core import AssetManager, AssetLibrary, getProjectPath, app

def _getModulePath( path ):
	import os.path
	return os.path.dirname( __file__ ) + '/' + path


class PexAssetManager(AssetManager):
	def getName(self):
		return 'asset_manager.pex'

	def acceptAssetFile(self, filepath):
		if not os.path.isfile(filepath): return False		
		name, ext = os.path.splitext(filepath)
		if not ext in ['.pex']: return False
		return True

	def importAsset(self, node, reload = False ):
		node.assetType = 'particle_pex'
		node.setObjectFile( 'def', node.getFilePath() )
		return True


PexAssetManager().register()

AssetLibrary.get().setAssetIcon( 'particle_pex', 'pex' )

Exemple #23
0
            # elif ext == '.material':
            # 	print( "material" )
            # 	materialPath = node.getCacheFile( 'material' )
            # 	node.setObjectFile( 'material', materialPath )
            # 	print( "materialPath: " + materialPath )
            # 	print( "nodePath: " + nodePath )
            # internalAtlas = _MOCK.convertSpineAtlasToPrebuiltAtlas( fullPath )
            # for page in internalAtlas.pages.values():
            # 	page.source = filePath + '/' + page.texture
            # atlasNode = node.affirmChildNode( node.getBaseName()+'_spine_atlas', 'prebuilt_atlas', manager = 'asset_manager.prebuilt_atlas' )
            # atlasSourceCachePath = atlasNode.getCacheFile( 'atlas_source' )
            # internalAtlas.save( internalAtlas, atlasSourceCachePath )
            # app.getModule( 'texture_library' ).scheduleImport( atlasNode )
            elif ext in texExt:
                saveFilePath = rootPath + '/' + name + '.png'
                print(("texture path: " + saveFilePath))
                # texturePath = node.getCacheFile( 'texture' )
                # node.setObjectFile( 'texture', texturePath )
                # print( "texturePath: " + texturePath )
                # print( "nodePath: " + nodePath )
                img = Image.open(fullPath)
                img = img.convert("RGBA")
                img.save(saveFilePath, 'PNG')

        return True


MeshAssetManager().register()

AssetLibrary.get().setAssetIcon('mesh', 'mesh')
Exemple #24
0
        if not filepath.endswith('.textures.psd'): return False
        return True

    def importAsset(self, node, reload=False):
        if node.isVirtual(): return
        node.setBundle()

        node.assetType = 'texture_pack'
        node.groupType = 'package'

        output = node.getCacheFile('export', is_dir=True)
        extractor = PSDLayerExtractor()
        result = extractor.extract(node.getAbsFilePath(), output)

        #import
        for item in result:
            name, absPath, filename = item
            texNode = node.affirmChildNode(name,
                                           'texture',
                                           manager='asset_manager.texture')
            texNode.setWorkspaceData('source', absPath)
            app.getModule('texture_library').scheduleImport(texNode)

        return True


##----------------------------------------------------------------##
PSDTexturePackAssetManager().register()

AssetLibrary.get().setAssetIcon('texture_pack', 'pack')
Exemple #25
0
	def acceptAssetFile(self, filepath):
		if not os.path.isfile(filepath): return False		
		if not filepath.endswith( '.ntileset.psd' ): return False
		return True

	def importAsset(self, node, reload = False ):
		if node.isVirtual(): return
		node.assetType = 'named_tileset_pack'
		#atlas
		atlasFile = node.getCacheFile( 'atlas' )
		node.setObjectFile( 'atlas', atlasFile )
		#define
		defFile = node.getCacheFile( 'def' )
		node.setObjectFile( 'def', defFile )
		
		proj = TilesetProject()
		proj.loadPSD( node.getAbsFilePath() )
		absAtlas, absDef = node.getAbsObjectFile( 'atlas' ), node.getAbsObjectFile( 'def' )
		proj.save( absAtlas, absDef )
		#TODO: let texture library handle atlas
		pack = jsonHelper.tryLoadJSON( absDef )
		for item in pack[ 'themes' ]:
			node.affirmChildNode( item[ 'name' ], 'named_tileset', manager = self )
		return True

NamedTilesetAssetManager().register()

AssetLibrary.get().setAssetIcon( 'named_tileset_pack',  'pack' )
AssetLibrary.get().setAssetIcon( 'named_tileset',  'cell' )
Exemple #26
0
    def importAsset(self, node, reload=False):
        if node.isVirtual(): return
        node.assetType = 'lut_texture'
        node.groupType = None

        output = node.getCacheFile('texture')
        node.setObjectFile('texture', output)
        lut, filter = extractLUTImage(node.getAbsFilePath())
        if lut:
            lut.save(output, 'PNG')
            node.setProperty('filter', filter)
            return True
        else:
            return False

    def hasAssetThumbnail(self, assetNode):
        if assetNode.isVirtual(): return False
        return True

    def buildAssetThumbnail(self, assetNode, targetPath, size):
        srcPath = assetNode.getAbsFilePath()
        if not ImageHelpers.buildThumbnail(srcPath, targetPath, size):
            return False
        return True


LUTPSDAssetManager().register()

AssetLibrary.get().setAssetIcon('lut_texture', 'color')
Exemple #27
0
##----------------------------------------------------------------##
class StyleSheetCreator( AssetCreator ):
	def getAssetType( self ):
		return 'stylesheet'

	def getLabel( self ):
		return 'Style Sheet'

	def createAsset(self, name, contextNode, assetType):
		ext = '.stylesheet'
		filename = name + ext

		if contextNode.isType( 'folder' ):
			nodepath = contextNode.getChildPath(filename)
			print nodepath
		else:
			nodepath = contextNode.getSiblingPath(filename)

		fullpath = AssetLibrary.get().getAbsPath( nodepath )
		modelName = _MOCK.Model.findName( 'StyleSheet' )
		assert( modelName )
		_MOCK.createEmptySerialization( fullpath, modelName )
		return nodepath
		

##----------------------------------------------------------------##
StyleSheetAssetManager().register()
StyleSheetCreator().register()

AssetLibrary.get().setAssetIcon('stylesheet', 'text')
Exemple #28
0

##----------------------------------------------------------------##
class DataJSONAssetManager(AssetManager):
    def getName(self):
        return 'asset_manager.data_json'

    def getMetaType(self):
        return 'script'

    def acceptAssetFile(self, filepath):
        if not os.path.isfile(filepath): return False
        name, ext = os.path.splitext(filepath)
        if not ext in ['.json']: return False
        try:
            fp = open(filepath, 'r')
            text = fp.read()
            json.loads(text)
        except Exception, e:
            return False
        return True

    def importAsset(self, node, reload=False):
        node.assetType = 'data_json'
        node.setObjectFile('data', node.getFilePath())
        return True


DataJSONAssetManager().register()
AssetLibrary.get().setAssetIcon('data_json', 'data')
Exemple #29
0
        # define
        defFile = node.getCacheFile("def")
        node.setObjectFile("def", defFile)

        proj = MSpriteProject()
        # traverse path
        filePath = node.getFilePath()
        nodePath = node.getNodePath()
        for fileName in os.listdir(node.getAbsFilePath()):
            fullPath = filePath + "/" + fileName
            name, ext = os.path.splitext(fileName)
            if ext == ".psd":
                proj.loadPSD(fullPath)

                # TODO: let texture library handle atlas
        absAtlas, absDef = node.getAbsObjectFile("atlas"), node.getAbsObjectFile("def")
        proj.save(absAtlas, absDef)

        atlasNode = node.affirmChildNode(node.getBaseName() + "_texture", "texture", manager="asset_manager.texture")
        atlasNode.setMetaData("source", atlasFile)
        app.getModule("texture_library").scheduleImport(atlasNode)

        return True


MSpriteAssetManager().register()

AssetLibrary.get().setAssetIcon("animclip", "clip")
AssetLibrary.get().setAssetIcon("quadlists", "cell")
AssetLibrary.get().setAssetIcon("msprite", "clip")
Exemple #30
0
		proj.loadFolder( node.getAbsFilePath() )

		#TODO: let texture library handle atlas
		absAtlas = AssetLibrary.get().getAbsProjectPath( atlasFile )
		absDef = AssetLibrary.get().getAbsProjectPath( defFile )
		absPackDef = AssetLibrary.get().getAbsProjectPath( packedDefFile )
		data = proj.save( absAtlas, absDef )
		JSONHelper.saveMsgPack( data, absPackDef )


		atlasNode = node.affirmChildNode( node.getBaseName() + '_texture', 'texture', manager = 'asset_manager.texture' )
		atlasNode.setWorkspaceData( 'source', atlasFile )
		app.getModule( 'texture_library' ).scheduleImport( atlasNode )

		if node.getMetaData( 'build_sub_deck', False ):
			if data:
				for animIdx, animData in data[ 'anims' ].items():
					print(( 'sub node', animData[ 'name' ] ))
					deprecated = animData.get( 'deprecated', False )					
					subNode = node.affirmChildNode( animData[ 'name' ], 'deck2d.msprite_seq', manager = self )
					subNode.setInternalDeprecated( deprecated )
		
		return True

MSpriteAssetManager().register()

AssetLibrary.get().setAssetIcon( 'animclip',   'clip' )
AssetLibrary.get().setAssetIcon( 'quadlists',  'cell' )
AssetLibrary.get().setAssetIcon( 'msprite',    'clip' )
AssetLibrary.get().setAssetIcon( 'deck2d.msprite_seq',  'cell' )