From 00c27095f71e72a480e7c574abf97bd96ab72118 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 22 Dec 2022 00:02:34 -0600 Subject: [PATCH] Establishes a common namespace for Module ScopeSet objects to make it easier to work with function calls out of module namespaces --- Engine/source/module/moduleManager.cpp | 4 ++++ .../game/core/utility/scripts/module.tscript | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index cdfd90f94..515c4ba58 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -385,6 +385,8 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup ) // Create a scope set. SimSet* pScopeSet = new SimSet; pScopeSet->registerObject( pLoadReadyModuleDefinition->getModuleId() ); + pScopeSet->setClassNamespace("ModuleRoot"); + pReadyEntry->mpModuleDefinition->mScopeSet = pScopeSet->getId(); // Increase load count. @@ -773,6 +775,8 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version // Create a scope set. SimSet* pScopeSet = new SimSet; pScopeSet->registerObject( pLoadReadyModuleDefinition->getModuleId() ); + pScopeSet->setClassNamespace("ModuleRoot"); + pReadyEntry->mpModuleDefinition->mScopeSet = pScopeSet->getId(); // Increase load count. diff --git a/Templates/BaseGame/game/core/utility/scripts/module.tscript b/Templates/BaseGame/game/core/utility/scripts/module.tscript index eceaaea1b..5c52c3ea7 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/module.tscript @@ -104,7 +104,7 @@ function loadAssetsByType(%assetType) } } -function SimSet::getModulePath(%scopeSet) +function ModuleRoot::getModulePath(%scopeSet) { %name = %scopeSet.getName(); %moduleDef = ModuleDatabase.findModule(%name); @@ -115,7 +115,7 @@ function SimSet::getModulePath(%scopeSet) return ""; } -function SimSet::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) +function ModuleRoot::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) { if ($traceModuleCalls) warn("SimSet::registerDatablock"); @@ -171,7 +171,7 @@ function SimSet::registerDatablock(%scopeSet, %datablockFilePath, %isExclusive) DatablockFilesList.echo(); } -function SimSet::unRegisterDatablock(%scopeSet, %datablockFilePath) +function ModuleRoot::unRegisterDatablock(%scopeSet, %datablockFilePath) { if ($traceModuleCalls) warn("SimSet::unRegisterDatablock"); @@ -215,7 +215,7 @@ function SimSet::unRegisterDatablock(%scopeSet, %datablockFilePath) DatablockFilesList.echo(); } -function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive) +function ModuleRoot::queueExec(%scopeSet, %execFilePath, %isExclusive) { if ($traceModuleCalls) warn("SimSet::queueExec"); @@ -272,7 +272,7 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive) %execFileList.echo(); } -function SimSet::unQueueExec(%scopeSet, %execFilePath) +function ModuleRoot::unQueueExec(%scopeSet, %execFilePath) { if ($traceModuleCalls) warn("SimSet::unRegisterDatablock"); @@ -317,10 +317,10 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath) %execFileList.echo(); } -function SimSet::GetEventManager(%this) +function ModuleRoot::GetEventManager(%scopeSet) { - if( !isObject( %this.eventManager ) ) - %this.eventManager = new EventManager() { queue = "ModuleEventManager"; }; + if( !isObject( %scopeSet.eventManager ) ) + %scopeSet.eventManager = new EventManager() { queue = "ModuleEventManager"; }; - return %this.eventManager; + return %scopeSet.eventManager; } \ No newline at end of file