当前位置: 首页>>代码示例>>C++>>正文


C++ SimObject::getClassRep方法代码示例

本文整理汇总了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;
   }
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:25,代码来源:c_scripting.cpp

示例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;
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:11,代码来源:field.cpp

示例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;
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:17,代码来源:group.cpp

示例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 );
        }
    }
}
开发者ID:03050903,项目名称:Torque3D,代码行数:74,代码来源:tamlBinaryReader.cpp


注:本文中的SimObject::getClassRep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。