From 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Tue, 25 Jun 2019 23:58:09 -0400
Subject: [PATCH] Edit panel pin state.
---
ObjEditor.java | 35 +++++++++++++++--
CameraPane.java | 20 ++++++++-
GroupEditor.java | 56 ++++++++++++++++++++++++----
icons/overlay.png | 0
Object3D.java | 2 +
icons/switch.png | 0
6 files changed, 98 insertions(+), 15 deletions(-)
diff --git a/CameraPane.java b/CameraPane.java
index 1175edb..b2db6b7 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -335,14 +335,28 @@
display.options1[2] = material.shadowbias;
display.options1[3] = material.aniso;
display.options1[4] = material.anisoV;
+// System.out.println("display.options1[0] " + display.options1[0]);
+// System.out.println("display.options1[1] " + display.options1[1]);
+// System.out.println("display.options1[2] " + display.options1[2]);
+// System.out.println("display.options1[3] " + display.options1[3]);
+// System.out.println("display.options1[4] " + display.options1[4]);
display.options2[0] = material.opacity;
display.options2[1] = material.diffuse;
display.options2[2] = material.factor;
+// System.out.println("display.options2[0] " + display.options2[0]);
+// System.out.println("display.options2[1] " + display.options2[1]);
+// System.out.println("display.options2[2] " + display.options2[2]);
cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
+// System.out.println("display.options3[0] " + display.options3[0]);
+// System.out.println("display.options3[1] " + display.options3[1]);
+// System.out.println("display.options3[2] " + display.options3[2]);
display.options4[0] = material.cameralight/0.2f;
display.options4[1] = material.subsurface;
display.options4[2] = material.sheen;
+// System.out.println("display.options4[0] " + display.options4[0]);
+// System.out.println("display.options4[1] " + display.options4[1]);
+// System.out.println("display.options4[2] " + display.options4[2]);
// if (display.CURRENTANTIALIAS > 0)
// display.options3[3] /= 4;
@@ -9374,13 +9388,13 @@
void ResetOptions()
{
options1[0] = 100;
- options1[1] = 0.00001f;
- options1[2] = 20;
+ options1[1] = 0.025f;
+ options1[2] = 0.01f;
options1[3] = 0;
options1[4] = 0;
options2[0] = 0;
- options2[1] = 1;
+ options2[1] = 0.75f;
options2[2] = 0;
options2[3] = 0;
diff --git a/GroupEditor.java b/GroupEditor.java
index d57f0f7..502ff05 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -605,10 +605,12 @@
copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
undoButton.setToolTipText("Undo changes");
undoButton.addActionListener(this);
+ undoButton.setEnabled(false);
copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
redoButton.setToolTipText("Redo changes");
redoButton.addActionListener(this);
+ redoButton.setEnabled(false);
copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
saveButton.setToolTipText("Save changes");
@@ -743,6 +745,18 @@
lightButton.setToolTipText("Create light");
lightButton.addActionListener(this);
+ for (int i=6; --i>=0;)
+ {
+ oe.toolboxPanel.Return();
+ oe.toolboxPanel.add(new cGridBag());
+ oe.toolboxPanel.add(new cGridBag());
+ oe.toolboxPanel.add(new cGridBag());
+ oe.toolboxPanel.add(new cGridBag());
+ oe.toolboxPanel.add(new cGridBag());
+ oe.toolboxPanel.add(new cGridBag());
+ oe.toolboxPanel.add(new cGridBag());
+ }
+
// EDIT panel
editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
editButton.setToolTipText("Edit selection");
@@ -3326,6 +3340,12 @@
} else
if (source == editItem || source == editButton)
{
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
+ {
+ Object3D child = (Object3D)e.nextElement();
+ child.pinned = true;
+ }
+
EditSelection(false);
} else
if (source == uneditButton)
@@ -3335,6 +3355,7 @@
Object3D child = (Object3D)e.nextElement();
if(child.editWindow != null)
objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
+ child.pinned = false;
child.CloseUI();
listUI.remove(child);
@@ -3351,6 +3372,7 @@
//copy.ClearUI();
for (Object3D obj : listUI)
{
+ obj.pinned = true;
obj.CloseUI();
}
listUI.clear();
@@ -3360,7 +3382,7 @@
{
assert(copy == group);
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
for (Object3D obj : listUI)
{
@@ -4502,10 +4524,6 @@
// }
// }
- static boolean allparams = true;
-
- static Vector<Object3D> listUI = new Vector<Object3D>();
-
void EditSelection(boolean newWindow)
{
// aConstraints.gridy = 0;
@@ -4599,6 +4617,17 @@
freezemodel = true;
+ //for (Object3D obj : listUI)
+ for (int i=listUI.size(); --i>=0;)
+ {
+ Object3D obj = listUI.elementAt(i);
+ if (!obj.pinned)
+ {
+ obj.CloseUI();
+ listUI.remove(i);
+ }
+ }
+
/**/
//switch (event.id)
{
@@ -4631,7 +4660,7 @@
if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
// a camera
{
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
{
CameraPane.camerachangeframe = 0; // don't refuse it
Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
@@ -4640,6 +4669,13 @@
// Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
}
+ if (tps != null && tps.length == 1)
+ {
+ EditSelection(false);
+ }
+
+ SetPinStates(tps != null && tps.length > 0);
+
refreshContents();
//return true;
}
@@ -4649,6 +4685,12 @@
freezemodel = false;
}
+ void SetPinStates(boolean enabled)
+ {
+ editButton.setEnabled(enabled);
+ uneditButton.setEnabled(enabled);
+ }
+
void refreshContents(boolean cp)
{
if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
@@ -5475,8 +5517,6 @@
cButton minButton;
cButton maxButton;
cButton fullButton;
- cButton undoButton;
- cButton redoButton;
cButton saveButton;
cButton oneStepButton;
diff --git a/ObjEditor.java b/ObjEditor.java
index c8ad401..d10d05b 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -207,7 +207,7 @@
objEditor.ctrlPanel.remove(namePanel);
- if (!GroupEditor.allparams)
+ if (!allparams)
return;
// objEditor.ctrlPanel.remove(liveCB);
@@ -337,6 +337,11 @@
return frame.action(event, obj);
}
+ // Cannot work without static
+ static boolean allparams = true;
+
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
+
void SetupMenu()
{
frame.setMenuBar(menuBar = new MenuBar());
@@ -397,6 +402,11 @@
// }
//
// materialFlushed = true;
+// }
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
+// {
+// if (listUI.size() == 0)
+// EditSelection(false);
// }
refreshContents(false); // To refresh Info tab
@@ -1102,7 +1112,7 @@
oe.ctrlPanel.Return();
- if (!GroupEditor.allparams)
+ if (!allparams)
return;
setupPanel = new cGridBag().setVertical(false);
@@ -1439,13 +1449,13 @@
//JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//tmp.setName("Edit");
objectPanel.add(materialPanel);
- objectPanel.add(toolboxPanel);
// JPanel north = new JPanel(new BorderLayout());
// north.setName("Edit");
// north.add(ctrlPanel, BorderLayout.NORTH);
// objectPanel.add(north);
objectPanel.add(editPanel);
objectPanel.add(infoPanel);
+ objectPanel.add(toolboxPanel);
/*
aConstraints.gridx = 0;
@@ -1454,7 +1464,7 @@
aConstraints.gridy += 1;
aConstraints.gridwidth = 1;
mainPanel.add(objectPanel, aConstraints);
- */
+ */
scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
VERTICAL_SCROLLBAR_AS_NEEDED,
@@ -3527,6 +3537,8 @@
tab.graphs[i] = null;
}
+ SetUndoStates();
+
// test save
if (false)
{
@@ -3549,6 +3561,8 @@
void CopyChanged(Object3D obj)
{
+ SetUndoStates();
+
boolean temp = CameraPane.SWITCH;
CameraPane.SWITCH = false;
@@ -3586,6 +3600,17 @@
}
refreshContents();
+ }
+
+ cButton undoButton;
+ cButton redoButton;
+
+ void SetUndoStates()
+ {
+ cRadio tab = GetCurrentTab();
+
+ undoButton.setEnabled(tab.undoindex > 0);
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
}
public void Undo()
@@ -4765,6 +4790,8 @@
String filename = browser.getFile();
if (filename != null && filename.length() > 0)
{
+ if (!filename.endsWith(".gfd"))
+ filename += ".gfd";
lastname = browser.getDirectory() + filename;
save();
}
diff --git a/Object3D.java b/Object3D.java
index c00f59b..e829908 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -7994,6 +7994,8 @@
transient ObjEditor editWindow;
transient ObjEditor manipWindow;
+ transient boolean pinned;
+
transient ObjectUI objectUI;
public static int povDepth = 0;
private static cVector tbMin = new cVector();
diff --git a/icons/overlay.png b/icons/overlay.png
index 8c71876..c9fabfb 100644
--- a/icons/overlay.png
+++ b/icons/overlay.png
Binary files differ
diff --git a/icons/switch.png b/icons/switch.png
index 310da04..4b82736 100644
--- a/icons/switch.png
+++ b/icons/switch.png
Binary files differ
--
Gitblit v1.6.2