Ensure that inclusion of any entity/component stuff is properly bracketed with the preprocessor check.

This commit is contained in:
Areloch 2016-05-15 10:11:46 -05:00
parent 749ac4efc2
commit b04ad52b5d
7 changed files with 75 additions and 6 deletions

View file

@ -36,7 +36,9 @@
#include "gui/editor/editorFunctions.h"
#endif
#include "console/engineAPI.h"
#ifdef TORQUE_EXPERIMENTAL_EC
#include "T3D/Entity.h"
#endif
IMPLEMENT_CONOBJECT(GuiTreeViewCtrl);
@ -645,6 +647,7 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf)
bool GuiTreeViewCtrl::Item::isParent() const
{
#ifdef TORQUE_EXPERIMENTAL_EC
//We might have a special case with entities
//So if our entity either has children, or has some component with the EditorInspect interface, we return true
if (mInspectorInfo.mObject)
@ -656,6 +659,7 @@ bool GuiTreeViewCtrl::Item::isParent() const
return true;
}
}
#endif
if(mState.test(VirtualParent))
{
@ -3786,6 +3790,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) )
onVirtualParentExpand(item);
#ifdef TORQUE_EXPERIMENTAL_EC
//Slightly hacky, but I'm not sure of a better setup until we get major update to the editors
//We check if our object is an entity, and if it is, we call a 'onInspect' function.
//This function is pretty much a special notifier to the entity so if it has any behaviors that do special
@ -3802,6 +3807,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
e->onEndInspect();
}
}
#endif
mFlags.set( RebuildVisible );
scrollVisible(item);
@ -4539,10 +4545,12 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item )
if ( !pItem )
continue;
#ifdef TORQUE_EXPERIMENTAL_EC
//A bit hackish, but we make a special exception here for items that are named 'Components', as they're merely
//virtual parents to act as a container to an Entity's components
if (pItem->mScriptInfo.mText == StringTable->insert("Components"))
continue;
#endif
SimObject *pObj = pItem->getObject();
@ -4607,10 +4615,11 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate)
// Go through our items and purge those that have disappeared from
// the set.
#ifdef TORQUE_EXPERIMENTAL_EC
//Entities will be a special case here, if we're an entity, skip this step
if (dynamic_cast<Entity*>(srcObj))
return true;
#endif
for( Item* ptr = item->mChild; ptr != NULL; )
{