mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
shift prototyping UI into tools proper
was prototyped in the prototyping module. now properly resides in tools
This commit is contained in:
parent
557101b338
commit
26d0e427de
5 changed files with 4 additions and 3 deletions
|
|
@ -37,9 +37,6 @@ function Prototyping::onDestroyGameServer(%this)
|
|||
//This is called when the client is initially set up by the game application
|
||||
function Prototyping::initClient(%this)
|
||||
{
|
||||
//class method prototyping
|
||||
%this.queueExec("./UI/classPrototyping");
|
||||
%this.queueExec("./UI/classPrototyping.gui");
|
||||
}
|
||||
|
||||
//This is called when a client connects to a server
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<GUIAsset
|
||||
AssetName="classPrototyping"
|
||||
ScriptFile="@assetFile=classPrototyping.tscript"
|
||||
GUIFile="@assetFile=classPrototyping.gui"
|
||||
VersionId="1"/>
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
$guiContent = new GuiControl(classPrototyping) {
|
||||
extent = "1024 768";
|
||||
profile = "GuiDefaultProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
isContainer = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
originalAssetName = "classPrototyping";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
text = "Class Prototyping";
|
||||
position = "216 124";
|
||||
extent = "592 519";
|
||||
horizSizing = "center";
|
||||
vertSizing = "center";
|
||||
profile = "ToolsGuiWindowProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
closeCommand = "Canvas.popDialog(classPrototyping);";
|
||||
new GuiScrollCtrl() {
|
||||
lockVertScroll = "1";
|
||||
position = "14 30";
|
||||
extent = "564 33";
|
||||
profile = "ToolsGuiScrollProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
|
||||
new GuiDynamicCtrlArrayControl(ClassInheritanceListCtrl) {
|
||||
colCount = "1";
|
||||
colSize = "80";
|
||||
rowCount = "1";
|
||||
rowSize = "18";
|
||||
autoCellSize = "1";
|
||||
fillRowFirst = "0";
|
||||
dynamicSize = "1";
|
||||
position = "1 1";
|
||||
extent = "400 18";
|
||||
profile = "GuiDefaultProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Callbacks";
|
||||
position = "24 66";
|
||||
extent = "54 14";
|
||||
profile = "ToolsGuiTextProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
new GuiScrollCtrl() {
|
||||
position = "19 80";
|
||||
extent = "552 326";
|
||||
profile = "ToolsGuiScrollProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
|
||||
new GuiDynamicCtrlArrayControl(ClassMethodListCtrl) {
|
||||
colCount = "1";
|
||||
colSize = "8000";
|
||||
rowCount = "1";
|
||||
rowSize = "18";
|
||||
dynamicSize = "1";
|
||||
extent = "552 326";
|
||||
profile = "GuiDefaultProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
BitmapAsset = "ToolsModule:iconOpen_image";
|
||||
bitmapMode = "Centered";
|
||||
position = "348 467";
|
||||
extent = "22 22";
|
||||
horizSizing = "left";
|
||||
profile = "ToolsGuiButtonProfile";
|
||||
command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setProtoTypeFilePath\");\nSelectAssetPathWindow.selectWindow();";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "New Module";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
text = "data/ExampleModule";
|
||||
position = "143 470";
|
||||
extent = "201 20";
|
||||
horizSizing = "width";
|
||||
profile = "ToolsGuiTextEditProfile";
|
||||
active = "0";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
internalName = "targetPath";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Target Path:";
|
||||
position = "20 470";
|
||||
extent = "116 17";
|
||||
profile = "ToolsGuiTextProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
text = "Save";
|
||||
position = "431 465";
|
||||
profile = "ToolsGuiButtonProfile";
|
||||
command = "classPrototyping.writeResults();";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
new GuiCheckBoxCtrl(ReportCommands) {
|
||||
text = "Report Commands";
|
||||
position = "16 420";
|
||||
extent = "125 30";
|
||||
profile = "ToolsGuiCheckBoxProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
new GuiCheckBoxCtrl(ReportVariables) {
|
||||
text = "Report Stock Variables";
|
||||
position = "152 420";
|
||||
extent = "125 30";
|
||||
profile = "ToolsGuiCheckBoxProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -1,204 +0,0 @@
|
|||
function classPrototyping::onWake(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function classPrototyping::onSleep(%this)
|
||||
{
|
||||
|
||||
}
|
||||
//PrototypeClass(MainMenuGui)
|
||||
//PrototypeClass(GuiChunkedBitmapCtrl)
|
||||
function PrototypeClass(%classInstance)
|
||||
{
|
||||
if (!isObject(%classInstance)) return;
|
||||
Canvas.pushDialog(classPrototyping);
|
||||
classPrototyping.fillClasslist(%classInstance);
|
||||
classPrototyping.SetNamespaceUsed(%classInstance);
|
||||
}
|
||||
|
||||
function classPrototyping::fillClasslist(%this, %classInstance)
|
||||
{
|
||||
ClassInheritanceListCtrl.deleteAllObjects();
|
||||
%this.instanceName = %classInstance.getName();
|
||||
|
||||
//get potentially scripted namespaces
|
||||
%class = %classInstance.getClassName();
|
||||
%prepend = "";
|
||||
if (%classInstance.getName() !$= "")
|
||||
%prepend = %classInstance.getName();
|
||||
if (%classInstance.class !$= "")
|
||||
%prepend = %prepend SPC %classInstance.class;
|
||||
if (%classInstance.superclass !$= "")
|
||||
%prepend = %prepend SPC %classInstance.superclass;
|
||||
|
||||
//append to hardcoded potential namespaces
|
||||
%this.classlist = %prepend SPC getClassHierarchy(%class);
|
||||
%this.classCount = getWordCount(%this.classlist);
|
||||
for (%i=0; %i<%this.classCount; %i++)
|
||||
{
|
||||
%inheritanceOrder = %this.classCount-(%i+1);
|
||||
%className = getWord(%this.classlist,%inheritanceOrder);
|
||||
if (%i<%this.classCount-1)
|
||||
%className = %className @"->";
|
||||
%elemClass = new GuiRadioCtrl("ProtoClassSelect"@ %i) {
|
||||
text = %className;
|
||||
entry = strreplace(%className,"->","");
|
||||
groupNum = "1";
|
||||
extent = "80 18";
|
||||
profile = "ToolsGuiRadioProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
eval("function ProtoClassSelect"@ %i @"::onClick(%this){classPrototyping.SetNamespaceUsed(%this.entry);}");
|
||||
ClassInheritanceListCtrl.addGuiControl(%elemClass);
|
||||
}
|
||||
%lastElem = "ProtoClassSelect"@ %this.classCount-1;
|
||||
%lastElem.setStateOn(true);
|
||||
}
|
||||
|
||||
function classPrototyping::SetNamespaceUsed(%this, %nameSpaceUsed)
|
||||
{
|
||||
ClassMethodListCtrl.deleteAllObjects();
|
||||
%this.fillMethodlist(%nameSpaceUsed);
|
||||
}
|
||||
|
||||
function classPrototyping::fillMethodlist(%this, %nameSpaceUsed)
|
||||
{
|
||||
ClassMethodListCtrl.deleteAllObjects();
|
||||
%this.nameSpaceUsed = %nameSpaceUsed;
|
||||
%this.methodArray = getMethodSigsNS(%nameSpaceUsed);
|
||||
%this.methodCount = %this.methodArray.count();
|
||||
|
||||
for (%i=0; %i<%this.methodCount; %i++)
|
||||
{
|
||||
%methodDef = getRecord(%this.methodArray.getValue(%i),0);
|
||||
%methodName = strreplace(%methodDef,"::"," ");
|
||||
%methodName = getWord(strreplace(%methodName,"("," "),2);
|
||||
|
||||
%elemMethod = new GuiCheckBoxCtrl("ProtoMethodSelect"@ %i) {
|
||||
text = %methodName;
|
||||
position = "1 1";
|
||||
profile = "ToolsGuiCheckBoxProfile";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
};
|
||||
ClassMethodListCtrl.addGuiControl(%elemMethod);
|
||||
}
|
||||
}
|
||||
|
||||
function setProtoTypeFilePath(%targetPath)
|
||||
{
|
||||
classPrototyping-->targetPath.text = %targetPath;
|
||||
}
|
||||
|
||||
function classPrototyping::readExistingLayout(%this)
|
||||
{
|
||||
for (%i=0; %i<%this.classCount; %i++)
|
||||
{
|
||||
%inheritanceOrder = %this.classCount-(%i+1);
|
||||
%obj = "ProtoClassSelect"@ %i;
|
||||
if (%obj.isStateOn())
|
||||
%namespaceUsed = getWord(%this.classlist,%inheritanceOrder);
|
||||
}
|
||||
|
||||
%file = new FileObject();
|
||||
%filename = classPrototyping-->targetPath.text @"/"@ %namespaceUsed @"."@ $TorqueScriptFileExtension;
|
||||
|
||||
if (!isObject(%this.callbacksDefined))
|
||||
%this.callbacksDefined = new arrayobject();
|
||||
%this.callbacksDefined.empty();
|
||||
%this.reportedCommands = false;
|
||||
%this.reportedVariables = false;
|
||||
%this.callbackBlockDefined = false;
|
||||
|
||||
%key=0;
|
||||
if(%file.openForRead(%filename))
|
||||
{
|
||||
while (!%file.isEof())
|
||||
{
|
||||
%line = %file.readLine();
|
||||
|
||||
//have we already reported commands?
|
||||
if (startsWith(%line,"/* Available Commands:") )
|
||||
%this.reportedCommands = true;
|
||||
|
||||
//have we already reported variables?
|
||||
if (startsWith(%line,"/* HardCoded Variables") )
|
||||
%this.reportedVariables = true;
|
||||
|
||||
if (startsWith(%line,"/*--- Callbacks ---*/") )
|
||||
%this.callbackBlockDefined = true;
|
||||
|
||||
//get list of methods already existing
|
||||
if (startswith(%line,"function "@ %namespaceUsed) )
|
||||
{
|
||||
%methodName = strreplace(%line,"::"," ");
|
||||
%methodName = getWord(strreplace(%methodName,"("," "),2);
|
||||
%this.callbacksDefined.add(%key++,%methodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
%file.delete();
|
||||
}
|
||||
|
||||
function classPrototyping::writeResults(%this)
|
||||
{
|
||||
%namespaceUsed = "";
|
||||
for (%i=0; %i<%this.classCount; %i++)
|
||||
{
|
||||
%inheritanceOrder = %this.classCount-(%i+1);
|
||||
%obj = "ProtoClassSelect"@ %i;
|
||||
if (%obj.isStateOn())
|
||||
%namespaceUsed = getWord(%this.classlist,%inheritanceOrder);
|
||||
}
|
||||
%this.readExistingLayout();
|
||||
%file = new FileObject();
|
||||
%filename = classPrototyping-->targetPath.text @"/"@ %namespaceUsed @"."@ $TorqueScriptFileExtension;
|
||||
if(%file.openForAppend(%filename))
|
||||
{
|
||||
if (ReportCommands.isStateOn() && %this.reportedCommands == false)
|
||||
{
|
||||
%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("*/");
|
||||
}
|
||||
|
||||
if (ReportVariables.isStateOn() && %this.reportedVariables == false)
|
||||
{
|
||||
%file.writeLine("/* HardCoded Variables");
|
||||
for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++)
|
||||
{
|
||||
%file.writeLine(getFieldNS(%this.nameSpaceUsed,%i));
|
||||
}
|
||||
%file.writeLine("*/");
|
||||
}
|
||||
|
||||
if (%this.callbackBlockDefined == false)
|
||||
%file.writeLine("\n/*--- Callbacks ---*/\n");
|
||||
|
||||
for (%i=0; %i<%this.methodCount; %i++)
|
||||
{
|
||||
%obj = "ProtoMethodSelect"@ %i;
|
||||
if (%obj.isStateOn())
|
||||
{
|
||||
%methodDef = getRecord(%this.methodArray.getValue(%i),0);
|
||||
%methodName = strreplace(%methodDef,"::"," ");
|
||||
%methodName = getWord(strreplace(%methodName,"("," "),2);
|
||||
if (%this.callbacksDefined.countValue(%methodName)==0)
|
||||
{
|
||||
echo(%methodName @ "not found. defining...");
|
||||
%file.writeLine("\n" @ strreplace(%this.methodArray.getValue(%i),%this.instanceName,%namespaceUsed));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error( "Failed to open " @ %filename @ " for writing" );
|
||||
}
|
||||
%file.delete();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue