From b1d79b74514041a059b454a9f6fc3970773c0cb8 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 12 Aug 2019 18:19:30 -0400
Subject: [PATCH] Compact toolbar.
---
ObjEditor.java | 87 +++++++++++++---
Torus.java | 8 +
Cone.java | 5 +
SwitchNode.java | 3
Grid.java | 5 +
Sphere.java | 9 +
Biparam.java | 7 +
cMesh.java | 2
CameraPane.java | 1
Globals.java | 2
GroupEditor.java | 131 ++++++++++++++-----------
icons/shadericons/shadow.png | 0
Superellipsoid.java | 12 +
Object3D.java | 6 +
icons/collapse.png | 0
15 files changed, 193 insertions(+), 85 deletions(-)
diff --git a/Biparam.java b/Biparam.java
index 67ef12f..934bccf 100644
--- a/Biparam.java
+++ b/Biparam.java
@@ -98,6 +98,11 @@
// recalculate();
}
+ double uStretch()
+ {
+ return 1;
+ }
+
void recalculate()
{
//System.out.println("BREP TRIMMED? 3 " + bRep.trimmed);
@@ -115,7 +120,7 @@
int p = iu * (vDivs + 1) + iv;
if (touched)
{
- vert.s = u;
+ vert.s = u * uStretch();
vert.t = v;
}
else
diff --git a/CameraPane.java b/CameraPane.java
index df56b97..e816ebc 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -16667,6 +16667,7 @@
private void DrawSkyBox(GL gl, float ratio)
{
if (//envyoff ||
+ WIREFRAME ||
cubemap == null)
{
gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
diff --git a/Cone.java b/Cone.java
index 63892ae..de9ce0f 100644
--- a/Cone.java
+++ b/Cone.java
@@ -193,6 +193,11 @@
return inside;
}
+ double uStretch()
+ {
+ return 6; // Actually 6.28 (I think)
+ }
+
Vertex biparamFunction(double u, double v)
{
cVector tPos;
diff --git a/Globals.java b/Globals.java
index 0b4407e..d968060 100644
--- a/Globals.java
+++ b/Globals.java
@@ -8,6 +8,8 @@
private static boolean LIVE = false;
+ // Option to set saturation to 1 when choosing a color first
+ public static boolean AUTOSATURATE = true;
public static boolean MINSHADER = false;
public static boolean COMPUTESHADOWWHENLIVE = true;
public static boolean RENDERSHADOW = true;
diff --git a/Grid.java b/Grid.java
index e8b144a..06d07a4 100644
--- a/Grid.java
+++ b/Grid.java
@@ -62,6 +62,11 @@
*/
}
+ double uStretch()
+ {
+ return 1;
+ }
+
Vertex biparamFunction(double u, double v)
{
Vertex temp = new Vertex((2*v-1)*radius*4, 0 /*-radius,*/, (2*u-1)*radius*4);
diff --git a/GroupEditor.java b/GroupEditor.java
index 953d129..1e9db13 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -359,6 +359,16 @@
refreshContents();
}
+ public void Show3DView()
+ {
+ // bug
+ //gridPanel.setDividerLocation(1.0);
+ //bigPanel.setDividerLocation(0.0);
+ bigThree.ClearUI();
+ bigThree.add(centralPanel);
+ bigThree.FlushUI();
+ }
+
//ObjEditor objEditor;
public void closeUI2()
{
@@ -984,11 +994,6 @@
//new Exception().printStackTrace();
oe.radioPanel = new JPanel(new GridBagLayout());
- oe.aConstraints.weightx = 1;
- oe.aConstraints.weighty = 0;
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
- oe.aConstraints.gridwidth = 100;
- oe.aConstraints.gridheight = 1;
// oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
oe.buttonGroup = new ButtonGroup();
@@ -1025,6 +1030,45 @@
maxButton.setToolTipText("Maximize window");
maxButton.addActionListener(this);
}
+
+ cButton gcButton;
+
+ oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ gcButton.setToolTipText("Garbage collect");
+ gcButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.gc();
+ }
+ });
+
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ collapseButton.setToolTipText("Collapse toolbar");
+ collapseButton.addActionListener(this);
+
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ maximize3DButton.setToolTipText("Maximize 3D view");
+ maximize3DButton.addActionListener(this);
+
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ twoButton.setToolTipText("Show 3D view only");
+ twoButton.addActionListener(this);
+ this.fullscreenLayout = twoButton;
+
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ threeButton.setToolTipText("Show controls and 3D view");
+ threeButton.addActionListener(this);
+ if (Globals.ADVANCED)
+ {
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ sixButton.setToolTipText("Show 3D view and controls");
+ sixButton.addActionListener(this);
+ }
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+// sevenButton.setToolTipText("3-column layout");
+// sevenButton.addActionListener(this);
+ //
oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
fullButton.setToolTipText("Full-screen window");
@@ -1069,14 +1113,14 @@
nextVersionButton.addActionListener(this);
nextVersionButton.setEnabled(false);
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
- liveCB.setToolTipText("Enable animation");
- liveCB.addItemListener(this);
-
oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
oneStepButton.setToolTipText("Animate one step forward");
oneStepButton.addActionListener(this);
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
+ liveCB.setToolTipText("Enable animation");
+ liveCB.addItemListener(this);
+
oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
fastCB.setToolTipText("Fast mode");
fastCB.addItemListener(this);
@@ -1103,21 +1147,6 @@
//oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
- twoButton.setToolTipText("Show 3D view only");
- twoButton.addActionListener(this);
- this.fullscreenLayout = twoButton;
-
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
- threeButton.setToolTipText("Show controls and 3D view");
- threeButton.addActionListener(this);
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
- sixButton.setToolTipText("Show 3D view and controls");
- sixButton.addActionListener(this);
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-// sevenButton.setToolTipText("3-column layout");
-// sevenButton.addActionListener(this);
- //
oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
rootButton.setToolTipText("Open selection in new tab");
@@ -1815,7 +1844,12 @@
TreePath path;
public TransferableTreePath(TreePath tp) {
- path = tp;
+ Object[] objs = new Object[tp.getPathCount()];
+ for (int i=0; i<objs.length; i++)
+ {
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
+ }
+ path = new TreePath(objs);
}
public synchronized DataFlavor[] getTransferDataFlavors() {
@@ -2708,6 +2742,18 @@
if (source == fullButton)
{
ToggleFullScreen();
+ } else
+ if (source == collapseButton)
+ {
+ this.expandedLayout = radio.layout;
+ CollapseToolbar();
+ } else
+ if (source == maximize3DButton)
+ {
+ this.expandedLayout = radio.layout;
+ radio.layout = twoButton;
+ Show3DView();
+ CollapseToolbar();
} else
if (source == previousVersionButton)
{
@@ -3660,38 +3706,7 @@
if (CameraPane.FULLSCREEN)
fullscreenLayout = radio.layout;
- // bug
- //gridPanel.setDividerLocation(1.0);
- //bigPanel.setDividerLocation(0.0);
-// bigThree.remove(scenePanel);
-// bigThree.remove(centralPanel);
-// bigThree.remove(XYZPanel);
-// aWindowConstraints.gridx = 0;
-// aWindowConstraints.gridy = 0;
-// aWindowConstraints.gridwidth = 1;
-// // aConstraints.gridheight = 3;
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-// aWindowConstraints.weightx = 0;
-// aWindowConstraints.weighty = 1;
-// //bigThree.add(jtp, aWindowConstraints);
-// aWindowConstraints.weightx = 1;
-// aWindowConstraints.gridwidth = 3;
-// // aConstraints.gridheight = 3;
-// aWindowConstraints.gridx = 1;
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
-// bigThree.add(centralPanel, aWindowConstraints);
-// aWindowConstraints.weightx = 0;
-// aWindowConstraints.gridx = 4;
-// aWindowConstraints.gridwidth = 1;
-// // aConstraints.gridheight = 3;
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-// //bigThree.add(XYZPanel, aWindowConstraints);
-// scenePanel.setVisible(false);
-// centralPanel.setVisible(true);
-// XYZPanel.setVisible(false);
- bigThree.ClearUI();
- bigThree.add(centralPanel);
- bigThree.FlushUI();
+ Show3DView();
cameraView.requestFocusInWindow();
@@ -5290,7 +5305,7 @@
Object3D child = (Object3D) group.selection.get(i);
objEditor.AddInfo(child, this, true);
- System.err.println("info : " + child.GetPath());
+// System.err.println("info : " + child.GetPath());
}
objEditor.SetText(); // jan 2014
diff --git a/ObjEditor.java b/ObjEditor.java
index 8e14d77..389e50d 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -754,6 +754,7 @@
boolean maximized;
cButton fullscreenLayout;
+ cButton expandedLayout;
void Minimize()
{
@@ -793,10 +794,12 @@
cButton minButton;
cButton maxButton;
cButton fullButton;
+ cButton collapseButton;
+ cButton maximize3DButton;
void ToggleFullScreen()
{
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
cameraView.ToggleFullScreen();
@@ -817,13 +820,13 @@
// X frame.getContentPane().remove(/*"Center",*/bigThree);
// X framePanel.add(bigThree);
// X frame.getContentPane().add(/*"Center",*/framePanel);
- framePanel.setDividerLocation(46);
+// framePanel.setDividerLocation(46); // icons are 24x24
//frame.setVisible(true);
- radio.layout = keepButton;
+// radio.layout = keepButton;
//theFrame = null;
keepButton = null;
- radio.layout.doClick();
+// radio.layout.doClick();
} else
{
@@ -844,10 +847,10 @@
// X frame.getContentPane().remove(/*"Center",*/framePanel);
// X framePanel.remove(bigThree);
// X frame.getContentPane().add(/*"Center",*/bigThree);
- framePanel.setDividerLocation(0);
+// framePanel.setDividerLocation(0);
- radio.layout = fullscreenLayout;
- radio.layout.doClick();
+// radio.layout = fullscreenLayout;
+// radio.layout.doClick();
//frame.setVisible(true);
}
frame.validate();
@@ -855,23 +858,31 @@
cameraView.requestFocusInWindow();
}
- private Object3D CompressCopy()
+ void CollapseToolbar()
+ {
+ framePanel.setDividerLocation(0);
+ //frame.validate();
+
+ cameraView.requestFocusInWindow();
+ }
+
+ private Object3D Duplicate(Object3D object)
{
boolean temp = CameraPane.SWITCH;
CameraPane.SWITCH = false;
- copy.ExtractBigData(versiontable);
+ object.ExtractBigData(versiontable);
// if (copy == client)
- Object3D versions[] = copy.versionlist;
- copy.versionlist = null;
+ Object3D versions[] = object.versionlist;
+ object.versionlist = null;
//byte[] compress = Compress(copy);
- Object3D compress = (Object3D)Grafreed.clone(copy);
+ Object3D compress = (Object3D)Grafreed.clone(object);
- copy.versionlist = versions;
+ object.versionlist = versions;
- copy.RestoreBigData(versiontable);
+ object.RestoreBigData(versiontable);
CameraPane.SWITCH = temp;
@@ -1702,6 +1713,23 @@
// aConstraints.gridheight = 1;
framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
+
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
+ new java.beans.PropertyChangeListener()
+ {
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
+ {
+ if ((Integer)pce.getOldValue() == 1)
+ {
+ if (radio.layout != expandedLayout)
+ {
+ radio.layout = expandedLayout;
+ radio.layout.doClick();
+ }
+ }
+ }
+ });
+
framePanel.setContinuousLayout(false);
framePanel.setOneTouchExpandable(false);
//.setDividerLocation(0.8);
@@ -2120,6 +2148,25 @@
}
});
presetpanel.add(candle);
+
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
+ shadowShader.setToolTipText("Shadow");
+ shadowShader.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ diffuseField.setFloat(0.001);
+ ambientField.setFloat(0.001);
+ cameraField.setFloat(0.001);
+ specularField.setFloat(0.001);
+ fakedepthField.setFloat(0.001);
+ opacityField.setFloat(0.6);
+
+ materialtouched = true;
+ applySelf();
+ }
+ });
+ presetpanel.add(shadowShader);
cGridBag panel = new cGridBag().setVertical(true);
@@ -4112,11 +4159,11 @@
public boolean Save(boolean user)
{
System.err.println("Save");
- //Replace();
+ Replace();
cRadio tab = GetCurrentTab();
- Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
boolean thesame = false;
@@ -4210,7 +4257,7 @@
void CopyChanged()
{
- Object3D obj = copy.versionlist[copy.versionindex];
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
SetUndoStates();
@@ -4363,7 +4410,7 @@
return false;
}
- copy.versionlist[copy.versionindex] = CompressCopy();
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
return true;
}
@@ -4738,7 +4785,7 @@
//System.out.println("stateChanged = " + this);
materialtouched = true;
- if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
{
saturationField.setFloat(1);
}
@@ -5882,6 +5929,7 @@
cNumberSlider anisoField;
JLabel anisoVLabel;
cNumberSlider anisoVField;
+
JLabel cameraLabel;
cNumberSlider cameraField;
JLabel selfshadowLabel;
@@ -5896,6 +5944,7 @@
cNumberSlider fakedepthField;
JLabel shadowbiasLabel;
cNumberSlider shadowbiasField;
+
JLabel bumpLabel;
cNumberSlider bumpField;
JLabel noiseLabel;
diff --git a/Object3D.java b/Object3D.java
index adb076e..cc8b73b 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -2468,7 +2468,11 @@
else
{
//((ObjEditor)editWindow).SetupUI2(null);
- ((ObjEditor)objectUI).pinButton.setSelected(pinned);
+ if (objectUI != null)
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
+ else
+ //new Exception().printStackTrace();
+ System.err.println("objectUI is null");
}
}
diff --git a/Sphere.java b/Sphere.java
index 1358cad..692bffb 100644
--- a/Sphere.java
+++ b/Sphere.java
@@ -49,7 +49,7 @@
minUDivs = 3;
minVDivs = 2;
//center = new cVector();
- radius = 1;
+ radius = 0.5;
if (recalc)
{
retile();
@@ -121,6 +121,11 @@
buffer.append("}\n");
}
+ double uStretch()
+ {
+ return 2;
+ }
+
Vertex biparamFunction(double u, double v)
{
double uAng = LA.toRadians(u * 360);
@@ -137,6 +142,8 @@
LA.vecCopy(temp.norm, temp/*.pos*/);
LA.vecNormalize(temp.norm);
+ temp.y += radius;
+
return temp;
}
diff --git a/Superellipsoid.java b/Superellipsoid.java
index bef4143..a0c9628 100644
--- a/Superellipsoid.java
+++ b/Superellipsoid.java
@@ -1,6 +1,7 @@
class Superellipsoid extends Biparam /*Sphere*/ implements java.io.Serializable
{
-
+ static final long serialVersionUID = -251688182693574378L;
+
Superellipsoid()
{
super(); // false);
@@ -147,6 +148,11 @@
cVector du; // = new cVector();
cVector dv; // = new cVector();
+ double uStretch()
+ {
+ return 2;
+ }
+
Vertex biparamFunction(double u, double v)
{
//System.out.println("U = " + u + "; V = " + v);
@@ -177,7 +183,7 @@
double sv = signPower(msv, east);
double z = radius * cv * cu;
double x = radius * cv * su;
- double y = radius * sv;
+ double y = radius * sv + radius;
double dcu = DsignPower(mcu, north) * -msu;
double dsu = DsignPower(msu, north) * mcu;
@@ -315,6 +321,6 @@
double east;
double north;
- double radius = 1;
+ double radius = 0.5;
private cVector inPnt;
}
diff --git a/SwitchNode.java b/SwitchNode.java
index c6e4dff..96c3568 100644
--- a/SwitchNode.java
+++ b/SwitchNode.java
@@ -97,7 +97,8 @@
if (bRep == null)
{
- bRep = (BoundaryRep) Grafreed.clone(switchobject.get(0).bRep);
+ // The switch mesh will be used to interpolate poaes (maybe).
+ bRep = (BoundaryRep)Grafreed.clone(switchobject.get(0).bRep);
}
if (CameraPane.SUPPORT && display.DrawMode() == display.SHADOW)
diff --git a/Torus.java b/Torus.java
index 4573395..dd1a181 100644
--- a/Torus.java
+++ b/Torus.java
@@ -56,6 +56,11 @@
buffer.append("}\n");
}
+ double uStretch()
+ {
+ return 6; // Actually 6.28 (I think)
+ }
+
Vertex biparamFunction(double u, double v)
{
if (u == 1)
@@ -87,6 +92,9 @@
//temp.pos = tPos; // useless new
temp.norm = tNorm;
LA.vecNormalize(temp.norm);
+
+ temp.y += minor;
+
return temp;
}
diff --git a/cMesh.java b/cMesh.java
index a31f4dd..51a76c3 100644
--- a/cMesh.java
+++ b/cMesh.java
@@ -49,7 +49,7 @@
cMesh(Object3D bRep)
{
- this("Me:" + bRep.name, bRep);
+ this("Mesh:" + bRep.name, bRep);
}
cMesh(String name, Object3D bRep)
diff --git a/icons/collapse.png b/icons/collapse.png
new file mode 100644
index 0000000..b560489
--- /dev/null
+++ b/icons/collapse.png
Binary files differ
diff --git a/icons/shadericons/shadow.png b/icons/shadericons/shadow.png
new file mode 100644
index 0000000..cd7119b
--- /dev/null
+++ b/icons/shadericons/shadow.png
Binary files differ
--
Gitblit v1.6.2