mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
script fixes from latest merge and more tests
This commit is contained in:
parent
ada1c5a021
commit
838395840d
3 changed files with 58 additions and 4 deletions
|
|
@ -647,5 +647,58 @@ TEST(Script, Sugar_Syntax)
|
||||||
ASSERT_EQ(valueSetArray.getInt(), 5);
|
ASSERT_EQ(valueSetArray.getInt(), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Script, InnerObjectTests)
|
||||||
|
{
|
||||||
|
ConsoleValue theObject = RunScript(R"(
|
||||||
|
function a()
|
||||||
|
{
|
||||||
|
%obj = new SimObject(TheOuterObject)
|
||||||
|
{
|
||||||
|
innerObject = new SimObject(TheInnerObject)
|
||||||
|
{
|
||||||
|
testField = 123;
|
||||||
|
position = "1 2 3";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return %obj;
|
||||||
|
}
|
||||||
|
return a();
|
||||||
|
)");
|
||||||
|
|
||||||
|
SimObject* outerObject = Sim::findObject("TheOuterObject");
|
||||||
|
ASSERT_NE(outerObject, (SimObject*)NULL);
|
||||||
|
if (outerObject)
|
||||||
|
{
|
||||||
|
ASSERT_EQ(theObject.getInt(), Sim::findObject("TheOuterObject")->getId());
|
||||||
|
}
|
||||||
|
ASSERT_NE(Sim::findObject("TheInnerObject"), (SimObject*)NULL);
|
||||||
|
|
||||||
|
ConsoleValue positionValue = RunScript(R"(
|
||||||
|
function TheOuterObject::getInnerPosition(%this)
|
||||||
|
{
|
||||||
|
return %this.innerObject.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function a()
|
||||||
|
{
|
||||||
|
%position = TheOuterObject.getInnerPosition();
|
||||||
|
return %position.y;
|
||||||
|
}
|
||||||
|
return a();
|
||||||
|
)");
|
||||||
|
|
||||||
|
ASSERT_EQ(positionValue.getInt(), 2);
|
||||||
|
|
||||||
|
ConsoleValue nestedFuncCall = RunScript(R"(
|
||||||
|
function TheInnerObject::test(%this)
|
||||||
|
{
|
||||||
|
return %this.testField;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TheOuterObject.innerObject.test();
|
||||||
|
)");
|
||||||
|
|
||||||
|
ASSERT_EQ(nestedFuncCall.getInt(), 123);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
%guiContent = new GuiControl(ProjectImportCtrl) {
|
$guiContent = new GuiControl(ProjectImportCtrl) {
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
extent = "1024 768";
|
extent = "1024 768";
|
||||||
minExtent = "8 2";
|
minExtent = "8 2";
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ function ProjectImportWindow::selectOGFolder(%this)
|
||||||
%dlg = new OpenFolderDialog()
|
%dlg = new OpenFolderDialog()
|
||||||
{
|
{
|
||||||
Title = "Select Export Folder";
|
Title = "Select Export Folder";
|
||||||
Filters = %filter;
|
Filters = "";
|
||||||
DefaultFile = "data/";
|
DefaultFile = "data/";
|
||||||
ChangePath = false;
|
ChangePath = false;
|
||||||
MustExist = true;
|
MustExist = true;
|
||||||
|
|
@ -588,7 +588,7 @@ function processLegacyShapeConstructorField(%line)
|
||||||
if(%foundAssets != 0)
|
if(%foundAssets != 0)
|
||||||
{
|
{
|
||||||
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
||||||
echo("Legacy Project Importer - processing of legacy shape constructor addSequence line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
|
echo("Legacy Project Importer - processing of legacy shape constructor addSequence line's value: " @ %animSourcePath @ " has found a matching AssetId: " @ %assetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
|
if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
|
||||||
|
|
@ -981,6 +981,7 @@ function processGUIntoAsset(%guiName, %file)
|
||||||
warn("Processing GUI into asset: " @ %guiName @ ", file: " @ %file);
|
warn("Processing GUI into asset: " @ %guiName @ ", file: " @ %file);
|
||||||
|
|
||||||
%filePath = filePath(%file);
|
%filePath = filePath(%file);
|
||||||
|
%fileName = fileBase(%file);
|
||||||
%moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%file);
|
%moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%file);
|
||||||
%moduleName = %moduleDef.ModuleId;
|
%moduleName = %moduleDef.ModuleId;
|
||||||
%modulePath = %moduleDef.ModulePath;
|
%modulePath = %moduleDef.ModulePath;
|
||||||
|
|
@ -1182,7 +1183,7 @@ function deleteAssetDefinitions()
|
||||||
%dlg = new OpenFolderDialog()
|
%dlg = new OpenFolderDialog()
|
||||||
{
|
{
|
||||||
Title = "Select Folder";
|
Title = "Select Folder";
|
||||||
Filters = %filter;
|
Filters = "";
|
||||||
DefaultFile = "data/";
|
DefaultFile = "data/";
|
||||||
ChangePath = false;
|
ChangePath = false;
|
||||||
MustExist = true;
|
MustExist = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue