Merge branch 'development' of https://github.com/GarageGames/Torque3D into PBR_ProbeArrayGLWIP

# Conflicts:
#	Engine/source/gfx/D3D11/gfxD3D11Device.cpp
#	Engine/source/lighting/lightManager.cpp
#	Templates/Full/game/levels/Empty Room.mis
#	Templates/Full/game/levels/Empty Terrain.mis
This commit is contained in:
AzaezelX 2019-05-01 23:18:31 -05:00
commit dd1470202d
218 changed files with 7060 additions and 2938 deletions

View file

@ -20,10 +20,11 @@ function CoreModule::onCreate(%this)
ModuleDatabase.LoadExplicit( "Core_Rendering" );
ModuleDatabase.LoadExplicit( "Core_Utility" );
ModuleDatabase.LoadExplicit( "Core_GUI" );
ModuleDatabase.LoadExplicit( "CoreModule" );
ModuleDatabase.LoadExplicit( "Core_Lighting" );
ModuleDatabase.LoadExplicit( "Core_SFX" );
ModuleDatabase.LoadExplicit( "Core_PostFX" );
ModuleDatabase.LoadExplicit( "Core_Components" );
ModuleDatabase.LoadExplicit( "Core_GameObjects" );
ModuleDatabase.LoadExplicit( "Core_ClientServer" );
%prefPath = getPrefpath();
@ -32,63 +33,6 @@ function CoreModule::onCreate(%this)
else
exec("data/defaults.cs");
%der = $pref::Video::displayDevice;
//We need to hook the missing/warn material stuff early, so do it here
/*$Core::MissingTexturePath = "core/images/missingTexture";
$Core::UnAvailableTexturePath = "core/images/unavailable";
$Core::WarningTexturePath = "core/images/warnMat";
$Core::CommonShaderPath = "core/shaders";
/*%classList = enumerateConsoleClasses( "Component" );
foreach$( %componentClass in %classList )
{
echo("Native Component of type: " @ %componentClass);
}*/
//exec("./helperFunctions.cs");
// We need some of the default GUI profiles in order to get the canvas and
// other aspects of the GUI system ready.
//exec("./profiles.cs");
//This is a bit of a shortcut, but we'll load the client's default settings to ensure all the prefs get initialized correctly
// Initialization of the various subsystems requires some of the preferences
// to be loaded... so do that first.
/*exec("./globals.cs");
exec("./canvas.cs");
exec("./cursor.cs");
exec("./renderManager.cs");
exec("./lighting.cs");
exec("./audio.cs");
exec("./sfx/audioAmbience.cs");
exec("./sfx/audioData.cs");
exec("./sfx/audioDescriptions.cs");
exec("./sfx/audioEnvironments.cs");
exec("./sfx/audioStates.cs");
exec("./parseArgs.cs");
// Materials and Shaders for rendering various object types
exec("./gfxData/commonMaterialData.cs");
exec("./gfxData/shaders.cs");
exec("./gfxData/terrainBlock.cs");
exec("./gfxData/water.cs");
exec("./gfxData/scatterSky.cs");
exec("./gfxData/clouds.cs");
// Initialize all core post effects.
exec("./postFx.cs");
//VR stuff
exec("./oculusVR.cs");*/
// Seed the random number generator.
setRandomSeed();

View file

@ -5,15 +5,4 @@
ScriptFile="Core.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy"
Group="Core">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
</ModuleDefinition>
Group="Core"/>

View file

@ -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();

View file

@ -43,7 +43,7 @@ function GameConnection::initialControlSet(%this)
// first check if the editor is active
if (!isToolBuild() || !isMethod("Editor", "checkActiveLoadDone") || !Editor::checkActiveLoadDone())
{
if (Canvas.getContent() != PlayGui.getId())
if (isObject(PlayGui) && Canvas.getContent() != PlayGui.getId())
Canvas.setContent(PlayGui);
}
}

View file

@ -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;

View file

@ -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();

View file

@ -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();

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ActionAnimationComponentAsset"
componentClass="ActionAnimationComponent"
friendlyName="Action Animation"
componentType="animation"
description="Allows a mesh component to be animated." />

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="AIControllerComponentAsset"
componentClass="AIControllerComponent"
friendlyName="AI Player Controller"
componentType="Game"
description="Enables an entity to move like a player object." />

View file

@ -0,0 +1,8 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="ArmAnimationComponentAsset"
componentClass="ArmAnimationComponent"
friendlyName="Arm Animation"
componentType="animation"
description="Allows a mesh component to be animated." />

View file

@ -1,89 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//registerComponent("ControlObjectComponent", "Component", "Control Object", "Game", false, "Allows the behavior owner to operate as a camera.");
function ControlObjectComponent::onAdd(%this)
{
%this.addComponentField(clientOwner, "The shape to use for rendering", "int", "1", "");
%clientID = %this.getClientID();
if(%clientID && !isObject(%clientID.getControlObject()))
%clientID.setControlObject(%this.owner);
}
function ControlObjectComponent::onRemove(%this)
{
%clientID = %this.getClientID();
if(%clientID)
%clientID.setControlObject(0);
}
function ControlObjectComponent::onClientConnect(%this, %client)
{
if(%this.isControlClient(%client) && !isObject(%client.getControlObject()))
%client.setControlObject(%this.owner);
}
function ControlObjectComponent::onClientDisconnect(%this, %client)
{
if(%this.isControlClient(%client))
%client.setControlObject(0);
}
function ControlObjectComponent::getClientID(%this)
{
return ClientGroup.getObject(%this.clientOwner-1);
}
function ControlObjectComponent::isControlClient(%this, %client)
{
%clientID = ClientGroup.getObject(%this.clientOwner-1);
if(%client.getID() == %clientID)
return true;
else
return false;
}
function ControlObjectComponent::onInspectorUpdate(%this, %field)
{
%clientID = %this.getClientID();
if(%clientID && !isObject(%clientID.getControlObject()))
%clientID.setControlObject(%this.owner);
}
function switchControlObject(%client, %newControlEntity)
{
if(!isObject(%client) || !isObject(%newControlEntity))
return error("SwitchControlObject: No client or target controller!");
%control = %newControlEntity.getComponent(ControlObjectComponent);
if(!isObject(%control))
return error("SwitchControlObject: Target controller has no conrol object behavior!");
%client.setControlObject(%newControlEntity);
}

View file

@ -0,0 +1,16 @@
//--- noshape.dts MATERIALS BEGIN ---
singleton Material(noshape_NoShape)
{
mapTo = "NoShape";
diffuseMap[0] = "";
diffuseColor[0] = "0.8 0.003067 0 .8";
emissive[0] = 0;
doubleSided = false;
translucent = 1;
translucentBlendOp = "LerpAlpha";
castShadows = false;
materialTag0 = "WorldEditor";
};
//--- noshape.dts MATERIALS END ---

Binary file not shown.

Binary file not shown.

View file

@ -4,6 +4,8 @@ function Core_Utility::onCreate(%this)
exec("./scripts/parseArgs.cs");
exec("./scripts/globals.cs");
exec("./scripts/helperFunctions.cs");
exec("./scripts/gameObjectManagement.cs");
exec("./scripts/persistanceManagement.cs");
}
function Core_Utility::onDestroy(%this)

View file

@ -0,0 +1,181 @@
//Game Object management
function findGameObject(%name)
{
//find all GameObjectAssets
%assetQuery = new AssetQuery();
if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset"))
return 0; //if we didn't find ANY, just exit
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
//%assetName = AssetDatabase.getAssetName(%assetId);
if(%assetId $= %name)
{
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
%assetQuery.delete();
return %gameObjectAsset;
}
}
%assetQuery.delete();
return 0;
}
function spawnGameObject(%name, %addToScene)
{
if(%addToScene $= "")
%addToScene = true;
//First, check if this already exists in our GameObjectPool
if(isObject(GameObjectPool))
{
%goCount = GameObjectPool.countKey(%name);
//if we have some already in the pool, pull it out and use that
if(%goCount != 0)
{
%goIdx = GameObjectPool.getIndexFromKey(%name);
%go = GameObjectPool.getValue(%goIdx);
%go.setHidden(false);
%go.setScopeAlways();
if(%addToMissionGroup == true) //save instance when saving level
getScene(0).add(%go);
else // clear instance on level exit
MissionCleanup.add(%go);
//remove from the object pool's list
GameObjectPool.erase(%goIdx);
return %go;
}
}
//We have no existing pool, or no existing game objects of this type, so spawn a new one
%gameObjectAsset = findGameObject(%name);
if(isObject(%gameObjectAsset))
{
%newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath);
if(%addToScene == true) //save instance when saving level
getScene(0).add(%newSGOObject);
else // clear instance on level exit
MissionCleanup.add(%newSGOObject);
return %newSGOObject;
}
return 0;
}
function saveGameObject(%name, %tamlPath, %scriptPath)
{
%gameObjectAsset = findGameObject(%name);
//find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset
if(isObject(%gameObjectAsset))
{
%assetID = %gameObjectAsset.getAssetId();
%gameObjectAsset.TAMLFilePath = %tamlPath;
%gameObjectAsset.scriptFilePath = %scriptPath;
TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID));
AssetDatabase.refreshAsset(%assetID);
}
else
{
//Doesn't exist, so make a new one
%gameObjectAsset = new GameObjectAsset()
{
assetName = %name @ "Asset";
gameObjectName = %name;
TAMLFilePath = %tamlPath;
scriptFilePath = %scriptPath;
};
//Save it alongside the taml file
%path = filePath(%tamlPath);
TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml");
AssetDatabase.refreshAllAssets(true);
}
}
//Allocates a number of a game object into a pool to be pulled from as needed
function allocateGameObjects(%name, %amount)
{
//First, we need to make sure our pool exists
if(!isObject(GameObjectPool))
{
new ArrayObject(GameObjectPool);
}
//Next, we loop and generate our game objects, and add them to the pool
for(%i=0; %i < %amount; %i++)
{
%go = spawnGameObject(%name, false);
//When our object is in the pool, it's not "real", so we need to make sure
//that we don't ghost it to clients untill we actually spawn it.
%go.clearScopeAlways();
//We also hide it, so that we don't 'exist' in the scene until we spawn
%go.hidden = true;
//Lastly, add us to the pool, with the key being our game object type
GameObjectPool.add(%name, %go);
}
}
function Entity::delete(%this)
{
//we want to intercept the delete call, and add it to our GameObjectPool
//if it's a game object
if(%this.gameObjectAsset !$= "")
{
%this.setHidden(true);
%this.clearScopeAlways();
if(!isObject(GameObjectPool))
{
new ArrayObject(GameObjectPool);
}
GameObjectPool.add(%this.gameObjectAsset, %this);
%missionSet = %this.getGroup();
%missionSet.remove(%this);
}
else
{
%this.superClass.delete();
}
}
function clearGameObjectPool()
{
if(isObject(GameObjectPool))
{
%count = GameObjectPool.count();
for(%i=0; %i < %count; %i++)
{
%go = GameObjectPool.getValue(%i);
%go.superClass.delete();
}
GameObjectPool.empty();
}
}

View file

@ -36,9 +36,6 @@ $pref::Input::JoystickEnabled = 0;
// Set directory paths for various data or default images.
$pref::Video::ProfilePath = "core/rendering/scripts/gfxprofile";
/*$pref::Video::missingTexturePath = "core/images/missingTexture.png";
$pref::Video::unavailableTexturePath = "core/images/unavailable.png";
$pref::Video::warningTexturePath = "core/images/warnMat.dds";*/
$pref::Video::disableVerticalSync = 1;
$pref::Video::mode = "800 600 false 32 60 4";

View file

@ -636,503 +636,6 @@ function mvReset()
// There are others.
}
//Persistance Manager tests
new PersistenceManager(TestPManager);
function runPManTest(%test)
{
if (!isObject(TestPManager))
return;
if (%test $= "")
%test = 100;
switch(%test)
{
case 0:
TestPManager.testFieldUpdates();
case 1:
TestPManager.testObjectRename();
case 2:
TestPManager.testNewObject();
case 3:
TestPManager.testNewGroup();
case 4:
TestPManager.testMoveObject();
case 5:
TestPManager.testObjectRemove();
case 100:
TestPManager.testFieldUpdates();
TestPManager.testObjectRename();
TestPManager.testNewObject();
TestPManager.testNewGroup();
TestPManager.testMoveObject();
TestPManager.testObjectRemove();
}
}
function TestPManager::testFieldUpdates(%doNotSave)
{
// Set some objects as dirty
TestPManager.setDirty(AudioGui);
TestPManager.setDirty(AudioSim);
TestPManager.setDirty(AudioMessage);
// Alter some of the existing fields
AudioEffect.isLooping = true;
AudioMessage.isLooping = true;
AudioEffect.is3D = true;
// Test removing a field
TestPManager.removeField(AudioGui, "isLooping");
// Alter some of the persistent fields
AudioGui.referenceDistance = 0.8;
AudioMessage.referenceDistance = 0.8;
// Add some new dynamic fields
AudioGui.foo = "bar";
AudioEffect.foo = "bar";
// Remove an object from the dirty list
// It shouldn't get updated in the file
TestPManager.removeDirty(AudioEffect);
// Dirty an object in another file as well
TestPManager.setDirty(WarningMaterial);
// Update a field that doesn't exist
WarningMaterial.glow[0] = true;
// Drity another object to test for crashes
// when a dirty object is deleted
TestPManager.setDirty(SFXPausedSet);
// Delete the object
SFXPausedSet.delete();
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testObjectRename(%doNotSave)
{
// Flag an object as dirty
if (isObject(AudioGui))
TestPManager.setDirty(AudioGui);
else if (isObject(AudioGuiFoo))
TestPManager.setDirty(AudioGuiFoo);
// Rename it
if (isObject(AudioGui))
AudioGui.setName(AudioGuiFoo);
else if (isObject(AudioGuiFoo))
AudioGuiFoo.setName(AudioGui);
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testNewObject(%doNotSave)
{
// Test adding a new named object
new SFXDescription(AudioNew)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 2;
};
// Flag it as dirty
TestPManager.setDirty(AudioNew, "core/scripts/client/audio.cs");
// Test adding a new unnamed object
%obj = new SFXDescription()
{
volume = 0.75;
isLooping = true;
bar = 3;
};
// Flag it as dirty
TestPManager.setDirty(%obj, "core/scripts/client/audio.cs");
// Test adding an "empty" object
new SFXDescription(AudioEmpty);
TestPManager.setDirty(AudioEmpty, "core/scripts/client/audio.cs");
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testNewGroup(%doNotSave)
{
// Test adding a new named SimGroup
new SimGroup(TestGroup)
{
foo = "bar";
new SFXDescription(TestObject)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 1;
};
new SimGroup(SubGroup)
{
foo = 2;
new SFXDescription(SubObject)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 3;
};
};
};
// Flag this as dirty
TestPManager.setDirty(TestGroup, "core/scripts/client/audio.cs");
// Test adding a new unnamed SimGroup
%group = new SimGroup()
{
foo = "bar";
new SFXDescription()
{
volume = 0.75;
channel = $GuiAudioType;
foo = 4;
};
new SimGroup()
{
foo = 5;
new SFXDescription()
{
volume = 0.75;
isLooping = true;
channel = $GuiAudioType;
foo = 6;
};
};
};
// Flag this as dirty
TestPManager.setDirty(%group, "core/scripts/client/audio.cs");
// Test adding a new unnamed SimSet
%set = new SimSet()
{
foo = "bar";
new SFXDescription()
{
volume = 0.75;
channel = $GuiAudioType;
foo = 7;
};
new SimGroup()
{
foo = 8;
new SFXDescription()
{
volume = 0.75;
isLooping = true;
channel = $GuiAudioType;
foo = 9;
};
};
};
// Flag this as dirty
TestPManager.setDirty(%set, "core/scripts/client/audio.cs");
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testMoveObject(%doNotSave)
{
// First add a couple of groups to the file
new SimGroup(MoveGroup1)
{
foo = "bar";
new SFXDescription(MoveObject1)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 1;
};
new SimSet(SubGroup1)
{
new SFXDescription(SubObject1)
{
volume = 0.75;
isLooping = true;
channel = $GuiAudioType;
foo = 2;
};
};
};
// Flag this as dirty
TestPManager.setDirty(MoveGroup1, "core/scripts/client/audio.cs");
new SimGroup(MoveGroup2)
{
foo = "bar";
new SFXDescription(MoveObject2)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 3;
};
};
// Flag this as dirty
TestPManager.setDirty(MoveGroup2, "core/scripts/client/audio.cs");
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
// Set them as dirty again
TestPManager.setDirty(MoveGroup1);
TestPManager.setDirty(MoveGroup2);
// Give the subobject an new value
MoveObject1.foo = 4;
// Move it into the other group
MoveGroup1.add(MoveObject2);
// Switch the other subobject
MoveGroup2.add(MoveObject1);
// Also add a new unnamed object to one of the groups
%obj = new SFXDescription()
{
volume = 0.75;
isLooping = true;
bar = 5;
};
MoveGroup1.add(%obj);
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testObjectRemove(%doNotSave)
{
TestPManager.removeObjectFromFile(AudioSim);
}
//Game Object management
function findGameObject(%name)
{
//find all GameObjectAssets
%assetQuery = new AssetQuery();
if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset"))
return 0; //if we didn't find ANY, just exit
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
//%assetName = AssetDatabase.getAssetName(%assetId);
if(%assetId $= %name)
{
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
%assetQuery.delete();
return %gameObjectAsset;
}
}
%assetQuery.delete();
return 0;
}
function spawnGameObject(%name, %addToMissionGroup)
{
if(%addToMissionGroup $= "")
%addToMissionGroup = true;
//First, check if this already exists in our GameObjectPool
if(isObject(GameObjectPool))
{
%goCount = GameObjectPool.countKey(%name);
//if we have some already in the pool, pull it out and use that
if(%goCount != 0)
{
%goIdx = GameObjectPool.getIndexFromKey(%name);
%go = GameObjectPool.getValue(%goIdx);
%go.setHidden(false);
%go.setScopeAlways();
if(%addToMissionGroup == true) //save instance when saving level
MissionGroup.add(%go);
else // clear instance on level exit
MissionCleanup.add(%go);
//remove from the object pool's list
GameObjectPool.erase(%goIdx);
return %go;
}
}
//We have no existing pool, or no existing game objects of this type, so spawn a new one
%gameObjectAsset = findGameObject(%name);
if(isObject(%gameObjectAsset))
{
%newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath);
if(%addToMissionGroup == true) //save instance when saving level
MissionGroup.add(%newSGOObject);
else // clear instance on level exit
MissionCleanup.add(%newSGOObject);
return %newSGOObject;
}
return 0;
}
function saveGameObject(%name, %tamlPath, %scriptPath)
{
%gameObjectAsset = findGameObject(%name);
//find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset
if(isObject(%gameObjectAsset))
{
%assetID = %gameObjectAsset.getAssetId();
%gameObjectAsset.TAMLFilePath = %tamlPath;
%gameObjectAsset.scriptFilePath = %scriptPath;
TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID));
AssetDatabase.refreshAsset(%assetID);
}
else
{
//Doesn't exist, so make a new one
%gameObjectAsset = new GameObjectAsset()
{
assetName = %name @ "Asset";
gameObjectName = %name;
TAMLFilePath = %tamlPath;
scriptFilePath = %scriptPath;
};
//Save it alongside the taml file
%path = filePath(%tamlPath);
TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml");
AssetDatabase.refreshAllAssets(true);
}
}
//Allocates a number of a game object into a pool to be pulled from as needed
function allocateGameObjects(%name, %amount)
{
//First, we need to make sure our pool exists
if(!isObject(GameObjectPool))
{
new ArrayObject(GameObjectPool);
}
//Next, we loop and generate our game objects, and add them to the pool
for(%i=0; %i < %amount; %i++)
{
%go = spawnGameObject(%name, false);
//When our object is in the pool, it's not "real", so we need to make sure
//that we don't ghost it to clients untill we actually spawn it.
%go.clearScopeAlways();
//We also hide it, so that we don't 'exist' in the scene until we spawn
%go.hidden = true;
//Lastly, add us to the pool, with the key being our game object type
GameObjectPool.add(%name, %go);
}
}
function Entity::delete(%this)
{
//we want to intercept the delete call, and add it to our GameObjectPool
//if it's a game object
if(%this.gameObjectAsset !$= "")
{
%this.setHidden(true);
%this.clearScopeAlways();
if(!isObject(GameObjectPool))
{
new ArrayObject(GameObjectPool);
}
GameObjectPool.add(%this.gameObjectAsset, %this);
%missionSet = %this.getGroup();
%missionSet.remove(%this);
}
else
{
%this.superClass.delete();
}
}
function clearGameObjectPool()
{
if(isObject(GameObjectPool))
{
%count = GameObjectPool.count();
for(%i=0; %i < %count; %i++)
{
%go = GameObjectPool.getValue(%i);
%go.superClass.delete();
}
GameObjectPool.empty();
}
}
//
function switchCamera(%client, %newCamEntity)
{
@ -1155,4 +658,17 @@ function switchCamera(%client, %newCamEntity)
%client.setControlCameraFov(%cam.FOV);
%client.camera = %newCamEntity;
}
function switchControlObject(%client, %newControlEntity)
{
if(!isObject(%client) || !isObject(%newControlEntity))
return error("SwitchControlObject: No client or target controller!");
%control = %newControlEntity.getComponent(ControlObjectComponent);
if(!isObject(%control))
return error("SwitchControlObject: Target controller has no conrol object behavior!");
%control.setConnectionControlObject(%client);
}

View file

@ -0,0 +1,315 @@
//Persistance Manager tests
new PersistenceManager(TestPManager);
function runPManTest(%test)
{
if (!isObject(TestPManager))
return;
if (%test $= "")
%test = 100;
switch(%test)
{
case 0:
TestPManager.testFieldUpdates();
case 1:
TestPManager.testObjectRename();
case 2:
TestPManager.testNewObject();
case 3:
TestPManager.testNewGroup();
case 4:
TestPManager.testMoveObject();
case 5:
TestPManager.testObjectRemove();
case 100:
TestPManager.testFieldUpdates();
TestPManager.testObjectRename();
TestPManager.testNewObject();
TestPManager.testNewGroup();
TestPManager.testMoveObject();
TestPManager.testObjectRemove();
}
}
function TestPManager::testFieldUpdates(%doNotSave)
{
// Set some objects as dirty
TestPManager.setDirty(AudioGui);
TestPManager.setDirty(AudioSim);
TestPManager.setDirty(AudioMessage);
// Alter some of the existing fields
AudioEffect.isLooping = true;
AudioMessage.isLooping = true;
AudioEffect.is3D = true;
// Test removing a field
TestPManager.removeField(AudioGui, "isLooping");
// Alter some of the persistent fields
AudioGui.referenceDistance = 0.8;
AudioMessage.referenceDistance = 0.8;
// Add some new dynamic fields
AudioGui.foo = "bar";
AudioEffect.foo = "bar";
// Remove an object from the dirty list
// It shouldn't get updated in the file
TestPManager.removeDirty(AudioEffect);
// Dirty an object in another file as well
TestPManager.setDirty(WarningMaterial);
// Update a field that doesn't exist
WarningMaterial.glow[0] = true;
// Drity another object to test for crashes
// when a dirty object is deleted
TestPManager.setDirty(SFXPausedSet);
// Delete the object
SFXPausedSet.delete();
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testObjectRename(%doNotSave)
{
// Flag an object as dirty
if (isObject(AudioGui))
TestPManager.setDirty(AudioGui);
else if (isObject(AudioGuiFoo))
TestPManager.setDirty(AudioGuiFoo);
// Rename it
if (isObject(AudioGui))
AudioGui.setName(AudioGuiFoo);
else if (isObject(AudioGuiFoo))
AudioGuiFoo.setName(AudioGui);
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testNewObject(%doNotSave)
{
// Test adding a new named object
new SFXDescription(AudioNew)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 2;
};
// Flag it as dirty
TestPManager.setDirty(AudioNew, "core/scripts/client/audio.cs");
// Test adding a new unnamed object
%obj = new SFXDescription()
{
volume = 0.75;
isLooping = true;
bar = 3;
};
// Flag it as dirty
TestPManager.setDirty(%obj, "core/scripts/client/audio.cs");
// Test adding an "empty" object
new SFXDescription(AudioEmpty);
TestPManager.setDirty(AudioEmpty, "core/scripts/client/audio.cs");
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testNewGroup(%doNotSave)
{
// Test adding a new named SimGroup
new SimGroup(TestGroup)
{
foo = "bar";
new SFXDescription(TestObject)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 1;
};
new SimGroup(SubGroup)
{
foo = 2;
new SFXDescription(SubObject)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 3;
};
};
};
// Flag this as dirty
TestPManager.setDirty(TestGroup, "core/scripts/client/audio.cs");
// Test adding a new unnamed SimGroup
%group = new SimGroup()
{
foo = "bar";
new SFXDescription()
{
volume = 0.75;
channel = $GuiAudioType;
foo = 4;
};
new SimGroup()
{
foo = 5;
new SFXDescription()
{
volume = 0.75;
isLooping = true;
channel = $GuiAudioType;
foo = 6;
};
};
};
// Flag this as dirty
TestPManager.setDirty(%group, "core/scripts/client/audio.cs");
// Test adding a new unnamed SimSet
%set = new SimSet()
{
foo = "bar";
new SFXDescription()
{
volume = 0.75;
channel = $GuiAudioType;
foo = 7;
};
new SimGroup()
{
foo = 8;
new SFXDescription()
{
volume = 0.75;
isLooping = true;
channel = $GuiAudioType;
foo = 9;
};
};
};
// Flag this as dirty
TestPManager.setDirty(%set, "core/scripts/client/audio.cs");
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testMoveObject(%doNotSave)
{
// First add a couple of groups to the file
new SimGroup(MoveGroup1)
{
foo = "bar";
new SFXDescription(MoveObject1)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 1;
};
new SimSet(SubGroup1)
{
new SFXDescription(SubObject1)
{
volume = 0.75;
isLooping = true;
channel = $GuiAudioType;
foo = 2;
};
};
};
// Flag this as dirty
TestPManager.setDirty(MoveGroup1, "core/scripts/client/audio.cs");
new SimGroup(MoveGroup2)
{
foo = "bar";
new SFXDescription(MoveObject2)
{
volume = 0.5;
isLooping = true;
channel = $GuiAudioType;
foo = 3;
};
};
// Flag this as dirty
TestPManager.setDirty(MoveGroup2, "core/scripts/client/audio.cs");
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
// Set them as dirty again
TestPManager.setDirty(MoveGroup1);
TestPManager.setDirty(MoveGroup2);
// Give the subobject an new value
MoveObject1.foo = 4;
// Move it into the other group
MoveGroup1.add(MoveObject2);
// Switch the other subobject
MoveGroup2.add(MoveObject1);
// Also add a new unnamed object to one of the groups
%obj = new SFXDescription()
{
volume = 0.75;
isLooping = true;
bar = 5;
};
MoveGroup1.add(%obj);
// Unless %doNotSave is set (by a batch/combo test)
// then go ahead and save now
if (!%doNotSave)
TestPManager.saveDirty();
}
function TestPManager::testObjectRemove(%doNotSave)
{
TestPManager.removeObjectFromFile(AudioSim);
}

View file

@ -189,7 +189,7 @@ function ConvexEditorPlugin::onSaveMission( %this, %missionFile )
{
if( ConvexEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getScene(0).save( %missionFile );
ConvexEditorGui.isDirty = false;
}
}

View file

@ -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));

View file

@ -1,5 +1,5 @@
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
new Scene(EditorTemplateLevel) {
canSave = "1";
canSaveDynamicFields = "1";
cdTrack = "2";

View file

@ -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 )

View file

@ -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 )
{

View file

@ -164,7 +164,7 @@ function MeshRoadEditorPlugin::onSaveMission( %this, %missionFile )
{
if( MeshRoadEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getScene(0).save( %missionFile );
MeshRoadEditorGui.isDirty = false;
}
}

View file

@ -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);

View file

@ -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);

View file

@ -205,7 +205,7 @@ function NavEditorPlugin::onSaveMission(%this, %missionFile)
{
if(NavEditorGui.isDirty)
{
MissionGroup.save(%missionFile);
getScene(0).save(%missionFile);
NavEditorGui.isDirty = false;
}
}

View file

@ -64,28 +64,6 @@ function destroyPhysicsTools()
function PhysicsEditorPlugin::onWorldEditorStartup( %this )
{
new PopupMenu( PhysicsToolsMenu )
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
EditorGui.menuBar.insert( PhysicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
// Add ourselves to the window menu.
//EditorGui.addToWindowMenu( "Road and Path Editor", "", "RoadEditor" );
}
function PhysicsToolsMenu::onMenuSelect(%this)

View file

@ -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;
}
}

View file

@ -156,7 +156,7 @@ function RoadEditorPlugin::onSaveMission( %this, %missionFile )
{
if( RoadEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getScene(0).save( %missionFile );
RoadEditorGui.isDirty = false;
}
}

View file

@ -1,80 +1,83 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<EditorSettings>
<Group name="AxisGizmo">
<Setting name="axisGizmoMaxScreenLen">100</Setting>
<Setting name="snapRotations">0</Setting>
<Setting name="mouseScaleScalar">0.8</Setting>
<Setting name="renderInfoText">1</Setting>
<Setting name="rotationSnap">15</Setting>
<Setting name="mouseRotateScalar">0.8</Setting>
<Setting name="renderWhenUsed">0</Setting>
<Group name="Grid">
<Setting name="planeDim">500</Setting>
<Setting name="gridColor">255 255 255 20</Setting>
<Setting name="snapToGrid">0</Setting>
<Setting name="renderPlaneHashes">0</Setting>
<Setting name="gridSize">10 10 10</Setting>
<Setting name="renderPlane">0</Setting>
</Group>
</Group>
<Group name="WorldEditor">
<Setting name="dropType">screenCenter</Setting>
<Setting name="forceLoadDAE">0</Setting>
<Setting name="orthoFOV">50</Setting>
<Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
<Setting name="undoLimit">40</Setting>
<Setting name="displayType">6</Setting>
<Setting name="orthoShowGrid">1</Setting>
<Group name="Tools">
<Setting name="snapSoft">0</Setting>
<Setting name="boundingBoxCollision">0</Setting>
<Setting name="snapGround">0</Setting>
<Setting name="dropAtScreenCenterMax">100</Setting>
<Setting name="snapSoftSize">2</Setting>
<Setting name="dropAtScreenCenterScalar">1</Setting>
<Setting name="objectsUseBoxCenter">1</Setting>
</Group>
<Group name="Docs">
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
</Group>
<Group name="Grid">
<Setting name="gridOriginColor">255 255 255 100</Setting>
<Setting name="gridSize">1</Setting>
<Setting name="gridColor">102 102 102 100</Setting>
<Setting name="gridMinorColor">51 51 51 100</Setting>
<Setting name="gridSnap">0</Setting>
</Group>
<Group name="Images">
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
</Group>
<Group name="Render">
<Setting name="showMousePopupInfo">1</Setting>
<Setting name="renderObjHandle">1</Setting>
<Setting name="renderSelectionBox">1</Setting>
<Setting name="renderPopupBackground">1</Setting>
<Setting name="renderObjText">1</Setting>
</Group>
<Setting name="forceLoadDAE">0</Setting>
<Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
<Setting name="displayType">6</Setting>
<Setting name="dropType">screenCenter</Setting>
<Setting name="orthoFOV">50</Setting>
<Setting name="undoLimit">40</Setting>
<Group name="Color">
<Setting name="objMouseOverColor">0 255 0 255</Setting>
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
<Setting name="objectTextColor">255 255 255 255</Setting>
<Setting name="objSelectColor">255 0 0 255</Setting>
<Setting name="selectionBoxColor">255 255 0 255</Setting>
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
<Setting name="objMouseOverColor">0 255 0 255</Setting>
<Setting name="objSelectColor">255 0 0 255</Setting>
<Setting name="dragRectColor">255 255 0 255</Setting>
<Setting name="objectTextColor">255 255 255 255</Setting>
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
</Group>
<Group name="ObjectIcons">
<Setting name="fadeIconsStartDist">8</Setting>
<Setting name="fadeIcons">1</Setting>
<Setting name="fadeIconsEndAlpha">0</Setting>
<Setting name="fadeIconsStartAlpha">255</Setting>
<Setting name="fadeIconsEndDist">20</Setting>
<Setting name="fadeIconsStartAlpha">255</Setting>
<Setting name="fadeIconsEndAlpha">0</Setting>
<Setting name="fadeIcons">1</Setting>
</Group>
<Group name="Render">
<Setting name="showMousePopupInfo">1</Setting>
<Setting name="renderObjText">1</Setting>
<Setting name="renderSelectionBox">1</Setting>
<Setting name="renderPopupBackground">1</Setting>
<Setting name="renderObjHandle">1</Setting>
</Group>
<Group name="Grid">
<Setting name="gridOriginColor">255 255 255 100</Setting>
<Setting name="gridColor">102 102 102 100</Setting>
<Setting name="gridSnap">0</Setting>
<Setting name="gridSize">1</Setting>
<Setting name="gridMinorColor">51 51 51 100</Setting>
</Group>
<Group name="Docs">
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
</Group>
<Group name="Images">
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
</Group>
<Group name="Tools">
<Setting name="boundingBoxCollision">0</Setting>
<Setting name="snapSoftSize">2</Setting>
<Setting name="dropAtScreenCenterMax">100</Setting>
<Setting name="snapSoft">0</Setting>
<Setting name="objectsUseBoxCenter">1</Setting>
<Setting name="dropAtScreenCenterScalar">1</Setting>
<Setting name="snapGround">0</Setting>
</Group>
</Group>
<Group name="AxisGizmo">
<Setting name="renderInfoText">1</Setting>
<Setting name="mouseRotateScalar">0.8</Setting>
<Setting name="axisGizmoMaxScreenLen">100</Setting>
<Setting name="mouseScaleScalar">0.8</Setting>
<Setting name="rotationSnap">15</Setting>
<Setting name="renderWhenUsed">0</Setting>
<Setting name="snapRotations">0</Setting>
<Group name="Grid">
<Setting name="renderPlane">0</Setting>
<Setting name="planeDim">500</Setting>
<Setting name="snapToGrid">0</Setting>
<Setting name="gridSize">10 10 10</Setting>
<Setting name="gridColor">255 255 255 20</Setting>
<Setting name="renderPlaneHashes">0</Setting>
</Group>
</Group>
<Group name="NavEditor">
<Setting name="SpawnClass">AIPlayer</Setting>
</Group>
<Group name="LevelInformation">
<Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
@ -84,7 +87,4 @@
</Group>
</Group>
</Group>
<Group name="NavEditor">
<Setting name="SpawnClass">AIPlayer</Setting>
</Group>
</EditorSettings>

