diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/NewGraphicDialog.as b/NewGraphicDialog.as index aa2ec1f..152011c 100644 --- a/NewGraphicDialog.as +++ b/NewGraphicDialog.as @@ -94,19 +94,7 @@ var graphicDef = new GraphicDef(graphicData); this.Hide(); - graphicExport.ExportGraphicDef(graphicDef); - } - - public function NewGraphicAdded(results) - { - if (results.okay == true) - { - var graphicDef = new GraphicDef(results.graphic_define); - DialogManager.Instance().ShowMessageBox("Added graphic "+graphicDef.ID+". Export Now?", "Export", "No", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); } ); - } else { - var graphicDef = GameData.Instance().GetGraphicDefByID(results.graphic_id); - DialogManager.Instance().ShowMessageBox("Graphic Already Existed!", "Re-Export", "Cancel", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); }); - } + graphicExport.ExportItem(graphicDef); } var selectedType = 1; @@ -184,7 +172,7 @@ private function openFile(event:Event):void { - _trace(event.target.nativePath); + _strace(event.target.nativePath); var path:String = event.target.nativePath; var pathParts:Array = path.split("Graphics\\"); if (pathParts.length == 2) @@ -193,7 +181,7 @@ var withoutExtension:String = fileRemainder.split(".")[0]; var pattern:RegExp = /\\/g; withoutExtension = withoutExtension.replace(pattern, "/"); - _trace(withoutExtension); + _strace(withoutExtension); graphicPath.text = withoutExtension; if (withoutExtension.indexOf("Backgrounds") > -1) diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/NewGraphicDialog.as b/NewGraphicDialog.as index aa2ec1f..152011c 100644 --- a/NewGraphicDialog.as +++ b/NewGraphicDialog.as @@ -94,19 +94,7 @@ var graphicDef = new GraphicDef(graphicData); this.Hide(); - graphicExport.ExportGraphicDef(graphicDef); - } - - public function NewGraphicAdded(results) - { - if (results.okay == true) - { - var graphicDef = new GraphicDef(results.graphic_define); - DialogManager.Instance().ShowMessageBox("Added graphic "+graphicDef.ID+". Export Now?", "Export", "No", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); } ); - } else { - var graphicDef = GameData.Instance().GetGraphicDefByID(results.graphic_id); - DialogManager.Instance().ShowMessageBox("Graphic Already Existed!", "Re-Export", "Cancel", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); }); - } + graphicExport.ExportItem(graphicDef); } var selectedType = 1; @@ -184,7 +172,7 @@ private function openFile(event:Event):void { - _trace(event.target.nativePath); + _strace(event.target.nativePath); var path:String = event.target.nativePath; var pathParts:Array = path.split("Graphics\\"); if (pathParts.length == 2) @@ -193,7 +181,7 @@ var withoutExtension:String = fileRemainder.split(".")[0]; var pattern:RegExp = /\\/g; withoutExtension = withoutExtension.replace(pattern, "/"); - _trace(withoutExtension); + _strace(withoutExtension); graphicPath.text = withoutExtension; if (withoutExtension.indexOf("Backgrounds") > -1) diff --git a/PNGExportHelper.as b/PNGExportHelper.as index 667d15f..f8c4c9d 100644 --- a/PNGExportHelper.as +++ b/PNGExportHelper.as @@ -74,7 +74,7 @@ output.copyPixels(bd, new Rectangle(ox * scale, oy * scale, scale, scale), new Point(ox * scale, oy * scale)); continue; } else { - //_trace(scaleda+""); + //_strace(scaleda+""); } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/NewGraphicDialog.as b/NewGraphicDialog.as index aa2ec1f..152011c 100644 --- a/NewGraphicDialog.as +++ b/NewGraphicDialog.as @@ -94,19 +94,7 @@ var graphicDef = new GraphicDef(graphicData); this.Hide(); - graphicExport.ExportGraphicDef(graphicDef); - } - - public function NewGraphicAdded(results) - { - if (results.okay == true) - { - var graphicDef = new GraphicDef(results.graphic_define); - DialogManager.Instance().ShowMessageBox("Added graphic "+graphicDef.ID+". Export Now?", "Export", "No", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); } ); - } else { - var graphicDef = GameData.Instance().GetGraphicDefByID(results.graphic_id); - DialogManager.Instance().ShowMessageBox("Graphic Already Existed!", "Re-Export", "Cancel", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); }); - } + graphicExport.ExportItem(graphicDef); } var selectedType = 1; @@ -184,7 +172,7 @@ private function openFile(event:Event):void { - _trace(event.target.nativePath); + _strace(event.target.nativePath); var path:String = event.target.nativePath; var pathParts:Array = path.split("Graphics\\"); if (pathParts.length == 2) @@ -193,7 +181,7 @@ var withoutExtension:String = fileRemainder.split(".")[0]; var pattern:RegExp = /\\/g; withoutExtension = withoutExtension.replace(pattern, "/"); - _trace(withoutExtension); + _strace(withoutExtension); graphicPath.text = withoutExtension; if (withoutExtension.indexOf("Backgrounds") > -1) diff --git a/PNGExportHelper.as b/PNGExportHelper.as index 667d15f..f8c4c9d 100644 --- a/PNGExportHelper.as +++ b/PNGExportHelper.as @@ -74,7 +74,7 @@ output.copyPixels(bd, new Rectangle(ox * scale, oy * scale, scale, scale), new Point(ox * scale, oy * scale)); continue; } else { - //_trace(scaleda+""); + //_strace(scaleda+""); } diff --git a/Packer/AsyncGraphicPacker.as b/Packer/AsyncGraphicPacker.as index c20aec9..ae68d5c 100644 --- a/Packer/AsyncGraphicPacker.as +++ b/Packer/AsyncGraphicPacker.as @@ -163,7 +163,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); clipIndex++; } @@ -225,7 +225,7 @@ output.writeUnsignedInt(png.length); output.writeBytes(png); pngSheets.push(png); - _trace("PNG Processed Sheet "+i+" of " + sheets.length); + _strace("PNG Processed Sheet "+i+" of " + sheets.length); sheetIndex++; } @@ -272,7 +272,7 @@ spriteNames.push(clipName); - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -280,7 +280,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -374,7 +374,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); if (outputFormat == "json_png_set") { @@ -912,7 +912,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/NewGraphicDialog.as b/NewGraphicDialog.as index aa2ec1f..152011c 100644 --- a/NewGraphicDialog.as +++ b/NewGraphicDialog.as @@ -94,19 +94,7 @@ var graphicDef = new GraphicDef(graphicData); this.Hide(); - graphicExport.ExportGraphicDef(graphicDef); - } - - public function NewGraphicAdded(results) - { - if (results.okay == true) - { - var graphicDef = new GraphicDef(results.graphic_define); - DialogManager.Instance().ShowMessageBox("Added graphic "+graphicDef.ID+". Export Now?", "Export", "No", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); } ); - } else { - var graphicDef = GameData.Instance().GetGraphicDefByID(results.graphic_id); - DialogManager.Instance().ShowMessageBox("Graphic Already Existed!", "Re-Export", "Cancel", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); }); - } + graphicExport.ExportItem(graphicDef); } var selectedType = 1; @@ -184,7 +172,7 @@ private function openFile(event:Event):void { - _trace(event.target.nativePath); + _strace(event.target.nativePath); var path:String = event.target.nativePath; var pathParts:Array = path.split("Graphics\\"); if (pathParts.length == 2) @@ -193,7 +181,7 @@ var withoutExtension:String = fileRemainder.split(".")[0]; var pattern:RegExp = /\\/g; withoutExtension = withoutExtension.replace(pattern, "/"); - _trace(withoutExtension); + _strace(withoutExtension); graphicPath.text = withoutExtension; if (withoutExtension.indexOf("Backgrounds") > -1) diff --git a/PNGExportHelper.as b/PNGExportHelper.as index 667d15f..f8c4c9d 100644 --- a/PNGExportHelper.as +++ b/PNGExportHelper.as @@ -74,7 +74,7 @@ output.copyPixels(bd, new Rectangle(ox * scale, oy * scale, scale, scale), new Point(ox * scale, oy * scale)); continue; } else { - //_trace(scaleda+""); + //_strace(scaleda+""); } diff --git a/Packer/AsyncGraphicPacker.as b/Packer/AsyncGraphicPacker.as index c20aec9..ae68d5c 100644 --- a/Packer/AsyncGraphicPacker.as +++ b/Packer/AsyncGraphicPacker.as @@ -163,7 +163,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); clipIndex++; } @@ -225,7 +225,7 @@ output.writeUnsignedInt(png.length); output.writeBytes(png); pngSheets.push(png); - _trace("PNG Processed Sheet "+i+" of " + sheets.length); + _strace("PNG Processed Sheet "+i+" of " + sheets.length); sheetIndex++; } @@ -272,7 +272,7 @@ spriteNames.push(clipName); - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -280,7 +280,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -374,7 +374,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); if (outputFormat == "json_png_set") { @@ -912,7 +912,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/Packer/GraphicPacker.as b/Packer/GraphicPacker.as index bfee014..dbaf85b 100644 --- a/Packer/GraphicPacker.as +++ b/Packer/GraphicPacker.as @@ -132,7 +132,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); } var fontSpritesByName = {}; @@ -196,7 +196,7 @@ clipName = orig.name; } } - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -204,7 +204,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -234,7 +234,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); return output; } @@ -681,7 +681,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/NewGraphicDialog.as b/NewGraphicDialog.as index aa2ec1f..152011c 100644 --- a/NewGraphicDialog.as +++ b/NewGraphicDialog.as @@ -94,19 +94,7 @@ var graphicDef = new GraphicDef(graphicData); this.Hide(); - graphicExport.ExportGraphicDef(graphicDef); - } - - public function NewGraphicAdded(results) - { - if (results.okay == true) - { - var graphicDef = new GraphicDef(results.graphic_define); - DialogManager.Instance().ShowMessageBox("Added graphic "+graphicDef.ID+". Export Now?", "Export", "No", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); } ); - } else { - var graphicDef = GameData.Instance().GetGraphicDefByID(results.graphic_id); - DialogManager.Instance().ShowMessageBox("Graphic Already Existed!", "Re-Export", "Cancel", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); }); - } + graphicExport.ExportItem(graphicDef); } var selectedType = 1; @@ -184,7 +172,7 @@ private function openFile(event:Event):void { - _trace(event.target.nativePath); + _strace(event.target.nativePath); var path:String = event.target.nativePath; var pathParts:Array = path.split("Graphics\\"); if (pathParts.length == 2) @@ -193,7 +181,7 @@ var withoutExtension:String = fileRemainder.split(".")[0]; var pattern:RegExp = /\\/g; withoutExtension = withoutExtension.replace(pattern, "/"); - _trace(withoutExtension); + _strace(withoutExtension); graphicPath.text = withoutExtension; if (withoutExtension.indexOf("Backgrounds") > -1) diff --git a/PNGExportHelper.as b/PNGExportHelper.as index 667d15f..f8c4c9d 100644 --- a/PNGExportHelper.as +++ b/PNGExportHelper.as @@ -74,7 +74,7 @@ output.copyPixels(bd, new Rectangle(ox * scale, oy * scale, scale, scale), new Point(ox * scale, oy * scale)); continue; } else { - //_trace(scaleda+""); + //_strace(scaleda+""); } diff --git a/Packer/AsyncGraphicPacker.as b/Packer/AsyncGraphicPacker.as index c20aec9..ae68d5c 100644 --- a/Packer/AsyncGraphicPacker.as +++ b/Packer/AsyncGraphicPacker.as @@ -163,7 +163,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); clipIndex++; } @@ -225,7 +225,7 @@ output.writeUnsignedInt(png.length); output.writeBytes(png); pngSheets.push(png); - _trace("PNG Processed Sheet "+i+" of " + sheets.length); + _strace("PNG Processed Sheet "+i+" of " + sheets.length); sheetIndex++; } @@ -272,7 +272,7 @@ spriteNames.push(clipName); - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -280,7 +280,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -374,7 +374,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); if (outputFormat == "json_png_set") { @@ -912,7 +912,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/Packer/GraphicPacker.as b/Packer/GraphicPacker.as index bfee014..dbaf85b 100644 --- a/Packer/GraphicPacker.as +++ b/Packer/GraphicPacker.as @@ -132,7 +132,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); } var fontSpritesByName = {}; @@ -196,7 +196,7 @@ clipName = orig.name; } } - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -204,7 +204,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -234,7 +234,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); return output; } @@ -681,7 +681,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/Utils.as b/Utils.as index 6cee277..b24dd91 100644 --- a/Utils.as +++ b/Utils.as @@ -257,13 +257,13 @@ // The version number is a list of items divided by "," var versionArray:Array = versionNumber.split(","); var length:Number = versionArray.length; - //for(var i:Number = 0; i < length; i++) trace("versionArray["+i+"]: "+versionArray[i]); + //for(var i:Number = 0; i < length; i++) _strace("versionArray["+i+"]: "+versionArray[i]); // The main version contains the OS type too so we split it in two // and we'll have the OS type and the major version number separately. var platformAndVersion:Array = versionArray[0].split(" "); - //for(var j:Number = 0; j < 2; j++) trace("platformAndVersion["+j+"]: "+platformAndVersion[j]); - //trace("-----"); + //for(var j:Number = 0; j < 2; j++) _strace("platformAndVersion["+j+"]: "+platformAndVersion[j]); + //_strace("-----"); var majorVersion:Number = parseInt(platformAndVersion[1]); var minorVersion:Number = parseInt(versionArray[1]); @@ -293,7 +293,7 @@ public static function WallPublish(title:String, desc1:String, desc2:String, image:String, url = null, action = null) { if (Utils.ExitFullScreenCallback) Utils.ExitFullScreenCallback(); - //trace(title + "\n" + desc1 + "\n" + desc2 + "\n" + image + "\n"); + //_strace(title + "\n" + desc1 + "\n" + desc2 + "\n" + image + "\n"); ExternalInterface.call("askToPublish", title, url, desc1, desc2, image, action); //if (Settings.Platform == Settings.HI5) { @@ -311,7 +311,7 @@ } catch (e) { - _trace(e.message); + _strace(e.message); } } @@ -323,7 +323,7 @@ } catch (e) { - _trace(e.message); + _strace(e.message); } } @@ -340,7 +340,7 @@ public static function Finish(e:TweenEvent) { - //trace("done " + e.currentTarget.obj.x + " " + e.currentTarget.obj.y + " " + e.currentTarget.obj.scaleX + " " + e.currentTarget.obj.scaleY); + //_strace("done " + e.currentTarget.obj.x + " " + e.currentTarget.obj.y + " " + e.currentTarget.obj.scaleX + " " + e.currentTarget.obj.scaleY); e.currentTarget.removeEventListener(TweenEvent.MOTION_FINISH, Finish); } public static function Popup(mc, startScale = 0.8, finishCallback = null) @@ -666,16 +666,16 @@ } public static function var_dump(_obj, name = "Dump") { - _trace(name + " " + (_obj) + " {"); + _strace(name + " " + (_obj) + " {"); flash.utils.describeType(_obj); var varList:XMLList = flash.utils.describeType(_obj)..variable; for(var i:int; i < varList.length(); i++) { //Show the name and the value - _trace(" " + varList[i].@name+' = '+ _obj[varList[i].@name]); + _strace(" " + varList[i].@name+' = '+ _obj[varList[i].@name]); } - _trace("}"); + _strace("}"); } public static function SetChildFrames(parentClip, frame, exclude = null) @@ -1195,7 +1195,7 @@ try { throw new Error('StackTrace'); } catch (e:Error) { - _trace(e.getStackTrace()); + _strace(e.getStackTrace()); } } } diff --git a/CharacterExport/CharacterExporter.as b/CharacterExport/CharacterExporter.as index 5c63402..d3a2331 100644 --- a/CharacterExport/CharacterExporter.as +++ b/CharacterExport/CharacterExporter.as @@ -424,7 +424,7 @@ { if (pieces[i].Matches(pieces[j].FullData, null)) { - _trace("MATCHING PIECES: " + i + " " + j); + _strace("MATCHING PIECES: " + i + " " + j); } } } @@ -1028,7 +1028,7 @@ var folderIndex = scriptPath.lastIndexOf("/"); var scriptFolder = scriptPath.substr(0, folderIndex + 1); - _trace(scriptFolder); + _strace(scriptFolder); var templatePath = scriptFolder + "template.txt"; @@ -1175,7 +1175,7 @@ } else { - _trace("Missing Piece " + clipName); + _strace("Missing Piece " + clipName); } } @@ -1309,7 +1309,7 @@ { if (timeline.layers[animParts - j - 1].frames[i].elements.length == 0) { - _trace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); + _strace("UHOH" + animParts + " " + i + " " + j + " " + usedParts.length); } timeline.layers[animParts - j - 1].frames[i].elements[0].matrix = usedParts[j].transform; } diff --git a/CharacterExport/CharacterSequence.as b/CharacterExport/CharacterSequence.as index 30a8244..dcf8c18 100644 --- a/CharacterExport/CharacterSequence.as +++ b/CharacterExport/CharacterSequence.as @@ -111,7 +111,7 @@ protected function RecursePieces(graphic:MovieClip, frame, depth, parentMatrix:Matrix) { - _trace(depth+" "+graphic.name+" frame:"+frame); + _strace(depth+" "+graphic.name+" frame:"+frame); var mat:Matrix = graphic.transform.matrix.clone(); mat.concat(parentMatrix); @@ -589,7 +589,7 @@ try { bd = new BitmapData(Math.min(512, r.width), Math.min(512, r.height), true, 0x0); } catch (e){ - _trace("failed to create bitmap data"); + _strace("failed to create bitmap data"); } diff --git a/FileExportSet.as b/FileExportSet.as index 90a2a41..3df339d 100644 --- a/FileExportSet.as +++ b/FileExportSet.as @@ -103,7 +103,7 @@ loader.load(uploadRequest); - _trace("uploading "+filename); + _strace("uploading "+filename); } else { if(completeCallback) completeCallback(); @@ -112,13 +112,13 @@ public function onLoaded(event) { - _trace("Upload Complete"); + _strace("Upload Complete"); UploadNextFile(); } function catchIOError(event:IOErrorEvent) { - trace("Error caught: "+event.type); + _strace("Error caught: "+event.type); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml index e210f14..5144634 100755 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport diff --git a/GraphicExport.as b/GraphicExport.as index 5bf366e..c46c218 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -52,9 +52,10 @@ var UILayer:MovieClip = new MovieClip(); public static var ISLOCAL = true; public static var wrapper:Socket = null; + private static var instance:GraphicExport = null; public function GraphicExport() { - + instance = this; GraphicFactory.FAILEDGRAPHICASBLANK = true; GameSettings.ISLOCAL = true; @@ -161,7 +162,7 @@ var graphicDef = new Defs.GraphicDef(graphicData); - ExportItem(graphicDef.ID, + ExportItem(graphicDef, function() { SendCommand({command:"done", job_num:parseInt(job.job_num)}); @@ -177,7 +178,11 @@ if (wrapper != null) { wrapper.writeUTF(com.adobe.serialization.json.JSON.encode(obj)); - wrapper.flush(); + wrapper.flush(); + //if (obj.hasOwnProperty("command") && obj.command == "print") + //{ + // instance.Log(obj.string); + //} } } @@ -202,7 +207,7 @@ public function Init() { - _trace("Initializing game params!!"); + _strace("Initializing game params!!"); //Set a scale mode for window resizing stage.align = StageAlign.TOP_LEFT; @@ -221,7 +226,6 @@ stage.addEventListener(Event.ENTER_FRAME, EnterFrame); - stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp); this.addChild(previewHolder); CreateUI(); @@ -315,21 +319,6 @@ { newGraphicDialog.Show(this); } - - public function ExportGraphicDef(graphicDef) - { - ExportItem(graphicDef.ID, DoneAll); - } - - public function ExportGraphicDefs(graphicDefs:Array) - { - var graphicIDs = new Array(); - for(var i = 0; i < graphicDefs.length; i++) - { - graphicIDs.push(graphicDefs[i].ID); - } - ExportItems(graphicIDs, DoneAll); - } var skeletalScale = 1; private function SkeletalScaleChanged(e:Event) @@ -377,124 +366,18 @@ } protected var graphicPreloader:GraphicPreloader = new GraphicPreloader(); - protected function KeyUp(e:KeyboardEvent) - { - if (this.stage.focus is TextField) return; - - if (e.keyCode == Keyboard.P) - { - HeroSpriteLoader.Instance().BeginLoadingHeroes(null); - graphicPreloader.PackHeros(/*true*/); - } - - if (e.keyCode == Keyboard.I) - { - ExportAsset(1); - } - - } - - protected function ExportAll(doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } - - protected function ExportByUse(useType, doItems = true, doAssets = true, startingGraphicID = 1, endingGraphicID = 999999) - { - ActivateExportButtons(false); - - var items:Array = []; - var assets:Array = []; - - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ID < startingGraphicID || defs[i].ID > endingGraphicID) continue; - - if (defs[i].ExportParams.hasOwnProperty("uses") && defs[i].ExportParams.uses.indexOf(useType) != -1) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id")) - { - if (doAssets && assets.indexOf(defs[i].ExportParams.asset_id) == -1) - { - assets.push(defs[i].ExportParams.asset_id); - } - } else { - if (doItems && items.indexOf(defs[i].ID) == -1) - { - items.push(defs[i].ID); - } - } - } - } - - ExportItems(items, function() - { - ExportAssets(assets, DoneAll); - }); - } protected function DoneAll() { ActivateExportButtons(true); - _trace("========= DONE ALL ========="); - } - - protected function ExportItems(items:Array, callback) - { - if (items.length == 0) - { - if (callback) callback(); - } else { - var itemId = items.shift(); - ExportItem(itemId, function(){ExportItems(items, callback);}); - } - } - - protected function ExportAssets(assets:Array, callback) - { - if (assets.length == 0) - { - if (callback) callback(); - } else { - var assetId = assets.shift(); - ExportAsset(assetId, function(){ExportAssets(assets, callback);}); - } + _strace("========= DONE ALL ========="); } protected var lastCallback; - protected function ExportItem(graphicId, callback = null) + public function ExportItem(def:Defs.GraphicDef, callback = null) { this.lastCallback = callback; - var def:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(graphicId); - Log("Exporting " + graphicId + " " + def != null); + Log("Exporting " + def.ID + " " + def != null); var graphicDefs:Array = [def]; var type = def.Type; @@ -505,7 +388,7 @@ assetDef = GameData.Instance().GetGraphicDefByID(def.ExportParams.asset_id); type = assetDef.Type; } - + Log(" type: " + type); switch (type) { case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: @@ -538,73 +421,11 @@ scenePacker.ExportDef(graphicDefs[0]); break; default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); + _strace("COULDN'T DETERMINE EXPORT FORMAT"); break; } } - - protected function ExportAsset(assetId, callback = null) - { - - ActivateExportButtons(false); - - this.lastCallback = callback; - var graphicDefs:Array = []; - var defs:Array = GameData.Instance().GraphicDefines; - for (var i in defs) - { - if (defs[i].ExportParams.hasOwnProperty("asset_id") && defs[i].ExportParams.asset_id == assetId) - { - graphicDefs.push(defs[i]); - } - } - - _trace(graphicDefs.length); - - var assetDef:Defs.GraphicDef = GameData.Instance().GetGraphicDefByID(assetId); - if (assetDef) - { - switch (assetDef.Type) - { - case Defs.GraphicDef.EXPORT_FORMAT_SPRITESHEET: - if (assetDef.ExportParams.hasOwnProperty("export_animation")) - { - var graphicPacker:AsyncGraphicPacker = new AsyncGraphicPacker(); - graphicPacker.ExportDefs(graphicDefs, DoneAsset, assetDef); - } else { - var iconPacker:IconPacker = new IconPacker(DoneAsset, assetDef, previewHolder, outputFormat); - iconPacker.ExportDefs(graphicDefs); - } - break; - case Defs.GraphicDef.EXPORT_FORMAT_CACHEDCLIP: - break; - case Defs.GraphicDef.EXPORT_FORMAT_SKELANIM: - var skelPacker:SkelAnimPacker = new SkelAnimPacker(DoneAsset, assetDef, previewHolder, - assetDef.ExportParams.hasOwnProperty("export_type") ? assetDef.ExportParams.export_type : null, skeletalScale); - skelPacker.ExportDefs(graphicDefs); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMSETS: - throw new Error("Assetified Animation Sets are not supported! (Just put multiple avatars in this def)"); - break; - case Defs.GraphicDef.EXPORT_FORMAT_ANIMPIECES: - var animPiecePacker:AnimPiecePacker = new AnimPiecePacker(DoneAsset, assetDef, previewHolder); - animPiecePacker.ExportDefs(graphicDefs); - break; - default: - _trace("COULDN'T DETERMINE EXPORT FORMAT"); - break; - } - } - } - - // TODO: make this more generic... - public static const UPLOAD = 0; - public static const SAVE = 1; - public static const TEST = 2; - - protected var saveMode = SAVE; - public function Log(logStr) { logText.text += logStr + "\n"; @@ -630,21 +451,7 @@ fileExport.Add(assetDef.Name, output); } - if (saveMode == SAVE) - { - fileExport.Save(lastCallback); - } - - /* - if (saveMode == UPLOAD) - { - var uploadURL = ""; - - fileExport.Upload(uploadURL, assetDef.Folder, lastCallback); - } - */ - - if (saveMode == TEST && lastCallback) lastCallback(); + fileExport.Save(lastCallback); } diff --git a/GraphicExport.exe b/GraphicExport.exe index df2c899..56315aa 100755 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 2050547..542db97 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/GraphicExport/IconPacker.as b/GraphicExport/IconPacker.as index b313e01..e8df65e 100644 --- a/GraphicExport/IconPacker.as +++ b/GraphicExport/IconPacker.as @@ -150,7 +150,7 @@ protected function GraphicLoaded(caller, g) { - _trace(currentDef.Name); + _strace(currentDef.Name); var bounds:Rectangle = CacheManager.Instance().GetAccurateBounds(g, 2048); if (currentDef.ExportParams.hasOwnProperty("available_sizes")) @@ -343,7 +343,7 @@ if (clip.height < 35 && clip.parent != null) { clip.visible = false; - _trace("removed clip that was "+clip.height+ " tall"); + _strace("removed clip that was "+clip.height+ " tall"); } for(var i = 0; i < clip.numChildren; i++) { diff --git a/GraphicExport/ScenePacker.as b/GraphicExport/ScenePacker.as index 1b70a5f..e2e025b 100644 --- a/GraphicExport/ScenePacker.as +++ b/GraphicExport/ScenePacker.as @@ -75,7 +75,7 @@ if (child is MovieClip && (child.width > 1024 || child.height > 1024)) { var chunkedChild = new ChunkedGraphic(child, 500); - _trace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); + _strace("Chunked child graphic, added "+chunkedChild.numChildren+" chunks!"); g.removeChildAt(i); var chunkID = 0; @@ -136,7 +136,7 @@ { str += key + " => " + childData[key] + " "; } - _trace(str); + _strace(str); } } diff --git a/NewGraphicDialog.as b/NewGraphicDialog.as index aa2ec1f..152011c 100644 --- a/NewGraphicDialog.as +++ b/NewGraphicDialog.as @@ -94,19 +94,7 @@ var graphicDef = new GraphicDef(graphicData); this.Hide(); - graphicExport.ExportGraphicDef(graphicDef); - } - - public function NewGraphicAdded(results) - { - if (results.okay == true) - { - var graphicDef = new GraphicDef(results.graphic_define); - DialogManager.Instance().ShowMessageBox("Added graphic "+graphicDef.ID+". Export Now?", "Export", "No", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); } ); - } else { - var graphicDef = GameData.Instance().GetGraphicDefByID(results.graphic_id); - DialogManager.Instance().ShowMessageBox("Graphic Already Existed!", "Re-Export", "Cancel", function(ok) { this.Hide(); if (ok) graphicExport.ExportGraphicDef(graphicDef); }); - } + graphicExport.ExportItem(graphicDef); } var selectedType = 1; @@ -184,7 +172,7 @@ private function openFile(event:Event):void { - _trace(event.target.nativePath); + _strace(event.target.nativePath); var path:String = event.target.nativePath; var pathParts:Array = path.split("Graphics\\"); if (pathParts.length == 2) @@ -193,7 +181,7 @@ var withoutExtension:String = fileRemainder.split(".")[0]; var pattern:RegExp = /\\/g; withoutExtension = withoutExtension.replace(pattern, "/"); - _trace(withoutExtension); + _strace(withoutExtension); graphicPath.text = withoutExtension; if (withoutExtension.indexOf("Backgrounds") > -1) diff --git a/PNGExportHelper.as b/PNGExportHelper.as index 667d15f..f8c4c9d 100644 --- a/PNGExportHelper.as +++ b/PNGExportHelper.as @@ -74,7 +74,7 @@ output.copyPixels(bd, new Rectangle(ox * scale, oy * scale, scale, scale), new Point(ox * scale, oy * scale)); continue; } else { - //_trace(scaleda+""); + //_strace(scaleda+""); } diff --git a/Packer/AsyncGraphicPacker.as b/Packer/AsyncGraphicPacker.as index c20aec9..ae68d5c 100644 --- a/Packer/AsyncGraphicPacker.as +++ b/Packer/AsyncGraphicPacker.as @@ -163,7 +163,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); clipIndex++; } @@ -225,7 +225,7 @@ output.writeUnsignedInt(png.length); output.writeBytes(png); pngSheets.push(png); - _trace("PNG Processed Sheet "+i+" of " + sheets.length); + _strace("PNG Processed Sheet "+i+" of " + sheets.length); sheetIndex++; } @@ -272,7 +272,7 @@ spriteNames.push(clipName); - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -280,7 +280,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -374,7 +374,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); if (outputFormat == "json_png_set") { @@ -912,7 +912,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/Packer/GraphicPacker.as b/Packer/GraphicPacker.as index bfee014..dbaf85b 100644 --- a/Packer/GraphicPacker.as +++ b/Packer/GraphicPacker.as @@ -132,7 +132,7 @@ CacheClip(clips[sorted[i]], sprite); sprites.push(sprite); spriteOriginalClips.push(clips[sorted[i]]); - _trace("cached clip "+i+" of "+clips.length); + _strace("cached clip "+i+" of "+clips.length); } var fontSpritesByName = {}; @@ -196,7 +196,7 @@ clipName = orig.name; } } - trace("Exporting "+clipName); + _strace("Exporting "+clipName); output.writeUnsignedInt(clipName.length); output.writeMultiByte(clipName, "us-ascii"); output.writeUnsignedInt(tex.NumSequences()); @@ -204,7 +204,7 @@ { var info:SequenceInfo = tex.GetSequenceInfo(j); output.writeUnsignedInt(info.Length); - trace("With "+info.Length+" Frames"); + _strace("With "+info.Length+" Frames"); for (var k = 0; k < info.Length; k++) { output.writeUnsignedInt(sheets.indexOf(info.FrameTextures[k])); @@ -234,7 +234,7 @@ var fr:FileReference = new FileReference(); fr.save(output, "data.pak"); } - trace("done. num sheets: " + sheets.length); + _strace("done. num sheets: " + sheets.length); return output; } @@ -681,7 +681,7 @@ if (localSheets.length < endFrame - startFrame + 1) { - trace("GraphicPacker: Problem caching"); + _strace("GraphicPacker: Problem caching"); } for (var j = 0; j < offsets.length; j++) diff --git a/Utils.as b/Utils.as index 6cee277..b24dd91 100644 --- a/Utils.as +++ b/Utils.as @@ -257,13 +257,13 @@ // The version number is a list of items divided by "," var versionArray:Array = versionNumber.split(","); var length:Number = versionArray.length; - //for(var i:Number = 0; i < length; i++) trace("versionArray["+i+"]: "+versionArray[i]); + //for(var i:Number = 0; i < length; i++) _strace("versionArray["+i+"]: "+versionArray[i]); // The main version contains the OS type too so we split it in two // and we'll have the OS type and the major version number separately. var platformAndVersion:Array = versionArray[0].split(" "); - //for(var j:Number = 0; j < 2; j++) trace("platformAndVersion["+j+"]: "+platformAndVersion[j]); - //trace("-----"); + //for(var j:Number = 0; j < 2; j++) _strace("platformAndVersion["+j+"]: "+platformAndVersion[j]); + //_strace("-----"); var majorVersion:Number = parseInt(platformAndVersion[1]); var minorVersion:Number = parseInt(versionArray[1]); @@ -293,7 +293,7 @@ public static function WallPublish(title:String, desc1:String, desc2:String, image:String, url = null, action = null) { if (Utils.ExitFullScreenCallback) Utils.ExitFullScreenCallback(); - //trace(title + "\n" + desc1 + "\n" + desc2 + "\n" + image + "\n"); + //_strace(title + "\n" + desc1 + "\n" + desc2 + "\n" + image + "\n"); ExternalInterface.call("askToPublish", title, url, desc1, desc2, image, action); //if (Settings.Platform == Settings.HI5) { @@ -311,7 +311,7 @@ } catch (e) { - _trace(e.message); + _strace(e.message); } } @@ -323,7 +323,7 @@ } catch (e) { - _trace(e.message); + _strace(e.message); } } @@ -340,7 +340,7 @@ public static function Finish(e:TweenEvent) { - //trace("done " + e.currentTarget.obj.x + " " + e.currentTarget.obj.y + " " + e.currentTarget.obj.scaleX + " " + e.currentTarget.obj.scaleY); + //_strace("done " + e.currentTarget.obj.x + " " + e.currentTarget.obj.y + " " + e.currentTarget.obj.scaleX + " " + e.currentTarget.obj.scaleY); e.currentTarget.removeEventListener(TweenEvent.MOTION_FINISH, Finish); } public static function Popup(mc, startScale = 0.8, finishCallback = null) @@ -666,16 +666,16 @@ } public static function var_dump(_obj, name = "Dump") { - _trace(name + " " + (_obj) + " {"); + _strace(name + " " + (_obj) + " {"); flash.utils.describeType(_obj); var varList:XMLList = flash.utils.describeType(_obj)..variable; for(var i:int; i < varList.length(); i++) { //Show the name and the value - _trace(" " + varList[i].@name+' = '+ _obj[varList[i].@name]); + _strace(" " + varList[i].@name+' = '+ _obj[varList[i].@name]); } - _trace("}"); + _strace("}"); } public static function SetChildFrames(parentClip, frame, exclude = null) @@ -1195,7 +1195,7 @@ try { throw new Error('StackTrace'); } catch (e:Error) { - _trace(e.getStackTrace()); + _strace(e.getStackTrace()); } } } diff --git a/_strace.as b/_strace.as index d2d2d0d..843015c 100644 --- a/_strace.as +++ b/_strace.as @@ -3,9 +3,6 @@ public function _strace(str) { _trace(str); - if (GraphicExport.wrapper != null) - { - GraphicExport.SendCommand({command:"print",string:str + "\n"}); - } + GraphicExport.SendCommand({command:"print",string:str + "\n"}); } } \ No newline at end of file