Normand Briere
2019-08-26 6266c8a4b2485b29a7d5bcb217460d7aad3e1c4a
GroupEditor.java
....@@ -765,11 +765,11 @@
765765 shadowYItem.addActionListener(this);
766766 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
767767 shadowZItem.addActionListener(this);
768
- attributeItem = menu.add(new MenuItem("Attribute"));
769
- attributeItem.addActionListener(this);
770768
771769 if (Globals.ADVANCED)
772770 {
771
+ attributeItem = menu.add(new MenuItem("Attribute"));
772
+ attributeItem.addActionListener(this);
773773 menu.add("-");
774774 linkerItem = menu.add(new MenuItem("Linker"));
775775 linkerItem.addActionListener(this);
....@@ -779,11 +779,18 @@
779779 pointflowItem.addActionListener(this);
780780 }
781781 menu.add("-");
782
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
783
+ textureRatioRItem.addActionListener(this);
784
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
785
+ textureRatioGItem.addActionListener(this);
786
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
787
+ textureRatioBItem.addActionListener(this);
788
+ menu.add("-");
782789 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
783790 resetTransformItem.addActionListener(this);
784791 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
785792 resetCentroidItem.addActionListener(this);
786
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
793
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
787794 resetCentroidXZItem.addActionListener(this);
788795 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
789796 transformGeometryItem.addActionListener(this);
....@@ -1217,7 +1224,7 @@
12171224 torusButton.setToolTipText("Create torus");
12181225 torusButton.addActionListener(this);
12191226
1220
- if (Globals.ADVANCED)
1227
+ if (false) //Globals.ADVANCED)
12211228 {
12221229 oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231230 kleinButton.setToolTipText("Create Klein bottle");
....@@ -1493,7 +1500,7 @@
14931500
14941501 void EditObject(Object3D obj)
14951502 {
1496
- assert(obj instanceof Composite);
1503
+ //assert(obj instanceof Composite);
14971504
14981505 // if (obj.versionlist == null)
14991506 // {
....@@ -3612,6 +3619,18 @@
36123619 {
36133620 TransformChildren();
36143621 } else
3622
+ if (source == textureRatioRItem)
3623
+ {
3624
+ TextureRatio(0);
3625
+ } else
3626
+ if (source == textureRatioGItem)
3627
+ {
3628
+ TextureRatio(1);
3629
+ } else
3630
+ if (source == textureRatioBItem)
3631
+ {
3632
+ TextureRatio(2);
3633
+ } else
36153634 if (source == resetTransformItem)
36163635 {
36173636 ResetTransform();
....@@ -3984,7 +4003,8 @@
39844003 if (source == closeButton)
39854004 {
39864005 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
- Replace();
4006
+ if (copy.versionlist != null)
4007
+ Replace();
39884008
39894009 cRadio ab;
39904010 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
....@@ -4084,7 +4104,8 @@
40844104 } else
40854105 if(source instanceof cRadio)
40864106 {
4087
- Replace();
4107
+ if (copy.versionlist != null)
4108
+ Replace();
40884109
40894110 group.parent = keepparent;
40904111 group.attributes = 0;
....@@ -4137,7 +4158,7 @@
41374158 */
41384159 radio.layout.doClick();
41394160
4140
- assert(copy instanceof Composite);
4161
+ //assert(copy instanceof Composite);
41414162
41424163 if (copy.versionlist == null)
41434164 {
....@@ -4148,7 +4169,7 @@
41484169 // and check if any of these nodes are reachable below the root.
41494170 Grafreed.grafreed.universe.TagObjects(copy, true);
41504171
4151
- if (copy.versionlist == null && !copy.HasTags())
4172
+ if (copy instanceof Composite && copy.versionlist == null && !copy.HasTags())
41524173 {
41534174 copy.versionlist = new Object3D[100];
41544175
....@@ -4275,6 +4296,18 @@
42754296 refreshContents();
42764297 }
42774298
4299
+ void TextureRatio(int axis)
4300
+ {
4301
+ Object3D obj;
4302
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4303
+ {
4304
+ obj = (Object3D)e.nextElement();
4305
+ obj.TextureRatio(axis);
4306
+ }
4307
+
4308
+ refreshContents();
4309
+ }
4310
+
42784311 void ResetTransform()
42794312 {
42804313 ResetTransform(-1);
....@@ -4290,38 +4323,8 @@
42904323 if (obj.toParent == null)
42914324 continue;
42924325
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
- }
4326
+ obj.ResetTransform(mask);
4327
+
43254328 if (obj.parent == null)
43264329 {
43274330 System.out.println("NULL PARENT!");
....@@ -4829,6 +4832,12 @@
48294832 for (int i=0; i<group.selection.size(); i++)
48304833 {
48314834 Object3D obj = group.selection.get(i);
4835
+
4836
+ if (obj.toParent == null)
4837
+ {
4838
+ obj.toParent = LA.newMatrix();
4839
+ obj.fromParent = LA.newMatrix();
4840
+ }
48324841
48334842 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48344843 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
....@@ -5412,7 +5421,7 @@
54125421 }
54135422 }
54145423
5415
- rootButton.setEnabled(allComposites);
5424
+ rootButton.setEnabled(true); // allComposites);
54165425 }
54175426
54185427 void refreshContents(boolean cp)
....@@ -6392,6 +6401,9 @@
63926401 private MenuItem maxTexturesItem;
63936402 private MenuItem panoTexturesItem;
63946403
6404
+ private MenuItem textureRatioRItem;
6405
+ private MenuItem textureRatioGItem;
6406
+ private MenuItem textureRatioBItem;
63956407 private MenuItem resetCentroidItem;
63966408 private MenuItem resetCentroidXZItem;
63976409 private MenuItem resetTransformItem;