View file

@ -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);

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -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" )
{

View file

@ -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";
}

View file

@ -133,6 +133,15 @@ function initializeWorldEditor()
EVisibility.addOption( "Frustum Lock", "$Scene::lockCull", "" );
EVisibility.addOption( "Disable Zone Culling", "$Scene::disableZoneCulling", "" );
EVisibility.addOption( "Disable Terrain Occlusion", "$Scene::disableTerrainOcclusion", "" );
EVisibility.addOption( "Colorblindness: Protanopia", "$CBV_Protanopia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Protanomaly", "$CBV_Protanomaly", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Deuteranopia", "$CBV_Deuteranopia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Deuteranomaly", "$CBV_Deuteranomaly", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Tritanopia", "$CBV_Tritanopia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Tritanomaly", "$CBV_Tritanomaly", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Achromatopsia", "$CBV_Achromatopsia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Achromatomaly", "$CBV_Achromatomaly", "toggleColorBlindnessViz" );
}
function destroyWorldEditor()

View file

@ -317,10 +317,15 @@ function EditorGui::shutdown( %this )
/// will take over the default world editor window.
function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
{
//We need to cache the editors list. So first see if we have our list we cache the entries into
if(!isObject(EditorsMenuList))
{
new ArrayObject(EditorsMenuList);
}
%windowMenu = %this.findMenu( "Editors" );
%count = %windowMenu.getItemCount();
%alreadyExists = false;
for ( %i = 0; %i < %count; %i++ )
{
@ -336,7 +341,10 @@ function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
%accel = "";
if(!%alreadyExists)
{
EditorsMenuList.add(%displayName TAB %accel TAB %newPlugin);
%windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin );
}
return %accel;
}
@ -637,7 +645,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 +843,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 +1477,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 +1609,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 +1693,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 )
{
@ -1864,6 +1884,7 @@ function Editor::open(%this)
%this.editorEnabled();
Canvas.setContent(EditorGui);
$isFirstPersonVar = true;
EditorGui.syncCameraGui();
}
@ -2025,21 +2046,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;
}

View file

@ -40,7 +40,7 @@ function ESelectObjectsWindow::toggleVisibility( %this )
/// to start searching for objects.
function ESelectObjectsWindow::getRootGroup( %this )
{
return MissionGroup;
return getScene(0);
}
//---------------------------------------------------------------------------------------------

View file

@ -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);

View file

@ -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)

View file

@ -367,3 +367,81 @@ function toggleBackbufferViz( %enable )
else if ( !%enable )
AL_DeferredShading.enable();
}
function toggleColorBlindnessViz( %enable )
{
if ( %enable $= "" )
{
$CBV_Protanopia = ColorBlindnessVisualize.isEnabled() ? false : true;
ColorBlindnessVisualize.toggle();
}
else if ( %enable )
ColorBlindnessVisualize.enable();
else if ( !%enable )
ColorBlindnessVisualize.disable();
}
new ShaderData( ColorBlindnessVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "tools/worldEditor/scripts/shaders/dbgColorBlindnessVisualizeP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = "tools/worldEditor/scripts/shaders/dbgColorBlindnessVisualizeP.glsl";
samplerNames[0] = "$backBuffer";
pixVersion = 2.0;
};
singleton PostEffect( ColorBlindnessVisualize )
{
isEnabled = false;
allowReflectPass = false;
renderTime = "PFXAfterBin";
renderBin = "GlowBin";
shader = ColorBlindnessVisualizeShader;
stateBlock = PFX_DefaultStateBlock;
texture[0] = "$backBuffer";
target = "$backBuffer";
renderPriority = 10;
};
function ColorBlindnessVisualize::setShaderConsts(%this)
{
%mode = 0;
if($CBV_Protanopia)
%mode = 1;
else if($CBV_Protanomaly)
%mode = 2;
else if($CBV_Deuteranopia)
%mode = 3;
else if($CBV_Deuteranomaly)
%mode = 4;
else if($CBV_Tritanopia)
%mode = 5;
else if($CBV_Tritanomaly)
%mode = 6;
else if($CBV_Achromatopsia)
%mode = 7;
else if($CBV_Achromatomaly)
%mode = 8;
%this.setShaderConst("$mode", %mode);
}
function ColorBlindnessVisualize::onEnabled( %this )
{
AL_NormalsVisualize.disable();
AL_DepthVisualize.disable();
AL_LightSpecularVisualize.disable();
AL_LightColorVisualize.disable();
$AL_NormalsVisualizeVar = false;
$AL_DepthVisualizeVar = false;
$AL_LightSpecularVisualizeVar = false;
$AL_LightColorVisualizeVar = false;
return true;
}

View file

@ -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()
{
@ -882,6 +897,64 @@ function EditorDropTypeMenu::setupDefaultState(%this)
//////////////////////////////////////////////////////////////////////////
function EditorSnapToMenu::onSelectItem(%this, %id, %text)
{
EWorldEditor.SnapTo(%id);
}
function EditorSnapToMenu::setupDefaultState(%this)
{
Parent::setupDefaultState(%this);
}
function WorldEditor::snapTo(%this, %id)
{
if(%this.getSelectionSize() > 2)
{
error("Please select two objects before selecting a Snap To function.");
return;
}
%objTarget = %this.getSelectedObject(0);
%objToSnap = %this.getSelectedObject(%this.getSelectionSize()-1);
switch$(%id)
{
case 0:
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 0, getWord(%objTarget.getTransform(), 0)));
case 1:
%objTargetXEdge = getWord(%objTarget.getTransform(), 0) + getWord(%objTarget.getObjectBox(), 0);
%objToSnapXEdge = %objTargetXEdge - getWord(%objToSnap.getObjectBox(), 3);
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 0, %objToSnapXEdge));
case 2:
%objTargetXEdge = getWord(%objTarget.getTransform(), 0) + getWord(%objTarget.getObjectBox(), 3);
%objToSnapXEdge = %objTargetXEdge - getWord(%objToSnap.getObjectBox(), 0);
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 0, %objToSnapXEdge));
case 3:
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 1, getWord(%objTarget.getTransform(), 1)));
case 4:
%objTargetXEdge = getWord(%objTarget.getTransform(), 1) + getWord(%objTarget.getObjectBox(), 1);
%objToSnapXEdge = %objTargetXEdge - getWord(%objToSnap.getObjectBox(), 4);
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 1, %objToSnapXEdge));
case 5:
%objTargetXEdge = getWord(%objTarget.getTransform(), 1) + getWord(%objTarget.getObjectBox(), 4);
%objToSnapXEdge = %objTargetXEdge - getWord(%objToSnap.getObjectBox(), 1);
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 1, %objToSnapXEdge));
case 6:
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 2, getWord(%objTarget.getTransform(), 2)));
case 7:
%objTargetXEdge = getWord(%objTarget.getTransform(), 2) + getWord(%objTarget.getObjectBox(), 2);
%objToSnapXEdge = %objTargetXEdge - getWord(%objToSnap.getObjectBox(), 5);
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 2, %objToSnapXEdge));
case 8:
%objTargetXEdge = getWord(%objTarget.getTransform(), 2) + getWord(%objTarget.getObjectBox(), 5);
%objToSnapXEdge = %objTargetXEdge - getWord(%objToSnap.getObjectBox(), 2);
%objToSnap.setTransform(setWord(%objToSnap.getTransform(), 2, %objToSnapXEdge));
}
}
//////////////////////////////////////////////////////////////////////////
function EditorAlignBoundsMenu::onSelectItem(%this, %id, %text)
{
// Have the editor align all selected objects by the selected bounds.

View file

@ -113,7 +113,7 @@ function EditorGui::buildMenus(%this)
%this.menuBar = new GuiMenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
extent = "1024 20";
extent = Canvas.extent.x SPC "20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
@ -233,8 +233,32 @@ function EditorGui::buildMenus(%this)
Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();";
item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu;
};
%this.menuBar.insert(%cameraMenu);
// Snap Menu
%snapToMenu = new PopupMenu()
{
superClass = "MenuBuilder";
class = "EditorSnapToMenu";
barTitle = "SnapTo";
// The onSelectItem() callback for this menu re-purposes the command field
// as the MenuBuilder version is not used.
item[0] = "Snap 2nd Object To 1st X" TAB "" TAB "X";
item[1] = "Snap 2nd Object To 1st X+" TAB "" TAB "X+";
item[2] = "Snap 2nd Object To 1st X-" TAB "" TAB "X-";
item[3] = "Snap 2nd Object To 1st Y" TAB "" TAB "Y";
item[4] = "Snap 2nd Object to 1st Y+" TAB "" TAB "Y+";
item[5] = "Snap 2nd Object to 1st Y-" TAB "" TAB "Y-";
item[6] = "Snap 2nd Object To 1st Z" TAB "" TAB "Z";
item[7] = "Snap 2nd Object to 1st Z+" TAB "" TAB "Z+";
item[8] = "Snap 2nd Object to 1st Z-" TAB "" TAB "Z-";
};
%this.menuBar.insert(%snapToMenu);
// Editors Menu
%editorsMenu = new PopupMenu()
{
@ -251,6 +275,41 @@ function EditorGui::buildMenus(%this)
//item[5] = "-";
};
%this.menuBar.insert(%editorsMenu);
//if we're just refreshing the menus, we probably have a list of editors we want added to the Editors menu there, so check and if so, add them now
if(isObject(EditorsMenuList))
{
%editorsListCount = EditorsMenuList.count();
for(%e = 0; %e < %editorsListCount; %e++)
{
%menuEntry = EditorsMenuList.getKey(%e);
%editorsMenu.addItem(%e, %menuEntry);
}
}
if(isObject(PhysicsEditorPlugin))
{
%physicsToolsMenu = new PopupMenu()
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
%this.menuBar.insert( %physicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
}
// Lighting Menu
%lightingMenu = new PopupMenu()
@ -389,6 +448,11 @@ function EditorGui::buildMenus(%this)
//////////////////////////////////////////////////////////////////////////
function WorldEditorMenubar::onResize(%this)
{
%this.extent.x = Canvas.extent.x;
}
function EditorGui::attachMenus(%this)
{
%this.menuBar.attachToCanvas(Canvas, 0);

View file

@ -0,0 +1,121 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//Using calculations and values provided by Alan Zucconi
// www.alanzucconi.com
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
in vec2 uv0;
uniform sampler2D backBufferTex;
in float mode;
out vec4 OUT_col;
void main()
{
vec4 imageColor = texture( backBufferTex, uv0 );
if(mode == 0)
{
OUT_col = imageColor;
}
else
{
vec3 R = imageColor.r;
vec3 G = imageColor.g;
vec3 B = imageColor.b;
if(mode == 1) // Protanopia
{
R = vec3(0.56667, 0.43333, 0);
G = vec3(0.55833, 0.44167, 0);
B = vec3(0, 0.24167, 0.75833);
}
else if(mode == 2) // Protanomaly
{
R = vec3(0.81667, 0.18333, 0);
G = vec3(0.33333, 0.66667, 0);
B = vec3(0, 0.125, 0.875);
}
else if(mode == 3) // Deuteranopia
{
R = vec3(0.625, 0.375, 0);
G = vec3(0.70, 0.30, 0);
B = vec3(0, 0.30, 0.70);
}
else if(mode == 4) // Deuteranomaly
{
R = vec3(0.80, 0.20, 0);
G = vec3(0.25833, 0.74167, 0);
B = vec3(0, 0.14167, 0.85833);
}
else if(mode == 5) // Tritanopia
{
R = vec3(0.95, 0.05, 0);
G = vec3(0, 0.43333, 0.56667);
B = vec3(0, 0.475, 0.525);
}
else if(mode == 6) // Tritanomaly
{
R = vec3(0.96667, 0.03333, 0);
G = vec3(0, 0.73333, 0.26667);
B = vec3(0, 0.18333, 0.81667);
}
else if(mode == 7) // Achromatopsia
{
R = vec3(0.299, 0.587, 0.114);
G = vec3(0.299, 0.587, 0.114);
B = vec3(0.299, 0.587, 0.114);
}
else if(mode == 8) // Achromatomaly
{
R = vec3(0.618, 0.32, 0.062);
G = vec3(0.163, 0.775, 0.062);
B = vec3(0.163, 0.320, 0.516);
}
//First set
vec4 c = imageColor;
c.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
c.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
c.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
vec3 cb = c.rgb;
cb.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
cb.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
cb.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
// Difference
vec3 diff = abs(c.rgb - cb);
float lum = c.r*.3 + c.g*.59 + c.b*.11;
vec3 bw = vec3(lum, lum, lum);
// return vec4(lerp(bw, vec3(1, 0, 0), saturate((diff.r + diff.g + diff.b) / 3)), c.a);
OUT_col = vec4(c.rgb,1);
}
}

View file

@ -0,0 +1,118 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//Using calculations and values provided by Alan Zucconi
// www.alanzucconi.com
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(backBufferTex,0);
uniform float mode;
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float4 imageColor = TORQUE_TEX2D( backBufferTex, IN.uv0 );
if(mode == 0)
{
return imageColor;
}
else
{
float3 R = imageColor.r;
float3 G = imageColor.g;
float3 B = imageColor.b;
if(mode == 1) // Protanopia
{
R = float3(0.56667, 0.43333, 0);
G = float3(0.55833, 0.44167, 0);
B = float3(0, 0.24167, 0.75833);
}
else if(mode == 2) // Protanomaly
{
R = float3(0.81667, 0.18333, 0);
G = float3(0.33333, 0.66667, 0);
B = float3(0, 0.125, 0.875);
}
else if(mode == 3) // Deuteranopia
{
R = float3(0.625, 0.375, 0);
G = float3(0.70, 0.30, 0);
B = float3(0, 0.30, 0.70);
}
else if(mode == 4) // Deuteranomaly
{
R = float3(0.80, 0.20, 0);
G = float3(0.25833, 0.74167, 0);
B = float3(0, 0.14167, 0.85833);
}
else if(mode == 5) // Tritanopia
{
R = float3(0.95, 0.05, 0);
G = float3(0, 0.43333, 0.56667);
B = float3(0, 0.475, 0.525);
}
else if(mode == 6) // Tritanomaly
{
R = float3(0.96667, 0.03333, 0);
G = float3(0, 0.73333, 0.26667);
B = float3(0, 0.18333, 0.81667);
}
else if(mode == 7) // Achromatopsia
{
R = float3(0.299, 0.587, 0.114);
G = float3(0.299, 0.587, 0.114);
B = float3(0.299, 0.587, 0.114);
}
else if(mode == 8) // Achromatomaly
{
R = float3(0.618, 0.32, 0.062);
G = float3(0.163, 0.775, 0.062);
B = float3(0.163, 0.320, 0.516);
}
//First set
float4 c = imageColor;
c.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
c.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
c.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
float3 cb = c.rgb;
cb.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
cb.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
cb.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
// Difference
float3 diff = abs(c.rgb - cb);
float lum = c.r*.3 + c.g*.59 + c.b*.11;
float3 bw = float3(lum, lum, lum);
// return float4(lerp(bw, float3(1, 0, 0), saturate((diff.r + diff.g + diff.b) / 3)), c.a);
return float4(c.rgb,1);
}
}

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D colorBufferTex;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
in vec2 uv0;

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "core/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D glowBuffer;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(glowBuffer, 0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D lightDeferredTex;

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/shaderModelAutoGen.hlsl"
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D lightDeferredTex;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
in vec2 uv0;

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "core/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D shadowMap;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/shaderModel.hlsl"
#include "../../../../core/rendering/shaders/shaderModel.hlsl"
struct MaterialDecoratorConnectV
{

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D matinfoTex;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(matinfoTex,0);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -219,7 +219,7 @@ function AggregateControl::callMethod(%this, %method, %args)
function parseMissionGroup( %className, %childGroup )
{
if( getWordCount( %childGroup ) == 0)
%currentGroup = "MissionGroup";
%currentGroup = getRootScene();
else
%currentGroup = %childGroup;
@ -240,7 +240,7 @@ function parseMissionGroup( %className, %childGroup )
function parseMissionGroupForIds( %className, %childGroup )
{
if( getWordCount( %childGroup ) == 0)
%currentGroup = "MissionGroup";
%currentGroup = getRootScene();
else
%currentGroup = %childGroup;

View file

@ -49,7 +49,7 @@ function GameConnection::loadMission(%this)
else
{
commandToClient(%this, 'MissionStartPhase1', $missionSequence,
$Server::MissionFile, MissionGroup.musicTrack);
$Server::MissionFile, getRootScene().musicTrack);
echo("*** Sending mission load to client: " @ $Server::MissionFile);
}
}

View file

@ -96,12 +96,12 @@ function loadMissionStage2()
// to caching mission lighting.
$missionCRC = getFileCRC( %file );
// Exec the mission. The MissionGroup (loaded components) is added to the ServerGroup
// Exec the mission. The Scene (loaded components) is added to the ServerGroup
exec(%file);
if( !isObject(MissionGroup) )
if( !isObject(getRootScene()) )
{
$Server::LoadFailMsg = "No 'MissionGroup' found in mission \"" @ %file @ "\".";
$Server::LoadFailMsg = "No 'Scene' found in mission \"" @ %file @ "\".";
}
}
@ -145,7 +145,7 @@ function loadMissionStage2()
function endMission()
{
if (!isObject( MissionGroup ))
if (!isObject( getRootScene() ))
return;
echo("*** ENDING MISSION");
@ -163,7 +163,7 @@ function endMission()
}
// Delete everything
MissionGroup.delete();
getRootScene().delete();
MissionCleanup.delete();
clearServerPaths();

View file

@ -1,6 +1,5 @@
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
canSave = "1";
new Scene(EmptyLevel) {
canSaveDynamicFields = "1";
enabled = "1";

View file

@ -1,7 +1,10 @@
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
new Scene(EmptyTerrainLevel) {
canSave = "1";
canSaveDynamicFields = "1";
isSubscene = "0";
isEditing = "0";
isDirty = "0";
enabled = "1";
new LevelInfo(theLevelInfo) {
@ -37,6 +40,8 @@ new SimGroup(MissionGroup) {
rotation = "1 0 0 0";
canSave = "1";
canSaveDynamicFields = "1";
scale = "1 1 1";
tile = "0";
};
new SimGroup(PlayerDropPoints) {
canSave = "1";
@ -163,7 +168,6 @@ new SimGroup(MissionGroup) {
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
surface = "0 0 0 1 1.29457 -0.42643 0.5";
surface = "0 1 0 0 1.29457 -0.42643 -0.5";
surface = "0.707107 0 0 0.707106 1.29457 5.75621 0";

View file

@ -1,5 +1,5 @@
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
new Scene(OutpostLevel) {
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";

View file

@ -134,12 +134,12 @@ package GameCore
// to caching mission lighting.
$missionCRC = getFileCRC( %file );
// Exec the mission. The MissionGroup (loaded components) is added to the ServerGroup
// Exec the mission. The Scene (loaded components) is added to the ServerGroup
exec(%file);
if( !isObject(MissionGroup) )
if( !isObject(getRootScene()) )
{
$Server::LoadFailMsg = "No 'MissionGroup' found in mission \"" @ %file @ "\".";
$Server::LoadFailMsg = "No Scene found in mission \"" @ %file @ "\".";
}
}

View file

@ -92,7 +92,7 @@ function ItemData::onThrow(%this, %user, %amount)
rotation = "0 0 1 "@ (getRandom() * 360);
count = %amount;
};
MissionGroup.add(%obj);
getRootScene().add(%obj);
%obj.schedulePop();
return %obj;
}

View file

@ -87,7 +87,7 @@ function TurretShapeData::onRemove(%this, %obj)
}
// This is on MissionGroup so it doesn't happen when the mission has ended
function MissionGroup::respawnTurret(%this, %datablock, %className, %transform, %static, %respawn)
function Scene::respawnTurret(%this, %datablock, %className, %transform, %static, %respawn)
{
%turret = new (%className)()
{
@ -97,7 +97,7 @@ function MissionGroup::respawnTurret(%this, %datablock, %className, %transform,
};
%turret.setTransform(%transform);
MissionGroup.add(%turret);
getRootScene().add(%turret);
return %turret;
}
@ -149,7 +149,7 @@ function TurretShapeData::onDestroyed(%this, %obj, %lastState)
if (%obj.doRespawn())
{
MissionGroup.schedule($TurretShape::RespawnTime, "respawnTurret", %this, %obj.getClassName(), %obj.getTransform(), true, true);
getRootScene().schedule($TurretShape::RespawnTime, "respawnTurret", %this, %obj.getClassName(), %obj.getTransform(), true, true);
}
}
@ -331,7 +331,7 @@ function AITurretShapeData::onThrow(%this, %user, %amount)
client = %user.client;
isAiControlled = true;
};
MissionGroup.add(%obj);
getRootScene().add(%obj);
// Let the turret know that we're a firend
%obj.addToIgnoreList(%user);

View file

@ -1 +0,0 @@
/procedural/

View file

@ -0,0 +1,2 @@
*.hlsl
*.glsl

View file

@ -189,7 +189,7 @@ function ConvexEditorPlugin::onSaveMission( %this, %missionFile )
{
if( ConvexEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getRootScene().save( %missionFile );
ConvexEditorGui.isDirty = false;
}
}

View file

@ -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 = getRootScene().getObject(getRootScene().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);
getRootScene().add(%group);
if (EditorTree.isVisible())
{
EditorTree.removeItem(EditorTree.findItemByObjectId(%obj));

View file

@ -1,5 +1,5 @@
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
new Scene(EditorTemplateLevel) {
canSaveDynamicFields = "1";
cdTrack = "2";
CTF_scoreLimit = "5";

View file

@ -1129,7 +1129,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( getRootScene(), %action.oldName, %action.newName );
}
function MaterialEditorGui::updateMaterialReferences( %this, %obj, %oldName, %newName )

View file

@ -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( getRootScene(), %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( getRootScene(), %this.newName, %this.oldName );
if( MaterialEditorPreviewWindow.isVisible() && MaterialEditorGui.currentMaterial == %this.material )
{

View file

@ -164,7 +164,7 @@ function MeshRoadEditorPlugin::onSaveMission( %this, %missionFile )
{
if( MeshRoadEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getRootScene().save( %missionFile );
MeshRoadEditorGui.isDirty = false;
}
}

View file

@ -114,7 +114,7 @@ function MissionAreaEditorPlugin::createNewMissionArea(%this)
%newMissionArea = new MissionArea();
%newMissionArea.area = "-256 -256 512 512";
MissionGroup.add(%newMissionArea);
getRootScene().add(%newMissionArea);
EditorGui.setEditor(MissionAreaEditorPlugin);

View file

@ -354,13 +354,13 @@ function CreateNewNavMeshDlg::create(%this)
if(MeshMissionBounds.isStateOn())
{
if(!isObject(MissionGroup))
if(!isObject(getRootScene()))
{
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(getRootScene());
%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);
getRootScene().add(%mesh);
NavEditorGui.selectObject(%mesh);
Canvas.popDialog(CreateNewNavMeshDlg);

View file

@ -205,7 +205,7 @@ function NavEditorPlugin::onSaveMission(%this, %missionFile)
{
if(NavEditorGui.isDirty)
{
MissionGroup.save(%missionFile);
getRootScene().save(%missionFile);
NavEditorGui.isDirty = false;
}
}

View file

@ -64,28 +64,6 @@ function destroyPhysicsTools()
function PhysicsEditorPlugin::onWorldEditorStartup( %this )
{
new PopupMenu( PhysicsToolsMenu )
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
EditorGui.menuBar.insert( PhysicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
// Add ourselves to the window menu.
//EditorGui.addToWindowMenu( "Road and Path Editor", "", "RoadEditor" );
}
function PhysicsToolsMenu::onMenuSelect(%this)

View file

@ -178,7 +178,7 @@ function RiverEditorPlugin::onSaveMission( %this, %missionFile )
{
if( RiverEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getRootScene().save( %missionFile );
RiverEditorGui.isDirty = false;
}
}

View file

@ -156,7 +156,7 @@ function RoadEditorPlugin::onSaveMission( %this, %missionFile )
{
if( RoadEditorGui.isDirty )
{
MissionGroup.save( %missionFile );
getRootScene().save( %missionFile );
RoadEditorGui.isDirty = false;
}
}

View file

@ -168,7 +168,7 @@ function ShapeEditorPlugin::open(%this, %filename)
ShapeEdNodes-->worldTransform.setStateOn(1);
// Initialise and show the shape editor
ShapeEdShapeTreeView.open(MissionGroup);
ShapeEdShapeTreeView.open(getRootScene());
ShapeEdShapeTreeView.buildVisibleTree(true);
ShapeEdPreviewGui.setVisible(true);

View file

@ -184,11 +184,11 @@ function TimeAdjustSliderCtrl::onAction(%this)
if ( !isObject( %this.tod ) )
{
if ( isObject( MissionGroup ) )
if ( isObject( getRootScene() ) )
{
for ( %i = 0; %i < MissionGroup.getCount(); %i++ )
for ( %i = 0; %i < getRootScene().getCount(); %i++ )
{
%obj = MissionGroup.getObject( %i );
%obj = getRootScene().getObject( %i );
if ( %obj.getClassName() $= "TimeOfDay" )
{

View file

@ -965,10 +965,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() == getRootScene().getID() )
{
if( !isObject("PlayerDropPoints") )
MissionGroup.add( new SimGroup("PlayerDropPoints") );
getRootScene().add( new SimGroup("PlayerDropPoints") );
%this.objectGroup = "PlayerDropPoints";
}
@ -985,10 +985,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() == getRootScene().getID() )
{
if( !isObject("ObserverDropPoints") )
MissionGroup.add( new SimGroup("ObserverDropPoints") );
getRootScene().add( new SimGroup("ObserverDropPoints") );
%this.objectGroup = "ObserverDropPoints";
}

View file

@ -317,10 +317,15 @@ function EditorGui::shutdown( %this )
/// will take over the default world editor window.
function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
{
//We need to cache the editors list. So first see if we have our list we cache the entries into
if(!isObject(EditorsMenuList))
{
new ArrayObject(EditorsMenuList);
}
%windowMenu = %this.findMenu( "Editors" );
%count = %windowMenu.getItemCount();
%alreadyExists = false;
for ( %i = 0; %i < %count; %i++ )
{
@ -336,7 +341,10 @@ function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
%accel = "";
if(!%alreadyExists)
{
EditorsMenuList.add(%displayName TAB %accel TAB %newPlugin);
%windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin );
}
return %accel;
}
@ -637,7 +645,7 @@ function EditorGui::addCameraBookmark( %this, %name )
if( !isObject(CameraBookmarks) )
{
%grp = new SimGroup(CameraBookmarks);
MissionGroup.add(%grp);
getRootScene().add(%grp);
}
CameraBookmarks.add( %obj );
@ -835,12 +843,17 @@ function EditorGui::syncCameraGui( %this )
function WorldEditorPlugin::onActivated( %this )
{
if(!isObject(Scenes))
$scenesRootGroup = new SimGroup(Scenes);
$scenesRootGroup.add(getRootScene());
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(getRootScene());
EWorldEditor.syncGui();
@ -1464,7 +1477,7 @@ function EditorTree::onDeleteObject( %this, %object )
return true;
if( %object == EWCreatorWindow.objectGroup )
EWCreatorWindow.setNewObjectGroup( MissionGroup );
EWCreatorWindow.setNewObjectGroup( getRootScene() );
// Append it to our list.
%this.undoDeleteList = %this.undoDeleteList TAB %object;
@ -1596,6 +1609,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 +1693,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.getName() !$= getRootScene() );
%popup.enableItem( 1, %obj.getName() !$= getRootScene() );
if( %haveLockAndHideEntries )
{
@ -1864,6 +1884,7 @@ function Editor::open(%this)
%this.editorEnabled();
Canvas.setContent(EditorGui);
$isFirstPersonVar = true;
EditorGui.syncCameraGui();
}
@ -2025,21 +2046,21 @@ function EWorldEditor::syncToolPalette( %this )
function EWorldEditor::addSimGroup( %this, %groupCurrentSelection )
{
%activeSelection = %this.getActiveSelection();
if ( %activeSelection.getObjectIndex( MissionGroup ) != -1 )
if ( %activeSelection.getObjectIndex( getRootScene() ) != -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 = getRootScene();
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() != getRootScene().getId() )
%parent = %firstSelectedObject.parentGroup;
}
@ -2625,4 +2646,4 @@ function EditorDropdownSliderContainer::onMouseDown(%this)
function EditorDropdownSliderContainer::onRightMouseDown(%this)
{
Canvas.popDialog(%this);
}
}

View file

@ -40,7 +40,7 @@ function ESelectObjectsWindow::toggleVisibility( %this )
/// to start searching for objects.
function ESelectObjectsWindow::getRootGroup( %this )
{
return MissionGroup;
return getRootScene();
}
//---------------------------------------------------------------------------------------------

View file

@ -186,7 +186,7 @@ function EWCreatorWindow::createStatic( %this, %file )
return;
if( !isObject(%this.objectGroup) )
%this.setNewObjectGroup( MissionGroup );
%this.setNewObjectGroup( getRootScene() );
%objId = new TSStatic()
{
@ -204,7 +204,7 @@ function EWCreatorWindow::createPrefab( %this, %file )
return;
if( !isObject(%this.objectGroup) )
%this.setNewObjectGroup( MissionGroup );
%this.setNewObjectGroup( getRootScene() );
%objId = new Prefab()
{
@ -222,7 +222,7 @@ function EWCreatorWindow::createObject( %this, %cmd )
return;
if( !isObject(%this.objectGroup) )
%this.setNewObjectGroup( MissionGroup );
%this.setNewObjectGroup( getRootScene() );
pushInstantGroup();
%objId = eval(%cmd);

View file

@ -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);
getRootScene().save("~/editor/" @ %file, true);
}
function WorldEditor::import(%this)

View file

@ -272,7 +272,7 @@ function EditorSaveMission()
// now write the terrain and mission files out:
if(EWorldEditor.isDirty || ETerrainEditor.isMissionDirty)
MissionGroup.save($Server::MissionFile);
getRootScene().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()
{

View file

@ -113,7 +113,7 @@ function EditorGui::buildMenus(%this)
%this.menuBar = new GuiMenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
extent = "1024 20";
extent = Canvas.extent.x SPC "20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
@ -251,6 +251,41 @@ function EditorGui::buildMenus(%this)
//item[5] = "-";
};
%this.menuBar.insert(%editorsMenu);
//if we're just refreshing the menus, we probably have a list of editors we want added to the Editors menu there, so check and if so, add them now
if(isObject(EditorsMenuList))
{
%editorsListCount = EditorsMenuList.count();
for(%e = 0; %e < %editorsListCount; %e++)
{
%menuEntry = EditorsMenuList.getKey(%e);
%editorsMenu.addItem(%e, %menuEntry);
}
}
if(isObject(PhysicsEditorPlugin))
{
%physicsToolsMenu = new PopupMenu()
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
%this.menuBar.insert( %physicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
}
// Lighting Menu
%lightingMenu = new PopupMenu()
@ -389,6 +424,11 @@ function EditorGui::buildMenus(%this)
//////////////////////////////////////////////////////////////////////////
function WorldEditorMenubar::onResize(%this)
{
%this.extent.x = Canvas.extent.x;
}
function EditorGui::attachMenus(%this)
{
%this.menuBar.attachToCanvas(Canvas, 0);