Normand Briere
2019-08-17 07c0c67b88160b51e61c5c1d2b9b602daafa44a9
GroupEditor.java
....@@ -415,12 +415,14 @@
415415 this.copy = this.group = group;
416416 //selectees = this.group.selectees;
417417
418
+ assert(false);
419
+
418420 if (copy.versionlist == null)
419421 {
420422 copy.versionlist = new Object3D[100];
421423 copy.versionindex = -1;
422424
423
- Save(true);
425
+ //Save(true);
424426 }
425427
426428 if(ui)
....@@ -449,7 +451,7 @@
449451 copy.versionlist = new Object3D[100];
450452 copy.versionindex = -1;
451453
452
- Save(true);
454
+ //Save(true);
453455 }
454456 }
455457
....@@ -569,9 +571,6 @@
569571 // pasteExpandItem.addActionListener(this);
570572 //menu.add("-");
571573 oe.jTree.popup.addSeparator();
572
-
573
- deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
- deleteItem.addActionListener(this);
575574
576575 if (Globals.ADVANCED)
577576 {
....@@ -706,15 +705,17 @@
706705 setMasterItem.addActionListener(this);
707706 }
708707
709
- oe.menuBar.add(menu = new Menu("Group"));
710
-// grabItem = menu.add(new MenuItem("Grab"));
711
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
712710 backItem = menu.add(new MenuItem("Back"));
713711 backItem.addActionListener(this);
714712 frontItem = menu.add(new MenuItem("Front"));
715713 frontItem.addActionListener(this);
716714 // compositeItem = menu.add(new MenuItem("Composite"));
717715 // compositeItem.addActionListener(this);
716
+
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
718719
719720 if (Globals.ADVANCED)
720721 {
....@@ -723,6 +724,11 @@
723724 }
724725 ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
726732
727733 // menu.add("-");
728734 //
....@@ -928,7 +934,7 @@
928934
929935 JTabbedPane resourcecontainer;
930936 cGridBag currenttab;
931
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
932938
933939 int tabcount = 0;
934940 int colcount = 0;
....@@ -940,17 +946,19 @@
940946
941947 public void ResourceCallBack(String[] path)
942948 {
943
- for (int i = 0; i < path.length; i++)
944
- System.out.print(path[i] + "/");
945
- System.out.println();
949
+// for (int i = 0; i < path.length; i++)
950
+// System.out.print(path[i] + "/");
951
+// System.out.println();
946952
947953 if (//rowcount == 0 ||
948
- path.length == 1)
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949955 {
950956 currenttab = new cGridBag();
951
- added = false;
952957 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
953958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
954962 rowcount = 1;
955963 colcount = 0;
956964 texturecount = 0;
....@@ -958,12 +966,11 @@
958966
959967 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
960968 {
961
- if (!added)
969
+ //if (!added)
962970 {
963
- added = true;
964
- resourcecontainer.add(currenttab);
971
+ //added = true;
965972 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
967974 }
968975
969976 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -1064,7 +1071,7 @@
10641071 collapseButton.setToolTipText("Collapse toolbar");
10651072 collapseButton.addActionListener(this);
10661073
1067
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10681075 maximize3DButton.setToolTipText("Maximize 3D view");
10691076 maximize3DButton.addActionListener(this);
10701077
....@@ -1106,6 +1113,7 @@
11061113 copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11071114 deleteVersionButton.setToolTipText("Delete current version");
11081115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
11091117
11101118 copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11111119 previousVersionButton.setToolTipText("Previous version");
....@@ -1116,12 +1124,12 @@
11161124 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11171125 restoreButton.setToolTipText("Undo (restore current version)");
11181126 restoreButton.addActionListener(this);
1119
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
11201128
11211129 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11221130 replaceButton.setToolTipText("Save (replace current version)");
11231131 replaceButton.addActionListener(this);
1124
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
11251133
11261134 copyOptionsPanel.add(updown);
11271135
....@@ -1186,6 +1194,10 @@
11861194 boxButton.setToolTipText("Create box");
11871195 boxButton.addActionListener(this);
11881196
1197
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ superButton.setToolTipText("Create superellipsoid");
1199
+ superButton.addActionListener(this);
1200
+
11891201 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11901202 sphereButton.setToolTipText("Create sphere");
11911203 sphereButton.addActionListener(this);
....@@ -1197,10 +1209,6 @@
11971209 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11981210 torusButton.setToolTipText("Create torus");
11991211 torusButton.addActionListener(this);
1200
-
1201
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1202
- superButton.setToolTipText("Create superellipsoid");
1203
- superButton.addActionListener(this);
12041212
12051213 if (Globals.ADVANCED)
12061214 {
....@@ -1250,6 +1258,8 @@
12501258 cGridBag textures = new cGridBag();
12511259
12521260 CreateTexturePanel(textures);
1261
+
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
12531263
12541264 oe.toolboxPanel.add(textures);
12551265
....@@ -1503,6 +1513,7 @@
15031513
15041514 oe.SetupViews();
15051515
1516
+ if (Globals.DEBUG)
15061517 System.out.println("SetupViews");
15071518 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15081519 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2164,7 +2175,11 @@
21642175 shadow.material = new cMaterial(obj.material);
21652176 shadow.material.diffuse = 0.0001f;
21662177 shadow.material.specular = 0.0001f;
2167
- //shadow.projectedVertices[1].x = 300;
2178
+ shadow.material.opacity = 0.75f;
2179
+
2180
+ AllocProjectedVertices(shadow);
2181
+
2182
+ shadow.projectedVertices[1].x = 300;
21682183
21692184 makeSomething(shadow);
21702185 }
....@@ -4109,7 +4124,10 @@
41094124 copy.versionlist = new Object3D[100];
41104125 copy.versionindex = -1;
41114126
4112
- Save(true);
4127
+ // Cannot work with loops
4128
+ // To fix this issue, first mark all nodes above the root,
4129
+ // and check if any of these nodes are reachable below the root.
4130
+ //Save(true);
41134131 }
41144132
41154133 SetVersionStates();
....@@ -5354,7 +5372,8 @@
53545372 if (group.selection != null)
53555373 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53565374 {
5357
- if (!(e.nextElement() instanceof Composite))
5375
+ Object next = e.nextElement();
5376
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53585377 {
53595378 allComposites = false;
53605379 break;
....@@ -6345,7 +6364,7 @@
63456364 private MenuItem transformGeometryItem;
63466365 private MenuItem transformChildrenItem;
63476366 private MenuItem hideItem;
6348
- private MenuItem grabItem;
6367
+ private JMenuItem grabItem;
63496368 private MenuItem backItem;
63506369 private MenuItem frontItem;
63516370 private MenuItem cameraItem;