mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Merge pull request #460 from Azaezel/fix/moduleHelpers
re-fix file exclusivity, readd callonmodules variable extension
This commit is contained in:
commit
47ec7e8d98
1 changed files with 32 additions and 7 deletions
|
|
@ -3,8 +3,9 @@ $reportModuleFileConflicts=true;
|
||||||
if (!isObject(ExecFilesList))
|
if (!isObject(ExecFilesList))
|
||||||
new ArrayObject(ExecFilesList);
|
new ArrayObject(ExecFilesList);
|
||||||
|
|
||||||
function callOnModules(%functionName, %moduleGroup)
|
function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
|
||||||
{
|
{
|
||||||
|
%maxvars = 7; // match this to i/o signature
|
||||||
//clear per module group file execution chain
|
//clear per module group file execution chain
|
||||||
ExecFilesList.empty();
|
ExecFilesList.empty();
|
||||||
//Get our modules so we can exec any specific client-side loading/handling
|
//Get our modules so we can exec any specific client-side loading/handling
|
||||||
|
|
@ -21,7 +22,18 @@ function callOnModules(%functionName, %moduleGroup)
|
||||||
|
|
||||||
if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName))
|
if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName))
|
||||||
{
|
{
|
||||||
eval(%module.scopeSet @ "." @ %functionName @ "();");
|
%stryng = %module.scopeSet @ "." @ %functionName @ "(";
|
||||||
|
for (%a=0;%a<%maxvars;%a++)
|
||||||
|
{
|
||||||
|
if (%var[%a] !$= "")
|
||||||
|
{
|
||||||
|
%stryng = %stryng @ %var[%a];
|
||||||
|
if (%a<%maxvars-1 && %var[%a+1] !$= "")
|
||||||
|
%stryng = %stryng @ ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%stryng = %stryng @ ");";
|
||||||
|
eval(%stryng);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,6 +81,18 @@ function loadModuleMaterials(%moduleGroup)
|
||||||
{
|
{
|
||||||
exec( %file );
|
exec( %file );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadAssetsByType(%assetType)
|
||||||
|
{
|
||||||
|
%assetQuery = new AssetQuery();
|
||||||
|
AssetDatabase.findAssetType(%assetQuery, %assetType);
|
||||||
|
%count = %assetQuery.getCount();
|
||||||
|
for(%i=0; %i < %count; %i++)
|
||||||
|
{
|
||||||
|
%assetId = %assetQuery.getAsset(%i);
|
||||||
|
%asset = AssetDatabase.acquireAsset(%assetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,9 +145,9 @@ function SimSet::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive)
|
||||||
//allows one to override exclusive with exclusive
|
//allows one to override exclusive with exclusive
|
||||||
%locked = DatablockFilesList.getValue(%i);
|
%locked = DatablockFilesList.getValue(%i);
|
||||||
|
|
||||||
if ((!%locked && !%isExclusive)&&($reportModuleFileConflicts))
|
if ((%locked && !%isExclusive)&&($reportModuleFileConflicts))
|
||||||
error("found" SPC %datablockFilePath SPC "duplicate file!");
|
error("found" SPC %datablockFilePath SPC "duplicate file!");
|
||||||
if (!%locked || (%locked && %isExclusive))
|
if (%isExclusive)
|
||||||
{ // Replacing an existing entry, update in-place
|
{ // Replacing an existing entry, update in-place
|
||||||
DatablockFilesList.setKey(%fullPath, %i);
|
DatablockFilesList.setKey(%fullPath, %i);
|
||||||
DatablockFilesList.setValue(%isExclusive, %i);
|
DatablockFilesList.setValue(%isExclusive, %i);
|
||||||
|
|
@ -221,9 +245,9 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
|
||||||
//do note that doing it in this order means setting exclusive twice
|
//do note that doing it in this order means setting exclusive twice
|
||||||
//allows one to override exclusive with exclusive
|
//allows one to override exclusive with exclusive
|
||||||
%locked = ExecFilesList.getValue(%i);
|
%locked = ExecFilesList.getValue(%i);
|
||||||
if ((!%locked && !%isExclusive)&&($reportModuleFileConflicts))
|
if ((%locked && !%isExclusive)&&($reportModuleFileConflicts))
|
||||||
error("found" SPC %execFilePath SPC "duplicate file!");
|
error("found" SPC %execFilePath SPC "duplicate file!");
|
||||||
if (!%locked || (%locked && %isExclusive))
|
if (%isExclusive)
|
||||||
{ // Replacing an existing entry, update in-place
|
{ // Replacing an existing entry, update in-place
|
||||||
ExecFilesList.setKey(%fullPath, %i);
|
ExecFilesList.setKey(%fullPath, %i);
|
||||||
ExecFilesList.setValue(%isExclusive, %i);
|
ExecFilesList.setValue(%isExclusive, %i);
|
||||||
|
|
@ -281,4 +305,5 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath)
|
||||||
}
|
}
|
||||||
if ($traceModuleCalls)
|
if ($traceModuleCalls)
|
||||||
ExecFilesList.echo();
|
ExecFilesList.echo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue