Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
GroupEditor.java
....@@ -368,16 +368,6 @@
368368 refreshContents();
369369 }
370370
371
- public void Show3DView()
372
- {
373
- // bug
374
- //gridPanel.setDividerLocation(1.0);
375
- //bigPanel.setDividerLocation(0.0);
376
- bigThree.ClearUI();
377
- bigThree.add(centralPanel);
378
- bigThree.FlushUI();
379
- }
380
-
381371 //ObjEditor objEditor;
382372 public void closeUI2()
383373 {
....@@ -493,11 +483,16 @@
493483
494484 Object3D parent = obj.parent;
495485 obj.parent = null;
486
+
496487 // Object3D support = obj.support;
497488 // obj.support = null;
498489 if (!supports)
499490 obj.SaveSupports();
491
+
500492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
501496 obj.parent = parent;
502497 // obj.support = support;
503498 // clone.support = support; // aout 2013
....@@ -567,8 +562,10 @@
567562 pasteLinkItem.addActionListener(this);
568563 pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
569564 pasteCloneItem.addActionListener(this);
570
-// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
571
-// pasteExpandItem.addActionListener(this);
565
+// CRASH
566
+ pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
567
+//
568
+ pasteExpandItem.addActionListener(this);
572569 //menu.add("-");
573570 oe.jTree.popup.addSeparator();
574571
....@@ -765,9 +762,9 @@
765762 shadowYItem.addActionListener(this);
766763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
767764 shadowZItem.addActionListener(this);
765
+
768766 attributeItem = menu.add(new MenuItem("Attribute"));
769767 attributeItem.addActionListener(this);
770
-
771768 if (Globals.ADVANCED)
772769 {
773770 menu.add("-");
....@@ -779,11 +776,18 @@
779776 pointflowItem.addActionListener(this);
780777 }
781778 menu.add("-");
779
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
780
+ textureRatioRItem.addActionListener(this);
781
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
782
+ textureRatioGItem.addActionListener(this);
783
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
784
+ textureRatioBItem.addActionListener(this);
785
+ menu.add("-");
782786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
783787 resetTransformItem.addActionListener(this);
784788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
785789 resetCentroidItem.addActionListener(this);
786
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
787791 resetCentroidXZItem.addActionListener(this);
788792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
789793 transformGeometryItem.addActionListener(this);
....@@ -799,7 +803,7 @@
799803 genNormalsCADItem.addActionListener(this);
800804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
801805 genNormalsMESHItem.addActionListener(this);
802
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
803807 {
804808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
805809 genNormalsMINEItem.addActionListener(this);
....@@ -962,7 +966,7 @@
962966 currenttab.setName(tabname);
963967 //added = false;
964968 resourcecontainer.add(currenttab);
965
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
966970 rowcount = 1;
967971 colcount = 0;
968972 texturecount = 0;
....@@ -977,6 +981,11 @@
977981 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
978982 }
979983
984
+ columns = 5;
985
+
986
+ if (path[0].contains("D&R") || path[0].contains("Paint"))
987
+ columns = 4;
988
+
980989 AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981990 totalcount++;
982991
....@@ -1074,13 +1083,17 @@
10741083 // }
10751084 // });
10761085
1086
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ fullScreenButton.setToolTipText("Full-screen window");
1088
+ fullScreenButton.addActionListener(this);
1089
+
10771090 oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10781091 collapseButton.setToolTipText("Collapse toolbar");
10791092 collapseButton.addActionListener(this);
10801093
1081
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1082
- maximize3DButton.setToolTipText("Maximize 3D view");
1083
- maximize3DButton.addActionListener(this);
1094
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1095
+// maximize3DButton.setToolTipText("Maximize 3D view");
1096
+// maximize3DButton.addActionListener(this);
10841097
10851098 oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861099 twoButton.setToolTipText("Show 3D view only");
....@@ -1100,10 +1113,6 @@
11001113 // sevenButton.setToolTipText("3-column layout");
11011114 // sevenButton.addActionListener(this);
11021115 //
1103
-
1104
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1105
- fullButton.setToolTipText("Full-screen window");
1106
- fullButton.addActionListener(this);
11071116
11081117 oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11091118 screenfitButton.setToolTipText("Screen fit");
....@@ -1191,6 +1200,7 @@
11911200 //clearButton.addActionListener(this);
11921201
11931202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11941204
11951205 // INSERT
11961206 row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1217,7 +1227,7 @@
12171227 torusButton.setToolTipText("Create torus");
12181228 torusButton.addActionListener(this);
12191229
1220
- if (Globals.ADVANCED)
1230
+ if (false) //Globals.ADVANCED)
12211231 {
12221232 oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231233 kleinButton.setToolTipText("Create Klein bottle");
....@@ -1231,6 +1241,7 @@
12311241 oe.toolboxPanel.add(row1);
12321242
12331243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
12341245
12351246 row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361247 groupButton.setToolTipText("Create group");
....@@ -1333,6 +1344,7 @@
13331344
13341345 oe.treePanel.add(versionManagerPanel);
13351346 oe.treePanel.Return();
1347
+
13361348 versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
13371349 versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
13381350 versionSliderPane.preferredHeight = 3;
....@@ -1392,7 +1404,7 @@
13921404 // supportCB.setToolTipText("Enable rigging");
13931405 // supportCB.addItemListener(this);
13941406
1395
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13961408 freezeCB.setToolTipText("Fast moving camera");
13971409 freezeCB.addItemListener(this);
13981410
....@@ -1401,9 +1413,12 @@
14011413
14021414 panel.Return();
14031415
1416
+ if (Globals.ADVANCED)
1417
+ {
14041418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
14051419 crowdCB.setToolTipText("Used for crowds");
14061420 crowdCB.addItemListener(this);
1421
+ }
14071422
14081423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
14091424 smoothCB.setToolTipText("Snapping delay");
....@@ -1416,30 +1431,26 @@
14161431 minshaderCB.setToolTipText("Minimal fast shader");
14171432 minshaderCB.addItemListener(this);
14181433
1419
-// constraints.gridy += 1;
14201434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
14211435 // speakerMocapCB.addItemListener(this);
14221436
1423
- panel.Return();
1424
-
14251437 if (false)
14261438 {
14271439 // handled in scripts
1428
- //constraints.gridy += 1;
14291440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
14301441 speakerCameraCB.addItemListener(this);
14311442
1432
- //constraints.gridy += 1;
14331443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
14341444 speakerFocusCB.addItemListener(this);
14351445
1436
- //constraints.gridy += 1;
1437
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1438
- smoothfocusCB.addItemListener(this);
14391446 panel.Return();
14401447 }
14411448
1442
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
14431454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
14441455 // debugCB.addItemListener(this);
14451456
....@@ -1493,7 +1504,7 @@
14931504
14941505 void EditObject(Object3D obj)
14951506 {
1496
- assert(obj instanceof Composite);
1507
+ //assert(obj instanceof Composite);
14971508
14981509 // if (obj.versionlist == null)
14991510 // {
....@@ -2078,7 +2089,7 @@
20782089 Object3D obj = (Object3D)group.selection.elementAt(0);
20792090 objEditor.ScreenFit(obj, false);
20802091
2081
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20822093 refreshContents();
20832094 }
20842095
....@@ -2115,7 +2126,7 @@
21152126 obj.parent.TransformToWorld(maxima); //, maxima);
21162127 }
21172128
2118
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
21192130
21202131 shadow.toParent = LA.newMatrix();
21212132 shadow.fromParent = LA.newMatrix();
....@@ -2715,11 +2726,11 @@
27152726 if (!group.selection.isEmpty())
27162727 {
27172728 Composite csg = new GroupLeaf();
2729
+ group(csg);
27182730 csg.count = 5;
27192731 Composite child = new cGroup("Branch");
27202732 csg.addChild(child);
27212733 child.addChild(csg);
2722
- group(csg);
27232734 }
27242735 } else
27252736 if (source == doubleItem)
....@@ -2727,6 +2738,7 @@
27272738 if (!group.selection.isEmpty())
27282739 {
27292740 Composite csg = new GroupLeaf("Fork");
2741
+ group(csg);
27302742 csg.count = 5;
27312743 Composite child = new cGroup("Branch A");
27322744 csg.addChild(child);
....@@ -2734,7 +2746,6 @@
27342746 child = new cGroup("Branch B");
27352747 csg.addChild(child);
27362748 child.addChild(csg);
2737
- group(csg);
27382749 }
27392750 } else
27402751 if (source == tripleItem)
....@@ -2800,7 +2811,7 @@
28002811 {
28012812 Maximize();
28022813 } else
2803
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
28042815 {
28052816 ToggleFullScreen();
28062817 } else
....@@ -2809,13 +2820,13 @@
28092820 this.expandedLayout = radio.layout;
28102821 CollapseToolbar();
28112822 } else
2812
- if (source == maximize3DButton)
2813
- {
2814
- this.expandedLayout = radio.layout;
2815
- radio.layout = twoButton;
2816
- Show3DView();
2817
- CollapseToolbar();
2818
- } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
28192830 if (source == previousVersionButton)
28202831 {
28212832 // Go to previous version
....@@ -2843,7 +2854,7 @@
28432854 if (source == saveVersionButton)
28442855 {
28452856 // Save a new version
2846
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
28472858 java.awt.Toolkit.getDefaultToolkit().beep();
28482859 } else
28492860 if (source == deleteVersionButton)
....@@ -3612,6 +3623,18 @@
36123623 {
36133624 TransformChildren();
36143625 } else
3626
+ if (source == textureRatioRItem)
3627
+ {
3628
+ TextureRatio(0);
3629
+ } else
3630
+ if (source == textureRatioGItem)
3631
+ {
3632
+ TextureRatio(1);
3633
+ } else
3634
+ if (source == textureRatioBItem)
3635
+ {
3636
+ TextureRatio(2);
3637
+ } else
36153638 if (source == resetTransformItem)
36163639 {
36173640 ResetTransform();
....@@ -3984,7 +4007,8 @@
39844007 if (source == closeButton)
39854008 {
39864009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
- Replace();
4010
+ if (copy.versionlist != null)
4011
+ Replace();
39884012
39894013 cRadio ab;
39904014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
....@@ -4084,7 +4108,8 @@
40844108 } else
40854109 if(source instanceof cRadio)
40864110 {
4087
- Replace();
4111
+ if (copy.versionlist != null)
4112
+ Replace();
40884113
40894114 group.parent = keepparent;
40904115 group.attributes = 0;
....@@ -4137,7 +4162,7 @@
41374162 */
41384163 radio.layout.doClick();
41394164
4140
- assert(copy instanceof Composite);
4165
+ //assert(copy instanceof Composite);
41414166
41424167 if (copy.versionlist == null)
41434168 {
....@@ -4148,9 +4173,10 @@
41484173 // and check if any of these nodes are reachable below the root.
41494174 Grafreed.grafreed.universe.TagObjects(copy, true);
41504175
4151
- if (copy.versionlist == null && !copy.HasTags())
4176
+ if (copy instanceof Composite && !copy.HasTags())
41524177 {
4153
- copy.versionlist = new Object3D[100];
4178
+ if (copy.versionlist == null)
4179
+ copy.versionlist = new Object3D[100];
41544180
41554181 //Save(true);
41564182 }
....@@ -4275,9 +4301,46 @@
42754301 refreshContents();
42764302 }
42774303
4304
+ void TextureRatio(int axis)
4305
+ {
4306
+ Object3D obj;
4307
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4308
+ {
4309
+ obj = (Object3D)e.nextElement();
4310
+ obj.TextureRatio(axis);
4311
+ }
4312
+
4313
+ refreshContents();
4314
+ }
4315
+
42784316 void ResetTransform()
42794317 {
42804318 ResetTransform(-1);
4319
+ }
4320
+
4321
+ void ScaleSelection(int scale)
4322
+ {
4323
+ Object3D obj;
4324
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4325
+ {
4326
+ obj = (Object3D)e.nextElement();
4327
+
4328
+ if (obj.toParent == null)
4329
+ continue;
4330
+
4331
+ obj.Scale(scale);
4332
+
4333
+ if (obj.parent == null)
4334
+ {
4335
+ System.out.println("NULL PARENT!");
4336
+ // new Exception().printStackTrace();
4337
+ }
4338
+ else
4339
+ TouchTransform(obj);
4340
+ //obj.parent.Touch();
4341
+ }
4342
+
4343
+ refreshContents();
42814344 }
42824345
42834346 void ResetTransform(int mask)
....@@ -4290,38 +4353,8 @@
42904353 if (obj.toParent == null)
42914354 continue;
42924355
4293
- if (mask == -1)
4294
- {
4295
- if (obj instanceof Camera) // jan 2014
4296
- {
4297
- LA.matIdentity(obj.toParent);
4298
- LA.matIdentity(obj.fromParent);
4299
- }
4300
- else
4301
- {
4302
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4303
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4304
- }
4305
- TouchTransform(obj);
4306
- continue;
4307
- }
4308
- if ((mask&2) != 0) // Scale/rotation
4309
- {
4310
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4311
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4312
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4313
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4314
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4315
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4316
- }
4317
- if ((mask&1) != 0) // Translation
4318
- {
4319
- if (obj.toParent != null)
4320
- {
4321
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4322
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4323
- }
4324
- }
4356
+ obj.ResetTransform(mask);
4357
+
43254358 if (obj.parent == null)
43264359 {
43274360 System.out.println("NULL PARENT!");
....@@ -4830,10 +4863,17 @@
48304863 {
48314864 Object3D obj = group.selection.get(i);
48324865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
48334872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48344873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48354874 }
48364875
4876
+ Globals.lighttouched = true;
48374877 refreshContents();
48384878 }
48394879
....@@ -5365,10 +5405,10 @@
53655405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53665406 // a camera
53675407 {
5368
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5408
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
53695409 {
53705410 CameraPane.camerachangeframe = 0; // don't refuse it
5371
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
53725412 }
53735413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
53745414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5412,12 +5452,12 @@
54125452 }
54135453 }
54145454
5415
- rootButton.setEnabled(allComposites);
5455
+ rootButton.setEnabled(true); // allComposites);
54165456 }
54175457
54185458 void refreshContents(boolean cp)
54195459 {
5420
- if (Globals.ADVANCED)
5460
+ if (Globals.SHOWINFO)
54215461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
54225462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
54235463 {
....@@ -6392,6 +6432,9 @@
63926432 private MenuItem maxTexturesItem;
63936433 private MenuItem panoTexturesItem;
63946434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
63956438 private MenuItem resetCentroidItem;
63966439 private MenuItem resetCentroidXZItem;
63976440 private MenuItem resetTransformItem;