Normand Briere
2019-09-02 21ac57b36a9e3b909853c7d64ac29b7ad72490a3
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 {
....@@ -765,9 +755,9 @@
765755 shadowYItem.addActionListener(this);
766756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
767757 shadowZItem.addActionListener(this);
758
+
768759 attributeItem = menu.add(new MenuItem("Attribute"));
769760 attributeItem.addActionListener(this);
770
-
771761 if (Globals.ADVANCED)
772762 {
773763 menu.add("-");
....@@ -779,11 +769,18 @@
779769 pointflowItem.addActionListener(this);
780770 }
781771 menu.add("-");
772
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
773
+ textureRatioRItem.addActionListener(this);
774
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
775
+ textureRatioGItem.addActionListener(this);
776
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
777
+ textureRatioBItem.addActionListener(this);
778
+ menu.add("-");
782779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
783780 resetTransformItem.addActionListener(this);
784781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
785782 resetCentroidItem.addActionListener(this);
786
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
787784 resetCentroidXZItem.addActionListener(this);
788785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
789786 transformGeometryItem.addActionListener(this);
....@@ -1074,13 +1071,17 @@
10741071 // }
10751072 // });
10761073
1074
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ fullScreenButton.setToolTipText("Full-screen window");
1076
+ fullScreenButton.addActionListener(this);
1077
+
10771078 oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10781079 collapseButton.setToolTipText("Collapse toolbar");
10791080 collapseButton.addActionListener(this);
10801081
1081
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1082
- maximize3DButton.setToolTipText("Maximize 3D view");
1083
- maximize3DButton.addActionListener(this);
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
10841085
10851086 oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861087 twoButton.setToolTipText("Show 3D view only");
....@@ -1100,10 +1101,6 @@
11001101 // sevenButton.setToolTipText("3-column layout");
11011102 // sevenButton.addActionListener(this);
11021103 //
1103
-
1104
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1105
- fullButton.setToolTipText("Full-screen window");
1106
- fullButton.addActionListener(this);
11071104
11081105 oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11091106 screenfitButton.setToolTipText("Screen fit");
....@@ -1217,7 +1214,7 @@
12171214 torusButton.setToolTipText("Create torus");
12181215 torusButton.addActionListener(this);
12191216
1220
- if (Globals.ADVANCED)
1217
+ if (false) //Globals.ADVANCED)
12211218 {
12221219 oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231220 kleinButton.setToolTipText("Create Klein bottle");
....@@ -1493,7 +1490,7 @@
14931490
14941491 void EditObject(Object3D obj)
14951492 {
1496
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14971494
14981495 // if (obj.versionlist == null)
14991496 // {
....@@ -2715,11 +2712,11 @@
27152712 if (!group.selection.isEmpty())
27162713 {
27172714 Composite csg = new GroupLeaf();
2715
+ group(csg);
27182716 csg.count = 5;
27192717 Composite child = new cGroup("Branch");
27202718 csg.addChild(child);
27212719 child.addChild(csg);
2722
- group(csg);
27232720 }
27242721 } else
27252722 if (source == doubleItem)
....@@ -2727,6 +2724,7 @@
27272724 if (!group.selection.isEmpty())
27282725 {
27292726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27302728 csg.count = 5;
27312729 Composite child = new cGroup("Branch A");
27322730 csg.addChild(child);
....@@ -2734,7 +2732,6 @@
27342732 child = new cGroup("Branch B");
27352733 csg.addChild(child);
27362734 child.addChild(csg);
2737
- group(csg);
27382735 }
27392736 } else
27402737 if (source == tripleItem)
....@@ -2800,7 +2797,7 @@
28002797 {
28012798 Maximize();
28022799 } else
2803
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
28042801 {
28052802 ToggleFullScreen();
28062803 } else
....@@ -2809,13 +2806,13 @@
28092806 this.expandedLayout = radio.layout;
28102807 CollapseToolbar();
28112808 } else
2812
- if (source == maximize3DButton)
2813
- {
2814
- this.expandedLayout = radio.layout;
2815
- radio.layout = twoButton;
2816
- Show3DView();
2817
- CollapseToolbar();
2818
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
28192816 if (source == previousVersionButton)
28202817 {
28212818 // Go to previous version
....@@ -3612,6 +3609,18 @@
36123609 {
36133610 TransformChildren();
36143611 } else
3612
+ if (source == textureRatioRItem)
3613
+ {
3614
+ TextureRatio(0);
3615
+ } else
3616
+ if (source == textureRatioGItem)
3617
+ {
3618
+ TextureRatio(1);
3619
+ } else
3620
+ if (source == textureRatioBItem)
3621
+ {
3622
+ TextureRatio(2);
3623
+ } else
36153624 if (source == resetTransformItem)
36163625 {
36173626 ResetTransform();
....@@ -3984,7 +3993,8 @@
39843993 if (source == closeButton)
39853994 {
39863995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
- Replace();
3996
+ if (copy.versionlist != null)
3997
+ Replace();
39883998
39893999 cRadio ab;
39904000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
....@@ -4084,7 +4094,8 @@
40844094 } else
40854095 if(source instanceof cRadio)
40864096 {
4087
- Replace();
4097
+ if (copy.versionlist != null)
4098
+ Replace();
40884099
40894100 group.parent = keepparent;
40904101 group.attributes = 0;
....@@ -4137,7 +4148,7 @@
41374148 */
41384149 radio.layout.doClick();
41394150
4140
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41414152
41424153 if (copy.versionlist == null)
41434154 {
....@@ -4148,9 +4159,10 @@
41484159 // and check if any of these nodes are reachable below the root.
41494160 Grafreed.grafreed.universe.TagObjects(copy, true);
41504161
4151
- if (copy.versionlist == null && !copy.HasTags())
4162
+ if (copy instanceof Composite && !copy.HasTags())
41524163 {
4153
- copy.versionlist = new Object3D[100];
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
41544166
41554167 //Save(true);
41564168 }
....@@ -4275,6 +4287,18 @@
42754287 refreshContents();
42764288 }
42774289
4290
+ void TextureRatio(int axis)
4291
+ {
4292
+ Object3D obj;
4293
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4294
+ {
4295
+ obj = (Object3D)e.nextElement();
4296
+ obj.TextureRatio(axis);
4297
+ }
4298
+
4299
+ refreshContents();
4300
+ }
4301
+
42784302 void ResetTransform()
42794303 {
42804304 ResetTransform(-1);
....@@ -4290,38 +4314,8 @@
42904314 if (obj.toParent == null)
42914315 continue;
42924316
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
- }
4317
+ obj.ResetTransform(mask);
4318
+
43254319 if (obj.parent == null)
43264320 {
43274321 System.out.println("NULL PARENT!");
....@@ -4829,6 +4823,12 @@
48294823 for (int i=0; i<group.selection.size(); i++)
48304824 {
48314825 Object3D obj = group.selection.get(i);
4826
+
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
48324832
48334833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48344834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
....@@ -5365,7 +5365,7 @@
53655365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53665366 // a camera
53675367 {
5368
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5368
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
53695369 {
53705370 CameraPane.camerachangeframe = 0; // don't refuse it
53715371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5412,12 +5412,12 @@
54125412 }
54135413 }
54145414
5415
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
54165416 }
54175417
54185418 void refreshContents(boolean cp)
54195419 {
5420
- if (Globals.ADVANCED)
5420
+ if (Globals.SHOWINFO)
54215421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
54225422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
54235423 {
....@@ -6392,6 +6392,9 @@
63926392 private MenuItem maxTexturesItem;
63936393 private MenuItem panoTexturesItem;
63946394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63956398 private MenuItem resetCentroidItem;
63966399 private MenuItem resetCentroidXZItem;
63976400 private MenuItem resetTransformItem;