Normand Briere
2019-08-15 33504fc9a180903aace77613264550754fba5706
GroupEditor.java
....@@ -540,32 +540,37 @@
540540 // menu.add("-");
541541 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
542542 duplicateItem.addActionListener(this);
543
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
544545 cloneItem.addActionListener(this);
545
- if (Globals.ADVANCED)
546
+ //if (Globals.ADVANCED)
546547 {
547548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
548549 cloneSupportItem.addActionListener(this);
549550 }
551
+ oe.jTree.popup.addSeparator();
550552 menu.add("-");
551
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
552554 cutItem.addActionListener(this);
553
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
554556 copyItem.addActionListener(this);
555557 pasteItem = menu.add(new MenuItem("Paste"));
556558 pasteItem.addActionListener(this);
557559
558
- menu.add("-");
559
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
560
+ oe.jTree.popup.addSeparator();
561
+ //menu.add("-");
562
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
560563 pasteIntoItem.addActionListener(this);
561
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
562565 pasteLinkItem.addActionListener(this);
563
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
564567 pasteCloneItem.addActionListener(this);
565
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
566569 // pasteExpandItem.addActionListener(this);
567
- menu.add("-");
568
- deleteItem = menu.add(new MenuItem("Delete"));
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
572
+
573
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
569574 deleteItem.addActionListener(this);
570575
571576 if (Globals.ADVANCED)
....@@ -716,7 +721,7 @@
716721 hideItem = menu.add(new MenuItem("Hidden Group"));
717722 hideItem.addActionListener(this);
718723 }
719
- ungroupItem = menu.add(new MenuItem("Ungroup"));
724
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
720725 ungroupItem.addActionListener(this);
721726
722727 // menu.add("-");
....@@ -923,7 +928,7 @@
923928
924929 JTabbedPane resourcecontainer;
925930 cGridBag currenttab;
926
- boolean added; // patch for jar
931
+ //boolean added; // patch for jar
927932
928933 int tabcount = 0;
929934 int colcount = 0;
....@@ -940,12 +945,14 @@
940945 // System.out.println();
941946
942947 if (//rowcount == 0 ||
943
- path.length == 1)
948
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
944949 {
945950 currenttab = new cGridBag();
946
- added = false;
947951 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948952 currenttab.setName(tabname);
953
+ //added = false;
954
+ resourcecontainer.add(currenttab);
955
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
949956 rowcount = 1;
950957 colcount = 0;
951958 texturecount = 0;
....@@ -953,12 +960,11 @@
953960
954961 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
955962 {
956
- if (!added)
963
+ //if (!added)
957964 {
958
- added = true;
959
- resourcecontainer.add(currenttab);
965
+ //added = true;
960966 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
967
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
962968 }
963969
964970 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -1181,6 +1187,10 @@
11811187 boxButton.setToolTipText("Create box");
11821188 boxButton.addActionListener(this);
11831189
1190
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ superButton.setToolTipText("Create superellipsoid");
1192
+ superButton.addActionListener(this);
1193
+
11841194 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11851195 sphereButton.setToolTipText("Create sphere");
11861196 sphereButton.addActionListener(this);
....@@ -1192,10 +1202,6 @@
11921202 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11931203 torusButton.setToolTipText("Create torus");
11941204 torusButton.addActionListener(this);
1195
-
1196
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
- superButton.setToolTipText("Create superellipsoid");
1198
- superButton.addActionListener(this);
11991205
12001206 if (Globals.ADVANCED)
12011207 {
....@@ -2159,7 +2165,11 @@
21592165 shadow.material = new cMaterial(obj.material);
21602166 shadow.material.diffuse = 0.0001f;
21612167 shadow.material.specular = 0.0001f;
2162
- //shadow.projectedVertices[1].x = 300;
2168
+ shadow.material.opacity = 0.75f;
2169
+
2170
+ AllocProjectedVertices(shadow);
2171
+
2172
+ shadow.projectedVertices[1].x = 300;
21632173
21642174 makeSomething(shadow);
21652175 }
....@@ -2680,27 +2690,35 @@
26802690 } else
26812691 if (source == loopItem || source == loopButton)
26822692 {
2693
+ if (!group.selection.isEmpty())
2694
+ {
26832695 Composite csg = new GroupLeaf();
26842696 csg.count = 5;
2685
- group(csg);
26862697 Composite child = new cGroup("Branch");
26872698 csg.addChild(child);
26882699 child.addChild(csg);
2700
+ group(csg);
2701
+ }
26892702 } else
26902703 if (source == doubleItem)
26912704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
26922707 Composite csg = new GroupLeaf("Fork");
26932708 csg.count = 5;
2694
- group(csg);
26952709 Composite child = new cGroup("Branch A");
26962710 csg.addChild(child);
26972711 child.addChild(csg);
26982712 child = new cGroup("Branch B");
26992713 csg.addChild(child);
27002714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
27012717 } else
27022718 if (source == tripleItem)
27032719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
27042722 Composite csg = new GroupLeaf("Trident");
27052723 csg.count = 4;
27062724 group(csg);
....@@ -2713,6 +2731,7 @@
27132731 child = new cGroup();
27142732 csg.addChild(child);
27152733 child.addChild(csg);
2734
+ }
27162735 } else
27172736 if (source == computeAOItem)
27182737 {
....@@ -3348,22 +3367,34 @@
33483367 } else
33493368 if (source == ungroupItem || source == ungroupButton)
33503369 {
3351
- boolean hasRoot = false;
3370
+ boolean canUngroup = true;
33523371
33533372 for (int i=0; i<group.selection.size(); i++)
33543373 {
3355
- if (group.selection.get(i) == group)
3374
+ Object3D selectedItem = group.selection.get(i);
3375
+
3376
+ if (selectedItem.Size() == 0)
33563377 {
3357
- hasRoot = true;
3378
+ // Cannot ungroup leaves
3379
+ canUngroup = false;
3380
+ break;
3381
+ }
3382
+
3383
+ if (selectedItem == group)
3384
+ {
3385
+ // Cannot ungroup root
3386
+ canUngroup = false;
33583387 break;
33593388 }
33603389 }
33613390
3362
- if (!hasRoot)
3391
+ if (canUngroup)
33633392 {
33643393 for (int i=0; i<group.selection.size(); i++)
33653394 {
3366
- Ungroup(group.selection.get(i));
3395
+ Object3D selectedItem = group.selection.get(i);
3396
+
3397
+ Ungroup(selectedItem);
33673398 }
33683399
33693400 ClearSelection(false);
....@@ -6233,11 +6264,11 @@
62336264 private MenuItem lookAtItem;
62346265 private MenuItem lookFromItem;
62356266 private MenuItem switchViewItem;
6236
- private MenuItem cutItem;
6267
+ private JMenuItem cutItem;
62376268 private MenuItem undoItem;
62386269 private MenuItem redoItem;
62396270 private JMenuItem duplicateItem;
6240
- private MenuItem cloneItem;
6271
+ private JMenuItem cloneItem;
62416272 private MenuItem cloneSupportItem;
62426273 private MenuItem overwriteGeoItem;
62436274 private MenuItem overwriteMatItem;
....@@ -6258,13 +6289,13 @@
62586289 private MenuItem cloneGeometriesItem;
62596290 private MenuItem shareGeometriesItem;
62606291 private MenuItem mergeGeometriesItem;
6261
- private MenuItem copyItem;
6292
+ private JMenuItem copyItem;
62626293 private MenuItem pasteItem;
6263
- private MenuItem pasteIntoItem;
6264
- private MenuItem pasteLinkItem;
6265
- private MenuItem pasteCloneItem;
6266
- private MenuItem pasteExpandItem;
6267
- private MenuItem deleteItem;
6294
+ private JMenuItem pasteIntoItem;
6295
+ private JMenuItem pasteLinkItem;
6296
+ private JMenuItem pasteCloneItem;
6297
+ private JMenuItem pasteExpandItem;
6298
+ private JMenuItem deleteItem;
62686299 private MenuItem clearAllItem;
62696300 private MenuItem genUVItem;
62706301 private MenuItem genNormalsMESHItem;
....@@ -6332,7 +6363,7 @@
63326363 private MenuItem switchTransfoItem;
63336364 private MenuItem morphItem;
63346365 private MenuItem linkerItem;
6335
- private MenuItem ungroupItem;
6366
+ private JMenuItem ungroupItem;
63366367 private MenuItem editItem;
63376368 private MenuItem openWindowItem;
63386369 private MenuItem editLeafItem;