Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
Edit panel pin state.
6 files modified
113 ■■■■ changed files
CameraPane.java 20 ●●●● patch | view | raw | blame | history
GroupEditor.java 56 ●●●● patch | view | raw | blame | history
ObjEditor.java 35 ●●●● patch | view | raw | blame | history
Object3D.java 2 ●●●●● patch | view | raw | blame | history
icons/overlay.png patch | view | raw | blame | history
icons/switch.png patch | view | raw | blame | history
CameraPane.java
....@@ -335,14 +335,28 @@
335335 display.options1[2] = material.shadowbias;
336336 display.options1[3] = material.aniso;
337337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
338343 display.options2[0] = material.opacity;
339344 display.options2[1] = material.diffuse;
340345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
341349
342350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
343354 display.options4[0] = material.cameralight/0.2f;
344355 display.options4[1] = material.subsurface;
345356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
346360
347361 // if (display.CURRENTANTIALIAS > 0)
348362 // display.options3[3] /= 4;
....@@ -9374,13 +9388,13 @@
93749388 void ResetOptions()
93759389 {
93769390 options1[0] = 100;
9377
- options1[1] = 0.00001f;
9378
- options1[2] = 20;
9391
+ options1[1] = 0.025f;
9392
+ options1[2] = 0.01f;
93799393 options1[3] = 0;
93809394 options1[4] = 0;
93819395
93829396 options2[0] = 0;
9383
- options2[1] = 1;
9397
+ options2[1] = 0.75f;
93849398 options2[2] = 0;
93859399 options2[3] = 0;
93869400
GroupEditor.java
....@@ -605,10 +605,12 @@
605605 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606606 undoButton.setToolTipText("Undo changes");
607607 undoButton.addActionListener(this);
608
+ undoButton.setEnabled(false);
608609
609610 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610611 redoButton.setToolTipText("Redo changes");
611612 redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
612614
613615 copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614616 saveButton.setToolTipText("Save changes");
....@@ -743,6 +745,18 @@
743745 lightButton.setToolTipText("Create light");
744746 lightButton.addActionListener(this);
745747
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ }
759
+
746760 // EDIT panel
747761 editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748762 editButton.setToolTipText("Edit selection");
....@@ -3326,6 +3340,12 @@
33263340 } else
33273341 if (source == editItem || source == editButton)
33283342 {
3343
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3344
+ {
3345
+ Object3D child = (Object3D)e.nextElement();
3346
+ child.pinned = true;
3347
+ }
3348
+
33293349 EditSelection(false);
33303350 } else
33313351 if (source == uneditButton)
....@@ -3335,6 +3355,7 @@
33353355 Object3D child = (Object3D)e.nextElement();
33363356 if(child.editWindow != null)
33373357 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3358
+ child.pinned = false;
33383359 child.CloseUI();
33393360 listUI.remove(child);
33403361
....@@ -3351,6 +3372,7 @@
33513372 //copy.ClearUI();
33523373 for (Object3D obj : listUI)
33533374 {
3375
+ obj.pinned = true;
33543376 obj.CloseUI();
33553377 }
33563378 listUI.clear();
....@@ -3360,7 +3382,7 @@
33603382 {
33613383 assert(copy == group);
33623384
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3385
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643386
33653387 for (Object3D obj : listUI)
33663388 {
....@@ -4502,10 +4524,6 @@
45024524 // }
45034525 // }
45044526
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45094527 void EditSelection(boolean newWindow)
45104528 {
45114529 // aConstraints.gridy = 0;
....@@ -4599,6 +4617,17 @@
45994617
46004618 freezemodel = true;
46014619
4620
+ //for (Object3D obj : listUI)
4621
+ for (int i=listUI.size(); --i>=0;)
4622
+ {
4623
+ Object3D obj = listUI.elementAt(i);
4624
+ if (!obj.pinned)
4625
+ {
4626
+ obj.CloseUI();
4627
+ listUI.remove(i);
4628
+ }
4629
+ }
4630
+
46024631 /**/
46034632 //switch (event.id)
46044633 {
....@@ -4631,7 +4660,7 @@
46314660 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46324661 // a camera
46334662 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4663
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46354664 {
46364665 CameraPane.camerachangeframe = 0; // don't refuse it
46374666 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +4669,13 @@
46404669 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46414670 }
46424671
4672
+ if (tps != null && tps.length == 1)
4673
+ {
4674
+ EditSelection(false);
4675
+ }
4676
+
4677
+ SetPinStates(tps != null && tps.length > 0);
4678
+
46434679 refreshContents();
46444680 //return true;
46454681 }
....@@ -4649,6 +4685,12 @@
46494685 freezemodel = false;
46504686 }
46514687
4688
+ void SetPinStates(boolean enabled)
4689
+ {
4690
+ editButton.setEnabled(enabled);
4691
+ uneditButton.setEnabled(enabled);
4692
+ }
4693
+
46524694 void refreshContents(boolean cp)
46534695 {
46544696 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
....@@ -5475,8 +5517,6 @@
54755517 cButton minButton;
54765518 cButton maxButton;
54775519 cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
54805520 cButton saveButton;
54815521 cButton oneStepButton;
54825522
ObjEditor.java
....@@ -207,7 +207,7 @@
207207
208208 objEditor.ctrlPanel.remove(namePanel);
209209
210
- if (!GroupEditor.allparams)
210
+ if (!allparams)
211211 return;
212212
213213 // objEditor.ctrlPanel.remove(liveCB);
....@@ -337,6 +337,11 @@
337337 return frame.action(event, obj);
338338 }
339339
340
+ // Cannot work without static
341
+ static boolean allparams = true;
342
+
343
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
344
+
340345 void SetupMenu()
341346 {
342347 frame.setMenuBar(menuBar = new MenuBar());
....@@ -397,6 +402,11 @@
397402 // }
398403 //
399404 // materialFlushed = true;
405
+// }
406
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
407
+// {
408
+// if (listUI.size() == 0)
409
+// EditSelection(false);
400410 // }
401411
402412 refreshContents(false); // To refresh Info tab
....@@ -1102,7 +1112,7 @@
11021112
11031113 oe.ctrlPanel.Return();
11041114
1105
- if (!GroupEditor.allparams)
1115
+ if (!allparams)
11061116 return;
11071117
11081118 setupPanel = new cGridBag().setVertical(false);
....@@ -1439,13 +1449,13 @@
14391449 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14401450 //tmp.setName("Edit");
14411451 objectPanel.add(materialPanel);
1442
- objectPanel.add(toolboxPanel);
14431452 // JPanel north = new JPanel(new BorderLayout());
14441453 // north.setName("Edit");
14451454 // north.add(ctrlPanel, BorderLayout.NORTH);
14461455 // objectPanel.add(north);
14471456 objectPanel.add(editPanel);
14481457 objectPanel.add(infoPanel);
1458
+ objectPanel.add(toolboxPanel);
14491459
14501460 /*
14511461 aConstraints.gridx = 0;
....@@ -1454,7 +1464,7 @@
14541464 aConstraints.gridy += 1;
14551465 aConstraints.gridwidth = 1;
14561466 mainPanel.add(objectPanel, aConstraints);
1457
- */
1467
+ */
14581468
14591469 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14601470 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -3527,6 +3537,8 @@
35273537 tab.graphs[i] = null;
35283538 }
35293539
3540
+ SetUndoStates();
3541
+
35303542 // test save
35313543 if (false)
35323544 {
....@@ -3549,6 +3561,8 @@
35493561
35503562 void CopyChanged(Object3D obj)
35513563 {
3564
+ SetUndoStates();
3565
+
35523566 boolean temp = CameraPane.SWITCH;
35533567 CameraPane.SWITCH = false;
35543568
....@@ -3586,6 +3600,17 @@
35863600 }
35873601
35883602 refreshContents();
3603
+ }
3604
+
3605
+ cButton undoButton;
3606
+ cButton redoButton;
3607
+
3608
+ void SetUndoStates()
3609
+ {
3610
+ cRadio tab = GetCurrentTab();
3611
+
3612
+ undoButton.setEnabled(tab.undoindex > 0);
3613
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
35893614 }
35903615
35913616 public void Undo()
....@@ -4765,6 +4790,8 @@
47654790 String filename = browser.getFile();
47664791 if (filename != null && filename.length() > 0)
47674792 {
4793
+ if (!filename.endsWith(".gfd"))
4794
+ filename += ".gfd";
47684795 lastname = browser.getDirectory() + filename;
47694796 save();
47704797 }
Object3D.java
....@@ -7994,6 +7994,8 @@
79947994 transient ObjEditor editWindow;
79957995 transient ObjEditor manipWindow;
79967996
7997
+ transient boolean pinned;
7998
+
79977999 transient ObjectUI objectUI;
79988000 public static int povDepth = 0;
79998001 private static cVector tbMin = new cVector();
icons/overlay.png
Binary files differ
icons/switch.png
Binary files differ