mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 15:13:45 +00:00
Merge pull request #2319 from Areloch/Scenes
Initial implementation of the Scene object
This commit is contained in:
commit
8ee1f92ba4
41 changed files with 513 additions and 144 deletions
236
Engine/source/T3D/Scene.cpp
Normal file
236
Engine/source/T3D/Scene.cpp
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
#include "Scene.h"
|
||||
|
||||
Scene * Scene::smRootScene = nullptr;
|
||||
Vector<Scene*> Scene::smSceneList;
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1(Scene);
|
||||
|
||||
Scene::Scene() :
|
||||
mIsSubScene(false),
|
||||
mParentScene(nullptr),
|
||||
mSceneId(-1),
|
||||
mIsEditing(false),
|
||||
mIsDirty(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Scene::~Scene()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Scene::initPersistFields()
|
||||
{
|
||||
Parent::initPersistFields();
|
||||
|
||||
addGroup("Internal");
|
||||
addField("isSubscene", TypeBool, Offset(mIsSubScene, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
|
||||
addField("isEditing", TypeBool, Offset(mIsEditing, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
|
||||
addField("isDirty", TypeBool, Offset(mIsDirty, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
|
||||
endGroup("Internal");
|
||||
}
|
||||
|
||||
bool Scene::onAdd()
|
||||
{
|
||||
if (!Parent::onAdd())
|
||||
return false;
|
||||
|
||||
smSceneList.push_back(this);
|
||||
mSceneId = smSceneList.size() - 1;
|
||||
|
||||
/*if (smRootScene == nullptr)
|
||||
{
|
||||
//we're the first scene, so we're the root. woo!
|
||||
smRootScene = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
mIsSubScene = true;
|
||||
smRootScene->mSubScenes.push_back(this);
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Scene::onRemove()
|
||||
{
|
||||
Parent::onRemove();
|
||||
|
||||
smSceneList.remove(this);
|
||||
mSceneId = -1;
|
||||
|
||||
/*if (smRootScene == this)
|
||||
{
|
||||
for (U32 i = 0; i < mSubScenes.size(); i++)
|
||||
{
|
||||
mSubScenes[i]->deleteObject();
|
||||
}
|
||||
}
|
||||
else if (smRootScene != nullptr)
|
||||
{
|
||||
for (U32 i = 0; i < mSubScenes.size(); i++)
|
||||
{
|
||||
if(mSubScenes[i]->getId() == getId())
|
||||
smRootScene->mSubScenes.erase(i);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void Scene::addObject(SimObject* object)
|
||||
{
|
||||
//Child scene
|
||||
Scene* scene = dynamic_cast<Scene*>(object);
|
||||
if (scene)
|
||||
{
|
||||
//We'll keep these principly separate so they don't get saved into each other
|
||||
mSubScenes.push_back(scene);
|
||||
return;
|
||||
}
|
||||
|
||||
SceneObject* sceneObj = dynamic_cast<SceneObject*>(object);
|
||||
if (sceneObj)
|
||||
{
|
||||
//We'll operate on the presumption that if it's being added via regular parantage means, it's considered permanent
|
||||
mPermanentObjects.push_back(sceneObj);
|
||||
Parent::addObject(object);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Do it like regular, though we should probably bail if we're trying to add non-scene objects to the scene?
|
||||
Parent::addObject(object);
|
||||
}
|
||||
|
||||
void Scene::removeObject(SimObject* object)
|
||||
{
|
||||
//Child scene
|
||||
Scene* scene = dynamic_cast<Scene*>(object);
|
||||
if (scene)
|
||||
{
|
||||
//We'll keep these principly separate so they don't get saved into each other
|
||||
mSubScenes.remove(scene);
|
||||
return;
|
||||
}
|
||||
|
||||
SceneObject* sceneObj = dynamic_cast<SceneObject*>(object);
|
||||
if (sceneObj)
|
||||
{
|
||||
//We'll operate on the presumption that if it's being added via regular parantage means, it's considered permanent
|
||||
|
||||
mPermanentObjects.remove(sceneObj);
|
||||
Parent::removeObject(object);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Parent::removeObject(object);
|
||||
}
|
||||
|
||||
void Scene::addDynamicObject(SceneObject* object)
|
||||
{
|
||||
mDynamicObjects.push_back(object);
|
||||
|
||||
//Do it like regular, though we should probably bail if we're trying to add non-scene objects to the scene?
|
||||
Parent::addObject(object);
|
||||
}
|
||||
|
||||
void Scene::removeDynamicObject(SceneObject* object)
|
||||
{
|
||||
mDynamicObjects.remove(object);
|
||||
|
||||
//Do it like regular, though we should probably bail if we're trying to add non-scene objects to the scene?
|
||||
Parent::removeObject(object);
|
||||
}
|
||||
|
||||
void Scene::interpolateTick(F32 delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Scene::processTick()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Scene::advanceTime(F32 timeDelta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
U32 Scene::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
|
||||
{
|
||||
bool ret = Parent::packUpdate(conn, mask, stream);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Scene::unpackUpdate(NetConnection *conn, BitStream *stream)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
Vector<SceneObject*> Scene::getObjectsByClass(String className)
|
||||
{
|
||||
return Vector<SceneObject*>();
|
||||
}
|
||||
|
||||
DefineEngineFunction(getScene, Scene*, (U32 sceneId), (0),
|
||||
"Get the root Scene object that is loaded.\n"
|
||||
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")
|
||||
{
|
||||
if (Scene::smSceneList.empty() || sceneId >= Scene::smSceneList.size())
|
||||
return nullptr;
|
||||
|
||||
return Scene::smSceneList[sceneId];
|
||||
}
|
||||
|
||||
DefineEngineFunction(getRootScene, S32, (), ,
|
||||
"Get the root Scene object that is loaded.\n"
|
||||
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")
|
||||
{
|
||||
Scene* root = Scene::getRootScene();
|
||||
|
||||
if (root)
|
||||
return root->getId();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DefineEngineMethod(Scene, getRootScene, S32, (),,
|
||||
"Get the root Scene object that is loaded.\n"
|
||||
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")
|
||||
{
|
||||
Scene* root = Scene::getRootScene();
|
||||
|
||||
if (root)
|
||||
return root->getId();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DefineEngineMethod(Scene, addDynamicObject, void, (SceneObject* sceneObj), (nullAsType<SceneObject*>()),
|
||||
"Get the root Scene object that is loaded.\n"
|
||||
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")
|
||||
{
|
||||
object->addDynamicObject(sceneObj);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Scene, removeDynamicObject, void, (SceneObject* sceneObj), (nullAsType<SceneObject*>()),
|
||||
"Get the root Scene object that is loaded.\n"
|
||||
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")
|
||||
{
|
||||
object->removeDynamicObject(sceneObj);
|
||||
}
|
||||
|
||||
DefineEngineMethod(Scene, getObjectsByClass, String, (String className), (""),
|
||||
"Get the root Scene object that is loaded.\n"
|
||||
"@return The id of the Root Scene. Will be 0 if no root scene is loaded")
|
||||
{
|
||||
if (className == String::EmptyString)
|
||||
return "";
|
||||
|
||||
//return object->getObjectsByClass(className);
|
||||
return "";
|
||||
}
|
||||
79
Engine/source/T3D/Scene.h
Normal file
79
Engine/source/T3D/Scene.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#pragma once
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#ifndef _NETOBJECT_H_
|
||||
#include "sim/netObject.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ITICKABLE_H_
|
||||
#include "core/iTickable.h"
|
||||
#endif
|
||||
|
||||
#include "scene/sceneObject.h"
|
||||
|
||||
/// Scene
|
||||
/// This object is effectively a smart container to hold and manage any relevent scene objects and data
|
||||
/// used to run things.
|
||||
class Scene : public NetObject, public virtual ITickable
|
||||
{
|
||||
typedef NetObject Parent;
|
||||
|
||||
bool mIsSubScene;
|
||||
|
||||
Scene* mParentScene;
|
||||
|
||||
Vector<Scene*> mSubScenes;
|
||||
|
||||
Vector<SceneObject*> mPermanentObjects;
|
||||
|
||||
Vector<SceneObject*> mDynamicObjects;
|
||||
|
||||
S32 mSceneId;
|
||||
|
||||
bool mIsEditing;
|
||||
|
||||
bool mIsDirty;
|
||||
|
||||
protected:
|
||||
static Scene * smRootScene;
|
||||
|
||||
DECLARE_CONOBJECT(Scene);
|
||||
|
||||
public:
|
||||
Scene();
|
||||
~Scene();
|
||||
|
||||
static void initPersistFields();
|
||||
|
||||
virtual bool onAdd();
|
||||
virtual void onRemove();
|
||||
|
||||
virtual void interpolateTick(F32 delta);
|
||||
virtual void processTick();
|
||||
virtual void advanceTime(F32 timeDelta);
|
||||
|
||||
virtual void addObject(SimObject* object);
|
||||
virtual void removeObject(SimObject* object);
|
||||
|
||||
void addDynamicObject(SceneObject* object);
|
||||
void removeDynamicObject(SceneObject* object);
|
||||
|
||||
//
|
||||
//Networking
|
||||
U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
|
||||
void unpackUpdate(NetConnection *conn, BitStream *stream);
|
||||
|
||||
//
|
||||
Vector<SceneObject*> getObjectsByClass(String className);
|
||||
|
||||
static Scene *getRootScene()
|
||||
{
|
||||
if (Scene::smSceneList.empty())
|
||||
return nullptr;
|
||||
|
||||
return Scene::smSceneList[0];
|
||||
}
|
||||
|
||||
static Vector<Scene*> smSceneList;
|
||||
};
|
||||
|
|
@ -34,6 +34,8 @@
|
|||
#include "T3D/physics/physicsShape.h"
|
||||
#include "core/util/path.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
// We use this locally ( within this file ) to prevent infinite recursion
|
||||
// while loading prefab files that contain other prefabs.
|
||||
static Vector<String> sPrefabFileStack;
|
||||
|
|
@ -269,11 +271,11 @@ void Prefab::setFile( String file )
|
|||
|
||||
SimGroup* Prefab::explode()
|
||||
{
|
||||
SimGroup *missionGroup;
|
||||
Scene* scene = Scene::getRootScene();
|
||||
|
||||
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
if ( !scene)
|
||||
{
|
||||
Con::errorf( "Prefab::explode, MissionGroup was not found." );
|
||||
Con::errorf( "Prefab::explode, Scene was not found." );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +297,7 @@ SimGroup* Prefab::explode()
|
|||
smChildToPrefabMap.erase( child->getId() );
|
||||
}
|
||||
|
||||
missionGroup->addObject(group);
|
||||
scene->addObject(group);
|
||||
mChildGroup = NULL;
|
||||
mChildMap.clear();
|
||||
|
||||
|
|
@ -468,10 +470,10 @@ Prefab* Prefab::getPrefabByChild( SimObject *child )
|
|||
|
||||
bool Prefab::isValidChild( SimObject *simobj, bool logWarnings )
|
||||
{
|
||||
if ( simobj->getName() && dStricmp(simobj->getName(),"MissionGroup") == 0 )
|
||||
if ( simobj->getName() && simobj == Scene::getRootScene() )
|
||||
{
|
||||
if ( logWarnings )
|
||||
Con::warnf( "MissionGroup is not valid within a Prefab." );
|
||||
Con::warnf( "root Scene is not valid within a Prefab." );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public:
|
|||
void setFile( String file );
|
||||
|
||||
/// Removes all children from this Prefab and puts them into a SimGroup
|
||||
/// which is added to the MissionGroup and returned to the caller.
|
||||
/// which is added to the Scene and returned to the caller.
|
||||
SimGroup* explode();
|
||||
|
||||
bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@
|
|||
#include "materials/materialDefinition.h"
|
||||
#include "T3D/prefab.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiMeshRoadEditorCtrl);
|
||||
|
||||
ConsoleDocClass( GuiMeshRoadEditorCtrl,
|
||||
|
|
@ -420,12 +422,14 @@ void GuiMeshRoadEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
|
|||
|
||||
newRoad->registerObject();
|
||||
|
||||
// Add to MissionGroup
|
||||
SimGroup *missionGroup;
|
||||
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
Con::errorf( "GuiMeshRoadEditorCtrl - could not find MissionGroup to add new MeshRoad" );
|
||||
// Add to scene
|
||||
Scene *scene;
|
||||
|
||||
scene = Scene::getRootScene();
|
||||
if ( !scene)
|
||||
Con::errorf( "GuiMeshRoadEditorCtrl - could not find Scene to add new MeshRoad" );
|
||||
else
|
||||
missionGroup->addObject( newRoad );
|
||||
scene->addObject( newRoad );
|
||||
|
||||
Point3F pos( endPnt );
|
||||
pos.z += mDefaultDepth * 0.5f;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
#include "T3D/gameBase/gameConnection.h"
|
||||
#include "T3D/prefab.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiRiverEditorCtrl);
|
||||
|
||||
ConsoleDocClass( GuiRiverEditorCtrl,
|
||||
|
|
@ -444,12 +446,12 @@ void GuiRiverEditorCtrl::_process3DMouseDown( const Gui3DMouseEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
// Add to MissionGroup
|
||||
SimGroup *missionGroup;
|
||||
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
Con::errorf( "GuiRiverEditorCtrl - could not find MissionGroup to add new River" );
|
||||
// Add to Scene
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if ( !scene )
|
||||
Con::errorf( "GuiRiverEditorCtrl - could not find root Scene to add new River" );
|
||||
else
|
||||
missionGroup->addObject( newRiver );
|
||||
scene->addObject( newRiver );
|
||||
|
||||
Point3F pos( endPnt );
|
||||
pos.z += mDefaultDepth * 0.5f;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
#include "gui/worldEditor/undoActions.h"
|
||||
#include "materials/materialDefinition.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiRoadEditorCtrl);
|
||||
|
||||
ConsoleDocClass( GuiRoadEditorCtrl,
|
||||
|
|
@ -407,12 +409,12 @@ void GuiRoadEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
|
|||
|
||||
newRoad->registerObject();
|
||||
|
||||
// Add to MissionGroup
|
||||
SimGroup *missionGroup;
|
||||
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
Con::errorf( "GuiDecalRoadEditorCtrl - could not find MissionGroup to add new DecalRoad" );
|
||||
// Add to scene
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if ( !scene )
|
||||
Con::errorf( "GuiDecalRoadEditorCtrl - could not find scene to add new DecalRoad" );
|
||||
else
|
||||
missionGroup->addObject( newRoad );
|
||||
scene->addObject( newRoad );
|
||||
|
||||
newRoad->insertNode( tPos, mDefaultWidth, 0 );
|
||||
U32 newNode = newRoad->insertNode( tPos, mDefaultWidth, 1 );
|
||||
|
|
@ -722,7 +724,7 @@ void GuiRoadEditorCtrl::renderScene(const RectI & updateRect)
|
|||
// Draw the spline based from the client-side road
|
||||
// because the serverside spline is not actually reliable...
|
||||
// Can be incorrect if the DecalRoad is before the TerrainBlock
|
||||
// in the MissionGroup.
|
||||
// in the scene.
|
||||
|
||||
if ( mHoverRoad && mHoverRoad != mSelRoad )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "scene/sceneRenderState.h"
|
||||
#include "renderInstance/renderBinManager.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(EditTSCtrl);
|
||||
ConsoleDocClass( EditTSCtrl,
|
||||
|
|
@ -795,15 +796,15 @@ void EditTSCtrl::_renderScene( ObjectRenderInst*, SceneRenderState *state, BaseM
|
|||
GFXTransformSaver saver;
|
||||
|
||||
// render through console callbacks
|
||||
SimSet * missionGroup = static_cast<SimSet*>(Sim::findObject("MissionGroup"));
|
||||
if(missionGroup)
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if(scene)
|
||||
{
|
||||
mConsoleRendering = true;
|
||||
|
||||
// [ rene, 27-Jan-10 ] This calls onEditorRender on the server objects instead
|
||||
// of on the client objects which seems a bit questionable to me.
|
||||
|
||||
for(SimSetIterator itr(missionGroup); *itr; ++itr)
|
||||
for(SimSetIterator itr(scene); *itr; ++itr)
|
||||
{
|
||||
SceneObject* object = dynamic_cast< SceneObject* >( *itr );
|
||||
if( object && object->isRenderEnabled() && !object->isHidden() )
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
#include "T3D/portal.h"
|
||||
#include "math/mPolyhedron.impl.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( GuiConvexEditorCtrl );
|
||||
|
||||
ConsoleDocClass( GuiConvexEditorCtrl,
|
||||
|
|
@ -121,12 +123,12 @@ bool GuiConvexEditorCtrl::onWake()
|
|||
if ( !Parent::onWake() )
|
||||
return false;
|
||||
|
||||
SimGroup *missionGroup;
|
||||
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if ( !scene )
|
||||
return true;
|
||||
|
||||
SimGroup::iterator itr = missionGroup->begin();
|
||||
for ( ; itr != missionGroup->end(); itr++ )
|
||||
SimGroup::iterator itr = scene->begin();
|
||||
for ( ; itr != scene->end(); itr++ )
|
||||
{
|
||||
if ( dStrcmp( (*itr)->getClassName(), "ConvexShape" ) == 0 )
|
||||
{
|
||||
|
|
@ -166,8 +168,8 @@ void GuiConvexEditorCtrl::setVisible( bool val )
|
|||
mSavedGizmoFlags = -1;
|
||||
}
|
||||
|
||||
SimGroup* misGroup;
|
||||
if (Sim::findObject("MissionGroup", misGroup))
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if (scene != nullptr)
|
||||
{
|
||||
//Make our proxy objects "real" again
|
||||
for (U32 i = 0; i < mProxyObjects.size(); ++i)
|
||||
|
|
@ -184,7 +186,7 @@ void GuiConvexEditorCtrl::setVisible( bool val )
|
|||
|
||||
SceneObject* polyObj = createPolyhedralObject(mProxyObjects[i].targetObjectClass.c_str(), mProxyObjects[i].shapeProxy);
|
||||
|
||||
misGroup->addObject(polyObj);
|
||||
scene->addObject(polyObj);
|
||||
|
||||
//Now, remove the convex proxy
|
||||
mProxyObjects[i].shapeProxy->deleteObject();
|
||||
|
|
@ -222,19 +224,19 @@ void GuiConvexEditorCtrl::setVisible( bool val )
|
|||
updateGizmoPos();
|
||||
mSavedGizmoFlags = mGizmoProfile->flags;
|
||||
|
||||
SimGroup* misGroup;
|
||||
if (Sim::findObject("MissionGroup", misGroup))
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if (scene != nullptr)
|
||||
{
|
||||
for (U32 c = 0; c < misGroup->size(); ++c)
|
||||
for (U32 c = 0; c < scene->size(); ++c)
|
||||
{
|
||||
bool isTrigger = (misGroup->at(c)->getClassName() == StringTable->insert("Trigger"));
|
||||
bool isZone = (misGroup->at(c)->getClassName() == StringTable->insert("Zone"));
|
||||
bool isPortal = (misGroup->at(c)->getClassName() == StringTable->insert("Portal"));
|
||||
bool isOccluder = (misGroup->at(c)->getClassName() == StringTable->insert("OcclusionVolume"));
|
||||
bool isTrigger = (scene->at(c)->getClassName() == StringTable->insert("Trigger"));
|
||||
bool isZone = (scene->at(c)->getClassName() == StringTable->insert("Zone"));
|
||||
bool isPortal = (scene->at(c)->getClassName() == StringTable->insert("Portal"));
|
||||
bool isOccluder = (scene->at(c)->getClassName() == StringTable->insert("OcclusionVolume"));
|
||||
|
||||
if (isZone || isPortal || isOccluder)
|
||||
{
|
||||
SceneObject* sceneObj = static_cast<SceneObject*>(misGroup->at(c));
|
||||
SceneObject* sceneObj = static_cast<SceneObject*>(scene->at(c));
|
||||
if (!sceneObj)
|
||||
{
|
||||
Con::errorf("WorldEditor::createConvexShapeFrom - Invalid object");
|
||||
|
|
@ -1350,9 +1352,9 @@ void GuiConvexEditorCtrl::setupShape( ConvexShape *shape )
|
|||
shape->registerObject();
|
||||
updateShape( shape );
|
||||
|
||||
SimGroup *group;
|
||||
if ( Sim::findObject( "missionGroup", group ) )
|
||||
group->addObject( shape );
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if ( scene )
|
||||
scene->addObject( shape );
|
||||
}
|
||||
|
||||
void GuiConvexEditorCtrl::updateShape( ConvexShape *shape, S32 offsetFace )
|
||||
|
|
@ -1929,10 +1931,8 @@ ConvexEditorTool::EventResult ConvexEditorCreateTool::on3DMouseUp( const Gui3DMo
|
|||
}
|
||||
else if ( mStage == 0 )
|
||||
{
|
||||
SimGroup *mg;
|
||||
Sim::findObject( "MissionGroup", mg );
|
||||
|
||||
mg->addObject( mNewConvex );
|
||||
SimGroup *scene = Scene::getRootScene();
|
||||
scene->addObject( mNewConvex );
|
||||
|
||||
mStage = -1;
|
||||
|
||||
|
|
@ -2128,9 +2128,9 @@ ConvexShape* ConvexEditorCreateTool::extrudeShapeFromFace( ConvexShape *inShape,
|
|||
newShape->registerObject();
|
||||
mEditor->updateShape( newShape );
|
||||
|
||||
SimGroup *group;
|
||||
if ( Sim::findObject( "missionGroup", group ) )
|
||||
group->addObject( newShape );
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if ( scene )
|
||||
scene->addObject( newShape );
|
||||
|
||||
return newShape;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include "gui/worldEditor/terrainActions.h"
|
||||
#include "terrain/terrMaterial.h"
|
||||
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(TerrainEditor);
|
||||
|
||||
|
|
@ -2405,10 +2405,10 @@ void TerrainEditor::reorderMaterial( S32 index, S32 orderPos )
|
|||
|
||||
DefineEngineMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)")
|
||||
{
|
||||
SimSet * missionGroup = dynamic_cast<SimSet*>(Sim::findObject("MissionGroup"));
|
||||
if (!missionGroup)
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if (!scene)
|
||||
{
|
||||
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: no mission group found");
|
||||
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: no scene found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2417,7 +2417,7 @@ DefineEngineMethod( TerrainEditor, attachTerrain, void, (const char * terrain),
|
|||
// attach to first found terrainBlock
|
||||
if (dStrcmp (terrain,"")==0)
|
||||
{
|
||||
for(SimSetIterator itr(missionGroup); *itr; ++itr)
|
||||
for(SimSetIterator itr(scene); *itr; ++itr)
|
||||
{
|
||||
TerrainBlock* terrBlock = dynamic_cast<TerrainBlock*>(*itr);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@
|
|||
|
||||
#include "tools/editorTool.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( WorldEditor );
|
||||
|
||||
ConsoleDocClass( WorldEditor,
|
||||
|
|
@ -455,19 +457,20 @@ bool WorldEditor::pasteSelection( bool dropSel )
|
|||
return false;
|
||||
}
|
||||
|
||||
SimGroup *missionGroup = NULL;
|
||||
SimGroup *targetGroup = NULL;
|
||||
if( isMethod( "getNewObjectGroup" ) )
|
||||
{
|
||||
const char* targetGroupName = Con::executef( this, "getNewObjectGroup" );
|
||||
if( targetGroupName && targetGroupName[ 0 ] && !Sim::findObject( targetGroupName, missionGroup ) )
|
||||
if( targetGroupName && targetGroupName[ 0 ] && !Sim::findObject( targetGroupName, targetGroup) )
|
||||
Con::errorf( "WorldEditor::pasteSelection() - no SimGroup called '%s'", targetGroupName );
|
||||
}
|
||||
|
||||
if( !missionGroup )
|
||||
if( !targetGroup)
|
||||
{
|
||||
if( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
targetGroup = Scene::getRootScene();
|
||||
if( !targetGroup)
|
||||
{
|
||||
Con::errorf( "WorldEditor::pasteSelection() - MissionGroup not found" );
|
||||
Con::errorf( "WorldEditor::pasteSelection() - Scene not found" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -481,8 +484,8 @@ bool WorldEditor::pasteSelection( bool dropSel )
|
|||
if ( !obj )
|
||||
continue;
|
||||
|
||||
if ( missionGroup )
|
||||
missionGroup->addObject( obj );
|
||||
if (targetGroup)
|
||||
targetGroup->addObject( obj );
|
||||
|
||||
action->addObject( obj );
|
||||
|
||||
|
|
@ -594,7 +597,7 @@ void WorldEditor::hideObject(SceneObject* serverObj, bool hide)
|
|||
|
||||
void WorldEditor::hideSelection(bool hide)
|
||||
{
|
||||
SimGroup* pGroup = dynamic_cast<SimGroup*>(Sim::findObject("MissionGroup"));
|
||||
Scene* scene = Scene::getRootScene();
|
||||
|
||||
// set server/client objects hide field
|
||||
for(U32 i = 0; i < mSelected->size(); i++)
|
||||
|
|
@ -605,7 +608,7 @@ void WorldEditor::hideSelection(bool hide)
|
|||
|
||||
// Prevent non-mission group objects (i.e. Player) from being hidden.
|
||||
// Otherwise it is difficult to show them again.
|
||||
if(!serverObj->isChildOfGroup(pGroup))
|
||||
if(!serverObj->isChildOfGroup(scene))
|
||||
continue;
|
||||
|
||||
hideObject(serverObj, hide);
|
||||
|
|
@ -2437,7 +2440,7 @@ void WorldEditor::renderScene( const RectI &updateRect )
|
|||
}
|
||||
|
||||
// Render the paths
|
||||
renderPaths(Sim::findObject("MissionGroup"));
|
||||
renderPaths(Scene::getRootScene());
|
||||
|
||||
// walk selected
|
||||
Selection* selection = getActiveSelectionSet();
|
||||
|
|
@ -3653,10 +3656,10 @@ void WorldEditor::makeSelectionPrefab( const char *filename )
|
|||
return;
|
||||
}
|
||||
|
||||
SimGroup *missionGroup;
|
||||
if ( !Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if ( !scene)
|
||||
{
|
||||
Con::errorf( "WorldEditor::makeSelectionPrefab - Could not find MissionGroup." );
|
||||
Con::errorf( "WorldEditor::makeSelectionPrefab - Could not find root Scene." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3746,7 +3749,7 @@ void WorldEditor::makeSelectionPrefab( const char *filename )
|
|||
fabMat.inverse();
|
||||
fab->setTransform( fabMat );
|
||||
fab->registerObject();
|
||||
missionGroup->addObject( fab );
|
||||
scene->addObject( fab );
|
||||
|
||||
// Select it, mark level as dirty.
|
||||
clearSelection();
|
||||
|
|
@ -3812,10 +3815,10 @@ void WorldEditor::makeSelectionAMesh(const char *filename)
|
|||
return;
|
||||
}
|
||||
|
||||
SimGroup *missionGroup;
|
||||
if (!Sim::findObject("MissionGroup", missionGroup))
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if (!scene)
|
||||
{
|
||||
Con::errorf("WorldEditor::makeSelectionAMesh - Could not find MissionGroup.");
|
||||
Con::errorf("WorldEditor::makeSelectionAMesh - Could not find root Scene.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3965,7 +3968,7 @@ void WorldEditor::makeSelectionAMesh(const char *filename)
|
|||
fabMat.inverse();
|
||||
ts->setTransform(fabMat);
|
||||
ts->registerObject();
|
||||
missionGroup->addObject(ts);
|
||||
scene->addObject(ts);
|
||||
|
||||
// Select it, mark level as dirty.
|
||||
clearSelection();
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
#include "renderInstance/renderPassManager.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
extern bool gEditingMission;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -59,13 +61,13 @@ DefineEngineFunction(pathOnMissionLoadDone, void, (),,
|
|||
"@ingroup Networking")
|
||||
{
|
||||
// Need to load subobjects for all loaded interiors...
|
||||
SimGroup* pMissionGroup = dynamic_cast<SimGroup*>(Sim::findObject("MissionGroup"));
|
||||
AssertFatal(pMissionGroup != NULL, "Error, mission done loading and no mission group?");
|
||||
Scene* scene = Scene::getRootScene();
|
||||
AssertFatal(scene != NULL, "Error, mission done loading and no scene?");
|
||||
|
||||
U32 currStart = 0;
|
||||
U32 currEnd = 1;
|
||||
Vector<SimGroup*> groups;
|
||||
groups.push_back(pMissionGroup);
|
||||
groups.push_back(scene);
|
||||
|
||||
while (true) {
|
||||
for (U32 i = currStart; i < currEnd; i++) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include "util/noise2d.h"
|
||||
#include "core/volume.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
using namespace Torque;
|
||||
|
||||
DefineEngineStaticMethod( TerrainBlock, createNew, S32, (String terrainName, U32 resolution, String materialName, bool genNoise),,
|
||||
|
|
@ -108,9 +110,9 @@ DefineEngineStaticMethod( TerrainBlock, createNew, S32, (String terrainName, U32
|
|||
terrain->registerObject( terrainName.c_str() );
|
||||
|
||||
// Add to mission group!
|
||||
SimGroup *missionGroup;
|
||||
if( Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
missionGroup->addObject( terrain );
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if(scene)
|
||||
scene->addObject( terrain );
|
||||
|
||||
return terrain->getId();
|
||||
}
|
||||
|
|
@ -245,10 +247,10 @@ DefineEngineStaticMethod( TerrainBlock, import, S32, (String terrainName, String
|
|||
terrain->import( (*heightmap), heightScale, metersPerPixel, layerMap, materials, flipYAxis );
|
||||
terrain->registerObject();
|
||||
|
||||
// Add to mission group!
|
||||
SimGroup *missionGroup;
|
||||
if ( Sim::findObject( "MissionGroup", missionGroup ) )
|
||||
missionGroup->addObject( terrain );
|
||||
// Add to scene!
|
||||
Scene* scene = Scene::getRootScene();
|
||||
if (scene)
|
||||
scene->addObject( terrain );
|
||||
}
|
||||
|
||||
return terrain->getId();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "T3D/pointLight.h"
|
||||
#include "T3D/spotLight.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Collada <light> elements are very similar, but are arranged as separate, unrelated
|
||||
|
|
@ -140,11 +141,11 @@ static void processNodeLights(AppNode* appNode, const MatrixF& offset, SimGroup*
|
|||
|
||||
// Load lights from a collada file and add to the scene.
|
||||
DefineEngineFunction( loadColladaLights, bool, (const char * filename, const char * parentGroup, const char * baseObject), ("", ""),
|
||||
"(string filename, SimGroup parentGroup=MissionGroup, SimObject baseObject=-1)"
|
||||
"(string filename, SimGroup parentGroup=Scene, SimObject baseObject=-1)"
|
||||
"Load all light instances from a COLLADA (.dae) file and add to the scene.\n"
|
||||
"@param filename COLLADA filename to load lights from\n"
|
||||
"@param parentGroup (optional) name of an existing simgroup to add the new "
|
||||
"lights to (defaults to MissionGroup)\n"
|
||||
"lights to (defaults to root Scene)\n"
|
||||
"@param baseObject (optional) name of an object to use as the origin (useful "
|
||||
"if you are loading the lights for a collada scene and have moved or rotated "
|
||||
"the geometry)\n"
|
||||
|
|
@ -165,16 +166,16 @@ DefineEngineFunction( loadColladaLights, bool, (const char * filename, const cha
|
|||
Torque::Path path(filename);
|
||||
|
||||
// Optional group to add the lights to. Create if it does not exist, and use
|
||||
// the MissionGroup if not specified.
|
||||
SimGroup* missionGroup = dynamic_cast<SimGroup*>(Sim::findObject("MissionGroup"));
|
||||
// the root Scene if not specified.
|
||||
Scene* scene = Scene::getRootScene();
|
||||
SimGroup* group = 0;
|
||||
if (!String::isEmpty(parentGroup)){
|
||||
if (!Sim::findObject(parentGroup, group)) {
|
||||
// Create the group if it could not be found
|
||||
group = new SimGroup;
|
||||
if (group->registerObject(parentGroup)) {
|
||||
if (missionGroup)
|
||||
missionGroup->addObject(group);
|
||||
if (scene)
|
||||
scene->addObject(group);
|
||||
}
|
||||
else {
|
||||
delete group;
|
||||
|
|
@ -183,7 +184,7 @@ DefineEngineFunction( loadColladaLights, bool, (const char * filename, const cha
|
|||
}
|
||||
}
|
||||
if (!group)
|
||||
group = missionGroup;
|
||||
group = scene;
|
||||
|
||||
// Optional object to provide the base transform
|
||||
MatrixF offset(true);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function Core_ClientServer::create( %this )
|
|||
exec( "./scripts/client/client.cs" );
|
||||
exec( "./scripts/server/server.cs" );
|
||||
|
||||
$Game::MissionGroup = "MissionGroup";
|
||||
$Game::MainScene = getScene(0);
|
||||
|
||||
initServer();
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ function sendLoadInfoToClient( %client )
|
|||
function parseMissionGroup( %className, %childGroup )
|
||||
{
|
||||
if( getWordCount( %childGroup ) == 0)
|
||||
%currentGroup = "MissionGroup";
|
||||
%currentGroup = getScene(0);
|
||||
else
|
||||
%currentGroup = %childGroup;
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ function parseMissionGroup( %className, %childGroup )
|
|||
function parseMissionGroupForIds( %className, %childGroup )
|
||||
{
|
||||
if( getWordCount( %childGroup ) == 0)
|
||||
%currentGroup = $Game::MissionGroup;
|
||||
%currentGroup = getScene(0);
|
||||
else
|
||||
%currentGroup = %childGroup;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ function loadMissionStage2()
|
|||
// Exec the mission. The MissionGroup (loaded components) is added to the ServerGroup
|
||||
exec(%file);
|
||||
|
||||
if( !isObject(MissionGroup) )
|
||||
if( !isObject(getScene(0)) )
|
||||
{
|
||||
$Server::LoadFailMsg = "No 'MissionGroup' found in mission \"" @ %file @ "\".";
|
||||
$Server::LoadFailMsg = "No Scene found in level \"" @ %file @ "\".";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ function loadMissionStage2()
|
|||
|
||||
function endMission()
|
||||
{
|
||||
if (!isObject( MissionGroup ))
|
||||
if (!isObject( getScene(0) ))
|
||||
return;
|
||||
|
||||
echo("*** ENDING MISSION");
|
||||
|
|
@ -159,7 +159,7 @@ function endMission()
|
|||
}
|
||||
|
||||
// Delete everything
|
||||
MissionGroup.delete();
|
||||
getScene(0).delete();
|
||||
MissionCleanup.delete();
|
||||
|
||||
clearServerPaths();
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ function onServerDestroyed()
|
|||
{
|
||||
physicsStopSimulation("server");
|
||||
|
||||
if (!isObject( MissionGroup ))
|
||||
if (!isObject( getScene(0) ))
|
||||
return;
|
||||
|
||||
echo("*** ENDING MISSION");
|
||||
|
|
@ -262,7 +262,7 @@ function onServerDestroyed()
|
|||
}
|
||||
|
||||
// Delete everything
|
||||
MissionGroup.delete();
|
||||
getScene(0).delete();
|
||||
MissionCleanup.delete();
|
||||
|
||||
clearServerPaths();
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ function ConvexEditorPlugin::onSaveMission( %this, %missionFile )
|
|||
{
|
||||
if( ConvexEditorGui.isDirty )
|
||||
{
|
||||
MissionGroup.save( %missionFile );
|
||||
getScene(0).save( %missionFile );
|
||||
ConvexEditorGui.isDirty = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1584,7 +1584,7 @@ function ColladaImportDlg::onOK(%this)
|
|||
function ColladaImportDlg::loadLights(%this)
|
||||
{
|
||||
// Get the ID of the last object added
|
||||
%obj = MissionGroup.getObject(MissionGroup.getCount()-1);
|
||||
%obj = getScene(0).getObject(getScene(0).getCount()-1);
|
||||
|
||||
// Create a new SimGroup to hold the model and lights
|
||||
%group = new SimGroup();
|
||||
|
|
@ -1596,7 +1596,7 @@ function ColladaImportDlg::loadLights(%this)
|
|||
{
|
||||
%group.add(%obj);
|
||||
%group.bringToFront(%obj);
|
||||
MissionGroup.add(%group);
|
||||
getScene(0).add(%group);
|
||||
if (EditorTree.isVisible())
|
||||
{
|
||||
EditorTree.removeItem(EditorTree.findItemByObjectId(%obj));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new SimGroup(MissionGroup) {
|
||||
new Scene(EditorTemplateLevel) {
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
cdTrack = "2";
|
||||
|
|
|
|||
|
|
@ -1051,7 +1051,7 @@ function MaterialEditorGui::updateActiveMaterialName(%this, %name)
|
|||
// Some objects (ConvexShape, DecalRoad etc) reference Materials by name => need
|
||||
// to find and update all these references so they don't break when we rename the
|
||||
// Material.
|
||||
MaterialEditorGui.updateMaterialReferences( MissionGroup, %action.oldName, %action.newName );
|
||||
MaterialEditorGui.updateMaterialReferences( getScene(0), %action.oldName, %action.newName );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::updateMaterialReferences( %this, %obj, %oldName, %newName )
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ function ActionUpdateActiveMaterialAnimationFlags::undo(%this)
|
|||
function ActionUpdateActiveMaterialName::redo(%this)
|
||||
{
|
||||
%this.material.setName(%this.newName);
|
||||
MaterialEditorGui.updateMaterialReferences( MissionGroup, %this.oldName, %this.newName );
|
||||
MaterialEditorGui.updateMaterialReferences( getScene(0), %this.oldName, %this.newName );
|
||||
|
||||
if( MaterialEditorPreviewWindow.isVisible() && MaterialEditorGui.currentMaterial == %this.material )
|
||||
{
|
||||
|
|
@ -199,7 +199,7 @@ function ActionUpdateActiveMaterialName::redo(%this)
|
|||
function ActionUpdateActiveMaterialName::undo(%this)
|
||||
{
|
||||
%this.material.setName(%this.oldName);
|
||||
MaterialEditorGui.updateMaterialReferences( MissionGroup, %this.newName, %this.oldName );
|
||||
MaterialEditorGui.updateMaterialReferences( getScene(0), %this.newName, %this.oldName );
|
||||
|
||||
if( MaterialEditorPreviewWindow.isVisible() && MaterialEditorGui.currentMaterial == %this.material )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ function MeshRoadEditorPlugin::onSaveMission( %this, %missionFile )
|
|||
{
|
||||
if( MeshRoadEditorGui.isDirty )
|
||||
{
|
||||
MissionGroup.save( %missionFile );
|
||||
getScene(0).save( %missionFile );
|
||||
MeshRoadEditorGui.isDirty = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ function MissionAreaEditorPlugin::createNewMissionArea(%this)
|
|||
%newMissionArea = new MissionArea();
|
||||
%newMissionArea.area = "-256 -256 512 512";
|
||||
|
||||
MissionGroup.add(%newMissionArea);
|
||||
getScene(0).add(%newMissionArea);
|
||||
|
||||
EditorGui.setEditor(MissionAreaEditorPlugin);
|
||||
|
||||
|
|
|
|||
|
|
@ -354,13 +354,13 @@ function CreateNewNavMeshDlg::create(%this)
|
|||
|
||||
if(MeshMissionBounds.isStateOn())
|
||||
{
|
||||
if(!isObject(MissionGroup))
|
||||
if(!isObject(getScene(0)))
|
||||
{
|
||||
MessageBoxOk("Error", "You must have a MissionGroup to use the mission bounds function.");
|
||||
MessageBoxOk("Error", "You must have a Scene to use the mission bounds function.");
|
||||
return;
|
||||
}
|
||||
// Get maximum extents of all objects.
|
||||
%box = MissionBoundsExtents(MissionGroup);
|
||||
%box = MissionBoundsExtents(getScene(0));
|
||||
%pos = GetBoxCenter(%box);
|
||||
%scale = (GetWord(%box, 3) - GetWord(%box, 0)) / 2 + 5
|
||||
SPC (GetWord(%box, 4) - GetWord(%box, 1)) / 2 + 5
|
||||
|
|
@ -380,7 +380,7 @@ function CreateNewNavMeshDlg::create(%this)
|
|||
scale = %this-->MeshScale.getText();
|
||||
};
|
||||
}
|
||||
MissionGroup.add(%mesh);
|
||||
getScene(0).add(%mesh);
|
||||
NavEditorGui.selectObject(%mesh);
|
||||
|
||||
Canvas.popDialog(CreateNewNavMeshDlg);
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ function NavEditorPlugin::onSaveMission(%this, %missionFile)
|
|||
{
|
||||
if(NavEditorGui.isDirty)
|
||||
{
|
||||
MissionGroup.save(%missionFile);
|
||||
getScene(0).save(%missionFile);
|
||||
NavEditorGui.isDirty = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,9 @@ function RiverEditorPlugin::onSaveMission( %this, %missionFile )
|
|||
{
|
||||
if( RiverEditorGui.isDirty )
|
||||
{
|
||||
MissionGroup.save( %missionFile );
|
||||
//Get our root scene, which would be the level
|
||||
getScene(0).save( %missionFile );
|
||||
|
||||
RiverEditorGui.isDirty = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ function RoadEditorPlugin::onSaveMission( %this, %missionFile )
|
|||
{
|
||||
if( RoadEditorGui.isDirty )
|
||||
{
|
||||
MissionGroup.save( %missionFile );
|
||||
getScene(0).save( %missionFile );
|
||||
RoadEditorGui.isDirty = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ function ShapeEditorPlugin::open(%this, %filename)
|
|||
ShapeEdNodes-->worldTransform.setStateOn(1);
|
||||
|
||||
// Initialise and show the shape editor
|
||||
ShapeEdShapeTreeView.open(MissionGroup);
|
||||
ShapeEdShapeTreeView.open(getScene(0));
|
||||
ShapeEdShapeTreeView.buildVisibleTree(true);
|
||||
|
||||
ShapeEdPreviewGui.setVisible(true);
|
||||
|
|
|
|||
|
|
@ -184,11 +184,11 @@ function TimeAdjustSliderCtrl::onAction(%this)
|
|||
|
||||
if ( !isObject( %this.tod ) )
|
||||
{
|
||||
if ( isObject( MissionGroup ) )
|
||||
if ( isObject( getScene(0) ) )
|
||||
{
|
||||
for ( %i = 0; %i < MissionGroup.getCount(); %i++ )
|
||||
for ( %i = 0; %i < getScene(0).getCount(); %i++ )
|
||||
{
|
||||
%obj = MissionGroup.getObject( %i );
|
||||
%obj = getScene(0).getObject( %i );
|
||||
|
||||
if ( %obj.getClassName() $= "TimeOfDay" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -947,10 +947,10 @@ function ObjectBuilderGui::buildPlayerDropPoint(%this)
|
|||
%this.addField("spawnClass", "TypeString", "Spawn Class", "Player");
|
||||
%this.addField("spawnDatablock", "TypeDataBlock", "Spawn Data", "PlayerData DefaultPlayerData");
|
||||
|
||||
if( EWCreatorWindow.objectGroup.getID() == MissionGroup.getID() )
|
||||
if( EWCreatorWindow.objectGroup.getID() == getScene(0).getID() )
|
||||
{
|
||||
if( !isObject("PlayerDropPoints") )
|
||||
MissionGroup.add( new SimGroup("PlayerDropPoints") );
|
||||
getScene(0).add( new SimGroup("PlayerDropPoints") );
|
||||
%this.objectGroup = "PlayerDropPoints";
|
||||
}
|
||||
|
||||
|
|
@ -967,10 +967,10 @@ function ObjectBuilderGui::buildObserverDropPoint(%this)
|
|||
%this.addField("spawnClass", "TypeString", "Spawn Class", "Camera");
|
||||
%this.addField("spawnDatablock", "TypeDataBlock", "Spawn Data", "CameraData Observer");
|
||||
|
||||
if( EWCreatorWindow.objectGroup.getID() == MissionGroup.getID() )
|
||||
if( EWCreatorWindow.objectGroup.getID() == getScene(0).getID() )
|
||||
{
|
||||
if( !isObject("ObserverDropPoints") )
|
||||
MissionGroup.add( new SimGroup("ObserverDropPoints") );
|
||||
getScene(0).add( new SimGroup("ObserverDropPoints") );
|
||||
%this.objectGroup = "ObserverDropPoints";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ function EditorGui::addCameraBookmark( %this, %name )
|
|||
if( !isObject(CameraBookmarks) )
|
||||
{
|
||||
%grp = new SimGroup(CameraBookmarks);
|
||||
MissionGroup.add(%grp);
|
||||
getScene(0).add(%grp);
|
||||
}
|
||||
CameraBookmarks.add( %obj );
|
||||
|
||||
|
|
@ -835,12 +835,17 @@ function EditorGui::syncCameraGui( %this )
|
|||
|
||||
function WorldEditorPlugin::onActivated( %this )
|
||||
{
|
||||
if(!isObject(Scenes))
|
||||
$scenesRootGroup = new SimGroup(Scenes);
|
||||
|
||||
$scenesRootGroup.add(getScene(0));
|
||||
|
||||
EditorGui.bringToFront( EWorldEditor );
|
||||
EWorldEditor.setVisible(true);
|
||||
EditorGui.menuBar.insert( EditorGui.worldMenu, EditorGui.menuBar.dynamicItemInsertPos );
|
||||
EWorldEditor.makeFirstResponder(true);
|
||||
EditorTree.open(MissionGroup,true);
|
||||
EWCreatorWindow.setNewObjectGroup(MissionGroup);
|
||||
EditorTree.open($scenesRootGroup,true);
|
||||
EWCreatorWindow.setNewObjectGroup(getScene(0));
|
||||
|
||||
EWorldEditor.syncGui();
|
||||
|
||||
|
|
@ -1464,7 +1469,7 @@ function EditorTree::onDeleteObject( %this, %object )
|
|||
return true;
|
||||
|
||||
if( %object == EWCreatorWindow.objectGroup )
|
||||
EWCreatorWindow.setNewObjectGroup( MissionGroup );
|
||||
EWCreatorWindow.setNewObjectGroup( getScene(0) );
|
||||
|
||||
// Append it to our list.
|
||||
%this.undoDeleteList = %this.undoDeleteList TAB %object;
|
||||
|
|
@ -1596,6 +1601,13 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
|
|||
{
|
||||
%popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();";
|
||||
}
|
||||
else if( %obj.isMemberOfClass( "Scene" ))
|
||||
{
|
||||
%popup.item[ 0 ] = "Set as Active Scene" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );";
|
||||
%popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");";
|
||||
%popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");";
|
||||
%popup.item[ 3 ] = "-";
|
||||
}
|
||||
else
|
||||
{
|
||||
%popup.object = %obj;
|
||||
|
|
@ -1673,8 +1685,8 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
|
|||
|
||||
if( %haveObjectEntries )
|
||||
{
|
||||
%popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" );
|
||||
%popup.enableItem( 1, %obj.getName() !$= "MissionGroup" );
|
||||
%popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj !$= getScene(0) );
|
||||
%popup.enableItem( 1, %obj !$= getScene(0) );
|
||||
|
||||
if( %haveLockAndHideEntries )
|
||||
{
|
||||
|
|
@ -2025,21 +2037,21 @@ function EWorldEditor::syncToolPalette( %this )
|
|||
function EWorldEditor::addSimGroup( %this, %groupCurrentSelection )
|
||||
{
|
||||
%activeSelection = %this.getActiveSelection();
|
||||
if ( %activeSelection.getObjectIndex( MissionGroup ) != -1 )
|
||||
if ( %activeSelection.getObjectIndex( getScene(0) ) != -1 )
|
||||
{
|
||||
MessageBoxOK( "Error", "Cannot add MissionGroup to a new SimGroup" );
|
||||
MessageBoxOK( "Error", "Cannot add Scene to a new SimGroup" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Find our parent.
|
||||
|
||||
%parent = MissionGroup;
|
||||
%parent = getScene(0);
|
||||
if( !%groupCurrentSelection && isObject( %activeSelection ) && %activeSelection.getCount() > 0 )
|
||||
{
|
||||
%firstSelectedObject = %activeSelection.getObject( 0 );
|
||||
if( %firstSelectedObject.isMemberOfClass( "SimGroup" ) )
|
||||
%parent = %firstSelectedObject;
|
||||
else if( %firstSelectedObject.getId() != MissionGroup.getId() )
|
||||
else if( %firstSelectedObject.getId() != getScene(0).getId() )
|
||||
%parent = %firstSelectedObject.parentGroup;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function ESelectObjectsWindow::toggleVisibility( %this )
|
|||
/// to start searching for objects.
|
||||
function ESelectObjectsWindow::getRootGroup( %this )
|
||||
{
|
||||
return MissionGroup;
|
||||
return getScene(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ function EWCreatorWindow::createStatic( %this, %file )
|
|||
return;
|
||||
|
||||
if( !isObject(%this.objectGroup) )
|
||||
%this.setNewObjectGroup( MissionGroup );
|
||||
%this.setNewObjectGroup( getScene(0) );
|
||||
|
||||
%objId = new TSStatic()
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ function EWCreatorWindow::createPrefab( %this, %file )
|
|||
return;
|
||||
|
||||
if( !isObject(%this.objectGroup) )
|
||||
%this.setNewObjectGroup( MissionGroup );
|
||||
%this.setNewObjectGroup( getScene(0) );
|
||||
|
||||
%objId = new Prefab()
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ function EWCreatorWindow::createObject( %this, %cmd )
|
|||
return;
|
||||
|
||||
if( !isObject(%this.objectGroup) )
|
||||
%this.setNewObjectGroup( MissionGroup );
|
||||
%this.setNewObjectGroup( getScene(0) );
|
||||
|
||||
pushInstantGroup();
|
||||
%objId = eval(%cmd);
|
||||
|
|
|
|||
|
|
@ -124,6 +124,12 @@ function WorldEditor::onSelectionCentroidChanged( %this )
|
|||
Inspector.refresh();
|
||||
}
|
||||
|
||||
function WorldEditor::setSceneAsDirty(%this)
|
||||
{
|
||||
EWorldEditor.isDirty = true;
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function WorldEditor::init(%this)
|
||||
|
|
@ -198,7 +204,7 @@ function WorldEditor::export(%this)
|
|||
|
||||
function WorldEditor::doExport(%this, %file)
|
||||
{
|
||||
missionGroup.save("~/editor/" @ %file, true);
|
||||
getScene(0).save("~/editor/" @ %file, true);
|
||||
}
|
||||
|
||||
function WorldEditor::import(%this)
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ function EditorSaveMission()
|
|||
// now write the terrain and mission files out:
|
||||
|
||||
if(EWorldEditor.isDirty || ETerrainEditor.isMissionDirty)
|
||||
MissionGroup.save($Server::MissionFile);
|
||||
getScene(0).save($Server::MissionFile);
|
||||
if(ETerrainEditor.isDirty)
|
||||
{
|
||||
// Find all of the terrain files
|
||||
|
|
@ -483,6 +483,21 @@ function EditorOpenMission(%filename)
|
|||
}
|
||||
}
|
||||
|
||||
function EditorOpenSceneAppend(%levelAsset)
|
||||
{
|
||||
//Load the asset's level file
|
||||
exec(%levelAsset.levelFile);
|
||||
|
||||
//We'll assume the scene name and assetname are the same for now
|
||||
%sceneName = %levelAsset.AssetName;
|
||||
%scene = nameToID(%sceneName);
|
||||
if(isObject(%scene))
|
||||
{
|
||||
//Append it to our scene heirarchy
|
||||
$scenesRootGroup.add(%scene);
|
||||
}
|
||||
}
|
||||
|
||||
function EditorExportToCollada()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new SimGroup(MissionGroup) {
|
||||
new Scene(EmptyTerrainLevel) {
|
||||
canSaveDynamicFields = "1";
|
||||
enabled = "1";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new SimGroup(MissionGroup) {
|
||||
new Scene(EmptyLevel) {
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
cdTrack = "2";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new SimGroup(MissionGroup) {
|
||||
new Scene(OutpostLevel) {
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
enabled = "1";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new SimGroup(MissionGroup) {
|
||||
new Scene(Empty_RoomLevel) {
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
Enabled = "1";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue