Duplicating changes in the tools folder over to the Empty template for parity.

This commit is contained in:
Areloch 2016-07-09 20:08:25 -05:00
parent a2a4b1c5e3
commit 10df58f716
21 changed files with 1070 additions and 74 deletions

View file

@ -204,6 +204,77 @@
editorSettingsWrite = "EditorGui.writeWorldEditorSettings();";
};
};
new GuiControl() {
position = "0 0";
extent = "430 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
new GuiTextCtrl() {
text = "New Game Objects";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "5 1";
extent = "70 16";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiTextRightProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
text = "scripts/server/gameObjects";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "81 0";
extent = "345 17";
minExtent = "8 2";
horizSizing = "width";
vertSizing = "bottom";
profile = "ToolsGuiTextEditProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "1";
class = "ESettingsWindowTextEdit";
editorSettingsRead = "EditorGui.readWorldEditorSettings();";
editorSettingsValue = "WorldEditor/newGameObjectDir";
editorSettingsWrite = "EditorGui.writeWorldEditorSettings();";
};
};
};
};
};

View file

@ -402,3 +402,4 @@ function generateProceduralTerrainMask()
Canvas.popDialog(ProceduralTerrainPainterGui);
ETerrainEditor.autoMaterialLayer($TPPHeightMin, $TPPHeightMax, $TPPSlopeMin, $TPPSlopeMax, $TPPCoverage);
}

View file

@ -158,7 +158,7 @@
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
wrap = "0";
bitmap= "tools/materialeditor/gui/unknownImage";
bitmap= "tools/materialEditor/gui/unknownImage";
};
new GuiBitmapCtrl(ETerrainMaterialSelectedBorder) {
canSaveDynamicFields = "0";

View file

@ -113,7 +113,7 @@
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Paint (5)";
hovertime = "1000";
bitmap = "tools/foresteditor/images/paint-forest-btn";
bitmap = "tools/forestEditor/images/paint-forest-btn";
buttonType = "RadioButton";
useMouseEvents = "0";
};
@ -134,7 +134,7 @@
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Erase (6)";
hovertime = "1000";
bitmap = "tools/foresteditor/images/erase-all-btn";
bitmap = "tools/forestEditor/images/erase-all-btn";
buttonType = "RadioButton";
useMouseEvents = "0";
};
@ -156,7 +156,7 @@
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Erase Selected (7)";
hovertime = "1000";
bitmap = "tools/foresteditor/images/erase-element-btn";
bitmap = "tools/forestEditor/images/erase-element-btn";
buttonType = "RadioButton";
useMouseEvents = "0";
};

View file

@ -261,7 +261,7 @@
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
bitmap = "tools/materialeditor/gui/unknownImage";
bitmap = "tools/materialEditor/gui/unknownImage";
wrap = "0";
};
new GuiBitmapButtonCtrl() {
@ -358,7 +358,7 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "TerrainMaterialDlg-->baseTexCtrl.setBitmap(\"tools/materialeditor/gui/unknownImage\");";
Command = "TerrainMaterialDlg-->baseTexCtrl.setBitmap(\"tools/materialEditor/gui/unknownImage\");";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
groupNum = "-1";
@ -466,7 +466,7 @@
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
bitmap = "tools/materialeditor/gui/unknownImage";
bitmap = "tools/materialEditor/gui/unknownImage";
wrap = "0";
};
new GuiTextCtrl() {
@ -563,7 +563,7 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "TerrainMaterialDlg-->normTexCtrl.setBitmap(\"tools/materialeditor/gui/unknownImage\");";
Command = "TerrainMaterialDlg-->normTexCtrl.setBitmap(\"tools/materialEditor/gui/unknownImage\");";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
groupNum = "-1";
@ -662,7 +662,7 @@
canSaveDynamicFields = "0";
new GuiBitmapCtrl() {
bitmap = "tools/materialeditor/gui/unknownImage";
bitmap = "tools/materialEditor/gui/unknownImage";
wrap = "0";
position = "1 1";
extent = "47 47";
@ -787,7 +787,7 @@
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
command = "TerrainMaterialDlg-->macroTexCtrl.setBitmap(\"tools/materialeditor/gui/unknownImage\");";
command = "TerrainMaterialDlg-->macroTexCtrl.setBitmap(\"tools/materialEditor/gui/unknownImage\");";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -999,7 +999,7 @@
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
bitmap = "tools/materialeditor/gui/unknownImage";
bitmap = "tools/materialEditor/gui/unknownImage";
wrap = "0";
};
new GuiBitmapButtonCtrl() {
@ -1096,7 +1096,7 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "TerrainMaterialDlg-->detailTexCtrl.setBitmap(\"tools/materialeditor/gui/unknownImage\");";
Command = "TerrainMaterialDlg-->detailTexCtrl.setBitmap(\"tools/materialEditor/gui/unknownImage\");";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
groupNum = "-1";

View file

@ -1619,7 +1619,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
}
// Open context menu if this is a SimGroup
else if( %obj.isMemberOfClass( "SimGroup" ) )
else if( !%obj.isMemberOfClass( "SceneObject" ) )
{
%popup = ETSimGroupContextPopup;
if( !isObject( %popup ) )
@ -1675,9 +1675,23 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
object = -1;
};
if(%obj.isMemberOfClass("Entity"))
{
%popup = ETEntityContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 12 ] = "-";
item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );";
};
}
// Specialized version for ConvexShapes.
if( %obj.isMemberOfClass( "ConvexShape" ) )
else if( %obj.isMemberOfClass( "ConvexShape" ) )
{
%popup = ETConvexShapeContextPopup;
if( !isObject( %popup ) )
@ -2204,6 +2218,155 @@ function EWorldEditor::deleteMissionObject( %this, %object )
EditorTree.buildVisibleTree( true );
}
function EWorldEditor::createGameObject( %this, %entity )
{
if(!isObject(GameObjectBuilder))
{
new GuiControl(GameObjectBuilder, EditorGuiGroup) {
profile = "ToolsGuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
new GuiWindowCtrl(GameObjectBuilderTargetWindow) {
profile = "ToolsGuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "384 205";
extent = "256 102";
minExtent = "256 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
text = "Create Object";
new GuiTextCtrl() {
profile = "GuiCenterTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "9 26";
extent = "84 16";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = "Object Name:";
};
new GuiTextEditCtrl(GameObjectBuilderObjectName) {
class = ObjectBuilderGuiTextEditCtrl;
profile = "ToolsGuiTextEditProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "78 26";
extent = "172 18";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
historySize = "0";
};
new GuiButtonCtrl(GameObjectBuilderOKButton) {
profile = "ToolsGuiButtonProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "7 250";
extent = "156 24";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
command = "EWorldEditor.buildGameObject();";
helpTag = "0";
text = "Create New";
Accelerator = "return";
};
new GuiButtonCtrl(GameObjectBuilderCancelButton) {
profile = "ToolsGuiButtonProfile";
horizSizing = "left";
vertSizing = "bottom";
position = "170 250";
extent = "80 24";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
command = "Canvas.popDialog(GameObjectBuilder);";
helpTag = "0";
text = "Cancel";
Accelerator = "escape";
};
};
};
GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88;
GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57;
GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57;
}
GameObjectBuilderObjectName.text = "";
GameObjectBuilder.selectedEntity = %entity;
Canvas.pushDialog(GameObjectBuilder);
}
function EWorldEditor::buildGameObject(%this)
{
if(GameObjectBuilderObjectName.getText() $= "")
{
error("Attempted to make a new Game Object with no name!");
Canvas.popDialog(GameObjectBuilder);
return;
}
%path = EditorSettings.value( "WorldEditor/newGameObjectDir" );
%className = GameObjectBuilderObjectName.getText();
GameObjectBuilder.selectedEntity.class = %className;
Inspector.inspect(GameObjectBuilder.selectedEntity);
%file = new FileObject();
if(%file.openForWrite(%path @ "\\" @ %className @ ".cs"))
{
%file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n");
%file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n");
//todo, pre-write any event functions of interest
%file.close();
}
//set up the paths
%tamlPath = %path @ "/" @ %className @ ".taml";
%scriptPath = %path @ "/" @ %className @ ".cs";
saveGameObject(%className, %tamlPath, %scriptPath);
//reload it
execGameObjects();
//now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later.
TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath);
GameObjectBuilder.selectedEntity = "";
Canvas.popDialog(GameObjectBuilder);
}
function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect )
{
if( !isObject( %set ) )

View file

@ -34,6 +34,7 @@ EditorSettings.setDefaultValue( "orthoFOV", "50" );
EditorSettings.setDefaultValue( "orthoShowGrid", "1" );
EditorSettings.setDefaultValue( "currentEditor", "WorldEditorInspectorPlugin" );
EditorSettings.setDefaultValue( "newLevelFile", "tools/levels/BlankRoom.mis" );
EditorSettings.setDefaultValue( "newGameObjectDir", "scripts/server/gameObjects" );
if( isFile( "C:/Program Files/Torsion/Torsion.exe" ) )
EditorSettings.setDefaultValue( "torsionPath", "C:/Program Files/Torsion/Torsion.exe" );

View file

@ -46,7 +46,7 @@ function EWCreatorWindow::init( %this )
%this.registerMissionObject( "SFXEmitter", "Sound Emitter" );
%this.registerMissionObject( "Precipitation" );
%this.registerMissionObject( "ParticleEmitterNode", "Particle Emitter" );
%this.registerMissionObject( "VolumetricFog", "Volumetric Fog" );
%this.registerMissionObject( "VolumetricFog", "Volumetric Fog" );
%this.registerMissionObject( "RibbonNode", "Ribbon" );
// Legacy features. Users should use Ground Cover and the Forest Editor.
@ -85,6 +85,7 @@ function EWCreatorWindow::init( %this )
%this.registerMissionObject( "SFXSpace", "Sound Space" );
%this.registerMissionObject( "OcclusionVolume", "Occlusion Volume" );
%this.registerMissionObject( "AccumulationVolume", "Accumulation Volume" );
%this.registerMissionObject( "Entity", "Entity" );
%this.endGroup();
@ -303,6 +304,36 @@ function EWCreatorWindow::navigate( %this, %address )
%this.addShapeIcon( %obj );
}
}
//Add a separate folder for Game Objects
if(isClass("Entity"))
{
if(%address $= "")
{
%this.addFolderIcon("GameObjects");
}
else
{
//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);
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
if(isFile(%gameObjectAsset.TAMLFilePath))
{
%this.addGameObjectIcon( %gameObjectAsset.gameObjectName );
}
}
}
}
}
if ( %this.tab $= "Meshes" )
@ -319,7 +350,7 @@ function EWCreatorWindow::navigate( %this, %address )
%fullPath = makeRelativePath( %fullPath, getMainDotCSDir() );
%splitPath = strreplace( %fullPath, " ", "_" );
%splitPath = strreplace( %splitPath, "/", " " );
%splitPath = strreplace( %splitPath, "/", " " );
if( getWord(%splitPath, 0) $= "tools" )
{
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
@ -737,6 +768,22 @@ function EWCreatorWindow::addPrefabIcon( %this, %fullPath )
%this.contentCtrl.addGuiControl( %ctrl );
}
function EWCreatorWindow::addGameObjectIcon( %this, %gameObjectName )
{
%ctrl = %this.createIcon();
%ctrl.altCommand = "spawnGameObject( \"" @ %gameObjectName @ "\", true );";
%ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( "Prefab" );
%ctrl.text = %gameObjectName;
%ctrl.class = "CreatorGameObjectIconBtn";
%ctrl.tooltip = "Spawn the " @ %gameObjectName @ " GameObject";
%ctrl.buttonType = "radioButton";
%ctrl.groupNum = "-1";
%this.contentCtrl.addGuiControl( %ctrl );
}
function CreatorPopupMenu::onSelect( %this, %id, %text )
{
%split = strreplace( %text, "/", " " );

View file

@ -218,7 +218,7 @@ function TerrainMaterialDlg::changeBase( %this )
if( %ctrl.bitmap !$= "" )
%file = %ctrl.bitmap;
else
%file = "tools/materialeditor/gui/unknownImage";
%file = "tools/materialEditor/gui/unknownImage";
}
%file = makeRelativePath( %file, getMainDotCsDir() );
@ -240,7 +240,7 @@ function TerrainMaterialDlg::changeDetail( %this )
if( %ctrl.bitmap !$= "" )
%file = %ctrl.bitmap;
else
%file = "tools/materialeditor/gui/unknownImage";
%file = "tools/materialEditor/gui/unknownImage";
}
%file = makeRelativePath( %file, getMainDotCsDir() );
@ -262,7 +262,7 @@ function TerrainMaterialDlg::changeMacro( %this )
if( %ctrl.bitmap !$= "" )
%file = %ctrl.bitmap;
else
%file = "tools/materialeditor/gui/unknownImage";
%file = "tools/materialEditor/gui/unknownImage";
}
%file = makeRelativePath( %file, getMainDotCsDir() );
@ -285,7 +285,7 @@ function TerrainMaterialDlg::changeNormal( %this )
if( %ctrl.bitmap !$= "" )
%file = %ctrl.bitmap;
else
%file = "tools/materialeditor/gui/unknownImage";
%file = "tools/materialEditor/gui/unknownImage";
}
%file = makeRelativePath( %file, getMainDotCsDir() );
@ -376,22 +376,22 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
%this-->matNameCtrl.setText( %mat.internalName );
if (%mat.diffuseMap $= ""){
%this-->baseTexCtrl.setBitmap( "tools/materialeditor/gui/unknownImage" );
%this-->baseTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
%this-->baseTexCtrl.setBitmap( %mat.diffuseMap );
}
if (%mat.detailMap $= ""){
%this-->detailTexCtrl.setBitmap( "tools/materialeditor/gui/unknownImage" );
%this-->detailTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
%this-->detailTexCtrl.setBitmap( %mat.detailMap );
}
if (%mat.macroMap $= ""){
%this-->macroTexCtrl.setBitmap( "tools/materialeditor/gui/unknownImage" );
%this-->macroTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
%this-->macroTexCtrl.setBitmap( %mat.macroMap );
}
if (%mat.normalMap $= ""){
%this-->normTexCtrl.setBitmap( "tools/materialeditor/gui/unknownImage" );
%this-->normTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
%this-->normTexCtrl.setBitmap( %mat.normalMap );
}
@ -428,22 +428,22 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%newName = %this-->matNameCtrl.getText();
if (%this-->baseTexCtrl.bitmap $= "tools/materialeditor/gui/unknownImage"){
if (%this-->baseTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newDiffuse = "";
}else{
%newDiffuse = %this-->baseTexCtrl.bitmap;
}
if (%this-->normTexCtrl.bitmap $= "tools/materialeditor/gui/unknownImage"){
if (%this-->normTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newNormal = "";
}else{
%newNormal = %this-->normTexCtrl.bitmap;
}
if (%this-->detailTexCtrl.bitmap $= "tools/materialeditor/gui/unknownImage"){
if (%this-->detailTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newDetail = "";
}else{
%newDetail = %this-->detailTexCtrl.bitmap;
}
if (%this-->macroTexCtrl.bitmap $= "tools/materialeditor/gui/unknownImage"){
if (%this-->macroTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newMacro = "";
}else{
%newMacro = %this-->macroTexCtrl.bitmap;

View file

@ -485,6 +485,7 @@ function EditorOpenMission(%filename)
function EditorExportToCollada()
{
%dlg = new SaveFileDialog()
{
Filters = "COLLADA Files (*.dae)|*.dae|";
@ -517,6 +518,7 @@ function EditorExportToCollada()
function EditorMakePrefab()
{
%dlg = new SaveFileDialog()
{
Filters = "Prefab Files (*.prefab)|*.prefab|";
@ -768,6 +770,15 @@ function EditorCameraSpeedMenu::setupGuiControls(%this)
// Set up min/max camera slider range
eval("CameraSpeedDropdownCtrlContainer-->Slider.range = \"" @ %minSpeed @ " " @ %maxSpeed @ "\";");
}
//////////////////////////////////////////////////////////////////////////
// Tools Menu Handler
//////////////////////////////////////////////////////////////////////////
function EditorUtilitiesMenu::onSelectItem(%this, %id, %text)
{
return Parent::onSelectItem(%this, %id, %text);
}
//////////////////////////////////////////////////////////////////////////
// World Menu Handler Object Menu
//////////////////////////////////////////////////////////////////////////

View file

@ -252,6 +252,19 @@ function EditorGui::buildMenus(%this)
// last menu items in EditorLightingMenu::onAdd().
};
%this.menuBar.insert(%lightingMenu, %this.menuBar.getCount());
// Tools Menu
%toolsMenu = new PopupMenu()
{
superClass = "MenuBuilder";
class = "EditorUtilitiesMenu";
barTitle = "Tools";
item[0] = "Network Graph" TAB "n" TAB "toggleNetGraph();";
item[1] = "Profiler" TAB "ctrl F2" TAB "showMetrics(true);";
};
%this.menuBar.insert(%toolsMenu, %this.menuBar.getCount());
// Help Menu
%helpMenu = new PopupMenu()