mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
ModuleSystem: Lookup CInterface methods when calling module create func
This commit is contained in:
parent
68b6884665
commit
fe09d6e125
2 changed files with 15 additions and 10 deletions
|
|
@ -42,6 +42,7 @@
|
||||||
#include "persistence/taml/tamlCustom.h"
|
#include "persistence/taml/tamlCustom.h"
|
||||||
|
|
||||||
#include "sim/netObject.h"
|
#include "sim/netObject.h"
|
||||||
|
#include "cinterface/cinterface.h"
|
||||||
|
|
||||||
IMPLEMENT_CONOBJECT( SimObject );
|
IMPLEMENT_CONOBJECT( SimObject );
|
||||||
|
|
||||||
|
|
@ -831,6 +832,10 @@ bool SimObject::isMethod( const char* methodName )
|
||||||
if( !methodName || !methodName[0] )
|
if( !methodName || !methodName[0] )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (CInterface::isMethod(this->getName(), methodName) || CInterface::isMethod(this->getClassName(), methodName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
StringTableEntry stname = StringTable->insert( methodName );
|
StringTableEntry stname = StringTable->insert( methodName );
|
||||||
|
|
||||||
if( getNamespace() )
|
if( getNamespace() )
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@
|
||||||
#include "console/consoleTypes.h"
|
#include "console/consoleTypes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "cinterface/cinterface.h"
|
||||||
|
|
||||||
#ifndef _MODULE_DEFINITION_H
|
#ifndef _MODULE_DEFINITION_H
|
||||||
#include "module/moduleDefinition.h"
|
#include "module/moduleDefinition.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -837,16 +839,7 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version
|
||||||
const bool scriptFileExecuted = dAtob( Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath() ) );
|
const bool scriptFileExecuted = dAtob( Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath() ) );
|
||||||
|
|
||||||
// Did we execute the script file?
|
// Did we execute the script file?
|
||||||
if ( scriptFileExecuted )
|
if ( !scriptFileExecuted )
|
||||||
{
|
|
||||||
// Yes, so is the create method available?
|
|
||||||
if ( pScopeSet->isMethod( pLoadReadyModuleDefinition->getCreateFunction() ) )
|
|
||||||
{
|
|
||||||
// Yes, so call the create method.
|
|
||||||
Con::executef( pScopeSet, pLoadReadyModuleDefinition->getCreateFunction() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// No, so warn.
|
// No, so warn.
|
||||||
Con::errorf( "Module Manager: Cannot load explicit module Id '%s' at version Id '%d' as it failed to have the script file '%s' loaded.",
|
Con::errorf( "Module Manager: Cannot load explicit module Id '%s' at version Id '%d' as it failed to have the script file '%s' loaded.",
|
||||||
|
|
@ -854,6 +847,13 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is the create method available?
|
||||||
|
if (pScopeSet->isMethod(pLoadReadyModuleDefinition->getCreateFunction()))
|
||||||
|
{
|
||||||
|
// Yes, so call the create method.
|
||||||
|
Con::executef(pScopeSet, pLoadReadyModuleDefinition->getCreateFunction());
|
||||||
|
}
|
||||||
|
|
||||||
// Raise notifications.
|
// Raise notifications.
|
||||||
raiseModulePostLoadNotifications( pLoadReadyModuleDefinition );
|
raiseModulePostLoadNotifications( pLoadReadyModuleDefinition );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue