Torque3D/Templates/BaseGame/game/tools/gui/uvEditor.ed.gui
Areloch c76c5f7ee1 Removed unneeded duplicate of blank sky skybox
Fixed various inspector field editor button icons
Fixed drag-n-drop apply logic for material assets
Fixed up some convex shape editor material references
Fixed tools overlay gui profile opaqueness flag
Fixed uvEditor image asset binding/lookups
Fixed decal editor preview display
Fixed shape editor would you like to save your changes prompt
Added additional sanity check for bad material reference in tsMesh
Fixed saving of terrain asset when working in editor default level
2021-08-06 01:06:36 -05:00

628 lines
18 KiB
Plaintext

new GuiControl(UVEditorOverlay, EditorGuiGroup) {
canSaveDynamicFields = "0";
Profile = "ToolsGuiOverlayProfile";
Enabled = "1";
isContainer = "1";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiWindowCtrl(UVEditor){
profile = "ToolsGuiWindowProfile";
HorizSizing = "center";
VertSizing = "center";
resizeWidth = "0";
resizeHeight = "0";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
position = "72 98";
extent =" 453 340";
MinExtent = "453 340";
text = "UV Editor";
closeCommand = "UVEditor.hideDialog();";
EdgeSnap = "0";
canCollapse = "0";
visible = "0";
new GuiTextCtrl() {
text = "0.0";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "26 24";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "U";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextCenterProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "138 24";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "1.0";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "250 24";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "0.0";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "4 36";
Extent = "18 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "V";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "4 159";
Extent = "18 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "1.0";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "4 282";
Extent = "18 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiControl(){
HorizSizing = "right";
VertSizing = "bottom";
profile = "ToolsGuiSolidDefaultProfile";
position = "25 37";
extent = "258 258";
};
new GuiBitmapCtrl(){
internalName = "bitmapPreview";
HorizSizing = "right";
VertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
position = "26 38";
extent = "256 256";
wrap = "0";
bitmapAsset = "";
};
new GuiRectHandles(){
internalName = "uvHandles";
class = "UVEditorRectHandles";
Profile = "ToolsGuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "26 38";
extent = "256 256";
};
new GuiBitmapBorderCtrl() {
profile = "ToolsGuiGroupBorderProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "26 300";
extent = "256 30";
minExtent = "0 0";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
new GuiTextCtrl() {
text = "Handle Color:";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 7";
Extent = "70 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiPopupMenuCtrlEx(){
internalName = "colorPopup";
Profile = "ToolsGuiPopUpMenuProfile";
Position = "80 5";
Extent = "126 20";
HorizSizing = "right";
VertSizing = "bottom";
Command = "UVEditor.onColorSelect();";
reverseTextList = "0";
};
};
new GuiBitmapBorderCtrl() {
profile = "ToolsGuiGroupBorderProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "292 38";
extent = "151 256";
minExtent = "0 0";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
new GuiTextCtrl() {
text = "U:";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 12";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
internalName = "UVX";
class = "UVEditorUVTextEdit";
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 = "ToolsGuiNumericTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "44 10";
Extent = "64 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "1";
};
new GuiTextCtrl() {
text = "V:";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 32";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
internalName = "UVY";
class = "UVEditorUVTextEdit";
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 = "ToolsGuiNumericTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "44 30";
Extent = "64 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "1";
};
new GuiTextCtrl() {
text = "Width:";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 52";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
internalName = "UVW";
class = "UVEditorUVTextEdit";
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 = "ToolsGuiNumericTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "44 50";
Extent = "64 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "1";
};
new GuiTextCtrl() {
text = "Height:";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 72";
Extent = "32 14";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
internalName = "UVH";
class = "UVEditorUVTextEdit";
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 = "ToolsGuiNumericTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "44 70";
Extent = "64 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "1";
};
new GuiButtonCtrl(){
HorizSizing = "right";
VertSizing = "top";
profile = "ToolsGuiButtonProfile";
position = "44 94";
extent = "64 20";
text = "Reset";
command = "UVEditor.reset();";
tooltip = "Reset the UV fields to their original values.";
};
};
new GuiButtonCtrl(){
internalName = "OKButton";
HorizSizing = "left";
VertSizing = "top";
profile = "ToolsGuiButtonProfile";
position = "292 306";
extent = "94 24";
text = "OK";
command = "UVEditor.apply();";
Accelerator = "return";
};
new GuiButtonCtrl(){
HorizSizing = "left";
VertSizing = "top";
profile = "ToolsGuiButtonProfile";
position = "391 306";
extent = "52 24";
text = "Cancel";
command = "UVEditor.hideDialog();";
Accelerator = "escape";
};
};
};
//-----------------------------------------------------------------------------
function UVEditor::showDialog( %this, %applyCallback, %obj, %uv)
{
// Set the select callback
UVEditor.applyCallback = %applyCallback;
// Set the initial UV coordinates
UVEditor.originalUV = %uv;
UVEditor-->uvHandles.handleRect = %uv;
UVEditor.setTextValues(%uv);
// Get the preview bitmap. Code copied from Material Selector.
%material = %obj.material;
if( %material.getToneMap(0) $= "" && %material.getDiffuseMap(0) $= "" && !isObject(%material.cubemap) )
{
%previewImage = "core/images/warnmat";
}
else
{
if( %material.toneMap[0] !$= "" )
%previewImage = %material.getToneMap(0);
else if( %material.getDiffuseMap(0) !$= "" )
%previewImage = %material.getDiffuseMap(0);
else if( %material.cubemap.cubeFace[0] !$= "" )
%previewImage = %material.cubemap.cubeFace[0];
}
UVEditor-->bitmapPreview.setBitmap(%previewImage);
// Set up the color popup
%popup = UVEditor-->colorPopup;
%popup.clear();
%popup.add("Default1|255|134|0");
%popup.add("Default2|0|121|255");
%popup.add("Black|0|0|0");
%popup.add("Gray|100|100|100");
%popup.add("White|255|255|255");
%popup.add("Red|255|0|0");
%popup.add("Green|0|255|0");
%popup.add("Blue|0|0|255");
%popup.add("Yellow|255|255|0");
%popup.add("Magenta|255|0|255");
%popup.add("Cyan|0|255|255");
%popup.setSelected(EditorSettings.value("WorldEditor/Color/uvEditorHandleColor"));
UVEditor-->uvHandles.useCustomColor = true;
UVEditor-->uvHandles.handleColor = %popup.getColorById(%popup.getSelected());
Canvas.pushDialog(UVEditorOverlay);
UVEditor.setVisible(1);
}
function UVEditor::hideDialog( %this )
{
UVEditor.setVisible(0);
Canvas.popDialog(UVEditorOverlay);
}
function UVEditor::apply( %this )
{
eval( "" @ UVEditor.applyCallback @ "(\"" @ UVEditor-->uvHandles.handleRect @ "\");");
UVEditor.hideDialog();
}
function UVEditor::reset( %this )
{
UVEditor-->uvHandles.handleRect = UVEditor.originalUV;
UVEditor.setTextValues(UVEditor.originalUV);
}
function UVEditor::setTextValues( %this, %uv )
{
UVEditor-->UVX.setText( getWord(%uv, 0) );
UVEditor-->UVY.setText( getWord(%uv, 1) );
UVEditor-->UVW.setText( getWord(%uv, 2) );
UVEditor-->UVH.setText( getWord(%uv, 3) );
}
function UVEditor::onColorSelect( %this )
{
UVEditor-->uvHandles.useCustomColor = true;
%sel = $ThisControl.getSelected();
UVEditor-->uvHandles.handleColor = $ThisControl.getColorById(%sel);
EditorSettings.setValue( "WorldEditor/Color/uvEditorHandleColor", %sel );
}
//-----------------------------------------------------------------------------
function UVEditorRectHandles::onHandleRectChange( %this )
{
%uv = UVEditor-->uvHandles.handleRect;
UVEditor.setTextValues(%uv);
}
//-----------------------------------------------------------------------------
function UVEditorUVTextEdit::onValidate( %this )
{
%u = UVEditor-->UVX.getValue();
%v = UVEditor-->UVY.getValue();
%w = UVEditor-->UVW.getValue();
%h = UVEditor-->UVH.getValue();
// Check limits
if(%u < 0)
%u = 0;
if(%u > 1)
%u = 1;
if(%v < 0)
%v = 0;
if(%v > 1)
%v = 1;
if(%w < 0)
%w = 0;
if(%w > 1)
%w = 1;
if(%h < 0)
%h = 0;
if(%h > 1)
%h = 1;
if((%u+%w) > 1)
%w = 1 - %u;
if((%v+%h) > 1)
%h = 1 - %v;
// Apply values
UVEditor-->UVX.setText( %u );
UVEditor-->UVY.setText( %v );
UVEditor-->UVW.setText( %w );
UVEditor-->UVH.setText( %h );
UVEditor-->uvHandles.handleRect = %u SPC %v SPC %w SPC %h;
}
function UVEditorUVTextEdit::onGainFirstResponder( %this )
{
%this.selectAllText();
}