mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Full Template for ticket #1
This commit is contained in:
parent
74f265b3b3
commit
f439dc8dcd
2150 changed files with 286240 additions and 0 deletions
|
|
@ -0,0 +1,224 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl(DatablockEditorCreatePrompt,EditorGuiGroup) {
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiDefaultProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
text = "Create New Datablock";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "0";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
canCollapse = "0";
|
||||
closeCommand = "canvas.popDialog(DatablockEditorCreatePrompt);";
|
||||
edgeSnap = "0";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "389 252";
|
||||
extent = "207 167";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiWindowProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Your new datablock must have a name";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "7 26";
|
||||
extent = "190 15";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
historySize = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
password = "0";
|
||||
passwordMask = "*";
|
||||
text = "Name";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "7 45";
|
||||
extent = "191 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiTextEditProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
internalName = "CreateDatablockName";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
text = "Create";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
position = "7 137";
|
||||
extent = "122 22";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiButtonProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
command = "DatablockEditorPlugin.createPromptNameCheck();";
|
||||
accelerator = "return";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
text = "Cancel";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
position = "135 137";
|
||||
extent = "63 22";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiButtonProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
command = "canvas.popDialog(DatablockEditorCreatePrompt);";
|
||||
accelerator = "escape";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Copy values from";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "7 66";
|
||||
extent = "100 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiPopUpMenuCtrl() {
|
||||
maxPopupHeight = "200";
|
||||
sbUsesNAColor = "0";
|
||||
reverseTextList = "0";
|
||||
bitmapBounds = "16 16";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "7 87";
|
||||
extent = "191 19";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
internalName = "CopySourceDropdown";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiCheckBoxCtrl() {
|
||||
useInactiveState = "0";
|
||||
text = "Client-Side Datablock";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
position = "7 105";
|
||||
extent = "140 30";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
fixedAspectRatio = "0";
|
||||
profile = "GuiCheckBoxProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
internalName = "ClientSideCheckBox";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl() {
|
||||
isContainer = "1";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "1024 768";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiWindowCollapseCtrl(DatablockEditorInspectorWindow) {
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
closeCommand = "DatablockEditorInspectorWindow.setVisible(false);";
|
||||
EdgeSnap = "1";
|
||||
text = "Datablock";
|
||||
Margin = "8 8 8 8";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiWindowProfile";
|
||||
HorizSizing = "windowRelative";
|
||||
VertSizing = "windowRelative";
|
||||
Position = getWord($pref::Video::mode, 0) - 209
|
||||
SPC getWord(EditorGuiToolbar.extent, 1) + getWord(DatablockEditorTreeWindow.extent, 1) - 2;
|
||||
Extent = "210 373";
|
||||
MinExtent = "210 140";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "DatablockEditorInspectorWindow";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiContainer() {
|
||||
Docking = "Client";
|
||||
Margin = "22 41 3 3";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "4 41";
|
||||
Extent = "202 287";
|
||||
MinExtent = "64 64";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
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 = "GuiEditorScrollProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "0 0";
|
||||
Extent = "202 287";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiInspector(DatablockEditorInspector) {
|
||||
dividerMargin = "5";
|
||||
StackingType = "Vertical";
|
||||
HorizStacking = "Left to Right";
|
||||
VertStacking = "Top to Bottom";
|
||||
Padding = "1";
|
||||
ChangeChildSizeToFit = "1";
|
||||
ChangeChildPosition = "1";
|
||||
isContainer = "1";
|
||||
Profile = "GuiInspectorProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
position = "1 1";
|
||||
Extent = "190 8";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
superClass = "EditorInspectorBase";
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiMLTextCtrl(DatablockFieldInfoControl) {
|
||||
lineSpacing = "2";
|
||||
allowColorChars = "0";
|
||||
maxChars = "-1";
|
||||
useURLMouseCursor = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiInspectorFieldInfoMLTextProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "top";
|
||||
position = "1 328";
|
||||
Extent = "205 14";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
historySize = "0";
|
||||
password = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
passwordMask = "*";
|
||||
maxLength = "1024";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiTextEditProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
position = "4 23";
|
||||
Extent = "159 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "DatablockFile";
|
||||
canSaveDynamicFields = "0";
|
||||
active = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/save-icon";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "167 23";
|
||||
Extent = "17 17";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "DatablockEditorPlugin.save();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Save Datablock (ALT S)";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/save-as";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "187 23";
|
||||
Extent = "17 17";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "DatablockEditorPlugin.showSaveNewFileDialog();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Save Datablock to a New File";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "saveAsButton";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl() {
|
||||
isContainer = "1";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 0";
|
||||
Extent = "1024 768";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiWindowCollapseCtrl(DatablockEditorTreeWindow) {
|
||||
resizeWidth = "1";
|
||||
resizeHeight = "1";
|
||||
canMove = "1";
|
||||
canClose = "0";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
minSize = "50 50";
|
||||
closeCommand = "DatablockInspectorTreeWindow.setVisible(false);";
|
||||
EdgeSnap = "1";
|
||||
text = "Datablock Library";
|
||||
Margin = "8 8 8 8";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiWindowProfile";
|
||||
HorizSizing = "windowRelative";
|
||||
VertSizing = "windowRelative";
|
||||
Position = getWord($pref::Video::mode, 0) - 209
|
||||
SPC getWord(EditorGuiToolbar.extent, 1) - 1;
|
||||
Extent = "210 324";
|
||||
MinExtent = "210 140";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "DatablockEditorTreeWindow";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTabBookCtrl(DatablockEditorTreeTabBook) {
|
||||
TabPosition = "Top";
|
||||
TabMargin = "0";
|
||||
MinTabWidth = "64";
|
||||
Docking = "Client";
|
||||
Margin = "3 2 3 3";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTabBookProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "4 25";
|
||||
Extent = "202 294";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "DatablockEditorTree";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTabPageCtrl() {
|
||||
text = "Existing";
|
||||
maxLength = "1024";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "EditorTabPage";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "0 19";
|
||||
Extent = "202 276";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "0";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextEditCtrl( DatablockEditorTreeFilter ) {
|
||||
position = "2 4";
|
||||
extent = "180 18";
|
||||
profile = "GuiTextEditProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
class = "GuiTreeViewFilterText";
|
||||
treeView = DatablockEditorTree;
|
||||
};
|
||||
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/clear-icon";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "185 5";
|
||||
Extent = "17 17";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
class = "GuiTreeViewFilterClearButton";
|
||||
textCtrl = DatablockEditorTreeFilter;
|
||||
};
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "dynamic";
|
||||
lockHorizScroll = "0";
|
||||
lockVertScroll = "0";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
mouseWheelScrollSpeed = "-1";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "0 25";
|
||||
Extent = "202 251";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTreeViewCtrl(DatablockEditorTree) {
|
||||
tabSize = "16";
|
||||
textOffset = "2";
|
||||
fullRowSelect = "0";
|
||||
itemHeight = "21";
|
||||
destroyTreeOnSleep = "0";
|
||||
MouseDragging = "0";
|
||||
MultipleSelections = "1";
|
||||
DeleteObjectAllowed = "1";
|
||||
DragToItemAllowed = "0";
|
||||
ClearAllOnSingleSelection = "1";
|
||||
showRoot = "1";
|
||||
internalNamesOnly = "0";
|
||||
objectNamesOnly = "0";
|
||||
compareToObjectID = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTreeViewProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "1 1";
|
||||
Extent = "198 21";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiTabPageCtrl(DatablockEditorCreator) {
|
||||
text = "New";
|
||||
maxLength = "1024";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "EditorTabPage";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "0 19";
|
||||
Extent = "202 276";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
internalName = "DatablockEditorCreator";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiScrollCtrl() {
|
||||
willFirstRespond = "1";
|
||||
hScrollBar = "dynamic";
|
||||
vScrollBar = "dynamic";
|
||||
lockHorizScroll = "0";
|
||||
lockVertScroll = "0";
|
||||
constantThumbHeight = "0";
|
||||
childMargin = "0 0";
|
||||
mouseWheelScrollSpeed = "-1";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
isContainer = "1";
|
||||
Profile = "GuiScrollProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "0 0";
|
||||
Extent = "202 276";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTreeViewCtrl(DatablockEditorTypeTree) {
|
||||
tabSize = "16";
|
||||
textOffset = "2";
|
||||
fullRowSelect = "0";
|
||||
itemHeight = "21";
|
||||
destroyTreeOnSleep = "0";
|
||||
MouseDragging = "0";
|
||||
MultipleSelections = "0";
|
||||
DeleteObjectAllowed = "0";
|
||||
DragToItemAllowed = "0";
|
||||
ClearAllOnSingleSelection = "1";
|
||||
showRoot = "1";
|
||||
internalNamesOnly = "0";
|
||||
objectNamesOnly = "0";
|
||||
compareToObjectID = "1";
|
||||
isContainer = "1";
|
||||
Profile = "GuiTreeViewProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "1 1";
|
||||
Extent = "196 260";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
altCommand = "DatablockEditorPlugin.createDatablock();";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/delete";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "190 26";
|
||||
Extent = "16 16";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "DatablockEditorPlugin.deleteDatablock();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
ToolTip = "Delete Datablock";
|
||||
hovertime = "1000";
|
||||
internalName = "deleteSelection";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "core/art/gui/images/new";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiButtonProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "192 25";
|
||||
Extent = "17 17";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "0";
|
||||
Command = "DatablockEditorPlugin.createDatablock();";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
tooltip = "Create New Datablock";
|
||||
hovertime = "1000";
|
||||
internalName = "CreateSelection";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
885
Templates/Full/game/tools/datablockEditor/datablockEditor.cs
Normal file
885
Templates/Full/game/tools/datablockEditor/datablockEditor.cs
Normal file
|
|
@ -0,0 +1,885 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Main code for the Datablock Editor plugin.
|
||||
|
||||
|
||||
$DATABLOCK_EDITOR_DEFAULT_FILENAME = "art/datablocks/managedDatablocks.cs";
|
||||
|
||||
//=============================================================================================
|
||||
// Initialization.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::init( %this )
|
||||
{
|
||||
if( !DatablockEditorTree.getItemCount() )
|
||||
%this.populateTrees();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::onWorldEditorStartup( %this )
|
||||
{
|
||||
// Add ourselves to the window menu.
|
||||
%accel = EditorGui.addToEditorsMenu( "Datablock Editor", "", DatablockEditorPlugin );
|
||||
|
||||
// Add ourselves to the ToolsToolbar
|
||||
%tooltip = "Datablock Editor (" @ %accel @ ")";
|
||||
EditorGui.addToToolsToolbar( "DatablockEditorPlugin", "DatablockEditorPalette", expandFilename("tools/worldEditor/images/toolbar/datablock-editor"), %tooltip );
|
||||
|
||||
//connect editor windows
|
||||
GuiWindowCtrl::Attach( DatablockEditorInspectorWindow, DatablockEditorTreeWindow);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::onActivated( %this )
|
||||
{
|
||||
EditorGui-->WorldEditorToolbar.setVisible(false);
|
||||
EditorGui.bringToFront( DatablockEditorPlugin );
|
||||
|
||||
DatablockEditorTreeWindow.setVisible( true );
|
||||
DatablockEditorInspectorWindow.setVisible( true );
|
||||
DatablockEditorInspectorWindow.makeFirstResponder( true );
|
||||
|
||||
%this.map.push();
|
||||
|
||||
// Set the status bar here until all tool have been hooked up
|
||||
EditorGuiStatusBar.setInfo( "Datablock editor." );
|
||||
|
||||
%numSelected = %this.getNumSelectedDatablocks();
|
||||
if( !%numSelected )
|
||||
EditorGuiStatusBar.setSelection( "" );
|
||||
else
|
||||
EditorGuiStatusBar.setSelection( %numSelected @ " datablocks selected" );
|
||||
|
||||
%this.init();
|
||||
DatablockEditorPlugin.readSettings();
|
||||
|
||||
if( EWorldEditor.getSelectionSize() == 1 )
|
||||
%this.onObjectSelected( EWorldEditor.getSelectedObject( 0 ) );
|
||||
|
||||
Parent::onActivated( %this );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::onDeactivated( %this )
|
||||
{
|
||||
DatablockEditorPlugin.writeSettings();
|
||||
|
||||
DatablockEditorInspectorWindow.setVisible( false );
|
||||
DatablockEditorTreeWindow.setVisible( false );
|
||||
%this.map.pop();
|
||||
|
||||
Parent::onDeactivated(%this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::onExitMission( %this )
|
||||
{
|
||||
DatablockEditorTree.clear();
|
||||
DatablockEditorInspector.inspect( "" );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::openDatablock( %this, %datablock )
|
||||
{
|
||||
EditorGui.setEditor( DatablockEditorPlugin );
|
||||
%this.selectDatablock( %datablock );
|
||||
DatablockEditorTreeTabBook.selectedPage = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::setEditorFunction( %this )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::onObjectSelected( %this, %object )
|
||||
{
|
||||
// Select datablock of object if this is a GameBase object.
|
||||
|
||||
if( %object.isMemberOfClass( "GameBase" ) )
|
||||
%this.selectDatablock( %object.getDatablock() );
|
||||
else if( %object.isMemberOfClass( "SFXEmitter" ) && isObject( %object.track ) )
|
||||
%this.selectDatablock( %object.track );
|
||||
else if( %object.isMemberOfClass( "LightBase" ) && isObject( %object.animationType ) )
|
||||
%this.selectDatablock( %object.animationType );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::populateTrees(%this)
|
||||
{
|
||||
// Populate datablock tree.
|
||||
|
||||
if( %this.excludeClientOnlyDatablocks )
|
||||
%set = DataBlockGroup;
|
||||
else
|
||||
%set = DataBlockSet;
|
||||
|
||||
DatablockEditorTree.clear();
|
||||
|
||||
foreach( %datablock in %set )
|
||||
{
|
||||
%unlistedFound = false;
|
||||
%id = %datablock.getId();
|
||||
|
||||
foreach( %obj in UnlistedDatablocks )
|
||||
if( %obj.getId() == %id )
|
||||
{
|
||||
%unlistedFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if( %unlistedFound )
|
||||
continue;
|
||||
|
||||
%this.addExistingItem( %datablock, true );
|
||||
}
|
||||
|
||||
DatablockEditorTree.sort( 0, true, false, false );
|
||||
|
||||
// Populate datablock type tree.
|
||||
|
||||
%classList = enumerateConsoleClasses( "SimDatablock" );
|
||||
DatablockEditorTypeTree.clear();
|
||||
|
||||
foreach$( %datablockClass in %classList )
|
||||
{
|
||||
if( !%this.isExcludedDatablockType( %datablockClass )
|
||||
&& DatablockEditorTypeTree.findItemByName( %datablockClass ) == 0 )
|
||||
DatablockEditorTypeTree.insertItem( 0, %datablockClass );
|
||||
}
|
||||
|
||||
DatablockEditorTypeTree.sort( 0, false, false, false );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::addExistingItem( %this, %datablock, %dontSort )
|
||||
{
|
||||
%tree = DatablockEditorTree;
|
||||
|
||||
// Look up class at root level. Create if needed.
|
||||
|
||||
%class = %datablock.getClassName();
|
||||
%parentID = %tree.findItemByName( %class );
|
||||
if( %parentID == 0 )
|
||||
%parentID = %tree.insertItem( 0, %class );
|
||||
|
||||
// If the datablock is already there, don't
|
||||
// do anything.
|
||||
|
||||
if( %tree.findItemByValue( %datablock.getId() ) )
|
||||
return;
|
||||
|
||||
// It doesn't exist so add it.
|
||||
|
||||
%name = %datablock.getName();
|
||||
if( %this.PM.isDirty( %datablock ) )
|
||||
%name = %name @ " *";
|
||||
|
||||
%id = DatablockEditorTree.insertItem( %parentID, %name, %datablock.getId() );
|
||||
if( !%dontSort )
|
||||
DatablockEditorTree.sort( %parentID, false, false, false );
|
||||
|
||||
return %id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::isExcludedDatablockType( %this, %className )
|
||||
{
|
||||
switch$( %className )
|
||||
{
|
||||
case "SimDatablock":
|
||||
return true;
|
||||
case "SFXTrack": // Abstract.
|
||||
return true;
|
||||
case "SFXFMODEvent": // Internally created.
|
||||
return true;
|
||||
case "SFXFMODEventGroup": // Internally created.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Settings.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::initSettings( %this )
|
||||
{
|
||||
EditorSettings.beginGroup("DatablockEditor", true);
|
||||
|
||||
EditorSettings.setDefaultValue("libraryTab", "0");
|
||||
|
||||
EditorSettings.endGroup();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::readSettings( %this )
|
||||
{
|
||||
EditorSettings.beginGroup("DatablockEditor", true);
|
||||
|
||||
DatablockEditorTreeTabBook.selectPage( EditorSettings.value( "libraryTab" ) );
|
||||
%db = EditorSettings.value( "selectedDatablock" );
|
||||
if( isObject( %db ) && %db.isMemberOfClass( "SimDatablock" ) )
|
||||
%this.selectDatablock( %db );
|
||||
|
||||
EditorSettings.endGroup();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::writeSettings( %this )
|
||||
{
|
||||
EditorSettings.beginGroup( "DatablockEditor", true );
|
||||
|
||||
EditorSettings.setValue( "libraryTab", DatablockEditorTreeTabBook.getSelectedPage() );
|
||||
if( %this.getNumSelectedDatablocks() > 0 )
|
||||
EditorSettings.setValue( "selectedDatablock", %this.getSelectedDatablock().getName() );
|
||||
|
||||
EditorSettings.endGroup();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Persistence.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
/// Return true if there is any datablock with unsaved changes.
|
||||
function DatablockEditorPlugin::isDirty( %this )
|
||||
{
|
||||
return %this.PM.hasDirty();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
/// Return true if any of the currently selected datablocks has unsaved changes.
|
||||
function DatablockEditorPlugin::selectedDatablockIsDirty( %this )
|
||||
{
|
||||
%tree = DatablockEditorTree;
|
||||
|
||||
%count = %tree.getSelectedItemsCount();
|
||||
%selected = %tree.getSelectedItemList();
|
||||
|
||||
foreach$( %id in %selected )
|
||||
{
|
||||
%db = %tree.getItemValue( %id );
|
||||
if( %this.PM.isDirty( %db ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::syncDirtyState( %this )
|
||||
{
|
||||
%tree = DatablockEditorTree;
|
||||
|
||||
%count = %tree.getSelectedItemsCount();
|
||||
%selected = %tree.getSelectedItemList();
|
||||
%haveDirty = false;
|
||||
|
||||
foreach$( %id in %selected )
|
||||
{
|
||||
%db = %tree.getItemValue( %id );
|
||||
if( %this.PM.isDirty( %db ) )
|
||||
{
|
||||
%this.flagDatablockAsDirty( %db, true );
|
||||
%haveDirty = true;
|
||||
}
|
||||
else
|
||||
%this.flagInspectorAsDirty( %db, false );
|
||||
}
|
||||
|
||||
%this.flagInspectorAsDirty( %haveDirty );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
function DatablockEditorPlugin::flagInspectorAsDirty( %this, %dirty )
|
||||
{
|
||||
if( %dirty )
|
||||
DatablockEditorInspectorWindow.text = "Datablock *";
|
||||
else
|
||||
DatablockEditorInspectorWindow.text = "Datablock";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::flagDatablockAsDirty(%this, %datablock, %dirty )
|
||||
{
|
||||
%tree = DatablockEditorTree;
|
||||
|
||||
%id = %tree.findItemByValue( %datablock.getId() );
|
||||
if( %id == 0 )
|
||||
return;
|
||||
|
||||
// Tag the item caption and sync the persistence manager.
|
||||
|
||||
if( %dirty )
|
||||
{
|
||||
DatablockEditorTree.editItem( %id, %datablock.getName() @ " *", %datablock.getId() );
|
||||
%this.PM.setDirty( %datablock );
|
||||
}
|
||||
else
|
||||
{
|
||||
DatablockEditorTree.editItem( %id, %datablock.getName(), %datablock.getId() );
|
||||
%this.PM.removeDirty( %datablock );
|
||||
}
|
||||
|
||||
// Sync the inspector dirty state.
|
||||
|
||||
%this.flagInspectorAsDirty( %this.PM.hasDirty() );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::showSaveNewFileDialog(%this)
|
||||
{
|
||||
%currentFile = %this.getSelectedDatablock().getFilename();
|
||||
getSaveFilename( "TorqueScript Files|*.cs|All Files|*.*", %this @ ".saveNewFileFinish", %currentFile, false );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::saveNewFileFinish( %this, %newFileName )
|
||||
{
|
||||
// Clear the first responder to capture any inspector changes
|
||||
%ctrl = canvas.getFirstResponder();
|
||||
if( isObject(%ctrl) )
|
||||
%ctrl.clearFirstResponder();
|
||||
|
||||
%tree = DatablockEditorTree;
|
||||
%count = %tree.getSelectedItemsCount();
|
||||
%selected = %tree.getSelectedItemList();
|
||||
|
||||
foreach$( %id in %selected )
|
||||
{
|
||||
%db = %tree.getItemValue( %id );
|
||||
%db = %this.getSelectedDatablock();
|
||||
|
||||
// Remove from current file.
|
||||
|
||||
%oldFileName = %db.getFileName();
|
||||
if( %oldFileName !$= "" )
|
||||
%this.PM.removeObjectFromFile( %db, %oldFileName );
|
||||
|
||||
// Save to new file.
|
||||
|
||||
%this.PM.setDirty( %db, %newFileName );
|
||||
if( %this.PM.saveDirtyObject( %db ) )
|
||||
{
|
||||
// Clear dirty state.
|
||||
|
||||
%this.flagDatablockAsDirty( %db, false );
|
||||
}
|
||||
}
|
||||
|
||||
DatablockEditorInspectorWindow-->DatablockFile.setText( %newFileName );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::save( %this )
|
||||
{
|
||||
// Clear the first responder to capture any inspector changes
|
||||
%ctrl = canvas.getFirstResponder();
|
||||
if( isObject(%ctrl) )
|
||||
%ctrl.clearFirstResponder();
|
||||
|
||||
%tree = DatablockEditorTree;
|
||||
%count = %tree.getSelectedItemsCount();
|
||||
%selected = %tree.getSelectedItemList();
|
||||
|
||||
for( %i = 0; %i < %count; %i ++ )
|
||||
{
|
||||
%id = getWord( %selected, %i );
|
||||
%db = %tree.getItemValue( %id );
|
||||
|
||||
if( %this.PM.isDirty( %db ) )
|
||||
{
|
||||
%this.PM.saveDirtyObject( %db );
|
||||
%this.flagDatablockAsDirty( %db, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Selection.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::getNumSelectedDatablocks( %this )
|
||||
{
|
||||
return DatablockEditorTree.getSelectedItemsCount();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::getSelectedDatablock( %this, %index )
|
||||
{
|
||||
%tree = DatablockEditorTree;
|
||||
if( !%tree.getSelectedItemsCount() )
|
||||
return 0;
|
||||
|
||||
if( !%index )
|
||||
%id = %tree.getSelectedItem();
|
||||
else
|
||||
%id = getWord( %tree.getSelectedItemList(), %index );
|
||||
|
||||
return %tree.getItemValue( %id );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::resetSelectedDatablock( %this )
|
||||
{
|
||||
DatablockEditorTree.clearSelection();
|
||||
DatablockEditorInspector.inspect(0);
|
||||
DatablockEditorInspectorWindow-->DatablockFile.setText("");
|
||||
|
||||
EditorGuiStatusBar.setSelection( "" );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::selectDatablockCheck( %this, %datablock )
|
||||
{
|
||||
if( %this.selectedDatablockIsDirty() )
|
||||
%this.showSaveDialog( %datablock );
|
||||
else
|
||||
%this.selectDatablock( %datablock );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::selectDatablock( %this, %datablock, %add, %dontSyncTree )
|
||||
{
|
||||
if( %add )
|
||||
DatablockEditorInspector.addInspect( %datablock );
|
||||
else
|
||||
DatablockEditorInspector.inspect( %datablock );
|
||||
|
||||
if( !%dontSyncTree )
|
||||
{
|
||||
%id = DatablockEditorTree.findItemByValue( %datablock.getId() );
|
||||
|
||||
if( !%add )
|
||||
DatablockEditorTree.clearSelection();
|
||||
|
||||
DatablockEditorTree.selectItem( %id, true );
|
||||
DatablockEditorTree.scrollVisible( %id );
|
||||
}
|
||||
|
||||
%this.syncDirtyState();
|
||||
|
||||
// Update the filename text field.
|
||||
|
||||
%numSelected = %this.getNumSelectedDatablocks();
|
||||
%fileNameField = DatablockEditorInspectorWindow-->DatablockFile;
|
||||
|
||||
if( %numSelected == 1 )
|
||||
{
|
||||
%fileName = %datablock.getFilename();
|
||||
if( %fileName !$= "" )
|
||||
%fileNameField.setText( %fileName );
|
||||
else
|
||||
%fileNameField.setText( $DATABLOCK_EDITOR_DEFAULT_FILENAME );
|
||||
}
|
||||
else
|
||||
{
|
||||
%fileNameField.setText( "" );
|
||||
}
|
||||
|
||||
EditorGuiStatusBar.setSelection( %this.getNumSelectedDatablocks() @ " Datablocks Selected" );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::unselectDatablock( %this, %datablock, %dontSyncTree )
|
||||
{
|
||||
DatablockEditorInspector.removeInspect( %datablock );
|
||||
|
||||
if( !%dontSyncTree )
|
||||
{
|
||||
%id = DatablockEditorTree.findItemByValue( %datablock.getId() );
|
||||
DatablockEditorTree.selectItem( %id, false );
|
||||
}
|
||||
|
||||
%this.syncDirtyState();
|
||||
|
||||
// If we have exactly one selected datablock remaining, re-enable
|
||||
// the save-as button.
|
||||
|
||||
%numSelected = %this.getNumSelectedDatablocks();
|
||||
if( %numSelected == 1 )
|
||||
{
|
||||
DatablockEditorInspectorWindow-->saveAsButton.setActive( true );
|
||||
|
||||
%fileNameField = DatablockEditorInspectorWindow-->DatablockFile;
|
||||
%fileNameField.setText( %this.getSelectedDatablock().getFilename() );
|
||||
%fileNameField.setActive( true );
|
||||
}
|
||||
|
||||
EditorGuiStatusBar.setSelection( %this.getNumSelectedDatablocks() @ " Datablocks Selected" );
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Creation and Deletion.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::deleteDatablock( %this )
|
||||
{
|
||||
%tree = DatablockEditorTree;
|
||||
|
||||
// If we have more than single datablock selected,
|
||||
// turn our undos into a compound undo.
|
||||
|
||||
%numSelected = %tree.getSelectedItemsCount();
|
||||
if( %numSelected > 1 )
|
||||
Editor.getUndoManager().pushCompound( "Delete Multiple Datablocks" );
|
||||
|
||||
for( %i = 0; %i < %numSelected; %i ++ )
|
||||
{
|
||||
%id = %tree.getSelectedItem( %i );
|
||||
%db = %tree.getItemValue( %id );
|
||||
|
||||
%fileName = %db.getFileName();
|
||||
|
||||
// Remove the datablock from the tree.
|
||||
|
||||
DatablockEditorTree.removeItem( %id );
|
||||
|
||||
// Create undo.
|
||||
|
||||
%action = %this.createUndo( ActionDeleteDatablock, "Delete Datablock" );
|
||||
%action.db = %db;
|
||||
%action.dbName = %db.getName();
|
||||
%action.fname = %fileName;
|
||||
|
||||
%this.submitUndo( %action );
|
||||
|
||||
// Kill the datablock in the file.
|
||||
|
||||
if( %fileName !$= "" )
|
||||
%this.PM.removeObjectFromFile( %db );
|
||||
|
||||
UnlistedDatablocks.add( %db );
|
||||
|
||||
// Show some confirmation.
|
||||
|
||||
if( %numSelected == 1 )
|
||||
MessageBoxOk( "Datablock Deleted", "The datablock (" @ %db.getName() @ ") has been removed from " @
|
||||
"it's file (" @ %db.getFilename() @ ") and upon restart will cease to exist" );
|
||||
}
|
||||
|
||||
// Close compound, if we were deleting multiple datablocks.
|
||||
|
||||
if( %numSelected > 1 )
|
||||
Editor.getUndoManager().popCompound();
|
||||
|
||||
// Show confirmation for multiple datablocks.
|
||||
|
||||
if( %numSelected > 1 )
|
||||
MessageBoxOk( "Datablocks Deleted", "The datablocks have been deleted and upon restart will cease to exist." );
|
||||
|
||||
// Clear selection.
|
||||
|
||||
DatablockEditorPlugin.resetSelectedDatablock();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::createDatablock(%this)
|
||||
{
|
||||
%class = DatablockEditorTypeTree.getItemText(DatablockEditorTypeTree.getSelectedItem());
|
||||
if( %class !$= "" )
|
||||
{
|
||||
// Need to prompt for a name.
|
||||
|
||||
DatablockEditorCreatePrompt-->CreateDatablockName.setText("Name");
|
||||
DatablockEditorCreatePrompt-->CreateDatablockName.selectAllText();
|
||||
|
||||
// Populate the copy source dropdown.
|
||||
|
||||
%list = DatablockEditorCreatePrompt-->CopySourceDropdown;
|
||||
%list.clear();
|
||||
%list.add( "", 0 );
|
||||
|
||||
%set = DataBlockSet;
|
||||
%count = %set.getCount();
|
||||
for( %i = 0; %i < %count; %i ++ )
|
||||
{
|
||||
%datablock = %set.getObject( %i );
|
||||
%datablockClass = %datablock.getClassName();
|
||||
|
||||
if( !isMemberOfClass( %datablockClass, %class ) )
|
||||
continue;
|
||||
|
||||
%list.add( %datablock.getName(), %i + 1 );
|
||||
}
|
||||
|
||||
// Set up state of client-side checkbox.
|
||||
|
||||
%clientSideCheckBox = DatablockEditorCreatePrompt-->ClientSideCheckBox;
|
||||
%canBeClientSide = DatablockEditorPlugin::canBeClientSideDatablock( %class );
|
||||
%clientSideCheckBox.setStateOn( %canBeClientSide );
|
||||
%clientSideCheckBox.setActive( %canBeClientSide );
|
||||
|
||||
// Show the dialog.
|
||||
|
||||
canvas.pushDialog( DatablockEditorCreatePrompt, 0, true );
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::createPromptNameCheck(%this)
|
||||
{
|
||||
%name = DatablockEditorCreatePrompt-->CreateDatablockName.getText();
|
||||
if( !Editor::validateObjectName( %name, true ) )
|
||||
return;
|
||||
|
||||
// Fetch the copy source and clear the list.
|
||||
|
||||
%copySource = DatablockEditorCreatePrompt-->copySourceDropdown.getText();
|
||||
DatablockEditorCreatePrompt-->copySourceDropdown.clear();
|
||||
|
||||
// Remove the dialog and create the datablock.
|
||||
|
||||
canvas.popDialog( DatablockEditorCreatePrompt );
|
||||
%this.createDatablockFinish( %name, %copySource );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::createDatablockFinish( %this, %name, %copySource )
|
||||
{
|
||||
%class = DatablockEditorTypeTree.getItemText(DatablockEditorTypeTree.getSelectedItem());
|
||||
if( %class !$= "" )
|
||||
{
|
||||
%action = %this.createUndo( ActionCreateDatablock, "Create New Datablock" );
|
||||
|
||||
if( DatablockEditorCreatePrompt-->ClientSideCheckBox.isStateOn() )
|
||||
%dbType = "singleton ";
|
||||
else
|
||||
%dbType = "datablock ";
|
||||
|
||||
if( %copySource !$= "" )
|
||||
%eval = %dbType @ %class @ "(" @ %name @ " : " @ %copySource @ ") { canSaveDynamicFields = \"1\"; };";
|
||||
else
|
||||
%eval = %dbType @ %class @ "(" @ %name @ ") { canSaveDynamicFields = \"1\"; };";
|
||||
|
||||
%res = eval( %eval );
|
||||
|
||||
%action.db = %name.getId();
|
||||
%action.dbName = %name;
|
||||
%action.fname = $DATABLOCK_EDITOR_DEFAULT_FILENAME;
|
||||
|
||||
%this.submitUndo( %action );
|
||||
|
||||
%action.redo();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::canBeClientSideDatablock( %className )
|
||||
{
|
||||
switch$( %className )
|
||||
{
|
||||
case "SFXProfile" or
|
||||
"SFXPlayList" or
|
||||
"SFXAmbience" or
|
||||
"SFXEnvironment" or
|
||||
"SFXState" or
|
||||
"SFXDescription" or
|
||||
"SFXFMODProject":
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Events.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorInspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue )
|
||||
{
|
||||
// Same work to do as for the regular WorldEditor Inspector.
|
||||
Inspector::onInspectorFieldModified( %this, %object, %fieldName, %arrayIndex, %oldValue, %newValue );
|
||||
|
||||
DatablockEditorPlugin.flagDatablockAsDirty( %object, true );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorInspector::onFieldSelected( %this, %fieldName, %fieldTypeStr, %fieldDoc )
|
||||
{
|
||||
DatablockFieldInfoControl.setText( "<font:ArialBold:14>" @ %fieldName @ "<font:ArialItalic:14> (" @ %fieldTypeStr @ ") " NL "<font:Arial:14>" @ %fieldDoc );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorInspector::onBeginCompoundEdit( %this )
|
||||
{
|
||||
Editor.getUndoManager().pushCompound( "Multiple Field Edit" );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorInspector::onEndCompoundEdit( %this, %discard )
|
||||
{
|
||||
Editor.getUndoManager().popCompound( %discard );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorInspector::onClear( %this )
|
||||
{
|
||||
DatablockFieldInfoControl.setText( "" );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onDeleteSelection( %this )
|
||||
{
|
||||
%this.undoDeleteList = "";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onDeleteObject( %this, %object )
|
||||
{
|
||||
// Append it to our list.
|
||||
%this.undoDeleteList = %this.undoDeleteList TAB %object;
|
||||
|
||||
// We're gonna delete this ourselves in the
|
||||
// completion callback.
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onObjectDeleteCompleted( %this )
|
||||
{
|
||||
//MEDeleteUndoAction::submit( %this.undoDeleteList );
|
||||
|
||||
// Let the world editor know to
|
||||
// clear its selection.
|
||||
//EWorldEditor.clearSelection();
|
||||
//EWorldEditor.isDirty = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onClearSelected(%this)
|
||||
{
|
||||
DatablockEditorInspector.inspect( 0 );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onAddSelection( %this, %id )
|
||||
{
|
||||
%obj = %this.getItemValue( %id );
|
||||
|
||||
if( !isObject( %obj ) )
|
||||
%this.selectItem( %id, false );
|
||||
else
|
||||
DatablockEditorPlugin.selectDatablock( %obj, true, true );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onRemoveSelection( %this, %id )
|
||||
{
|
||||
%obj = %this.getItemValue( %id );
|
||||
if( isObject( %obj ) )
|
||||
DatablockEditorPlugin.unselectDatablock( %obj, true );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTree::onRightMouseUp( %this, %id, %mousePos )
|
||||
{
|
||||
%datablock = %this.getItemValue( %id );
|
||||
if( !isObject( %datablock ) )
|
||||
return;
|
||||
|
||||
if( !isObject( DatablockEditorTreePopup ) )
|
||||
new PopupMenu( DatablockEditorTreePopup )
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
isPopup = true;
|
||||
|
||||
item[ 0 ] = "Delete" TAB "" TAB "DatablockEditorPlugin.selectDatablock( %this.datablockObject ); DatablockEditorPlugin.deleteDatablock( %this.datablockObject );";
|
||||
item[ 1 ] = "Jump to Definition in Torsion" TAB "" TAB "EditorOpenDeclarationInTorsion( %this.datablockObject );";
|
||||
|
||||
datablockObject = "";
|
||||
};
|
||||
|
||||
DatablockEditorTreePopup.datablockObject = %datablock;
|
||||
DatablockEditorTreePopup.showPopup( Canvas );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorTreeTabBook::onTabSelected(%this, %text, %id)
|
||||
{
|
||||
switch(%id)
|
||||
{
|
||||
case 0:
|
||||
DatablockEditorTreeWindow-->DeleteSelection.visible = true;
|
||||
DatablockEditorTreeWindow-->CreateSelection.visible = false;
|
||||
|
||||
case 1:
|
||||
DatablockEditorTreeWindow-->DeleteSelection.visible = false;
|
||||
DatablockEditorTreeWindow-->CreateSelection.visible = true;
|
||||
}
|
||||
}
|
||||
159
Templates/Full/game/tools/datablockEditor/datablockEditorUndo.cs
Normal file
159
Templates/Full/game/tools/datablockEditor/datablockEditorUndo.cs
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 DatablockEditorPlugin::createUndo( %this, %class, %desc )
|
||||
{
|
||||
pushInstantGroup();
|
||||
%action = new UndoScriptAction()
|
||||
{
|
||||
class = %class;
|
||||
superClass = BaseDatablockEdAction;
|
||||
actionName = %desc;
|
||||
editor = DatablockEditorPlugin;
|
||||
treeview = DatablockEditorTree;
|
||||
inspector = DatablockEditorInspector;
|
||||
};
|
||||
popInstantGroup();
|
||||
return %action;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function DatablockEditorPlugin::submitUndo( %this, %action )
|
||||
{
|
||||
%action.addToManager( Editor.getUndoManager() );
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// BaseDatablockEdAction.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function BaseDatablockEdAction::redo( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function BaseDatablockEdAction::undo( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// ActionCreateDatablock.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function ActionCreateDatablock::redo( %this )
|
||||
{
|
||||
%db = %this.db;
|
||||
|
||||
%db.name = %this.dbName;
|
||||
|
||||
%this.editor.PM.setDirty( %db, %this.fname );
|
||||
%this.editor.addExistingItem( %db );
|
||||
%this.editor.selectDatablock( %db );
|
||||
%this.editor.flagInspectorAsDirty( true );
|
||||
|
||||
UnlistedDatablocks.remove( %id );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function ActionCreateDatablock::undo( %this )
|
||||
{
|
||||
%db = %this.db;
|
||||
|
||||
%itemId = %this.treeview.findItemByName( %db.name );
|
||||
if( !%itemId )
|
||||
%itemId = %this.treeview.findItemByName( %db.name @ " *" );
|
||||
|
||||
%this.treeview.removeItem( %itemId );
|
||||
%this.editor.resetSelectedDatablock();
|
||||
%this.editor.PM.removeDirty( %db );
|
||||
|
||||
%this.dbName = %db.name;
|
||||
%db.name = "";
|
||||
|
||||
UnlistedDatablocks.add( %this.db );
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// ActionDeleteDatablock.
|
||||
//=============================================================================================
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function ActionDeleteDatablock::redo( %this )
|
||||
{
|
||||
%db = %this.db;
|
||||
|
||||
%itemId = %this.treeview.findItemByName( %db.name );
|
||||
if( !%itemId )
|
||||
%itemId = %this.treeview.findItemByName( %db.name @ " *" );
|
||||
|
||||
// Remove from tree and file.
|
||||
|
||||
%this.treeview.removeItem( %db );
|
||||
%this.editor.resetSelectedDatablock();
|
||||
if( %db.getFileName() !$= "" )
|
||||
%this.editor.PM.removeObjectFromFile( %db );
|
||||
|
||||
// Unassign name.
|
||||
|
||||
%this.dbName = %db.name;
|
||||
%db.name = "";
|
||||
|
||||
// Add to unlisted.
|
||||
|
||||
UnlistedDatablocks.add( %db );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function ActionDeleteDatablock::undo( %this )
|
||||
{
|
||||
%db = %this.db;
|
||||
|
||||
// Restore name.
|
||||
|
||||
%db.name = %this.dbName;
|
||||
|
||||
// Add to tree and select.
|
||||
|
||||
%this.editor.addExistingItem( %db, true );
|
||||
%this.editor.selectDatablock( %db );
|
||||
|
||||
// Mark as dirty.
|
||||
|
||||
%this.editor.PM.setDirty( %db, %this.fname );
|
||||
%this.editor.syncDirtyState();
|
||||
|
||||
// Remove from unlisted.
|
||||
|
||||
UnlistedDatablocks.remove( %id );
|
||||
}
|
||||
66
Templates/Full/game/tools/datablockEditor/main.cs
Normal file
66
Templates/Full/game/tools/datablockEditor/main.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 initializeDatablockEditor()
|
||||
{
|
||||
echo( " - Initializing Datablock Editor" );
|
||||
|
||||
exec("./datablockEditor.cs");
|
||||
exec("./datablockEditorUndo.cs");
|
||||
exec("./DatablockEditorTreeWindow.ed.gui");
|
||||
exec("./DatablockEditorInspectorWindow.ed.gui");
|
||||
exec("./DatablockEditorCreatePrompt.ed.gui");
|
||||
|
||||
// Add ourselves to EditorGui, where all the other tools reside
|
||||
DatablockEditorInspectorWindow.setVisible( false );
|
||||
DatablockEditorTreeWindow.setVisible( false );
|
||||
|
||||
EditorGui.add( DatablockEditorInspectorWindow );
|
||||
EditorGui.add( DatablockEditorTreeWindow );
|
||||
|
||||
new ScriptObject( DatablockEditorPlugin )
|
||||
{
|
||||
superClass = "WorldEditorPlugin";
|
||||
editorGui = EWorldEditor;
|
||||
};
|
||||
|
||||
new SimSet( UnlistedDatablocks );
|
||||
|
||||
// create our persistence manager
|
||||
DatablockEditorPlugin.PM = new PersistenceManager();
|
||||
|
||||
%map = new ActionMap();
|
||||
%map.bindCmd( keyboard, "backspace", "DatablockEditorPlugin.onDeleteKey();", "" );
|
||||
%map.bindCmd( keyboard, "delete", "DatablockEditorPlugin.onDeleteKey();", "" );
|
||||
DatablockEditorPlugin.map = %map;
|
||||
|
||||
DatablockEditorPlugin.initSettings();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
function destroyDatablockEditor()
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue