Browse Source

file saving

AzaezelX 1 year ago
parent
commit
ace243171e

+ 1 - 1
Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.gui

@@ -68,7 +68,7 @@ $guiContent = new GuiControl(classPrototyping) {
          extent = "22 22";
          extent = "22 22";
          horizSizing = "left";
          horizSizing = "left";
          profile = "ToolsGuiButtonProfile";
          profile = "ToolsGuiButtonProfile";
-         command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setAssetTargetUpdatePath\");\nSelectAssetPathWindow.selectWindow();";
+         command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setProtoTypeFilePath\");\nSelectAssetPathWindow.selectWindow();";
          tooltipProfile = "GuiToolTipProfile";
          tooltipProfile = "GuiToolTipProfile";
          tooltip = "New Module";
          tooltip = "New Module";
       };
       };

+ 35 - 22
Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.tscript

@@ -20,7 +20,6 @@ function PrototypeClass(%classInstance)
 function classPrototyping::fillClasslist(%this, %classInstance)
 function classPrototyping::fillClasslist(%this, %classInstance)
 {
 {
     ClassInheritanceListCtrl.deleteAllObjects();
     ClassInheritanceListCtrl.deleteAllObjects();
-    %this.inst = %classInstance;
     %this.instanceName = %classInstance.getName();
     %this.instanceName = %classInstance.getName();
     
     
     //get potentially scripted namespaces
     //get potentially scripted namespaces
@@ -86,6 +85,11 @@ function classPrototyping::fillMethodlist(%this, %nameSpaceUsed)
     }
     }
 }
 }
 
 
+function setProtoTypeFilePath(%targetPath)
+{
+   classPrototyping-->targetPath.text = %targetPath;
+}
+
 function classPrototyping::writeResults(%this)
 function classPrototyping::writeResults(%this)
 {
 {
     %namespaceUsed = "";
     %namespaceUsed = "";
@@ -96,33 +100,42 @@ function classPrototyping::writeResults(%this)
         if (%obj.isStateOn())
         if (%obj.isStateOn())
             %namespaceUsed = getWord(%this.classlist,%inheritanceOrder);
             %namespaceUsed = getWord(%this.classlist,%inheritanceOrder);
     }
     }
-    echo(%namespaceUsed);
-    for (%i=0; %i<%this.methodCount; %i++)
+	%file = new FileObject();
+    %filename = classPrototyping-->targetPath.text @"/"@ %namespaceUsed @"."@ $TorqueScriptFileExtension;
+	if(%file.openForWrite(%filename))
     {
     {
-        %obj = "ProtoMethodSelect"@ %i;
-        if (%obj.isStateOn())
-            echo(strreplace(%this.methodArray.getValue(%i),%this.instanceName,%namespaceUsed));
-    }
+        for (%i=0; %i<%this.methodCount; %i++)
+        {
+            %obj = "ProtoMethodSelect"@ %i;
+            if (%obj.isStateOn())
+                %file.writeLine(strreplace(%this.methodArray.getValue(%i),%this.instanceName,%namespaceUsed));
+        }
     
     
-    if (ReportCommands.isStateOn())
-    {
-        %this.commandArray = getMethodSigsNS(%this.nameSpaceUsed,true);
-        %this.commandCount = %this.commandArray.count();
-        echo("/* Available Commands:");
-        for (%i=0; %i< %this.commandCount; %i++)
+        if (ReportCommands.isStateOn())
         {
         {
-            echo(getRecord(%this.commandArray.getValue(%i),0));
+            %this.commandArray = getMethodSigsNS(%this.nameSpaceUsed,true);
+            %this.commandCount = %this.commandArray.count();
+            %file.writeLine("/* Available Commands:");
+            for (%i=0; %i< %this.commandCount; %i++)
+            {
+                %file.writeLine(getRecord(%this.commandArray.getValue(%i),0));
+            }
+            %file.writeLine("*/");
         }
         }
-        echo("*/");
-    }
     
     
-    if (ReportVariables.isStateOn())
-    {
-        echo("/* HardCoded Variables");
-        for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++)
+        if (ReportVariables.isStateOn())
         {
         {
-            echo(getFieldNS(%this.nameSpaceUsed,%i));
+            %file.writeLine("/* HardCoded Variables");
+            for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++)
+            {
+                %file.writeLine(getFieldNS(%this.nameSpaceUsed,%i));
+            }
+            %file.writeLine("*/");
         }
         }
-        echo("*/");
     }
     }
+	else
+	{
+		error( "Failed to open " @ %filename @ " for writing" );
+	}
+	%file.delete();
 }
 }