MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / assignName

Method assignName

Engine/source/console/simObject.cpp:777–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775//-----------------------------------------------------------------------------
776
777void SimObject::assignName(const char *name)
778{
779 if(mObjectName && !isNameChangeAllowed() )
780 {
781 Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", mObjectName);
782 return;
783 }
784
785 // Added this assert 3/30/2007 because it is dumb to try to name
786 // a SimObject the same thing as it's class name -patw
787 //AssertFatal( dStricmp( getClassName(), name ), "Attempted to assign a name to a SimObject which matches it's type name." );
788 if( dStricmp( getClassName(), name ) == 0 )
789 Con::errorf( "SimObject::assignName - Assigning name '%s' to instance of object with type '%s'."
790 " This can cause namespace linking issues.", getClassName(), name );
791
792 StringTableEntry newName = NULL;
793 if(name[0])
794 newName = StringTable->insert(name);
795
796 onNameChange( newName );
797
798 if( mGroup )
799 mGroup->mNameDictionary.remove( this );
800 if( isProperlyAdded() )
801 {
802 unlinkNamespaces();
803 Sim::gNameDictionary->remove( this );
804 }
805
806 mObjectName = newName;
807
808 if( mGroup )
809 mGroup->mNameDictionary.insert( this );
810 if( isProperlyAdded() )
811 {
812 Sim::gNameDictionary->insert( this );
813 linkNamespaces();
814 }
815}
816
817//-----------------------------------------------------------------------------
818

Callers 15

onAddMethod · 0.80
onAddMethod · 0.80
setProtectedNameMethod · 0.80
simObject.cppFile · 0.80
execMethod · 0.80
addObjectMethod · 0.80
initRootFunction · 0.80
netConnection.cppFile · 0.80
ShadowMapPassMethod · 0.80
activateMethod · 0.80
redoMethod · 0.80
PhysicsPluginMethod · 0.80

Calls 6

dStricmpFunction · 0.85
unlinkNamespacesFunction · 0.85
linkNamespacesFunction · 0.85
errorfFunction · 0.70
insertMethod · 0.45
removeMethod · 0.45

Tested by 1

setNameMethod · 0.64