From a69bb4474a3264a9a7a7f8b8d8154ea771f167c8 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Fri, 28 Jun 2019 23:44:22 -0400
Subject: [PATCH] Fix ungroup.
---
ObjEditor.java | 79 ++++++++++++++++---------
RandomEditor.java | 2
Torus.java | 2
Cone.java | 1
CameraPane.java | 15 ++--
Globals.java | 2
GroupLeaf.java | 7 ++
GroupEditor.java | 59 +++++++++++++------
RandomNode.java | 2
cButton.java | 4
10 files changed, 111 insertions(+), 62 deletions(-)
diff --git a/CameraPane.java b/CameraPane.java
index 88a2741..0f77a95 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -13375,9 +13375,10 @@
"DP3 " + dest + ".z," + "normals," + "eye;" +
"MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
//"MOV " + dest + ".w," + "normal.z;" +
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
- //"MOV " + dest + ".z," + "params2.w;" +
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
+
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
"POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
"RCP " + dest + ".w," + dest + ".w;" +
//"RSQ " + dest + ".w," + dest + ".w;" +
@@ -15119,9 +15120,9 @@
case '_':
kompactbit = 5;
break;
- case '+':
- kompactbit = 6;
- break;
+// case '+':
+// kompactbit = 6;
+// break;
case ' ':
ObjEditor.theFrame.ToggleFullScreen();
repaint();
@@ -15170,8 +15171,8 @@
case DELETE:
ClearSelection();
break;
- /*
case '+':
+ /*
//fontsize += 1;
bbzoom *= 2;
repaint();
diff --git a/Cone.java b/Cone.java
index 979cce1..3eb0ba6 100644
--- a/Cone.java
+++ b/Cone.java
@@ -2,6 +2,7 @@
class Cone extends Biparam implements java.io.Serializable
{
+ static final long serialVersionUID = -679715043452968126L;
Cone()
{
diff --git a/Globals.java b/Globals.java
index c361638..b46c997 100644
--- a/Globals.java
+++ b/Globals.java
@@ -16,7 +16,7 @@
public static boolean TIMERRUNNING = false;
// Hold on calculation when moving camera
- public static boolean FREEZEONMOVE = false; // true;
+ public static boolean FREEZEONMOVE = false;
static boolean CROWD = false;
static public int drawMode = iCameraPane.DEFAULT; // WARNING
diff --git a/GroupEditor.java b/GroupEditor.java
index aa482be..4fa246f 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -220,7 +220,7 @@
// toggleSwitchItem.addItemListener(this);
// toggleSwitchItem.setState(CameraPane.SWITCH);
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
toggleHandleItem.addItemListener(this);
toggleHandleItem.setState(CameraPane.HANDLES);
@@ -582,7 +582,7 @@
*/
cGridBag copyOptionsPanel = new cGridBag();
- copyOptionsPanel.preferredHeight = 2;
+ copyOptionsPanel.preferredHeight = 1;
//this.AddOptions(oe.toolbarPanel, oe.aConstraints);
@@ -726,7 +726,7 @@
compositeButton.addActionListener(this);
oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
- switchButton.setToolTipText("Create switch");
+ switchButton.setToolTipText("Create item switcher");
switchButton.addActionListener(this);
oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
@@ -863,9 +863,13 @@
if (true) // Globals.ADVANCED)
{
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
- supportCB.setToolTipText("Enable rigging");
- supportCB.addItemListener(this);
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
+// supportCB.setToolTipText("Enable rigging");
+// supportCB.addItemListener(this);
+
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
+ freezeCB.setToolTipText("Fast moving camera");
+ freezeCB.addItemListener(this);
// panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
// localCB.addItemListener(this);
@@ -929,7 +933,7 @@
toggleTextureCB.addItemListener(this);
panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
- toggleSwitchCB.setToolTipText("Use switch");
+ toggleSwitchCB.setToolTipText("Choose a single item");
toggleSwitchCB.addItemListener(this);
panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
@@ -1000,6 +1004,7 @@
cCheckBox slowCB;
cCheckBox boxCB;
cCheckBox zoomBoxCB;
+ cCheckBox freezeCB;
//cToggleButton trackCB;
cCheckBox trackCB;
cCheckBox smoothfocusCB;
@@ -1117,6 +1122,10 @@
else if(e.getSource() == shadowCB)
{
Globals.COMPUTESHADOWWHENLIVE ^= true;
+ }
+ else if(e.getSource() == freezeCB)
+ {
+ Globals.FREEZEONMOVE ^= true;
}
else if(e.getSource() == autosaveCB)
{
@@ -2122,25 +2131,25 @@
Composite csg = new GroupLeaf();
csg.count = 5;
group(csg);
- Composite child = new cGroup();
+ Composite child = new cGroup("Branch");
csg.addChild(child);
child.addChild(csg);
} else
if (source == doubleItem)
{
- Composite csg = new GroupLeaf();
+ Composite csg = new GroupLeaf("Fork");
csg.count = 5;
group(csg);
- Composite child = new cGroup();
+ Composite child = new cGroup("Branch A");
csg.addChild(child);
child.addChild(csg);
- child = new cGroup();
+ child = new cGroup("Branch B");
csg.addChild(child);
child.addChild(csg);
} else
if (source == tripleItem)
{
- Composite csg = new GroupLeaf();
+ Composite csg = new GroupLeaf("Trident");
csg.count = 4;
group(csg);
Composite child = new cGroup();
@@ -2755,15 +2764,28 @@
} else
if (source == ungroupItem || source == ungroupButton)
{
- //ungroup();
+ boolean hasRoot = false;
+
for (int i=0; i<group.selection.size(); i++)
{
- Ungroup(group.selection.get(i));
+ if (group.selection.get(i) == group)
+ {
+ hasRoot = true;
+ break;
+ }
}
- ClearSelection(false);
-
- refreshContents();
+ if (!hasRoot)
+ {
+ for (int i=0; i<group.selection.size(); i++)
+ {
+ Ungroup(group.selection.get(i));
+ }
+
+ ClearSelection(false);
+
+ refreshContents();
+ }
} else
if (source == genUVItem)
{
@@ -5526,9 +5548,6 @@
cButton restoreCameraButton;
- cButton minButton;
- cButton maxButton;
- cButton fullButton;
cButton saveButton;
cButton oneStepButton;
diff --git a/GroupLeaf.java b/GroupLeaf.java
index 805acf2..98da0c9 100644
--- a/GroupLeaf.java
+++ b/GroupLeaf.java
@@ -14,7 +14,12 @@
GroupLeaf()
{
- super("GroupLeaf");
+ this("Loop");
+ }
+
+ GroupLeaf(String name)
+ {
+ super(name);
addChild(new cGroup("Leaf"));
}
diff --git a/ObjEditor.java b/ObjEditor.java
index 559d8de..b7cf47d 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -449,7 +449,7 @@
// TEXTAREA infoarea.setLineWrap(true);
// TEXTAREA infoarea.setWrapStyleWord(true);
infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
- infoPanel.setPreferredSize(new Dimension(50, 200));
+ //infoPanel.setPreferredSize(new Dimension(50, 200));
infoPanel.setName("Info");
//infoPanel.setLayout(new BorderLayout());
//infoPanel.add(createTextPane());
@@ -721,10 +721,19 @@
void Minimize()
{
frame.setState(Frame.ICONIFIED);
+ frame.validate();
}
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
void Maximize()
{
+ if (CameraPane.FULLSCREEN)
+ {
+ ToggleFullScreen();
+ }
+
if (maximized)
{
frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
@@ -739,7 +748,13 @@
}
maximized ^= true;
+
+ frame.validate();
}
+
+ cButton minButton;
+ cButton maxButton;
+ cButton fullButton;
void ToggleFullScreen()
{
@@ -748,6 +763,8 @@
if (!CameraPane.FULLSCREEN)
{
device.setFullScreenWindow(null);
+ frame.validate();
+
//frame.setVisible(false);
// frame.removeNotify();
// frame.setUndecorated(false);
@@ -773,6 +790,7 @@
// frame.getToolkit().getScreenSize().height);
//frame.setVisible(false);
device.setFullScreenWindow(frame);
+ frame.validate();
// frame.removeNotify();
// frame.setUndecorated(true);
// frame.addNotify();
@@ -785,6 +803,7 @@
radio.layout.doClick();
//frame.setVisible(true);
}
+ frame.validate();
}
private JTextPane createTextPane()
@@ -1117,7 +1136,7 @@
namePanel = new cGridBag();
nameField = AddText(namePanel, copy.GetName());
- namePanel.add(nameField);
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
oe.ctrlPanel.add(namePanel);
oe.ctrlPanel.Return();
@@ -1142,7 +1161,7 @@
rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
rewindCB.setToolTipText("Rewind animation");
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
if (Globals.ADVANCED)
@@ -1686,24 +1705,6 @@
texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
colorSection.add(texture);
- cGridBag anisoU = new cGridBag();
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
- colorSection.add(anisoU);
-
- cGridBag anisoV = new cGridBag();
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
- colorSection.add(anisoV);
-
- cGridBag shadowbias = new cGridBag();
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
- colorSection.add(shadowbias);
-
panel.add(new JSeparator());
panel.add(colorSection);
@@ -1753,6 +1754,12 @@
fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
diffuseSection.add(fakedepth);
+
+ cGridBag shadowbias = new cGridBag();
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
+ diffuseSection.add(shadowbias);
panel.add(new JSeparator());
@@ -1804,6 +1811,18 @@
// aConstraints.gridy += 1;
// aConstraints.gridwidth = 1;
+ cGridBag anisoU = new cGridBag();
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
+ specularSection.add(anisoU);
+
+ cGridBag anisoV = new cGridBag();
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
+ specularSection.add(anisoV);
+
panel.add(new JSeparator());
@@ -1811,35 +1830,35 @@
//ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
- cGridBag globalSection = new cGridBag().setVertical(true);
+ //cGridBag globalSection = new cGridBag().setVertical(true);
cGridBag camera = new cGridBag();
camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
- globalSection.add(camera);
+ colorSection.add(camera);
cGridBag ambient = new cGridBag();
ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
- globalSection.add(ambient);
+ colorSection.add(ambient);
cGridBag backlit = new cGridBag();
backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
- globalSection.add(backlit);
+ colorSection.add(backlit);
cGridBag opacity = new cGridBag();
opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
- globalSection.add(opacity);
+ colorSection.add(opacity);
- panel.add(new JSeparator());
+ //panel.add(new JSeparator());
- panel.add(globalSection);
+ //panel.add(globalSection);
//ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
@@ -3538,8 +3557,10 @@
copy.ExtractBigData(hashtable);
+ byte[] compress = Compress(copy);
+
//EditorFrame.m_MainFrame.requestFocusInWindow();
- tab.graphs[tab.undoindex++] = Compress(copy);
+ tab.graphs[tab.undoindex++] = compress;
copy.RestoreBigData(hashtable);
diff --git a/RandomEditor.java b/RandomEditor.java
index 7e433cf..85b7563 100644
--- a/RandomEditor.java
+++ b/RandomEditor.java
@@ -60,7 +60,7 @@
void SetupUI2(ObjEditor oe)
{
super.SetupUI2(oe);
- childPanel = AddSlider(oe.ctrlPanel, "Child: ", 0, switchnode.Size()-1, switchnode.rnd);
+ childPanel = AddSlider(oe.ctrlPanel, "Item: ", 0, switchnode.Size()-1, switchnode.rnd);
childField = (cNumberSlider)childPanel.getComponent(1);
oe.ctrlPanel.Return();
diff --git a/RandomNode.java b/RandomNode.java
index b1c0107..7d0d7b3 100644
--- a/RandomNode.java
+++ b/RandomNode.java
@@ -5,7 +5,7 @@
RandomNode()
{
- this("Random");
+ this("Switch");
}
RandomNode(String name)
diff --git a/Torus.java b/Torus.java
index 04aba57..9e5fb59 100644
--- a/Torus.java
+++ b/Torus.java
@@ -2,6 +2,8 @@
class Torus extends Biparam implements java.io.Serializable
{
+ static final long serialVersionUID = -7637054329820073252L;
+
Torus()
{
inPnt = new cVector();
diff --git a/cButton.java b/cButton.java
index faeb185..2022871 100644
--- a/cButton.java
+++ b/cButton.java
@@ -12,7 +12,7 @@
{
super(name);
- setMargin(new java.awt.Insets(1, -8, 1, -8));
+ setMargin(new java.awt.Insets(1, -1, 1, -1));
if (border)
setBorder(new javax.swing.border.EtchedBorder());
@@ -26,7 +26,7 @@
{
super(icon);
- setMargin(new java.awt.Insets(-1, -8, -1, -8));
+ setMargin(new java.awt.Insets(-1, -1, -1, -1));
//result = new JButton( icon );
//result.setBorderPainted( false );
--
Gitblit v1.6.2