本文整理汇总了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;
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
//.........这里部分代码省略.........