diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml old mode 100644 new mode 100755 index 3fe1fc6..e210f14 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport @@ -38,4 +38,4 @@ false false - + desktop extendedDesktop diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml old mode 100644 new mode 100755 index 3fe1fc6..e210f14 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport @@ -38,4 +38,4 @@ false false - + desktop extendedDesktop diff --git a/GraphicExport.as b/GraphicExport.as index 0dab2f4..161026f 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -114,7 +114,7 @@ for (var i = 0; i < data.length; i++) { var c = data.charAt(i); - if (c == "\n" || c == "\r") + if (c == "\0") { if (lastData != "") DispatchCommand(lastData); lastData = ""; @@ -176,6 +176,7 @@ this.addChild(previewHolder); CreateUI(); + ActivateExportButtons(false); } var exportButtons:Array = []; @@ -185,6 +186,10 @@ { exportButtons[i].Enabled = active; } + + this.heuristicCheck.Enabled = active; + this.edgeExpand.Enabled = active; + this.skeletal_scale.type = active ? TextFieldType.INPUT : TextFieldType.DYNAMIC; } protected function CreateUI() @@ -234,7 +239,6 @@ } } */ - heuristicCheck.Checked = false; heuristicCheck.OnClickParam = heuristicCheck; diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml old mode 100644 new mode 100755 index 3fe1fc6..e210f14 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport @@ -38,4 +38,4 @@ false false - + desktop extendedDesktop diff --git a/GraphicExport.as b/GraphicExport.as index 0dab2f4..161026f 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -114,7 +114,7 @@ for (var i = 0; i < data.length; i++) { var c = data.charAt(i); - if (c == "\n" || c == "\r") + if (c == "\0") { if (lastData != "") DispatchCommand(lastData); lastData = ""; @@ -176,6 +176,7 @@ this.addChild(previewHolder); CreateUI(); + ActivateExportButtons(false); } var exportButtons:Array = []; @@ -185,6 +186,10 @@ { exportButtons[i].Enabled = active; } + + this.heuristicCheck.Enabled = active; + this.edgeExpand.Enabled = active; + this.skeletal_scale.type = active ? TextFieldType.INPUT : TextFieldType.DYNAMIC; } protected function CreateUI() @@ -234,7 +239,6 @@ } } */ - heuristicCheck.Checked = false; heuristicCheck.OnClickParam = heuristicCheck; diff --git a/GraphicExport.exe b/GraphicExport.exe old mode 100644 new mode 100755 index 97303ae..51690f8 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml old mode 100644 new mode 100755 index 3fe1fc6..e210f14 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport @@ -38,4 +38,4 @@ false false - + desktop extendedDesktop diff --git a/GraphicExport.as b/GraphicExport.as index 0dab2f4..161026f 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -114,7 +114,7 @@ for (var i = 0; i < data.length; i++) { var c = data.charAt(i); - if (c == "\n" || c == "\r") + if (c == "\0") { if (lastData != "") DispatchCommand(lastData); lastData = ""; @@ -176,6 +176,7 @@ this.addChild(previewHolder); CreateUI(); + ActivateExportButtons(false); } var exportButtons:Array = []; @@ -185,6 +186,10 @@ { exportButtons[i].Enabled = active; } + + this.heuristicCheck.Enabled = active; + this.edgeExpand.Enabled = active; + this.skeletal_scale.type = active ? TextFieldType.INPUT : TextFieldType.DYNAMIC; } protected function CreateUI() @@ -234,7 +239,6 @@ } } */ - heuristicCheck.Checked = false; heuristicCheck.OnClickParam = heuristicCheck; diff --git a/GraphicExport.exe b/GraphicExport.exe old mode 100644 new mode 100755 index 97303ae..51690f8 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.fla b/GraphicExport.fla old mode 100644 new mode 100755 index 6a5c953..1bfaa36 --- a/GraphicExport.fla +++ b/GraphicExport.fla Binary files differ diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml old mode 100644 new mode 100755 index 3fe1fc6..e210f14 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport @@ -38,4 +38,4 @@ false false - + desktop extendedDesktop diff --git a/GraphicExport.as b/GraphicExport.as index 0dab2f4..161026f 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -114,7 +114,7 @@ for (var i = 0; i < data.length; i++) { var c = data.charAt(i); - if (c == "\n" || c == "\r") + if (c == "\0") { if (lastData != "") DispatchCommand(lastData); lastData = ""; @@ -176,6 +176,7 @@ this.addChild(previewHolder); CreateUI(); + ActivateExportButtons(false); } var exportButtons:Array = []; @@ -185,6 +186,10 @@ { exportButtons[i].Enabled = active; } + + this.heuristicCheck.Enabled = active; + this.edgeExpand.Enabled = active; + this.skeletal_scale.type = active ? TextFieldType.INPUT : TextFieldType.DYNAMIC; } protected function CreateUI() @@ -234,7 +239,6 @@ } } */ - heuristicCheck.Checked = false; heuristicCheck.OnClickParam = heuristicCheck; diff --git a/GraphicExport.exe b/GraphicExport.exe old mode 100644 new mode 100755 index 97303ae..51690f8 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.fla b/GraphicExport.fla old mode 100644 new mode 100755 index 6a5c953..1bfaa36 --- a/GraphicExport.fla +++ b/GraphicExport.fla Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 9a77a8b..e6508d8 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/Checkbox.as b/Checkbox.as index f9d6ccf..c5aaba2 100644 --- a/Checkbox.as +++ b/Checkbox.as @@ -5,7 +5,7 @@ public class Checkbox extends MovieClip { - + public var Enabled:Boolean = true; public function Checkbox() { checkbox.gotoAndStop(1); @@ -14,6 +14,7 @@ protected function Clicked(event) { + if (!Enabled) return; Toggle(); if (OnClick != null) OnClick(OnClickParam); } diff --git a/GraphicExport-app.xml b/GraphicExport-app.xml old mode 100644 new mode 100755 index 3fe1fc6..e210f14 --- a/GraphicExport-app.xml +++ b/GraphicExport-app.xml @@ -16,7 +16,7 @@ Japanese App name goes here --> - + GraphicExport 1.0 GraphicExport @@ -38,4 +38,4 @@ false false - + desktop extendedDesktop diff --git a/GraphicExport.as b/GraphicExport.as index 0dab2f4..161026f 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -114,7 +114,7 @@ for (var i = 0; i < data.length; i++) { var c = data.charAt(i); - if (c == "\n" || c == "\r") + if (c == "\0") { if (lastData != "") DispatchCommand(lastData); lastData = ""; @@ -176,6 +176,7 @@ this.addChild(previewHolder); CreateUI(); + ActivateExportButtons(false); } var exportButtons:Array = []; @@ -185,6 +186,10 @@ { exportButtons[i].Enabled = active; } + + this.heuristicCheck.Enabled = active; + this.edgeExpand.Enabled = active; + this.skeletal_scale.type = active ? TextFieldType.INPUT : TextFieldType.DYNAMIC; } protected function CreateUI() @@ -234,7 +239,6 @@ } } */ - heuristicCheck.Checked = false; heuristicCheck.OnClickParam = heuristicCheck; diff --git a/GraphicExport.exe b/GraphicExport.exe old mode 100644 new mode 100755 index 97303ae..51690f8 --- a/GraphicExport.exe +++ b/GraphicExport.exe Binary files differ diff --git a/GraphicExport.fla b/GraphicExport.fla old mode 100644 new mode 100755 index 6a5c953..1bfaa36 --- a/GraphicExport.fla +++ b/GraphicExport.fla Binary files differ diff --git a/GraphicExport.swf b/GraphicExport.swf index 9a77a8b..e6508d8 100644 --- a/GraphicExport.swf +++ b/GraphicExport.swf Binary files differ diff --git a/exporter.py b/exporter.py old mode 100644 new mode 100755 index b334e76..17061d7 --- a/exporter.py +++ b/exporter.py @@ -5,9 +5,55 @@ import errno import sys import os +import json +import argparse + +class ArgumentParser(argparse.ArgumentParser): + def _get_action_from_name(self, name): + """Given a name, get the Action instance registered with this parser. + If only it were made available in the ArgumentError object. It is + passed as it's first arg... + """ + container = self._actions + if name is None: + return None + for action in container: + if '/'.join(action.option_strings) == name: + return action + elif action.metavar == name: + return action + elif action.dest == name: + return action + + def has_dest(self, name): + for a in self._actions: + if a.dest == name: + return True + return False + + def error(self, message): + exc = sys.exc_info()[1] + if exc: + exc.argument = self._get_action_from_name(exc.argument_name) + raise exc + super(ArgumentParser, self).error(message) port = 7890 +job_parser = ArgumentParser(description="Specify an export job") +job_parser.add_argument("input_swf", nargs="?", help="location of a .swf file to export") +job_parser.add_argument("-t", "--type", default=1, help="export type: 1=spritesheet, 3=skeletal", choices=[1,3]) + +cmd_parser = ArgumentParser(description="Export .swf files, either from the command line or piped from stdin", parents=[job_parser], conflict_handler="resolve") +cmd_parser.add_argument("-p", "--port", default=port, help="port to use for the wrapper server", type=int) + +try: + cmd_args = cmd_parser.parse_args() +except argparse.ArgumentError, exc: + # only show cmd line errors for things *just* in the cmd_parser (we will parse other stuff later) + if cmd_parser.has_dest(exc.argument.dest) and not job_parser.has_dest(exc.argument.dest): + super(ArgumentParser, cmd_parser).error(exc.message) + s = socket.socket() s.bind(("localhost", port)) @@ -33,7 +79,8 @@ if conn: conn.setblocking(False) - conn.send("EXPORT|" + "|".join(sys.argv[1:]) + "\n") + + conn.send("EXPORT|" + "|".join(sys.argv[1:]) + "\0") while g.returncode is None: try: