Full Template for ticket #1
437
Templates/Full/game/tools/forestEditor/forestEditToolbar.ed.gui
Normal file
|
|
@ -0,0 +1,437 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl(ForestEditToolbar,EditorGuiGroup) {
|
||||
isContainer = "1";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Position = "306 0";
|
||||
Extent = "800 40";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "ForestEditToolbar";
|
||||
canSaveDynamicFields = "1";
|
||||
enabled = "1";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Brush Settings";
|
||||
maxLength = "255";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "6 7";
|
||||
Extent = "70 16";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiControl() {
|
||||
isContainer = "1";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "760 40";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiControl(ForestBrushSizeTextEditContainer) {
|
||||
isContainer = "1";
|
||||
Profile = "GuiTransparentProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "72 5";
|
||||
Extent = "120 50";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Size";
|
||||
maxLength = "1024";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "21 5";
|
||||
Extent = "47 10";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
passwordMask = "*";
|
||||
text = "9";
|
||||
maxLength = "4";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiNumericDropSliderTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "49 2";
|
||||
Extent = "42 18";
|
||||
MinExtent = "8 16";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
AltCommand = "ForestTools->BrushTool.size = $ThisControl.getValue();";
|
||||
validate = "ForestEditorGui.validateBrushSize();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "textEdit";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "core/art/gui/images/dropslider";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "83 2";
|
||||
Extent = "18 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "Canvas.pushDialog(ForestBrushSizeSliderCtrlContainer);";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Changes size of the brush";
|
||||
hovertime = "750";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
new GuiBitmapCtrl() {
|
||||
bitmap = "core/art/gui/images/separator-h.png";
|
||||
wrap = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "200 3";
|
||||
Extent = "2 26";
|
||||
MinExtent = "1 1";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiControl(ForestBrushPressureTextEditContainer) {
|
||||
isContainer = "1";
|
||||
Profile = "GuiTransparentProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "208 5";
|
||||
Extent = "120 50";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Pressure";
|
||||
maxLength = "1024";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 5";
|
||||
Extent = "47 10";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
passwordMask = "*";
|
||||
text = "100";
|
||||
maxLength = "3";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiNumericDropSliderTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "49 2";
|
||||
Extent = "42 18";
|
||||
MinExtent = "8 16";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestTools->BrushTool.pressure = $ThisControl.getValue() / 100;";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "textEdit";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "core/art/gui/images/dropslider";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "83 2";
|
||||
Extent = "18 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "Canvas.pushDialog(ForestBrushPressureSliderCtrlContainer);";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Changes the pressure";
|
||||
hovertime = "750";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
new GuiBitmapCtrl() {
|
||||
bitmap = "core/art/gui/images/separator-h.png";
|
||||
wrap = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "336 3";
|
||||
Extent = "2 26";
|
||||
MinExtent = "1 1";
|
||||
canSave = "1";
|
||||
Visible = "0";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiControl(ForestBrushHardnessTextEditContainer) {
|
||||
isContainer = "1";
|
||||
Profile = "GuiTransparentProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "352 5";
|
||||
Extent = "120 50";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "0";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Hardness";
|
||||
maxLength = "1024";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 5";
|
||||
Extent = "47 10";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
passwordMask = "*";
|
||||
text = "1";
|
||||
maxLength = "3";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiNumericDropSliderTextProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "49 2";
|
||||
Extent = "42 18";
|
||||
MinExtent = "8 16";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestTools->BrushTool.hardness = $ThisControl.getValue() / 100);";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "textEdit";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "core/art/gui/images/dropslider";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "83 2";
|
||||
Extent = "18 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "Canvas.pushDialog(ForestBrushHardnessSliderCtrlContainer);";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Changes the hardness curve.";
|
||||
hovertime = "750";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
new GuiMouseEventCtrl(ForestBrushSizeSliderCtrlContainer,EditorGuiGroup) {
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
class = "EditorDropdownSliderContainer";
|
||||
|
||||
new GuiSliderCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "slider";
|
||||
isContainer = "0";
|
||||
Profile = "GuiSliderBoxProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = firstWord(ForestBrushSizeTextEditContainer.position) + firstWord(ForestEditToolbar.position)+11 SPC
|
||||
(getWord(ForestBrushSizeTextEditContainer, 1)) + 25;
|
||||
Extent = "112 20";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
AltCommand = "ForestTools->BrushTool.size = $ThisControl.value;";
|
||||
range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0);
|
||||
ticks = "0";
|
||||
value = "0";
|
||||
};
|
||||
};
|
||||
|
||||
new GuiMouseEventCtrl(ForestBrushPressureSliderCtrlContainer,EditorGuiGroup) {
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
class = "EditorDropdownSliderContainer";
|
||||
|
||||
new GuiSliderCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "slider";
|
||||
isContainer = "0";
|
||||
Profile = "GuiSliderBoxProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = firstWord(ForestBrushPressureTextEditContainer.position) + firstWord(ForestEditToolbar.position) SPC
|
||||
(getWord(ForestBrushPressureTextEditContainer, 1)) + 25;
|
||||
Extent = "112 20";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
AltCommand = "ForestTools->BrushTool.pressure = $ThisControl.value;";
|
||||
range = "0.01 1";
|
||||
ticks = "0";
|
||||
value = "0";
|
||||
};
|
||||
};
|
||||
|
||||
new GuiMouseEventCtrl(ForestBrushHardnessSliderCtrlContainer,EditorGuiGroup) {
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
helpTag = "0";
|
||||
class = "EditorDropdownSliderContainer";
|
||||
|
||||
new GuiSliderCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "slider";
|
||||
isContainer = "0";
|
||||
Profile = "GuiSliderBoxProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = firstWord(ForestBrushHardnessTextEditContainer.position) + firstWord(ForestEditToolbar.position) SPC
|
||||
(getWord(TForestBrushHardnessTextEditContainer, 1)) + 25;
|
||||
Extent = "112 20";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
AltCommand = "ForestTools->BrushTool.hardness = $ThisControl.value;";
|
||||
range = "0 1";
|
||||
ticks = "0";
|
||||
value = "0";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
27
Templates/Full/game/tools/forestEditor/forestEditor.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
singleton GuiControlProfile (ForestEditorProfile)
|
||||
{
|
||||
canKeyFocus = true;
|
||||
category = "Editor";
|
||||
};
|
||||
466
Templates/Full/game/tools/forestEditor/forestEditorGui.cs
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ForestEditorGui Script Methods
|
||||
|
||||
function ForestEditorGui::setActiveTool( %this, %tool )
|
||||
{
|
||||
if ( %tool == ForestTools->BrushTool )
|
||||
ForestEditTabBook.selectPage(0);
|
||||
|
||||
Parent::setActiveTool( %this, %tool );
|
||||
}
|
||||
|
||||
/// This is called by the editor when the active forest has
|
||||
/// changed giving us a chance to update the GUI.
|
||||
function ForestEditorGui::onActiveForestUpdated( %this, %forest, %createNew )
|
||||
{
|
||||
%gotForest = isObject( %forest );
|
||||
|
||||
// Give the user a chance to add a forest.
|
||||
if ( !%gotForest && %createNew )
|
||||
{
|
||||
MessageBoxYesNo( "Forest",
|
||||
"There is not a Forest in this mission. Do you want to add one?",
|
||||
%this @ ".createForest();", "" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// Called from a message box when a forest is not found.
|
||||
function ForestEditorGui::createForest( %this )
|
||||
{
|
||||
if ( isObject( theForest ) )
|
||||
{
|
||||
error( "Cannot create a second 'theForest' Forest!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Allocate the Forest and make it undoable.
|
||||
new Forest( theForest )
|
||||
{
|
||||
dataFile = "";
|
||||
parentGroup = "MissionGroup";
|
||||
};
|
||||
|
||||
MECreateUndoAction::submit( theForest );
|
||||
|
||||
ForestEditorInspector.inspect( theForest );
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
|
||||
function ForestEditorGui::newBrush( %this )
|
||||
{
|
||||
%internalName = getUniqueInternalName( "Brush", ForestBrushGroup, true );
|
||||
|
||||
%brush = new ForestBrush()
|
||||
{
|
||||
internalName = %internalName;
|
||||
parentGroup = ForestBrushGroup;
|
||||
};
|
||||
|
||||
MECreateUndoAction::submit( %brush );
|
||||
|
||||
ForestEditBrushTree.open( ForestBrushGroup );
|
||||
ForestEditBrushTree.buildVisibleTree(true);
|
||||
%item = ForestEditBrushTree.findItemByObjectId( %brush );
|
||||
ForestEditBrushTree.clearSelection();
|
||||
ForestEditBrushTree.addSelection( %item );
|
||||
ForestEditBrushTree.scrollVisible( %item );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditorGui::newElement( %this )
|
||||
{
|
||||
%sel = ForestEditBrushTree.getSelectedObject();
|
||||
|
||||
if ( !isObject( %sel ) )
|
||||
%parentGroup = ForestBrushGroup;
|
||||
else
|
||||
{
|
||||
if ( %sel.getClassName() $= "ForestBrushElement" )
|
||||
%parentGroup = %sel.parentGroup;
|
||||
else
|
||||
%parentGroup = %sel;
|
||||
}
|
||||
|
||||
%internalName = getUniqueInternalName( "Element", ForestBrushGroup, true );
|
||||
|
||||
%element = new ForestBrushElement()
|
||||
{
|
||||
internalName = %internalName;
|
||||
parentGroup = %parentGroup;
|
||||
};
|
||||
|
||||
MECreateUndoAction::submit( %element );
|
||||
|
||||
ForestEditBrushTree.clearSelection();
|
||||
ForestEditBrushTree.buildVisibleTree( true );
|
||||
%item = ForestEditBrushTree.findItemByObjectId( %element.getId() );
|
||||
ForestEditBrushTree.scrollVisible( %item );
|
||||
ForestEditBrushTree.addSelection( %item );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditorGui::deleteBrushOrElement( %this )
|
||||
{
|
||||
ForestEditBrushTree.deleteSelection();
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditorGui::newMesh( %this )
|
||||
{
|
||||
%spec = "All Mesh Files|*.dts;*.dae|DTS|*.dts|DAE|*.dae";
|
||||
|
||||
%dlg = new OpenFileDialog()
|
||||
{
|
||||
Filters = %spec;
|
||||
DefaultPath = $Pref::WorldEditor::LastPath;
|
||||
DefaultFile = "";
|
||||
ChangePath = true;
|
||||
};
|
||||
|
||||
%ret = %dlg.Execute();
|
||||
|
||||
if ( %ret )
|
||||
{
|
||||
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
||||
%fullPath = makeRelativePath( %dlg.FileName, getMainDotCSDir() );
|
||||
%file = fileBase( %fullPath );
|
||||
}
|
||||
|
||||
%dlg.delete();
|
||||
|
||||
if ( !%ret )
|
||||
return;
|
||||
|
||||
%name = getUniqueName( %file );
|
||||
|
||||
%str = "datablock TSForestItemData( " @ %name @ " ) { shapeFile = \"" @ %fullPath @ "\"; };";
|
||||
eval( %str );
|
||||
|
||||
if ( isObject( %name ) )
|
||||
{
|
||||
ForestEditMeshTree.clearSelection();
|
||||
ForestEditMeshTree.buildVisibleTree( true );
|
||||
%item = ForestEditMeshTree.findItemByObjectId( %name.getId() );
|
||||
ForestEditMeshTree.scrollVisible( %item );
|
||||
ForestEditMeshTree.addSelection( %item );
|
||||
|
||||
ForestDataManager.setDirty( %name, "art/forest/managedItemData.cs" );
|
||||
|
||||
%element = new ForestBrushElement()
|
||||
{
|
||||
internalName = %name;
|
||||
forestItemData = %name;
|
||||
parentGroup = ForestBrushGroup;
|
||||
};
|
||||
|
||||
ForestEditBrushTree.clearSelection();
|
||||
ForestEditBrushTree.buildVisibleTree( true );
|
||||
%item = ForestEditBrushTree.findItemByObjectId( %element.getId() );
|
||||
ForestEditBrushTree.scrollVisible( %item );
|
||||
ForestEditBrushTree.addSelection( %item );
|
||||
|
||||
pushInstantGroup();
|
||||
%action = new MECreateUndoAction()
|
||||
{
|
||||
actionName = "Create TSForestItemData";
|
||||
};
|
||||
popInstantGroup();
|
||||
|
||||
%action.addObject( %name );
|
||||
%action.addObject( %element );
|
||||
%action.addToManager( Editor.getUndoManager() );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
function ForestEditorGui::deleteMesh( %this )
|
||||
{
|
||||
%obj = ForestEditMeshTree.getSelectedObject();
|
||||
|
||||
// Can't delete itemData's that are in use without
|
||||
// crashing at the moment...
|
||||
|
||||
if ( isObject( %obj ) )
|
||||
{
|
||||
MessageBoxOKCancel( "Warning",
|
||||
"Deleting this mesh will also delete BrushesElements and ForestItems referencing it.",
|
||||
"ForestEditorGui.okDeleteMesh(" @ %obj @ ");",
|
||||
"" );
|
||||
}
|
||||
}
|
||||
|
||||
function ForestEditorGui::okDeleteMesh( %this, %mesh )
|
||||
{
|
||||
// Remove mesh from file
|
||||
ForestDataManager.removeObjectFromFile( %mesh, "art/forest/managedItemData.cs" );
|
||||
|
||||
// Submitting undo actions is handled in code.
|
||||
%this.deleteMeshSafe( %mesh );
|
||||
|
||||
// Update TreeViews.
|
||||
ForestEditBrushTree.buildVisibleTree( true );
|
||||
ForestEditMeshTree.buildVisibleTree( true );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditorGui::validateBrushSize( %this )
|
||||
{
|
||||
%minBrushSize = 1;
|
||||
%maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0);
|
||||
|
||||
%val = $ThisControl.getText();
|
||||
if(%val < %minBrushSize)
|
||||
$ThisControl.setValue(%minBrushSize);
|
||||
else if(%val > %maxBrushSize)
|
||||
$ThisControl.setValue(%maxBrushSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Child-control Script Methods
|
||||
|
||||
|
||||
function ForestEditMeshTree::onSelect( %this, %obj )
|
||||
{
|
||||
ForestEditorInspector.inspect( %obj );
|
||||
}
|
||||
|
||||
function ForestEditBrushTree::onRemoveSelection( %this, %obj )
|
||||
{
|
||||
%this.buildVisibleTree( true );
|
||||
ForestTools->BrushTool.collectElements();
|
||||
|
||||
if ( %this.getSelectedItemsCount() == 1 )
|
||||
ForestEditorInspector.inspect( %obj );
|
||||
else
|
||||
ForestEditorInspector.inspect( "" );
|
||||
}
|
||||
|
||||
function ForestEditBrushTree::onAddSelection( %this, %obj )
|
||||
{
|
||||
%this.buildVisibleTree( true );
|
||||
ForestTools->BrushTool.collectElements();
|
||||
|
||||
if ( %this.getSelectedItemsCount() == 1 )
|
||||
ForestEditorInspector.inspect( %obj );
|
||||
else
|
||||
ForestEditorInspector.inspect( "" );
|
||||
}
|
||||
|
||||
function ForestEditTabBook::onTabSelected( %this, %text, %idx )
|
||||
{
|
||||
%bbg = ForestEditorPalleteWindow.findObjectByInternalName("BrushButtonGroup");
|
||||
%mbg = ForestEditorPalleteWindow.findObjectByInternalName("MeshButtonGroup");
|
||||
|
||||
%bbg.setVisible( false );
|
||||
%mbg.setVisible( false );
|
||||
|
||||
if ( %text $= "Brushes" )
|
||||
{
|
||||
%bbg.setVisible( true );
|
||||
%obj = ForestEditBrushTree.getSelectedObject();
|
||||
ForestEditorInspector.inspect( %obj );
|
||||
}
|
||||
else if ( %text $= "Meshes" )
|
||||
{
|
||||
%mbg.setVisible( true );
|
||||
%obj = ForestEditMeshTree.getSelectedObject();
|
||||
ForestEditorInspector.inspect( %obj );
|
||||
}
|
||||
}
|
||||
|
||||
function ForestEditBrushTree::onDeleteSelection( %this )
|
||||
{
|
||||
%list = ForestEditBrushTree.getSelectedObjectList();
|
||||
|
||||
MEDeleteUndoAction::submit( %list, true );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditBrushTree::onDragDropped( %this )
|
||||
{
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditMeshTree::onDragDropped( %this )
|
||||
{
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditMeshTree::onDeleteObject( %this, %obj )
|
||||
{
|
||||
// return true - skip delete.
|
||||
return true;
|
||||
}
|
||||
|
||||
function ForestEditMeshTree::onDoubleClick( %this )
|
||||
{
|
||||
%obj = %this.getSelectedObject();
|
||||
|
||||
%name = getUniqueInternalName( %obj.getName(), ForestBrushGroup, true );
|
||||
|
||||
%element = new ForestBrushElement()
|
||||
{
|
||||
internalName = %name;
|
||||
forestItemData = %obj.getName();
|
||||
parentGroup = ForestBrushGroup;
|
||||
};
|
||||
|
||||
//ForestDataManager.setDirty( %element, "art/forest/brushes.cs" );
|
||||
|
||||
ForestEditBrushTree.clearSelection();
|
||||
ForestEditBrushTree.buildVisibleTree( true );
|
||||
%item = ForestEditBrushTree.findItemByObjectId( %element );
|
||||
ForestEditBrushTree.scrollVisible( %item );
|
||||
ForestEditBrushTree.addSelection( %item );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditBrushTree::handleRenameObject( %this, %name, %obj )
|
||||
{
|
||||
if ( %name !$= "" )
|
||||
{
|
||||
%found = ForestBrushGroup.findObjectByInternalName( %name );
|
||||
if ( isObject( %found ) && %found.getId() != %obj.getId() )
|
||||
{
|
||||
MessageBoxOK( "Error", "Brush or Element with that name already exists.", "" );
|
||||
|
||||
// true as in, we handled it, don't rename the object.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Since we aren't showing any groups whens inspecting a ForestBrushGroup
|
||||
// we can't push this event off to the inspector to handle.
|
||||
|
||||
//return GuiTreeViewCtrl::handleRenameObject( %this, %name, %obj );
|
||||
|
||||
|
||||
// The instant group will try to add our
|
||||
// UndoAction if we don't disable it.
|
||||
pushInstantGroup();
|
||||
|
||||
%nameOrClass = %obj.getName();
|
||||
if ( %nameOrClass $= "" )
|
||||
%nameOrClass = %obj.getClassname();
|
||||
|
||||
%action = new InspectorFieldUndoAction()
|
||||
{
|
||||
actionName = %nameOrClass @ "." @ "internalName" @ " Change";
|
||||
|
||||
objectId = %obj.getId();
|
||||
fieldName = "internalName";
|
||||
fieldValue = %obj.internalName;
|
||||
arrayIndex = 0;
|
||||
|
||||
inspectorGui = "";
|
||||
};
|
||||
|
||||
// Restore the instant group.
|
||||
popInstantGroup();
|
||||
|
||||
%action.addToManager( Editor.getUndoManager() );
|
||||
EWorldEditor.isDirty = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function ForestEditorInspector::inspect( %this, %obj )
|
||||
{
|
||||
if ( isObject( %obj ) )
|
||||
%class = %obj.getClassName();
|
||||
|
||||
%this.showObjectName = false;
|
||||
%this.showCustomFields = false;
|
||||
|
||||
switch$ ( %class )
|
||||
{
|
||||
case "ForestBrush":
|
||||
%this.groupFilters = "+NOTHING,-Ungrouped";
|
||||
|
||||
case "ForestBrushElement":
|
||||
%this.groupFilters = "+ForestBrushElement,-Ungrouped";
|
||||
|
||||
case "TSForestItemData":
|
||||
%this.groupFilters = "+Media,+Wind";
|
||||
|
||||
default:
|
||||
%this.groupFilters = "";
|
||||
}
|
||||
|
||||
Parent::inspect( %this, %obj );
|
||||
}
|
||||
|
||||
function ForestEditorInspector::onInspectorFieldModified( %this, %object, %fieldName, %oldValue, %newValue )
|
||||
{
|
||||
// The instant group will try to add our
|
||||
// UndoAction if we don't disable it.
|
||||
%instantGroup = $InstantGroup;
|
||||
$InstantGroup = 0;
|
||||
|
||||
%nameOrClass = %object.getName();
|
||||
if ( %nameOrClass $= "" )
|
||||
%nameOrClass = %object.getClassname();
|
||||
|
||||
%action = new InspectorFieldUndoAction()
|
||||
{
|
||||
actionName = %nameOrClass @ "." @ %fieldName @ " Change";
|
||||
|
||||
objectId = %object.getId();
|
||||
fieldName = %fieldName;
|
||||
fieldValue = %oldValue;
|
||||
|
||||
inspectorGui = %this;
|
||||
};
|
||||
|
||||
// Restore the instant group.
|
||||
$InstantGroup = %instantGroup;
|
||||
|
||||
%action.addToManager( Editor.getUndoManager() );
|
||||
|
||||
if ( %object.getClassName() $= "TSForestItemData" )
|
||||
ForestDataManager.setDirty( %object );
|
||||
|
||||
ForestEditorPlugin.dirty = true;
|
||||
}
|
||||
|
||||
function ForestEditorInspector::onFieldSelected( %this, %fieldName, %fieldTypeStr, %fieldDoc )
|
||||
{
|
||||
//FieldInfoControl.setText( "<font:ArialBold:14>" @ %fieldName @ "<font:ArialItalic:14> (" @ %fieldTypeStr @ ") " NL "<font:Arial:14>" @ %fieldDoc );
|
||||
}
|
||||
|
||||
function ForestBrushSizeSliderCtrlContainer::onWake(%this)
|
||||
{
|
||||
%this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0);
|
||||
%this-->slider.setValue(ForestBrushSizeTextEditContainer-->textEdit.getValue());
|
||||
}
|
||||
511
Templates/Full/game/tools/forestEditor/forestEditorGui.gui
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new ForestEditorCtrl(ForestEditorGui,EditorGuiGroup) {
|
||||
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";
|
||||
cameraZRot = "0";
|
||||
forceFOV = "0";
|
||||
reflectPriority = "1";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "0";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "0";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "ForestEditorProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "0 0";
|
||||
Extent = "800 600";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "1";
|
||||
|
||||
new GuiWindowCollapseCtrl(ForestEditorPalleteWindow) {
|
||||
CollapseGroup = "-1";
|
||||
CollapseGroupNum = "-1";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
EdgeSnap = "1";
|
||||
text = "Forest Editor";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiWindowCollapseProfile";
|
||||
HorizSizing = "windowRelative";
|
||||
VertSizing = "windowRelative";
|
||||
Position = getWord($pref::Video::mode, 0) - 209
|
||||
SPC getWord(EditorGuiToolbar.extent, 1)-1;
|
||||
Extent = "210 252";
|
||||
MinExtent = "210 100";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "PalleteWindow";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTabBookCtrl(ForestEditTabBook) {
|
||||
TabPosition = "Top";
|
||||
TabMargin = "10";
|
||||
MinTabWidth = "60";
|
||||
TabHeight = "20";
|
||||
AllowReorder = "0";
|
||||
FrontTabPadding = "0";
|
||||
Docking = "Client";
|
||||
Margin = "3 1 3 3";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTabBookProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "3 44";
|
||||
Extent = "210 205";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTabPageCtrl() {
|
||||
fitBook = "0";
|
||||
text = "Brushes";
|
||||
maxLength = "1024";
|
||||
Docking = "Client";
|
||||
Margin = "-1 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTabPageProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 22";
|
||||
Extent = "210 194";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "0";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "BrushesTab";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
lockHorizScroll = true;
|
||||
lockVertScroll = "0";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
mouseWheelScrollSpeed = "-1";
|
||||
Docking = "Client";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "210 194";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTreeViewCtrl(ForestEditBrushTree) {
|
||||
tabSize = "16";
|
||||
textOffset = "2";
|
||||
fullRowSelect = "0";
|
||||
itemHeight = "21";
|
||||
destroyTreeOnSleep = "1";
|
||||
MouseDragging = "1";
|
||||
MultipleSelections = "1";
|
||||
DeleteObjectAllowed = "1";
|
||||
DragToItemAllowed = "1";
|
||||
ClearAllOnSingleSelection = "1";
|
||||
showRoot = "0";
|
||||
internalNamesOnly = "1";
|
||||
objectNamesOnly = "0";
|
||||
useInspectorTooltips = "0";
|
||||
tooltipOnWidthOnly = "0";
|
||||
compareToObjectID = "1";
|
||||
canRenameObjects = "1";
|
||||
renameInternal = "1";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTreeViewProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "1 1";
|
||||
Extent = "208 2";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiTabPageCtrl() {
|
||||
fitBook = "0";
|
||||
text = "Meshes";
|
||||
maxLength = "1024";
|
||||
Docking = "Client";
|
||||
Margin = "-1 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTabPageProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 22";
|
||||
Extent = "210 183";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "MeshesTab";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
lockHorizScroll = true;
|
||||
lockVertScroll = "0";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
mouseWheelScrollSpeed = "-1";
|
||||
Docking = "Client";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "210 194";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTreeViewCtrl(ForestEditMeshTree) {
|
||||
tabSize = "16";
|
||||
textOffset = "2";
|
||||
fullRowSelect = "0";
|
||||
itemHeight = "21";
|
||||
destroyTreeOnSleep = "1";
|
||||
MouseDragging = "0";
|
||||
MultipleSelections = "0";
|
||||
DeleteObjectAllowed = "0";
|
||||
DragToItemAllowed = "0";
|
||||
ClearAllOnSingleSelection = "1";
|
||||
showRoot = "0";
|
||||
internalNamesOnly = "0";
|
||||
objectNamesOnly = "1";
|
||||
useInspectorTooltips = "0";
|
||||
tooltipOnWidthOnly = "0";
|
||||
compareToObjectID = "1";
|
||||
canRenameObjects = "1";
|
||||
renameInternal = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTreeViewProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "1 -67";
|
||||
Extent = "208 2";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
AltCommand = "$ThisControl.onDoubleClick();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiStackControl() {
|
||||
StackingType = "Horizontal";
|
||||
HorizStacking = "Left to Right";
|
||||
VertStacking = "Top to Bottom";
|
||||
Padding = "3";
|
||||
DynamicSize = "1";
|
||||
ChangeChildSizeToFit = "0";
|
||||
ChangeChildPosition = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "170 25";
|
||||
Extent = "35 17";
|
||||
MinExtent = "16 16";
|
||||
canSave = "1";
|
||||
Visible = "0";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "MeshButtonGroup";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/forestEditor/images/new-mesh";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "16 16";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestEditorGui.newMesh();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Add New Mesh";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/delete";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "19 0";
|
||||
Extent = "16 16";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestEditorGui.deleteMesh();";
|
||||
tooltip = "Delete Selected";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
new GuiStackControl() {
|
||||
StackingType = "Horizontal";
|
||||
HorizStacking = "Left to Right";
|
||||
VertStacking = "Top to Bottom";
|
||||
Padding = "3";
|
||||
DynamicSize = "1";
|
||||
ChangeChildSizeToFit = "0";
|
||||
ChangeChildPosition = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "151 25";
|
||||
Extent = "54 17";
|
||||
MinExtent = "16 16";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "BrushButtonGroup";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/forestEditor/images/new-brush";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "16 16";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestEditorGui.newBrush();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Add New Brush Group";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/forestEditor/images/new-element";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "19 0";
|
||||
Extent = "16 16";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestEditorGui.newElement();";
|
||||
tooltip = "Add New Brush Element";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/delete";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "38 0";
|
||||
Extent = "16 16";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "ForestEditorGui.deleteBrushOrElement();";
|
||||
tooltip = "Delete Selected";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiWindowCollapseCtrl(ForestEditorPropertiesWindow) {
|
||||
CollapseGroup = "-1";
|
||||
CollapseGroupNum = "-1";
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
EdgeSnap = "1";
|
||||
text = "Properties";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiWindowCollapseProfile";
|
||||
HorizSizing = "windowRelative";
|
||||
VertSizing = "windowRelative";
|
||||
Position = getWord($pref::Video::mode, 0) - 209
|
||||
SPC getWord(EditorGuiToolbar.extent, 1) + getWord(ForestEditorPalleteWindow.extent, 1) - 2;
|
||||
Extent = "210 460";
|
||||
MinExtent = "210 50";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "PropertiesWindow";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "alwaysOff";
|
||||
vScrollBar = "dynamic";
|
||||
lockHorizScroll = true;
|
||||
lockVertScroll = "0";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
mouseWheelScrollSpeed = "-1";
|
||||
Docking = "Client";
|
||||
Margin = "3 1 3 3";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "3 23";
|
||||
Extent = "210 263";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiInspector(ForestEditorInspector) {
|
||||
dividerMargin = "5";
|
||||
showCustomFields = "0";
|
||||
StackingType = "Vertical";
|
||||
HorizStacking = "Left to Right";
|
||||
VertStacking = "Top to Bottom";
|
||||
Padding = "1";
|
||||
DynamicSize = "1";
|
||||
ChangeChildSizeToFit = "1";
|
||||
ChangeChildPosition = "1";
|
||||
isContainer = "1";
|
||||
Profile = "GuiInspectorProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "1 1";
|
||||
Extent = "193 16";
|
||||
MinExtent = "16 16";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "Inspector";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
After Width: | Height: | Size: 751 B |
|
After Width: | Height: | Size: 1,012 B |
|
After Width: | Height: | Size: 671 B |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 945 B |
|
After Width: | Height: | Size: 619 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 677 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-brush_d.png
Normal file
|
After Width: | Height: | Size: 694 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-brush_h.png
Normal file
|
After Width: | Height: | Size: 693 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-brush_n.png
Normal file
|
After Width: | Height: | Size: 636 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-element_d.png
Normal file
|
After Width: | Height: | Size: 437 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-element_h.png
Normal file
|
After Width: | Height: | Size: 440 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-element_n.png
Normal file
|
After Width: | Height: | Size: 412 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-mesh_d.png
Normal file
|
After Width: | Height: | Size: 709 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-mesh_h.png
Normal file
|
After Width: | Height: | Size: 722 B |
BIN
Templates/Full/game/tools/forestEditor/images/new-mesh_n.png
Normal file
|
After Width: | Height: | Size: 633 B |
|
After Width: | Height: | Size: 940 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 754 B |
285
Templates/Full/game/tools/forestEditor/main.cs
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 initializeForestEditor()
|
||||
{
|
||||
echo(" % - Initializing Forest Editor");
|
||||
|
||||
exec( "./forestEditor.cs" );
|
||||
exec( "./forestEditorGui.gui" );
|
||||
exec( "./forestEditToolbar.ed.gui" );
|
||||
|
||||
exec( "./forestEditorGui.cs" );
|
||||
exec( "./tools.cs" );
|
||||
|
||||
ForestEditorGui.setVisible( false );
|
||||
ForestEditorPalleteWindow.setVisible( false );
|
||||
ForestEditorPropertiesWindow.setVisible( false );
|
||||
ForestEditToolbar.setVisible( false );
|
||||
|
||||
EditorGui.add( ForestEditorGui );
|
||||
EditorGui.add( ForestEditorPalleteWindow );
|
||||
EditorGui.add( ForestEditorPropertiesWindow );
|
||||
EditorGui.add( ForestEditToolbar );
|
||||
|
||||
new ScriptObject( ForestEditorPlugin )
|
||||
{
|
||||
superClass = "EditorPlugin";
|
||||
editorGui = ForestEditorGui;
|
||||
};
|
||||
|
||||
new SimSet(ForestTools)
|
||||
{
|
||||
new ForestBrushTool()
|
||||
{
|
||||
internalName = "BrushTool";
|
||||
toolTip = "Paint Tool";
|
||||
buttonImage = "tools/forest/images/brushTool";
|
||||
};
|
||||
|
||||
new ForestSelectionTool()
|
||||
{
|
||||
internalName = "SelectionTool";
|
||||
toolTip = "Selection Tool";
|
||||
buttonImage = "tools/forest/images/selectionTool";
|
||||
};
|
||||
};
|
||||
|
||||
%map = new ActionMap();
|
||||
%map.bindCmd( keyboard, "1", "ForestEditorSelectModeBtn.performClick();", "" ); // Select
|
||||
%map.bindCmd( keyboard, "2", "ForestEditorMoveModeBtn.performClick();", "" ); // Move
|
||||
%map.bindCmd( keyboard, "3", "ForestEditorRotateModeBtn.performClick();", "" ); // Rotate
|
||||
%map.bindCmd( keyboard, "4", "ForestEditorScaleModeBtn.performClick();", "" ); // Scale
|
||||
%map.bindCmd( keyboard, "5", "ForestEditorPaintModeBtn.performClick();", "" ); // Paint
|
||||
%map.bindCmd( keyboard, "6", "ForestEditorEraseModeBtn.performClick();", "" ); // Erase
|
||||
%map.bindCmd( keyboard, "7", "ForestEditorEraseSelectedModeBtn.performClick();", "" ); // EraseSelected
|
||||
//%map.bindCmd( keyboard, "backspace", "ForestEditorGui.onDeleteKey();", "" );
|
||||
//%map.bindCmd( keyboard, "delete", "ForestEditorGui.onDeleteKey();", "" );
|
||||
ForestEditorPlugin.map = %map;
|
||||
}
|
||||
|
||||
function destroyForestEditor()
|
||||
{
|
||||
}
|
||||
|
||||
// NOTE: debugging helper.
|
||||
function reinitForest()
|
||||
{
|
||||
exec( "./main.cs" );
|
||||
exec( "./forestEditorGui.cs" );
|
||||
exec( "./tools.cs" );
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onWorldEditorStartup( %this )
|
||||
{
|
||||
new PersistenceManager( ForestDataManager );
|
||||
|
||||
%brushPath = "art/forest/brushes.cs";
|
||||
if ( !isFile( %brushPath ) )
|
||||
createPath( %brushPath );
|
||||
|
||||
// This creates the ForestBrushGroup, all brushes, and elements.
|
||||
exec( %brushpath );
|
||||
|
||||
if ( !isObject( ForestBrushGroup ) )
|
||||
{
|
||||
new SimGroup( ForestBrushGroup );
|
||||
%this.showError = true;
|
||||
}
|
||||
|
||||
ForestEditBrushTree.open( ForestBrushGroup );
|
||||
|
||||
if ( !isObject( ForestItemDataSet ) )
|
||||
new SimSet( ForestItemDataSet );
|
||||
|
||||
ForestEditMeshTree.open( ForestItemDataSet );
|
||||
|
||||
// Add ourselves to the window menu.
|
||||
%accel = EditorGui.addToEditorsMenu( "Forest Editor", "", ForestEditorPlugin );
|
||||
|
||||
// Add ourselves to the tools menu.
|
||||
%tooltip = "Forest Editor (" @ %accel @ ")";
|
||||
EditorGui.addToToolsToolbar( "ForestEditorPlugin", "ForestEditorPalette", expandFilename("tools/forestEditor/images/forest-editor-btn"), %tooltip );
|
||||
|
||||
//connect editor windows
|
||||
GuiWindowCtrl::attach( ForestEditorPropertiesWindow, ForestEditorPalleteWindow );
|
||||
ForestEditTabBook.selectPage(0);
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onWorldEditorShutdown( %this )
|
||||
{
|
||||
if ( isObject( ForestBrushGroup ) )
|
||||
ForestBrushGroup.delete();
|
||||
if ( isObject( ForestDataManager ) )
|
||||
ForestDataManager.delete();
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onActivated( %this )
|
||||
{
|
||||
EditorGui.bringToFront( ForestEditorGui );
|
||||
ForestEditorGui.setVisible( true );
|
||||
ForestEditorPalleteWindow.setVisible( true );
|
||||
ForestEditorPropertiesWindow.setVisible( true );
|
||||
ForestEditorGui.makeFirstResponder( true );
|
||||
//ForestEditToolbar.setVisible( true );
|
||||
|
||||
%this.map.push();
|
||||
Parent::onActivated(%this);
|
||||
|
||||
ForestEditBrushTree.open( ForestBrushGroup );
|
||||
ForestEditMeshTree.open( ForestItemDataSet );
|
||||
|
||||
// Open the Brush tab.
|
||||
ForestEditTabBook.selectPage(0);
|
||||
|
||||
// Sync the pallete button state
|
||||
|
||||
// And toolbar.
|
||||
%tool = ForestEditorGui.getActiveTool();
|
||||
if ( isObject( %tool ) )
|
||||
%tool.onActivated();
|
||||
|
||||
if ( !isObject( %tool ) )
|
||||
{
|
||||
ForestEditorPaintModeBtn.performClick();
|
||||
|
||||
if ( ForestEditBrushTree.getItemCount() > 0 )
|
||||
{
|
||||
ForestEditBrushTree.selectItem( 0, true );
|
||||
}
|
||||
}
|
||||
else if ( %tool == ForestTools->SelectionTool )
|
||||
{
|
||||
%mode = GlobalGizmoProfile.mode;
|
||||
switch$ (%mode)
|
||||
{
|
||||
case "None":
|
||||
ForestEditorSelectModeBtn.performClick();
|
||||
case "Move":
|
||||
ForestEditorMoveModeBtn.performClick();
|
||||
case "Rotate":
|
||||
ForestEditorRotateModeBtn.performClick();
|
||||
case "Scale":
|
||||
ForestEditorScaleModeBtn.performClick();
|
||||
}
|
||||
}
|
||||
else if ( %tool == ForestTools->BrushTool )
|
||||
{
|
||||
%mode = ForestTools->BrushTool.mode;
|
||||
switch$ (%mode)
|
||||
{
|
||||
case "Paint":
|
||||
ForestEditorPaintModeBtn.performClick();
|
||||
case "Erase":
|
||||
ForestEditorEraseModeBtn.performClick();
|
||||
case "EraseSelected":
|
||||
ForestEditorEraseSelectedModeBtn.performClick();
|
||||
}
|
||||
}
|
||||
|
||||
if ( %this.showError )
|
||||
MessageBoxOK( "Error", "Your art/forest folder does not contain a valid brushes.cs. Brushes you create will not be saved!" );
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onDeactivated( %this )
|
||||
{
|
||||
ForestEditorGui.setVisible( false );
|
||||
ForestEditorPalleteWindow.setVisible( false );
|
||||
ForestEditorPropertiesWindow.setVisible( false );
|
||||
|
||||
%tool = ForestEditorGui.getActiveTool();
|
||||
if ( isObject( %tool ) )
|
||||
%tool.onDeactivated();
|
||||
|
||||
// Also take this opportunity to save.
|
||||
ForestDataManager.saveDirty();
|
||||
|
||||
%this.map.pop();
|
||||
|
||||
Parent::onDeactivated(%this);
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::isDirty( %this )
|
||||
{
|
||||
%dirty = %this.dirty || ForestEditorGui.isDirty();
|
||||
return %dirty;
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::clearDirty( %this )
|
||||
{
|
||||
%this.dirty = false;
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onSaveMission( %this, %missionFile )
|
||||
{
|
||||
ForestDataManager.saveDirty();
|
||||
|
||||
if ( isObject( theForest ) )
|
||||
theForest.saveDataFile();
|
||||
|
||||
ForestBrushGroup.save( "art/forest/brushes.cs" );
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onEditorSleep( %this )
|
||||
{
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::onEditMenuSelect( %this, %editMenu )
|
||||
{
|
||||
%hasSelection = false;
|
||||
|
||||
%selTool = ForestTools->SelectionTool;
|
||||
if ( ForestEditorGui.getActiveTool() == %selTool )
|
||||
if ( %selTool.getSelectionCount() > 0 )
|
||||
%hasSelection = true;
|
||||
|
||||
%editMenu.enableItem( 3, %hasSelection ); // Cut
|
||||
%editMenu.enableItem( 4, %hasSelection ); // Copy
|
||||
%editMenu.enableItem( 5, %hasSelection ); // Paste
|
||||
%editMenu.enableItem( 6, %hasSelection ); // Delete
|
||||
%editMenu.enableItem( 8, %hasSelection ); // Deselect
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::handleDelete( %this )
|
||||
{
|
||||
ForestTools->SelectionTool.deleteSelection();
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::handleDeselect( %this )
|
||||
{
|
||||
ForestTools->SelectionTool.clearSelection();
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::handleCut( %this )
|
||||
{
|
||||
ForestTools->SelectionTool.cutSelection();
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::handleCopy( %this )
|
||||
{
|
||||
ForestTools->SelectionTool.copySelection();
|
||||
}
|
||||
|
||||
function ForestEditorPlugin::handlePaste( %this )
|
||||
{
|
||||
ForestTools->SelectionTool.pasteSelection();
|
||||
}
|
||||
61
Templates/Full/game/tools/forestEditor/tools.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 ForestBrushTool::onActivated( %this )
|
||||
{
|
||||
ForestEditToolbar.setVisible( true );
|
||||
%this.syncBrushToolbar();
|
||||
}
|
||||
|
||||
function ForestBrushTool::onDeactivated( %this )
|
||||
{
|
||||
ForestEditToolbar.setVisible( false );
|
||||
}
|
||||
|
||||
function ForestBrushTool::syncBrushToolbar( %this )
|
||||
{
|
||||
%size = %this.size;
|
||||
ForestBrushSizeSliderCtrlContainer->slider.setValue( %size );
|
||||
ForestBrushSizeTextEditContainer-->textEdit.setValue( %size );
|
||||
|
||||
%pres = %this.pressure;
|
||||
ForestBrushPressureSliderCtrlContainer->slider.setValue( %pres );
|
||||
ForestBrushPressureTextEditContainer-->textEdit.setValue( mCeil(100 * %pres) @ "%" );
|
||||
|
||||
%hard = %this.hardness;
|
||||
ForestBrushHardnessSliderCtrlContainer->slider.setValue( %hard );
|
||||
ForestBrushHardnessTextEditContainer-->textEdit.setValue( mCeil(100 * %hard) @ "%");
|
||||
}
|
||||
|
||||
function ForestBrushTool::onMouseDown( %this )
|
||||
{
|
||||
ForestEditTabBook.selectPage( 0 );
|
||||
}
|
||||
|
||||
function ForestSelectionTool::onActivated( %this )
|
||||
{
|
||||
}
|
||||
|
||||
function ForestSelectionTool::onDeactivated( %this )
|
||||
{
|
||||
%this.clearSelection();
|
||||
}
|
||||