Catch the template files up and add the improved convex editor bits.

This commit is contained in:
Areloch 2019-05-19 21:30:45 -05:00
parent 3697737498
commit ebb51bb178
18 changed files with 1617 additions and 333 deletions

View file

@ -22,6 +22,19 @@
function ConvexEditorGui::onWake( %this )
{
convexEditorToolbar-->gridSnapSizeEdit.setText(%this.getGridSnapSize());
if(ConvexEditorOptionssWindow-->matPreviewBtn.bitmap $= "")
{
//no active material, so set one
ConvexEditorOptionssWindow-->matPreviewBtn.setText("");
%mat = EditorSettings.Value("ConvexEditor/MaterialName");
ConvexEditorOptionssWindow-->matPreviewBtn.setBitmap(%mat.diffuseMap[0]);
ConvexEditorOptionssWindow.activeMaterial = %mat;
}
}
function ConvexEditorGui::onSleep( %this )
@ -45,18 +58,159 @@ function ConvexEditorGui::onSelectionChanged( %this, %shape, %face )
ConvexEditorDeleteFaceBtn.setActive( false );
ConvexEditorDeleteFaceBtn.ToolTip = "Delete selection [Disabled] (Delete)";
if ( !isObject( %shape ) )
if ( !isObject( %shape ) )
{
ConvexEditorOptionssWindow-->defMatPreviewBtn.setText("No Brush Selected");
ConvexEditorOptionssWindow.activeShape = "";
return;
}
ConvexEditorDeleteFaceBtn.setActive( true );
ConvexEditorOptionssWindow-->defMatPreviewBtn.setText("");
ConvexEditorOptionssWindow-->defMatPreviewBtn.setBitmap(%shape.material.diffuseMap[0]);
ConvexEditorOptionssWindow.activeShape = %shape;
if ( %face == -1 )
{
ConvexEditorDeleteFaceBtn.ToolTip = "Delete selected ConvexShape (Delete)";
ConvexEditorOptionssWindow-->UOffset.setText("");
ConvexEditorOptionssWindow-->VOffset.setText("");
ConvexEditorOptionssWindow-->UScale.setText("");
ConvexEditorOptionssWindow-->VScale.setText("");
ConvexEditorOptionssWindow-->ZRotation.setText("");
}
else
{
ConvexEditorDeleteFaceBtn.ToolTip = "Delete selected Face (Delete)";
ConvexEditorSplitFaceBtn.ToolTip = "Split selected face" NL "Use Ctrl + Rotate instead for more control";
ConvexEditorSplitFaceBtn.setActive( true );
%UVOffset = %this.getSelectedFaceUVOffset();
ConvexEditorOptionssWindow-->UOffset.setText(%UVOffset.x);
ConvexEditorOptionssWindow-->VOffset.setText(%UVOffset.y);
%UVScale = %this.getSelectedFaceUVScale();
ConvexEditorOptionssWindow-->UScale.setText(%UVScale.x);
ConvexEditorOptionssWindow-->VScale.setText(%UVScale.y);
ConvexEditorOptionssWindow-->ZRotation.setText(ConvexEditorGui.getSelectedFaceZRot());
}
}
function ConvexEditorUVFld::onReturn(%this)
{
EWorldEditor.isDirty = true;
%offset = "0 0";
%offset.x = ConvexEditorOptionssWindow-->UOffset.getText();
%offset.y = ConvexEditorOptionssWindow-->VOffset.getText();
%scale = "0 0";
%scale.x = ConvexEditorOptionssWindow-->UScale.getText();
%scale.y = ConvexEditorOptionssWindow-->VScale.getText();
%rot = ConvexEditorOptionssWindow-->ZRotation.getText();
ConvexEditorGui.setSelectedFaceUVOffset(%offset);
ConvexEditorGui.setSelectedFaceUVScale(%scale);
ConvexEditorGui.setSelectedFaceZRot(%rot);
}
function ConvexEditorUVHorzFlipBtn::onClick(%this)
{
EWorldEditor.isDirty = true;
%current = ConvexEditorGui.getSelectedFaceHorzFlip();
ConvexEditorGui.setSelectedFaceHorzFlip(!%current);
}
function ConvexEditorUVVertFlipBtn::onClick(%this)
{
EWorldEditor.isDirty = true;
%current = ConvexEditorGui.getSelectedFaceVertFlip();
ConvexEditorGui.setSelectedFaceVertFlip(!%current);
}
function ConvexEditorMaterialBtn::onClick(%this)
{
%this.getMaterialName();
}
function ConvexEditorMaterialBtn::getMaterialName(%this)
{
materialSelector.showDialog(%this @ ".gotMaterialName", "name");
}
function ConvexEditorMaterialBtn::gotMaterialName(%this, %name)
{
//eval(%this.object @ "." @ %this.targetField @ " = " @ %name @ ";");
//%this.object.changeMaterial(getTrailingNumber(%this.targetField), %name);
//%this.object.inspectorApply();
%diffusemap = %name.diffuseMap[0];
ConvexEditorOptionssWindow-->matPreviewBtn.setBitmap(%diffusemap);
ConvexEditorOptionssWindow.activeMaterial = %name;
}
function ConvexEditorMaterialApplyBtn::onClick(%this)
{
EWorldEditor.isDirty = true;
ConvexEditorGui.setSelectedFaceMaterial(ConvexEditorOptionssWindow.activeMaterial);
ConvexEditorGui.updateShape();
}
function ConvexEditorMaterialLiftBtn::onClick(%this)
{
%mat = ConvexEditorGui.getSelectedFaceMaterial();
ConvexEditorOptionssWindow.activeMaterial = %mat;
ConvexEditorOptionssWindow-->matPreviewBtn.setBitmap(%mat.diffuseMap[0]);
}
function ConvexEditorMaterialResetBtn::onClick(%this)
{
EWorldEditor.isDirty = true;
ConvexEditorGui.setSelectedFaceMaterial(ConvexEditorOptionssWindow.activeShape.material);
ConvexEditorGui.updateShape();
}
function ConvexEditorGui::toggleGridSnap(%this)
{
%this.toggleGridSnapping();
}
function ConvexEditorGridSnapSizeFld::onReturn(%this)
{
ConvexEditorGui.setGridSnapSize(%this.getText());
}
function ConvexEditorDefaultMaterialBtn::onClick(%this)
{
%this.getMaterialName();
}
function ConvexEditorDefaultMaterialBtn::getMaterialName(%this)
{
materialSelector.showDialog(%this @ ".gotMaterialName", "name");
}
function ConvexEditorDefaultMaterialBtn::gotMaterialName(%this, %name)
{
//eval(%this.object @ "." @ %this.targetField @ " = " @ %name @ ";");
//%this.object.changeMaterial(getTrailingNumber(%this.targetField), %name);
//%this.object.inspectorApply();
%diffusemap = %name.diffuseMap[0];
ConvexEditorOptionssWindow-->defMatPreviewBtn.setBitmap(%diffusemap);
ConvexEditorOptionssWindow.activeShape.material = %name;
ConvexEditorGui.updateShape();
}

