mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
select within zone pushbutton
This commit is contained in:
parent
260452645d
commit
837378a94f
2 changed files with 68 additions and 2 deletions
|
|
@ -28,6 +28,8 @@
|
||||||
#include "scene/mixin/sceneAmbientSoundObject.impl.h"
|
#include "scene/mixin/sceneAmbientSoundObject.impl.h"
|
||||||
#include "scene/mixin/scenePolyhedralObject.impl.h"
|
#include "scene/mixin/scenePolyhedralObject.impl.h"
|
||||||
|
|
||||||
|
#include "gui/worldEditor/worldEditor.h"
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_CO_NETOBJECT_V1( Zone );
|
IMPLEMENT_CO_NETOBJECT_V1( Zone );
|
||||||
|
|
||||||
|
|
@ -80,6 +82,62 @@ void Zone::consoleInit()
|
||||||
getStaticClassRep()->mIsRenderEnabled = false;
|
getStaticClassRep()->mIsRenderEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Zone::initPersistFields()
|
||||||
|
{
|
||||||
|
addProtectedField("selectAll", TypeBool, Offset(mSelecting, Zone),
|
||||||
|
&_doSelect, &defaultProtectedGetFn, "Select all in this zone", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors);
|
||||||
|
|
||||||
|
Parent::initPersistFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Zone::_doSelect(void* object, const char* index, const char* data)
|
||||||
|
{
|
||||||
|
Zone* zone = reinterpret_cast<Zone*>(object);
|
||||||
|
|
||||||
|
zone->selectWithin();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zone::selectWithin()
|
||||||
|
{
|
||||||
|
SimpleQueryList sql;
|
||||||
|
//getContainer()->polyhedronFindObjects(getPolyhedron(), 0xFFFFFFFF, SimpleQueryList::insertionCallback, &sql);
|
||||||
|
|
||||||
|
//replace the above with this once we stort out how to look up the managed zoneID from the insatnce itself
|
||||||
|
Zone* zoneClient = (Zone*)getClientObject();
|
||||||
|
SceneZoneSpaceManager* zoneManager = zoneClient->getSceneManager()->getZoneManager();
|
||||||
|
if (zoneManager)
|
||||||
|
{
|
||||||
|
for (U32 zoneId = zoneClient->mZoneRangeStart; zoneId < zoneClient->mZoneRangeStart + zoneClient->mNumZones; ++zoneId)
|
||||||
|
for (SceneZoneSpaceManager::ZoneContentIterator iter(zoneManager, zoneId, false); iter.isValid(); ++iter)
|
||||||
|
{
|
||||||
|
SceneObject* obj = (SceneObject*)iter->getServerObject();
|
||||||
|
bool fullyEnclosed = true;
|
||||||
|
|
||||||
|
for (SceneObject::ObjectZonesIterator zoneIter(obj); zoneIter.isValid(); ++zoneIter)
|
||||||
|
{
|
||||||
|
if (*zoneIter != zoneId);
|
||||||
|
fullyEnclosed = false;
|
||||||
|
}
|
||||||
|
if (fullyEnclosed)
|
||||||
|
sql.insertObject(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WorldEditor* wedit;
|
||||||
|
if (Sim::findObject("EWorldEditor", wedit))
|
||||||
|
{
|
||||||
|
wedit->clearSelection();
|
||||||
|
wedit->selectObject(this);
|
||||||
|
for (SceneObject** i = sql.mList.begin(); i != sql.mList.end(); i++)
|
||||||
|
{
|
||||||
|
wedit->selectObject(*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Console API.
|
// Console API.
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
@ -104,3 +162,9 @@ DefineEngineMethod( Zone, dumpZoneState, void, ( bool updateFirst ), ( true ),
|
||||||
{
|
{
|
||||||
object->dumpZoneState( updateFirst );
|
object->dumpZoneState( updateFirst );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(Zone, selectWithin, void, () ,,
|
||||||
|
"select a list of all objects assigned to the zone")
|
||||||
|
{
|
||||||
|
object->selectWithin();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,11 @@
|
||||||
class Zone : public SceneAmbientSoundObject< ScenePolyhedralZone >
|
class Zone : public SceneAmbientSoundObject< ScenePolyhedralZone >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool mSelecting = false;
|
||||||
|
static void initPersistFields();
|
||||||
|
static bool _doSelect(void* object, const char* index, const char* data);
|
||||||
typedef SceneAmbientSoundObject< ScenePolyhedralZone > Parent;
|
typedef SceneAmbientSoundObject< ScenePolyhedralZone > Parent;
|
||||||
|
void selectWithin();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// SceneVolume.
|
// SceneVolume.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue