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


C++ SimSet::addObject方法代码示例

本文整理汇总了C++中SimSet::addObject方法的典型用法代码示例。如果您正苦于以下问题:C++ SimSet::addObject方法的具体用法?C++ SimSet::addObject怎么用?C++ SimSet::addObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimSet的用法示例。


在下文中一共展示了SimSet::addObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onAdd

bool Material::onAdd()
{
   if (Parent::onAdd() == false)
      return false;

   mCubemapData = dynamic_cast<CubemapData*>(Sim::findObject( mCubemapName ) );

   if( mTranslucentBlendOp >= NumBlendTypes || mTranslucentBlendOp < 0 )
   {
      Con::errorf( "Invalid blend op in material: %s", getName() );
      mTranslucentBlendOp = LerpAlpha;
   }

   SimSet *matSet = MATMGR->getMaterialSet();
   if( matSet )
      matSet->addObject( (SimObject*)this );

   // save the current script path for texture lookup later
   const String  scriptFile = Con::getVariable("$Con::File");  // current script file - local materials.cs

   String::SizeType  slash = scriptFile.find( '/', scriptFile.length(), String::Right );
   if ( slash != String::NPos )
      mPath = scriptFile.substr( 0, slash + 1 );

   _mapMaterial();

   return true;
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:28,代码来源:materialDefinition.cpp

示例2: handleItemDroppedOnItem

bool SimTreeView::handleItemDroppedOnItem( HTREEITEM hTarget, HTREEITEM hDropItem )
{
   bool removeFromSource=false;
	lockManager();

   HTREEITEM hParent = getParent( hTarget );
   SimSet *pTarget = (SimSet*)getObject( hParent );
   SimObject *obj = getObject(hDragItem);
   SimObject *pParent = getObject( getParent(hDropItem) );

   if ( pTarget != obj )
   {
      state.set(STV_MODIFIED);
      if ( pTarget->find(pTarget->begin(), pTarget->end(), obj) != pTarget->end() )
      {
         if ( pTarget->reOrder( obj, getObject(hTarget) ) )
            refresh( hParent );
      }
      else
      {
         if ( !dynamic_cast<SimGroup*>(pTarget) )
         {
            if ( dynamic_cast<SimGroup*>(pParent) )
               removeFromSource = false;    // Group->Set, copy
            else if ( (GetKeyState( VK_SHIFT ) & 0x80000000) == 0 )
               removeFromSource = true;     // Set->Set, but pressing shift key, copy
            else
               removeFromSource = true;     // Set->Set, copying set by menu
         }
         else if ( !dynamic_cast<SimGroup*>(pParent) )
         {
         	unlockManager();
            return false;                    // set->Group is not allowed
         }
         else
         {
            state.clear(GWTV_COPYING);       // Group->Group, moving
            removeFromSource =  true;
         }
      	pTarget->addObject(obj);
         pTarget->reOrder( obj, getObject(hTarget) );
         WinParent::handleItemDroppedOnItem( hTarget, hDropItem );
      }
   }
	unlockManager();
   return removeFromSource;  // don't modify list after return
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:47,代码来源:simTreeView.cpp

示例3: onAdd

bool tripod::onAdd()
{
	if (!ObjParent::onAdd())
		return false;

	// Post by sending an event
   addToSet(SimTimerSetId);
   SimSet *grp;

   grp = (SimSet*)manager->findObject( SimCameraSetId );
  
   if ( grp )
      grp->addObject( this );

   setEventMap();      
      
    return true;
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:18,代码来源:Tripod.cpp

示例4: clone

SimSet* SimSet::clone()
{
   // Clone the set object.
   
   SimObject* object = Parent::clone();
   SimSet* set = dynamic_cast< SimSet* >( object );
   if( !set )
   {
      object->deleteObject();
      return NULL;
   }
   
   // Add all object in the set.
   
   for( iterator iter = begin(); iter != end(); ++ iter )
      set->addObject( *iter );
   
   return set;
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:19,代码来源:simSet.cpp

示例5: onAdd

bool TerrainMaterial::onAdd()
{
   if ( !Parent::onAdd() )
      return false;

   SimSet *set = Sim::getTerrainMaterialSet();

   // Make sure we have an internal name set.
   if ( !mInternalName || !mInternalName[0] )
      Con::warnf( "TerrainMaterial::onAdd() - No internal name set!" );
   else
   {
      SimObject *object = set->findObjectByInternalName( mInternalName );
      if ( object )
         Con::warnf( "TerrainMaterial::onAdd() - Internal name collision; '%s' already exists!", mInternalName );
   }

   set->addObject( this );

   return true;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:21,代码来源:terrMaterial.cpp

示例6: onCommand

void SimTreeView::onCommand( int id, HWND hwndCtl, UINT codeNotify )
{
   hwndCtl, codeNotify;
   SimObject   *obj;
   SimSet    *prnt;
	lockManager();

   switch( id )
   {
      case IDM_EXIT:
         destroyWindow();
         break;

      case IDM_CUT:
         if ( (obj = getSelectedObject()) !=  NULL )
         {
            // persist selected object
            obj->fileStore( "temp\\clip.tmp" );

            // remove it from parent
            obj->deleteObject();
            delItem( getSelection() );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_COPY:
         if ( (obj = getSelectedObject()) !=  NULL )
            obj->fileStore( "temp\\clip.tmp" );
         break;

      case IDM_PASTE:
         {
            // unpersist object to get a duplicate
            Persistent::Base::Error err;
            obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err );
            if ( err != Ok )
               return;

            // add to simTree
            HTREEITEM hParent = getSelection();
            if ( !isItemFolder(hParent) )
               hParent = getParent( hParent );

            prnt = (SimSet*)getObject( hParent );
            prnt->getManager()->addObject( obj );
				prnt->addObject(obj);
            HTREEITEM hItem = addSet( obj, hParent );
            selectItem( hItem );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_DELETE:
         obj = getSelectedObject();
         if ( obj )
         {
            obj->deleteObject();
            delItem( getSelection() );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_REMOVE:
         obj = getSelectedObject();
         if ( obj )
         {
            prnt = getSelectedParent();
				prnt->removeObject(obj);
            delItem( getSelection() );
            state.set(STV_MODIFIED);
         }
         break;

      case IDM_DUPLICATE:
         {
            obj = getSelectedObject();
            
            // persist object to get a duplicate
            if ( obj->fileStore( "temp\\clip.tmp" ) != Ok )
            {
					unlockManager();
               return;
            }

            Persistent::Base::Error err;
            obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err );
            if ( err != Ok )
            {
					unlockManager();
               return;
            }
            // perhaps delete clip.tmp to clean up directory

            HTREEITEM hParent = getSelection();
            if ( !isItemFolder(hParent) )
               hParent = getParent( hParent );

            prnt = (SimSet*)getObject( hParent );
            prnt->getManager()->addObject( obj );
//.........这里部分代码省略.........
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:101,代码来源:simTreeView.cpp


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