View file

@ -21,6 +21,95 @@
EdgeSnap = "0";
text ="";
new GuiTextCtrl() {
profile = "ToolsGuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "15 7";
extent = "86 16";
minExtent = "8 8";
visible = "1";
text = "Sketch Tool";
maxLength = "255";
helpTag = "0";
};
new GuiBitmapCtrl() {
Profile = "ToolsGuiDefaultProfile";
position = "94 3";
Extent = "2 26";
MinExtent = "1 1";
bitmap = "tools/gui/images/separator-h.png";
};
new GuiBitmapButtonCtrl(ConvexEditorCreateBoxBtn) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "100 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.createConvexBox();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Create ConvexShape Box" NL "Use Alt + Click-Drag instead of this for more control of starting placement.";
hovertime = "1000";
bitmap = "tools/convexEditor/images/convex-editor-btn";
text = "";
groupNum = "-1";
buttonType = "pushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(ConvexEditorSplitFaceBtn) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "134 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.splitSelectedFace();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Split selected face" NL "Use Ctrl + Rotate instead for more control.";
hovertime = "1000";
bitmap = "tools/convexEditor/images/split-face-btn";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(ConvexEditorDeleteFaceBtn) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "166 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.handleDelete();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Delete selected face" NL "(Delete)";
hovertime = "1000";
bitmap = "tools/gui/images/menubar/delete-btn";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapCtrl() {
Profile = "ToolsGuiDefaultProfile";
position = "190 3";
Extent = "2 26";
MinExtent = "1 1";
bitmap = "tools/gui/images/separator-h.png";
};
new GuiContainer() {
canSaveDynamicFields = "0";
Enabled = "1";
@ -28,94 +117,87 @@
Profile = "menubarProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "0 0";
Extent = "800 32";
Position = "195 0";
Extent = "190 32";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
internalName = "objectGridSnapBtn";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "5 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.toggleGridSnap();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Toggles grid snapping (G)";
hovertime = "1000";
groupNum = "-1";
buttonType = "toggleButton";
useMouseEvents = "0";
groupNum = "-1";
bitmap = "tools/gui/images/menubar/snap-grid";
textMargin = "4";
};
new GuiTextCtrl() {
profile = "ToolsGuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "15 7";
extent = "86 16";
minExtent = "8 8";
visible = "1";
text = "Sketch Tool";
maxLength = "255";
helpTag = "0";
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "39 10";
Extent = "108 10";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "Grid snap size(m)";
maxLength = "1024";
};
new GuiBitmapCtrl() {
Profile = "ToolsGuiDefaultProfile";
position = "94 3";
Extent = "2 26";
MinExtent = "1 1";
bitmap = "tools/gui/images/separator-h.png";
new GuiTextEditCtrl() {
canSaveDynamicFields = "0";
internalName = "gridSnapSizeEdit";
isContainer = "0";
profile="ToolsGuiNumericDropSliderTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "130 6";
Extent = "42 16";
MinExtent = "8 16";
canSave = "1";
Visible = "1";
class = "ConvexEditorGridSnapSizeFld";
hovertime = "1000";
text = "1";
maxLength = "4";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
};
new GuiBitmapButtonCtrl(ConvexEditorCreateBoxBtn) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "100 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.createConvexBox();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Create ConvexShape Box" NL "Use Alt + Click-Drag instead of this for more control of starting placement.";
hovertime = "1000";
bitmap = "tools/convexEditor/images/convex-editor-btn";
text = "";
groupNum = "-1";
buttonType = "pushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(ConvexEditorSplitFaceBtn) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "134 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.splitSelectedFace();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Split selected face" NL "Use Ctrl + Rotate instead for more control.";
hovertime = "1000";
bitmap = "tools/convexEditor/images/split-face-btn";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(ConvexEditorDeleteFaceBtn) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "166 3";
Extent = "29 27";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "ConvexEditorGui.handleDelete();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Delete selected face" NL "(Delete)";
hovertime = "1000";
bitmap = "tools/gui/images/menubar/delete-btn";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
};
new GuiBitmapCtrl() {
Profile = "ToolsGuiDefaultProfile";
position = "380 3";
Extent = "2 26";
MinExtent = "1 1";
bitmap = "tools/gui/images/separator-h.png";
};
};
//--- OBJECT WRITE END ---

