本文整理汇总了C++中SimObject::getClassRep方法的典型用法代码示例。如果您正苦于以下问题:C++ SimObject::getClassRep方法的具体用法?C++ SimObject::getClassRep怎么用?C++ SimObject::getClassRep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimObject
的用法示例。
在下文中一共展示了SimObject::getClassRep方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: script_simobject_find
S32 script_simobject_find(const char* classname, const char* name)
{
SimObject *object;
if( Sim::findObject( name, object ) )
{
// if we specified a classname do type checking
if (classname && dStrlen(classname))
{
AbstractClassRep* ocr = object->getClassRep();
while (ocr)
{
if (!dStricmp(ocr->getClassName(), classname))
return object->getId();
ocr = ocr->getParentClass();
}
}
// invalid type
return 0;
}
// didn't find object
return 0;
}
示例2: resetData
void GuiInspectorField::resetData()
{
if( !mField )
return;
SimObject* inspectObject = getInspector()->getInspectObject();
SimObject* tempObject = static_cast< SimObject* >( inspectObject->getClassRep()->create() );
setData( tempObject->getDataField( mField->pFieldname, mFieldArrayIndex ) );
delete tempObject;
}
示例3: findCommonAncestorClass
AbstractClassRep* GuiInspectorGroup::findCommonAncestorClass()
{
AbstractClassRep* classRep = getInspector()->getInspectObject( 0 )->getClassRep();
const U32 numInspectObjects = getInspector()->getNumInspectObjects();
for( U32 i = 1; i < numInspectObjects; ++ i )
{
SimObject* object = getInspector()->getInspectObject( i );
while( !object->getClassRep()->isClass( classRep ) )
{
classRep = classRep->getParentClass();
AssertFatal( classRep, "GuiInspectorGroup::findcommonAncestorClass - Walked above ConsoleObject!" );
}
}
return classRep;
}
示例4: parseChildren
void TamlBinaryReader::parseChildren( Stream& stream, TamlCallbacks* pCallbacks, SimObject* pSimObject, const U32 versionId )
{
// Debug Profiling.
PROFILE_SCOPE(TamlBinaryReader_ParseChildren);
// Sanity!
AssertFatal( pSimObject != NULL, "Taml: Cannot parse children on a NULL object." );
// Fetch children count.
U32 childrenCount;
stream.read( &childrenCount );
// Finish if no children.
if ( childrenCount == 0 )
return;
// Fetch the Taml children.
TamlChildren* pChildren = dynamic_cast<TamlChildren*>( pSimObject );
// Is this a sim set?
if ( pChildren == NULL )
{
// No, so warn.
Con::warnf("Taml: Child element found under parent but object cannot have children." );
return;
}
// Fetch any container child class specifier.
AbstractClassRep* pContainerChildClass = pSimObject->getClassRep()->getContainerChildClass( true );
// Iterate children.
for ( U32 index = 0; index < childrenCount; ++ index )
{
// Parse child element.
SimObject* pChildSimObject = parseElement( stream, versionId );
// Finish if child failed.
if ( pChildSimObject == NULL )
return;
// Do we have a container child class?
if ( pContainerChildClass != NULL )
{
// Yes, so is the child object the correctly derived type?
if ( !pChildSimObject->getClassRep()->isClass( pContainerChildClass ) )
{
// No, so warn.
Con::warnf("Taml: Child element '%s' found under parent '%s' but object is restricted to children of type '%s'.",
pChildSimObject->getClassName(),
pSimObject->getClassName(),
pContainerChildClass->getClassName() );
// NOTE: We can't delete the object as it may be referenced elsewhere!
pChildSimObject = NULL;
// Skip.
continue;
}
}
// Add child.
pChildren->addTamlChild( pChildSimObject );
// Find Taml callbacks for child.
TamlCallbacks* pChildCallbacks = dynamic_cast<TamlCallbacks*>( pChildSimObject );
// Do we have callbacks on the child?
if ( pChildCallbacks != NULL )
{
// Yes, so perform callback.
mpTaml->tamlAddParent( pChildCallbacks, pSimObject );
}
}
}