MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetVariable

Method GetVariable

trinity/Tr2VariableStore.cpp:338–356  ·  view source on GitHub ↗

------------------------------------------------------------- Description: Searches for a variable the given name in this store and its parents. If the variable is not found the function registers it in this store (with type TRIVARIABLE_INVALID). Arguments: name - Name of the variable to unregister. Return Value: Variable with the given name. -------------------------------------------------------

Source from the content-addressed store, hash-verified

336// Variable with the given name.
337// -------------------------------------------------------------
338TriVariable* Tr2VariableStore::GetVariable( const char* name )
339{
340 Tr2VariableStore* store = this;
341 while( store )
342 {
343 if( TriVariable* variable = store->FindLocalVariable( name ) )
344 {
345 return variable;
346 }
347 store = store->GetParentVariableStore();
348 }
349
350 TriVariablePtr var;
351 var.CreateInstance();
352 var->m_type = TRIVARIABLE_INVALID;
353 var->m_name = name;
354 m_variableMap[name] = var;
355 return var;
356}
357
358// -------------------------------------------------------------
359// Description:

Callers 6

DrawHelperMethod · 0.45
RegisterVariableMethod · 0.45
PyGetVariableFunction · 0.45
MapPassResourcesMethod · 0.45
MapPassParametersMethod · 0.45
InitializeMethod · 0.45

Calls 3

FindLocalVariableMethod · 0.80
CreateInstanceMethod · 0.80

Tested by

no test coverage detected