View file

@ -28,16 +28,20 @@ function initializeConvexEditor()
exec( "./convexEditorGui.gui" );
exec( "./convexEditorToolbar.ed.gui" );
exec( "./convexEditorGui.cs" );
exec( "./convexEditorSidebarGui.gui" );
exec( "./materials.cs" );
ConvexEditorGui.setVisible( false );
ConvexEditorOptionsWindow.setVisible( false );
ConvexEditorTreeWindow.setVisible( false );
ConvexEditorToolbar.setVisible( false );
ConvexEditorOptionssWindow.setVisible( false );
EditorGui.add( ConvexEditorGui );
EditorGui.add( ConvexEditorOptionsWindow );
EditorGui.add( ConvexEditorTreeWindow );
EditorGui.add( ConvexEditorToolbar );
EditorGui.add( ConvexEditorOptionssWindow );
new ScriptObject( ConvexEditorPlugin )
{
@ -98,6 +102,7 @@ function ConvexEditorPlugin::onActivated( %this )
EditorGui.bringToFront( ConvexEditorGui );
ConvexEditorGui.setVisible( true );
ConvexEditorToolbar.setVisible( true );
ConvexEditorOptionssWindow.setVisible( true );
ConvexEditorGui.makeFirstResponder( true );
%this.map.push();
@ -132,6 +137,7 @@ function ConvexEditorPlugin::onDeactivated( %this )
ConvexEditorGui.setVisible( false );
ConvexEditorOptionsWindow.setVisible( false );
ConvexEditorTreeWindow.setVisible( false );
ConvexEditorOptionssWindow.setVisible( false );
ConvexEditorToolbar.setVisible( false );
%this.map.pop();