Full Template for ticket #1

This commit is contained in:
DavidWyand-GG 2012-09-19 11:54:25 -04:00
parent 74f265b3b3
commit f439dc8dcd
2150 changed files with 286240 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

View file

@ -0,0 +1,33 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
/*
function doUtil()
{
for ( %i = 0; %i < DecalDataSet.getCount(); %i++ )
{
%obj = DecalDataSet.getObject(%i);
%obj.internalName = %obj.getName();
DecalPMan.setDirty( %obj );
}
}
*/

View file

@ -0,0 +1,122 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
function DecalEditorGui::createAction(%this, %class, %desc)
{
pushInstantGroup();
%action = new UndoScriptAction()
{
class = %class;
superClass = BaseDecalEdAction;
actionName = %desc;
tree = DecalEditorTreeView;
};
popInstantGroup();
return %action;
}
function DecalEditorGui::doAction(%this, %action)
{
if (%action.doit())
%action.addToManager(Editor.getUndoManager());
}
function BaseDecalEdAction::redo(%this)
{
// Default redo action is the same as the doit action
%this.doit();
}
function BaseDecalEdAction::undo(%this)
{
}
//------------------------------------------------------------------------------
// Edit node
function DecalEditorGui::doEditNodeDetails(%this, %instanceId, %transformData, %gizmo)
{
%action = %this.createAction(ActionEditNodeDetails, "Edit Decal Transform");
%action.instanceId = %instanceId;
%action.newTransformData = %transformData;
if( %gizmo )
%action.oldTransformData = %this.gizmoDetails;
else
%action.oldTransformData = %this.getDecalTransform(%instanceId);
%this.doAction(%action);
}
function ActionEditNodeDetails::doit(%this)
{
%count = getWordCount(%this.newTransformData);
if(%this.instanceId !$= "" && %count == 7)
{
DecalEditorGui.editDecalDetails( %this.instanceId, %this.newTransformData );
DecalEditorGui.syncNodeDetails();
DecalEditorGui.selectDecal( %this.instanceId );
return true;
}
return false;
}
function ActionEditNodeDetails::undo(%this)
{
%count = getWordCount(%this.oldTransformData);
if(%this.instanceId !$= "" && %count == 7)
{
DecalEditorGui.editDecalDetails( %this.instanceId, %this.oldTransformData );
DecalEditorGui.syncNodeDetails();
DecalEditorGui.selectDecal( %this.instanceId );
}
}
//------------------------------------------------------------------------------
// Delete Decal Datablocks
// This functionality solely depends on the undo/redo datablock callbacks in
// source.
function DecalEditorGui::redoDeleteDecalDatablock( %this, %datablock )
{
// Remove the object from file and place a filter
if( %datablock.getFilename() !$= "" )
{
DecalPMan.removeDirty( %datablock );
DecalPMan.removeObjectFromFile( %datablock );
}
DecalDataList.addFilteredItem( %datablock );
}
function DecalEditorGui::undoDeleteDecalDatablock( %this, %datablock )
{
// Replace the object in file and remove the filter
%filename = %datablock.getFilename();
if( %datablock.getFilename() !$= "" )
{
DecalPMan.setDirty( %datablock, %filename );
DecalPMan.saveDirty();
}
DecalDataList.removeFilteredItem( %datablock );
}

View file

@ -0,0 +1,343 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
function DecalEditorGui::onWake( %this )
{
}
function DecalEditorGui::onSelectInstance( %this, %decalId, %lookupName )
{
if( DecalEditorGui.selDecalInstanceId == %decalId )
return;
// Lets remember the new Id
DecalEditorGui.selDecalInstanceId = %decalId;
DecalEditorTreeView.clearSelection();
%name = %decalId SPC %lookupName;
%item = DecalEditorTreeView.findItemByName( %name );
DecalEditorTreeView.selectItem( %item );
DecalEditorGui.syncNodeDetails();
}
function DecalEditorGui::onCreateInstance( %this, %decalId, %lookupName )
{
// Lets remember the new Id
DecalEditorGui.selDecalInstanceId = %decalId;
// Add the new instance to the node tree
DecalEditorTreeView.addNodeTree( %decalId, %lookupName );
DecalEditorTreeView.clearSelection();
%name = %decalId SPC %lookupName;
%item = DecalEditorTreeView.findItemByName( %name );
DecalEditorTreeView.selectItem( %item );
DecalEditorGui.syncNodeDetails();
}
function DecalEditorGui::onDeleteInstance( %this, %decalId, %lookupName )
{
if( %decalId == DecalEditorGui.selDecalInstanceId )
DecalEditorGui.selDecalInstanceId = -1;
%id = DecalEditorTreeView.findItemByName( %decalId SPC %lookupName );
DecalEditorTreeView.removeItem(%id);
}
function DecalEditorGui::editNodeDetails( %this )
{
%decalId = DecalEditorGui.selDecalInstanceId;
if( %decalId == -1 )
return;
%nodeDetails = DecalEditorDetailContainer-->nodePosition.getText();
%nodeDetails = %nodeDetails @ " " @ DecalEditorDetailContainer-->nodeTangent.getText();
%nodeDetails = %nodeDetails @ " " @ DecalEditorDetailContainer-->nodeSize.getText();
if( getWordCount(%nodeDetails) == 7 )
DecalEditorGui.doEditNodeDetails( %decalId, %nodeDetails, false );
}
// Stores the information when the gizmo is first used
function DecalEditorGui::prepGizmoTransform( %this, %decalId, %nodeDetails )
{
DecalEditorGui.gizmoDetails = %nodeDetails;
}
// Activated in onMouseUp while gizmo is dirty
function DecalEditorGui::completeGizmoTransform( %this, %decalId, %nodeDetails )
{
DecalEditorGui.doEditNodeDetails( %decalId, %nodeDetails, true );
}
function DecalEditorGui::onSleep( %this )
{
}
function DecalEditorGui::syncNodeDetails( %this )
{
%decalId = DecalEditorGui.selDecalInstanceId;
if( %decalId == -1 )
return;
%lookupName = DecalEditorGui.getDecalLookupName( %decalId );
DecalEditorGui.updateInstancePreview( %lookupName.material );
DecalEditorDetailContainer-->instanceId.setText(%decalId @ " " @ %lookupName);
%transformData = DecalEditorGui.getDecalTransform(%decalId);
DecalEditorDetailContainer-->nodePosition.setText(getWords(%transformData, 0, 2));
DecalEditorDetailContainer-->nodeTangent.setText(getWords(%transformData, 3, 5));
DecalEditorDetailContainer-->nodeSize.setText(getWord(%transformData, 6));
}
function DecalEditorGui::paletteSync( %this, %mode )
{
%evalShortcut = "ToolsPaletteArray-->" @ %mode @ ".setStateOn(1);";
eval(%evalShortcut);
}
function DecalDataList::onSelect( %this, %id, %text )
{
%obj = %this.getItemObject( %id );
DecalEditorGui.currentDecalData = %obj;
%itemNum = DecalDataList.getSelectedItem();
if ( %itemNum == -1 )
return;
%data = DecalDataList.getItemObject( %itemNum );
// Update the materialEditorList
$Tools::materialEditorList = %data.getId();
//Canvas.pushDialog( DecalEditDlg );
DecalInspector.inspect( %data );
DecalEditorGui.updateDecalPreview( %data.material );
}
function RetargetDecalButton::onClick( %this )
{
%id = DecalDataList.getSelectedItem();
%datablock = DecalDataList.getItemText(%id );
if( !isObject(%datablock) )
{
MessageBoxOK("Error", "A valid Decal Template must be selected.");
return;
}
// This is the first place IODropdown is used. The # in the function passed replaced with the output
// of the preset menu.
IODropdown("Retarget Decal Instances",
"Retarget DecalInstances from " @ %datablock.getName() @ " over to....",
"decalDataSet",
"DecalEditorGui.retargetDecalDatablock(" @ %datablock.getName() @ ", #);",
"");
DecalEditorGui.rebuildInstanceTree();
}
function NewDecalButton::onClick( %this )
{
%name = getUniqueName( "NewDecalData" );
%str = "datablock DecalData( " @ %name @ " ) { Material = \"WarningMaterial\"; };";
eval( %str );
DecalPMan.setDirty( %name, $decalDataFile );
if ( strchr(LibraryTabControl.text, "*") $= "" )
LibraryTabControl.text = LibraryTabControl.text @ "*";
DecalDataList.doMirror();
%id = DecalDataList.findItemText( %name );
DecalDataList.setSelected( %id, true );
Canvas.pushDialog( DecalEditDlg );
DecalInspector.inspect( %name );
}
function DeleteDecalButton::onClick( %this )
{
if( DecalEditorTabBook.getSelectedPage() == 0 ) // library
{
%id = DecalDataList.getSelectedItem();
%datablock = DecalDataList.getItemText(%id );
MessageBoxYesNoCancel("Delete Decal Datablock?",
"Are you sure you want to delete<br><br>" @ %datablock @ "<br><br> Datablock deletion won't take affect until the engine is quit.",
"DecalEditorGui.deleteSelectedDecalDatablock();",
"",
"" );
}
else // instances
{
DecalEditorGui.deleteSelectedDecal();
}
}
// Intended for gui use. The undo/redo functionality for deletion of datablocks
// will enable itself automatically after using this function.
function DecalEditorGui::deleteSelectedDecalDatablock()
{
%id = DecalDataList.getSelectedItem();
%datablock = DecalDataList.getItemText(%id );
DecalEditorGui.deleteDecalDatablock( %datablock );
if( %datablock.getFilename() !$= "" )
{
DecalPMan.removeDirty( %datablock );
DecalPMan.removeObjectFromFile( %datablock );
}
DecalDataList.addFilteredItem( %datablock );
}
function DecalEditorTabBook::onTabSelected( %this, %text, %idx )
{
if( %idx == 0)
{
DecalPreviewWindow.text = "Template Properties";
DecalEditorLibraryProperties.setVisible(true);
DecalEditorTemplateProperties.setVisible(false);
RetargetDecalButton.setVisible( true );
SaveDecalsButton.setVisible( true );
NewDecalButton.setVisible( true );
DeleteDecalButton.tabSelected = %idx;
}
else
{
DecalPreviewWindow.text = "Instance Properties";
RetargetDecalButton.setVisible( false );
NewDecalButton.setVisible( false );
SaveDecalsButton.setVisible( false );
DeleteDecalButton.tabSelected = %idx;
DecalEditorLibraryProperties.setVisible(false);
DecalEditorTemplateProperties.setVisible(true);
}
}
function DecalEditorTreeView::onDefineIcons()
{
%icons = "core/art/gui/images/treeview/default:" @
"tools/classIcons/decal:" @
"tools/classIcons/decalNode:";
DecalEditorTreeView.buildIconTable( %icons );
}
function DecalEditorTreeView::onSelect(%this, %id)
{
%instanceTag = getWord( DecalEditorTreeView.getItemText(%id), 1 );
if( !isObject( %instanceTag ) )
return;
if( %instanceTag.getClassName() !$= "DecalData" )
return;
// Grab the id from the tree view
%decalId = getWord( DecalEditorTreeView.getItemText(%id), 0 );
if( DecalEditorGui.selDecalInstanceId == %decalId )
return;
// Set the curent decalinstances id
DecalEditorGui.selDecalInstanceId = %decalId;
DecalEditorGui.selectDecal(%decalId);
DecalEditorGui.syncNodeDetails(%id);
}
// Creating per node in the instance tree
function DecalEditorTreeView::addNodeTree(%this, %nodeName, %parentName)
{
// If my template isnt there...put it there
if ( %this.findItemByName(%parentName) == 0 )
{
%rootId = %this.findItemByName("<root>");
%this.insertItem( %rootId, %parentName, 0, "", 1, 1);
}
%nodeName = %nodeName SPC %parentName;
%parentId = %this.findItemByName(%parentName);
%id = %this.insertItem(%parentId, %nodeName, 0, "", 2);
}
function DecalInspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue )
{
if( %fieldName $= "Material" )
DecalEditorGui.updateDecalPreview( %newValue );
// Same work to do as for the regular WorldEditor Inspector.
Inspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue );
if (%oldValue != %newValue || %oldValue !$= %newValue)
%this.setDirty(%object);
}
function DecalInspector::setDirty( %this, %object )
{
DecalPMan.setDirty( %object );
if ( strchr(LibraryTabControl.text, "*") $= "" )
LibraryTabControl.text = LibraryTabControl.text @ "*";
}
function DecalInspector::removeDirty()
{
if ( strchr(LibraryTabControl.text, "*") !$= "" )
LibraryTabControl.text = stripChars(LibraryTabControl.text, "*");
}
function DecalEditorGui::updateDecalPreview( %this, %material )
{
if( isObject( %material ) )
DecalPreviewWindow-->decalPreview.setBitmap( MaterialEditorGui.searchForTexture( %material.getId(), %material.diffuseMap[0]) );
else
DecalPreviewWindow-->decalPreview.setBitmap("tools/materialeditor/gui/unknownImage");
}
function DecalEditorGui::updateInstancePreview( %this, %material )
{
if( isObject( %material ) )
DecalPreviewWindow-->instancePreview.setBitmap( MaterialEditorGui.searchForTexture( %material.getId(), %material.diffuseMap[0]) );
else
DecalPreviewWindow-->instancePreview.setBitmap("tools/materialeditor/gui/unknownImage");
}
function DecalEditorGui::rebuildInstanceTree( %this )
{
// Initialize the instance tree when the tab is selected
DecalEditorTreeView.removeItem(0);
%rootId = DecalEditorTreeView.insertItem(0, "<root>", 0, "");
%count = DecalEditorGui.getDecalCount();
for (%i = 0; %i < %count; %i++)
{
%name = DecalEditorGui.getDecalLookupName(%i);
if( %name $= "invalid" )
continue;
DecalEditorTreeView.addNodeTree(%i, %name);
}
}

View file

@ -0,0 +1,831 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiDecalEditorCtrl(DecalEditorGui) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "WorldEditorProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
cameraZRot = "0";
forceFOV = "0";
renderMissionArea = "0";
missionAreaFillColor = "255 0 0 20";
missionAreaFrameColor = "255 0 0 128";
allowBorderMove = "0";
borderMovePixelSize = "20";
borderMoveSpeed = "0.1";
consoleFrameColor = "255 0 0 255";
consoleFillColor = "255 0 0 120";
consoleSphereLevel = "1";
consoleCircleSegments = "32";
consoleLineWidth = "1";
GizmoProfile = "GlobalGizmoProfile";
currentDecalID = "175";
Docking = "None";
new GuiWindowCollapseCtrl(DecalEditorWindow) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "windowRelative";
VertSizing = "windowRelative";
Position = getWord($pref::Video::mode, 0) - 209 SPC getWord(EditorGuiToolbar.extent, 1) -1;
Extent = "210 600";
MinExtent = "210 100";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "2 2 2 2";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "EditorGui.setEditor( WorldEditorInspectorPlugin );";
EdgeSnap = "1";
text = "Decal Editor";
new GuiTabBookCtrl(DecalEditorTabBook) {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiTabBookProfile";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "202 502";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
Margin = "3 1 3 3";
Docking = "client";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
TabPosition = "Top";
TabMargin = "0";
MinTabWidth = "64";
new GuiTabPageCtrl(LibraryTabControl) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "EditorTabPage";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "202 483";
Docking = "client";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
Margin = "-1 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "Library";
maxLength = "1024";
new GuiContainer() {
isContainer = "1";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "202 483";
Margin = "0 0 0 0";
Docking = "client";
MinExtent = "0 8";
Profile = "GuiInspectorProfile";
new GuiBitmapBorderCtrl() {
isContainer = "1";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "202 483";
MinExtent = "0 -500";
Profile = "GuiTabBorderProfile";
};
};
new GuiScrollCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiScrollProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "202 483";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiDefaultProfile";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = "true";
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiListBoxCtrl(DecalDataList) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiListBoxProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "0 0";
Extent = "474 48";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
AllowMultipleSelections = "0";
fitParentWidth = "0";
mirrorSet = "DecalDataSet";
};
};
};
new GuiTabPageCtrl() {
canSaveDynamicFields = "0";
internalName = "instanceTab";
Enabled = "1";
isContainer = "1";
Profile = "EditorTabPage";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "202 483";
Docking = "client";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
Margin = "-1 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "Instances";
maxLength = "1024";
new GuiContainer() {
isContainer = "1";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "202 483";
Margin = "0 0 0 0";
Docking = "client";
MinExtent = "0 8";
Profile = "GuiInspectorProfile";
new GuiBitmapBorderCtrl() {
isContainer = "1";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "202 483";
MinExtent = "0 -500";
Profile = "GuiTabBorderProfile";
};
};
new GuiScrollCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiScrollProfile";
HorizSizing = "width";
VertSizing = "height";
Position = "0 0";
Extent = "202 483";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
Docking = "None";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "0";
AnchorBottom = "0";
AnchorLeft = "0";
AnchorRight = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = "true";
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiTreeViewCtrl(DecalEditorTreeView) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiTreeViewProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "1 1";
Extent = "200 100";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
tabSize = "16";
textOffset = "2";
fullRowSelect = "0";
itemHeight = "21";
destroyTreeOnSleep = "1";
MouseDragging = "0";
MultipleSelections = "0";
DeleteObjectAllowed = "1";
DragToItemAllowed = "0";
showRoot = "0";
internalNamesOnly = "0";
};
};
};
};
// Save Button
new GuiBitmapButtonCtrl(SaveDecalsButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "137 26";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
Command = "DecalPMan.saveDirty(); DecalInspector::removeDirty();";
hovertime = "1000";
groupNum = "-1";
text ="";
tooltip = "Save All";
buttonType = "PushButton";
useMouseEvents = "0";
bitmap = "tools/gui/images/save-icon";
};
new GuiBitmapButtonCtrl(RetargetDecalButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
Position = "157 26";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
tooltip = "Retarget missing decals to an existing decal datablock";
bitmap = "tools/gui/images/retarget-btn";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(NewDecalButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
Position = "177 26";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
tooltip = "Create New Decal Template";
bitmap = "core/art/gui/images/new";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(DeleteDecalButton) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
Position = "190 26";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
text = "";
tooltip = "Delete Selected Decal Template";
bitmap = "tools/gui/images/delete";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
tabSelected = "0";
};
};
new GuiWindowCollapseCtrl(DecalPreviewWindow) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "1";
Profile = "GuiWindowProfile";
HorizSizing = "windowRelative";
VertSizing = "windowRelative";
Position = getWord($pref::Video::mode, 0) - 209 SPC getWord(EditorGuiToolbar.extent, 1) + getWord(DecalEditorWindow.extent, 1) - 2;
Extent = "210 335";
MinExtent = "210 335";
canSave = "1";
Visible = "0";
hovertime = "1000";
Docking = "None";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "0";
AnchorBottom = "0";
AnchorLeft = "0";
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "152 235";
closeCommand = "EPainter.parentGroup.setVisible(false);";
EdgeSnap = "1";
text = "Decal Properties";
new GuiScrollCtrl(DecalEditorTemplateProperties){
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiScrollProfile";
VertSizing = "bottom";
HorizSizing = "width";
Position = "4 24";
Extent = "202 259";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
AnchorTop = "0";
AnchorBottom = "0";
AnchorLeft = "0";
AnchorRight = "0";
willFirstRespond = "1";
Docking = "client";
Margin = "3 1 3 3";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = true;
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiStackControl() {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "0 0";
Extent = "189 0";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
new GuiRolloutCtrl() {
class = "BehaviorQuickEditRollout";
superclass = LBQuickEditRollout;
Profile = "GuiRolloutProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "0 0";
Extent = "208 0";
Caption = "Decal Instance Preview";
Margin = "0 0 0 -3";
DragSizable = false;
container = true;
parentRollout = %this.rollout;
object = %behavior;
new GuiStackControl() {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "0 0";
Extent = "208 0";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
new GuiContainer(){
HorizSizing = "width";
VertSizing = "bottom";
Position = "-1 0";
Extent = "202 187";
Docking = "none";
new GuiBitmapCtrl() {
canSaveDynamicFields = "0";
internalName = "instancePreview";
Enabled = "1";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "center";
VertSizing = "height";
Position = "0 0";
Extent = "188 186";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
wrap = "0";
bitmap= "tools/materialeditor/gui/unknownImage";
};
new GuiBitmapCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "center";
VertSizing = "height";
Position = "0 0";
Extent = "188 186";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
bitmap = "tools/worldEditor/images/terrainpainter/terrain-painter-border-large";
wrap = "0";
};
};
};
};
new GuiRolloutCtrl() {
class = "BehaviorQuickEditRollout";
superclass = LBQuickEditRollout;
Profile = "GuiRolloutProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "0 0";
Extent = "202 0";
Caption = "Decal Instance Properties";
Margin = "0 0 0 0";
DragSizable = false;
container = true;
parentRollout = %this.rollout;
object = %behavior;
new GuiStackControl() {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "0 0";
Extent = "208 0";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
new GuiContainer(DecalEditorDetailContainer){
Position = "0 202";
Extent = "202 79";
HorizSizing = "width";
VertSizing = "bottom";
isContainer = "1";
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "3 2";
Extent = "47 16";
text = "Instance";
};
new GuiTextCtrl(){ // instance Name
Profile = "GuiTextProfile";
internalName = "instanceId";
HorizSizing = "width";
VertSizing = "bottom";
Position = "54 2";
Extent = "128 18";
text = "";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "3 21";
Extent = "47 16";
text = "Translate";
};
new GuiTextEditCtrl(){ // instance translate
Profile = "GuiTextEditProfile";
internalName = "nodePosition";
HorizSizing = "width";
VertSizing = "bottom";
AltCommand = "DecalEditorGui.editNodeDetails();";
Position = "54 20";
Extent = "128 18";
text = "";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "3 41";
Extent = "47 16";
text = "Tangent";
};
new GuiTextEditCtrl(){ // instance rotation
Profile = "GuiTextEditProfile";
internalName = "nodeTangent";
HorizSizing = "width";
VertSizing = "bottom";
AltCommand = "DecalEditorGui.editNodeDetails();";
Position = "54 40";
Extent = "128 18";
text = "";
};
new GuiTextCtrl(){
Profile = "GuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "3 61";
Extent = "47 16";
text = "Size";
};
new GuiTextEditCtrl(){ // instance scale
Profile = "GuiTextEditProfile";
internalName = "nodeSize";
HorizSizing = "width";
VertSizing = "bottom";
AltCommand = "DecalEditorGui.editNodeDetails();";
Position = "54 60";
Extent = "128 18";
text = "";
};
};
};
};
};
};
new GuiScrollCtrl(DecalEditorLibraryProperties) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiScrollProfile";
VertSizing = "bottom";
HorizSizing = "width";
Position = "4 24";
Extent = "202 259";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
AnchorTop = "0";
AnchorBottom = "0";
AnchorLeft = "0";
AnchorRight = "0";
willFirstRespond = "1";
Docking = "client";
Margin = "3 1 3 3";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
lockHorizScroll = true;
lockVertScroll = "false";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiStackControl() {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "0 0";
Extent = "187 0";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
new GuiRolloutCtrl() {
class = "BehaviorQuickEditRollout";
superclass = LBQuickEditRollout;
Profile = "GuiRolloutProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "0 0";
Extent = "208 0";
Caption = "Decal Template Preview";
Margin = "0 0 0 -3";
DragSizable = false;
container = true;
parentRollout = %this.rollout;
object = %behavior;
new GuiStackControl() {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "0 0";
Extent = "208 0";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
new GuiContainer(){
HorizSizing = "width";
VertSizing = "bottom";
Position = "-1 0";
Extent = "202 187";
Docking = "none";
new GuiBitmapCtrl() {
canSaveDynamicFields = "0";
internalName = "decalPreview";
Enabled = "1";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "center";
VertSizing = "height";
Position = "0 0";
Extent = "188 186";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
wrap = "0";
bitmap= "tools/materialeditor/gui/unknownImage";
};
new GuiBitmapCtrl() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "center";
VertSizing = "height";
Position = "0 0";
Extent = "188 186";
MinExtent = "8 2";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
bitmap = "tools/worldEditor/images/terrainpainter/terrain-painter-border-large";
wrap = "0";
};
};
};
};
new GuiRolloutCtrl() {
class = "BehaviorQuickEditRollout";
superclass = LBQuickEditRollout;
Profile = "GuiRolloutProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "0 0";
Extent = "202 0";
Caption = "Decal Template Properties";
Margin = "0 0 0 0";
DragSizable = false;
container = true;
parentRollout = %this.rollout;
object = %behavior;
new GuiInspector(DecalInspector) {
StackingType = "Vertical";
HorizStacking = "Left to Right";
VertStacking = "Top to Bottom";
Padding = "1";
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Profile = "GuiTransparentProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "1 1";
Extent = "200 257";
MinExtent = "16 16";
canSave = "1";
isDecoy = "0";
Visible = "1";
tooltipprofile = "GuiToolTipProfile";
hovertime = "1000";
dividerMargin = "5";
groupFilters = "+General,+SimBase,+Decal,+Rendering,+Texturing";
};
};
};
};
//----------------------------------
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,199 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
function initializeDecalEditor()
{
echo(" % - Initializing Decal Editor");
$decalDataFile = "art/decals/managedDecalData.cs";
exec( "./decalEditor.cs" );
exec( "./decalEditorGui.gui" );
exec( "./decalEditorGui.cs" );
exec( "./decalEditorActions.cs" );
// Add ourselves to EditorGui, where all the other tools reside
DecalEditorGui.setVisible( false );
DecalPreviewWindow.setVisible( false );
DecalEditorWindow.setVisible( false );
EditorGui.add( DecalEditorGui );
EditorGui.add( DecalEditorWindow );
EditorGui.add( DecalPreviewWindow );
DecalEditorTabBook.selectPage( 0 );
new ScriptObject( DecalEditorPlugin )
{
superClass = "EditorPlugin";
editorGui = DecalEditorGui;
};
%map = new ActionMap();
%map.bindCmd( keyboard, "5", "EDecalEditorAddDecalBtn.performClick();", "" );
%map.bindCmd( keyboard, "1", "EDecalEditorSelectDecalBtn.performClick();", "" );
%map.bindCmd( keyboard, "2", "EDecalEditorMoveDecalBtn.performClick();", "" );
%map.bindCmd( keyboard, "3", "EDecalEditorRotateDecalBtn.performClick();", "" );
%map.bindCmd( keyboard, "4", "EDecalEditorScaleDecalBtn.performClick();", "" );
DecalEditorPlugin.map = %map;
new PersistenceManager( DecalPMan );
}
function destroyDecalEditor()
{
}
// JCF: helper for during development
function reinitDecalEditor()
{
exec( "./main.cs" );
exec( "./decalEditor.cs" );
exec( "./decalEditorGui.cs" );
}
function DecalEditorPlugin::onWorldEditorStartup( %this )
{
// Add ourselves to the window menu.
%accel = EditorGui.addToEditorsMenu( "Decal Editor", "", DecalEditorPlugin );
// Add ourselves to the ToolsToolbar
%tooltip = "Decal Editor (" @ %accel @ ")";
EditorGui.addToToolsToolbar( "DecalEditorPlugin", "DecalEditorPalette", expandFilename("tools/decalEditor/decal-editor"), %tooltip );
//connect editor windows
GuiWindowCtrl::attach( DecalPreviewWindow, DecalEditorWindow );
//set initial palette setting
%this.paletteSelection = "AddDecalMode";
}
function DecalEditorPlugin::onActivated( %this )
{
EditorGui.bringToFront( DecalEditorGui );
DecalEditorGui.setVisible( true );
DecalEditorGui.makeFirstResponder( true );
DecalPreviewWindow.setVisible( true );
DecalEditorWindow.setVisible( true );
%this.map.push();
//WORKAROUND: due to the gizmo mode being stored on its profile (which may be shared),
// we may end up with a mismatch between the editor mode and gizmo mode here.
// Reset mode explicitly here to work around this.
DecalEditorGui.setMode( DecalEditorGui.getMode() );
// Set the current palette selection
DecalEditorGui.paletteSync( %this.paletteSelection );
// Store this on a dynamic field
// in order to restore whatever setting
// the user had before.
%this.prevGizmoAlignment = GlobalGizmoProfile.alignment;
// The DecalEditor always uses Object alignment.
GlobalGizmoProfile.alignment = "Object";
DecalEditorGui.rebuildInstanceTree();
// These could perhaps be the node details like the shape editor
//ShapeEdPropWindow.syncNodeDetails(-1);
Parent::onActivated(%this);
}
function DecalEditorPlugin::onDeactivated( %this )
{
DecalEditorGui.setVisible(false);
DecalPreviewWindow.setVisible( false );
DecalEditorWindow.setVisible( false );
%this.map.pop();
// Remember last palette selection
%this.paletteSelection = DecalEditorGui.getMode();
// Restore the previous Gizmo
// alignment settings.
GlobalGizmoProfile.alignment = %this.prevGizmoAlignment;
Parent::onDeactivated(%this);
}
function DecalEditorPlugin::isDirty( %this )
{
%dirty = DecalPMan.hasDirty();
%dirty |= decalManagerDirty();
return %dirty;
}
function DecalEditorPlugin::onSaveMission( %this, %file )
{
DecalPMan.saveDirty();
decalManagerSave( %file @ ".decals" );
}
function DecalEditorPlugin::onEditMenuSelect( %this, %editMenu )
{
%hasSelection = false;
if ( DecalEditorGui.getSelectionCount() > 0 )
%hasSelection = true;
%editMenu.enableItem( 3, false ); // Cut
%editMenu.enableItem( 4, false ); // Copy
%editMenu.enableItem( 5, false ); // Paste
%editMenu.enableItem( 6, %hasSelection ); // Delete
%editMenu.enableItem( 8, false ); // Deselect
// NOTE: If you want to implement Cut, Copy, Paste, or Deselect
// for this editor simply enable the menu items when it is appropriate
// and fill in the method stubs below.
}
function DecalEditorPlugin::handleDelete( %this )
{
DecalEditorGui.deleteSelectedDecal();
}
function DecalEditorPlugin::handleDeselect( %this )
{
}
function DecalEditorPlugin::handleCut( %this )
{
}
function DecalEditorPlugin::handleCopy( %this )
{
}
function DecalEditorPlugin::handlePaste( %this )
{
}
function DecalEditorPlugin::handleEscape( %this )
{
}