Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
Object3D.java
....@@ -22,12 +22,21 @@
2222 //static final long serialVersionUID = -607422624994562685L;
2323 static final long serialVersionUID = 5022536242724664900L;
2424
25
+ // Use GetUUID for backward compatibility with null.
2526 private UUID uuid = UUID.randomUUID();
2627
27
- // TEMPORARY for mocap undo
28
- mocap.reader.BVHReader.BVHResult bvh;
29
- Object3D skeleton;
28
+ // TEMPORARY for mocap undo. No need to be transient.
29
+ mocap.reader.BVHReader.BVHResult savebvh;
30
+ Object3D saveskeleton;
3031 //
32
+
33
+ String skyboxname;
34
+ String skyboxext;
35
+
36
+ Object3D versionlist[];
37
+ int versionindex = -1;
38
+
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
3140
3241 ScriptNode scriptnode;
3342
....@@ -170,24 +179,35 @@
170179
171180 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172181 {
182
+ Object3D o;
183
+
173184 if (hashtable.containsKey(GetUUID()))
174185 {
175
- Object3D o = hashtable.get(GetUUID());
186
+ o = hashtable.get(GetUUID());
176187
177
- assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
188
+ Grafreed.Assert(this.bRep == o.bRep);
189
+ //if (this.bRep != null)
190
+ // assert(this.bRep.support == o.transientrep);
191
+ if (this.support != null)
192
+ assert(this.support.bRep == o.transientrep);
193
+ }
194
+ else
195
+ {
196
+ o = new Object3D("copy of " + this.name);
180197
181
- return;
198
+ hashtable.put(GetUUID(), o);
182199 }
183200
184
- Object3D o = new Object3D();
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
201
+ if (!blockloop)
189202 {
190
- get(i).ExtractBigData(hashtable);
203
+ blockloop = true;
204
+
205
+ for (int i=0; i<Size(); i++)
206
+ {
207
+ get(i).ExtractBigData(hashtable);
208
+ }
209
+
210
+ blockloop = false;
191211 }
192212
193213 ExtractBigData(o);
....@@ -195,11 +215,26 @@
195215
196216 void ExtractBigData(Object3D o)
197217 {
218
+ if (o.bRep != null)
219
+ Grafreed.Assert(o.bRep == this.bRep);
220
+
198221 o.bRep = this.bRep;
199
- if (this.bRep != null)
222
+// July 2019 if (this.bRep != null)
223
+// {
224
+// o.transientrep = this.bRep.support;
225
+// o.bRep.support = null;
226
+// }
227
+ o.selection = this.selection;
228
+ o.versionlist = this.versionlist;
229
+ o.versionindex = this.versionindex;
230
+
231
+ if (this.support != null)
200232 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
233
+ if (o.transientrep != null)
234
+ Grafreed.Assert(o.transientrep == this.support.bRep);
235
+
236
+ o.transientrep = this.support.bRep;
237
+ this.support.bRep = null;
203238 }
204239
205240 // o.support = this.support;
....@@ -214,6 +249,73 @@
214249 // this.fileparent = null;
215250 }
216251
252
+// Object3D GetObject(java.util.UUID uuid)
253
+// {
254
+// if (this.uuid.equals(uuid))
255
+// return this;
256
+//
257
+// if (blockloop)
258
+// return null;
259
+//
260
+// blockloop = true;
261
+//
262
+// for (int i=0; i<Size(); i++)
263
+// {
264
+// Object3D o = get(i).GetObject(uuid);
265
+//
266
+// if (o != null)
267
+// return o;
268
+// }
269
+//
270
+// blockloop = false;
271
+//
272
+// return null;
273
+// }
274
+
275
+ transient boolean tag;
276
+
277
+ void TagObjects(Object3D o, boolean tag)
278
+ {
279
+ if (blockloop)
280
+ return;
281
+
282
+ o.tag = tag;
283
+
284
+ if (o == this)
285
+ return;
286
+
287
+ blockloop = true;
288
+
289
+ for (int i=0; i<Size(); i++)
290
+ {
291
+ get(i).TagObjects(o, tag);
292
+ }
293
+
294
+ blockloop = false;
295
+ }
296
+
297
+ boolean HasTags()
298
+ {
299
+ if (blockloop)
300
+ return false;
301
+
302
+ blockloop = true;
303
+
304
+ boolean hasTags = false;
305
+
306
+ for (int i=0; i<Size(); i++)
307
+ {
308
+ hasTags |= get(i).tag || get(i).HasTags();
309
+
310
+ if (hasTags)
311
+ break;
312
+ }
313
+
314
+ blockloop = false;
315
+
316
+ return hasTags;
317
+ }
318
+
217319 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
218320 {
219321 if (!hashtable.containsKey(GetUUID()))
....@@ -223,19 +325,35 @@
223325
224326 RestoreBigData(o);
225327
226
- hashtable.remove(GetUUID());
328
+ if (blockloop)
329
+ return;
330
+
331
+ blockloop = true;
332
+
333
+ //hashtable.remove(GetUUID());
227334
228335 for (int i=0; i<Size(); i++)
229336 {
230337 get(i).RestoreBigData(hashtable);
231338 }
339
+
340
+ blockloop = false;
232341 }
233342
234343 void RestoreBigData(Object3D o)
235344 {
236345 this.bRep = o.bRep;
237
- if (this.bRep != null)
238
- this.bRep.support = o.transientrep;
346
+ if (this.support != null && o.transientrep != null)
347
+ {
348
+ this.support.bRep = o.transientrep;
349
+ }
350
+
351
+ this.selection = o.selection;
352
+
353
+ this.versionlist = o.versionlist;
354
+ this.versionindex = o.versionindex;
355
+// July 2019 if (this.bRep != null)
356
+// this.bRep.support = o.transientrep;
239357 // this.support = o.support;
240358 // this.fileparent = o.fileparent;
241359 }
....@@ -381,6 +499,7 @@
381499 }
382500
383501 boolean live = false;
502
+ transient boolean keepdontselect;
384503 boolean dontselect = false;
385504 boolean hide = false;
386505 boolean link2master = false; // performs reset support/master at each frame
....@@ -563,12 +682,14 @@
563682 toParent = LA.newMatrix();
564683 fromParent = LA.newMatrix();
565684 }
685
+
566686 if (toParentMarked == null)
567687 {
568688 if (maxcount != 1)
569689 {
570
- new Exception().printStackTrace();
690
+ //new Exception().printStackTrace();
571691 }
692
+
572693 toParentMarked = LA.newMatrix();
573694 fromParentMarked = LA.newMatrix();
574695 }
....@@ -879,7 +1000,7 @@
8791000
8801001 if (marked && Globals.isLIVE() && live &&
8811002 //TEMP21aug2018
882
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
1003
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
8831004 currentframe != Globals.framecount)
8841005 {
8851006 currentframe = Globals.framecount;
....@@ -891,7 +1012,8 @@
8911012
8921013 boolean changedir = random && Math.random() < 0.01; // && !link2master;
8931014
894
- if (transformcount*factor > maxcount || (step == 1 && changedir))
1015
+ if (transformcount*factor >= maxcount && (rewind || random) ||
1016
+ (step == 1 && changedir))
8951017 {
8961018 countdown = 1;
8971019 delay = speedup?8:1;
....@@ -963,6 +1085,10 @@
9631085 if (material == null || material.multiply)
9641086 return true;
9651087
1088
+ if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
1089
+ return false;
1090
+
1091
+ // Transparent objects are dynamic because we have to sort the triangles.
9661092 return material.opacity > 0.99;
9671093 }
9681094
....@@ -1363,6 +1489,7 @@
13631489 toParent = LA.newMatrix();
13641490 fromParent = LA.newMatrix();
13651491 }
1492
+
13661493 LA.matCopy(other.toParent, toParent);
13671494 LA.matCopy(other.fromParent, fromParent);
13681495
....@@ -2242,11 +2369,6 @@
22422369
22432370 InitOthers();
22442371
2245
- if (this instanceof Camera)
2246
- {
2247
- material.shift = 90;
2248
- }
2249
-
22502372 material.multiply = multiply;
22512373
22522374 if (multiply)
....@@ -2384,6 +2506,15 @@
23842506 }
23852507 */
23862508 }
2509
+ else
2510
+ {
2511
+ //((ObjEditor)editWindow).SetupUI2(null);
2512
+ if (objectUI != null)
2513
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2514
+ else
2515
+ //new Exception().printStackTrace();
2516
+ System.err.println("objectUI is null");
2517
+ }
23872518 }
23882519
23892520 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2425,6 +2556,14 @@
24252556 {
24262557 editWindow.refreshContents();
24272558 }
2559
+ else
2560
+ {
2561
+ if (manipWindow != null)
2562
+ {
2563
+ manipWindow.refreshContents();
2564
+ }
2565
+ }
2566
+
24282567 //if (parent != null)
24292568 //parent.refreshEditWindow();
24302569 }
....@@ -2504,7 +2643,8 @@
25042643 private static final int editSelf = 1;
25052644 private static final int editChild = 2;
25062645
2507
- void drawEditHandles(ClickInfo info, int level)
2646
+ void drawEditHandles(//ClickInfo info,
2647
+ int level)
25082648 {
25092649 if (level == 0)
25102650 {
....@@ -2512,7 +2652,8 @@
25122652 return;
25132653
25142654 Object3D selectee;
2515
- for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1))
2655
+ for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info,
2656
+ level + 1))
25162657 {
25172658 selectee = (Object3D) e.nextElement();
25182659 }
....@@ -2520,19 +2661,22 @@
25202661 } else
25212662 {
25222663 //super.
2523
- drawEditHandles0(info, level + 1);
2664
+ drawEditHandles0(//info,
2665
+ level + 1);
25242666 }
25252667 }
25262668
2527
- boolean doEditClick(ClickInfo info, int level)
2669
+ boolean doEditClick(//ClickInfo info,
2670
+ int level)
25282671 {
25292672 doSomething = 0;
25302673 if (level == 0)
25312674 {
2532
- return doParentClick(info);
2675
+ return doParentClick(); //info);
25332676 }
25342677 if (//super.
2535
- doEditClick0(info, level))
2678
+ doEditClick0(//info,
2679
+ level))
25362680 {
25372681 doSomething = 1;
25382682 return true;
....@@ -2542,7 +2686,7 @@
25422686 }
25432687 }
25442688
2545
- boolean doParentClick(ClickInfo info)
2689
+ boolean doParentClick() //ClickInfo info)
25462690 {
25472691 if (selection == null)
25482692 {
....@@ -2555,7 +2699,8 @@
25552699 for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();)
25562700 {
25572701 Object3D selectee = (Object3D) e.nextElement();
2558
- if (selectee.doEditClick(info, 1))
2702
+ if (selectee.doEditClick(//info,
2703
+ 1))
25592704 {
25602705 childToDrag = selectee;
25612706 doSomething = 2;
....@@ -2567,13 +2712,15 @@
25672712 return retval;
25682713 }
25692714
2570
- void doEditDrag(ClickInfo info, boolean opposite)
2715
+ void doEditDrag(//ClickInfo clickInfo,
2716
+ boolean opposite)
25712717 {
25722718 switch (doSomething)
25732719 {
25742720 case 1: // '\001'
25752721 //super.
2576
- doEditDrag0(info, opposite);
2722
+ doEditDrag0(//clickInfo,
2723
+ opposite);
25772724 break;
25782725
25792726 case 2: // '\002'
....@@ -2586,11 +2733,13 @@
25862733 {
25872734 //sel.hitSomething = childToDrag.hitSomething;
25882735 //childToDrag.doEditDrag(info);
2589
- sel.doEditDrag(info, opposite);
2736
+ sel.doEditDrag(//clickInfo,
2737
+ opposite);
25902738 } else
25912739 {
25922740 //super.
2593
- doEditDrag0(info, opposite);
2741
+ doEditDrag0(//clickInfo,
2742
+ opposite);
25942743 }
25952744 }
25962745 break;
....@@ -2608,6 +2757,9 @@
26082757 {
26092758 deselectAll();
26102759 }
2760
+
2761
+ new Exception().printStackTrace();
2762
+
26112763 ClickInfo newInfo = new ClickInfo();
26122764 newInfo.flags = info.flags;
26132765 newInfo.bounds = info.bounds;
....@@ -3055,7 +3207,7 @@
30553207 {
30563208 if (bRep != null)
30573209 {
3058
- bRep.GenerateNormalsMINE();
3210
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30593211 Touch();
30603212 }
30613213 }
....@@ -3465,15 +3617,47 @@
34653617
34663618 void ClearMaterials()
34673619 {
3620
+ if (blockloop)
3621
+ return;
3622
+
3623
+ blockloop = true;
3624
+
34683625 ClearMaterial();
3469
- for (int i = 0; i < size(); i++)
3626
+ for (int i = 0; i < Size(); i++)
34703627 {
3471
- Object3D child = (Object3D) reserve(i);
3628
+ Object3D child = (Object3D) get(i);
34723629 if (child == null)
34733630 continue;
34743631 child.ClearMaterials();
3475
- release(i);
34763632 }
3633
+
3634
+ blockloop = false;
3635
+ }
3636
+
3637
+ void ClearVersionList()
3638
+ {
3639
+ this.versionlist = null;
3640
+ this.versionindex = -1;
3641
+ this.versiontable = null;
3642
+ }
3643
+
3644
+ void ClearVersions()
3645
+ {
3646
+ if (blockloop)
3647
+ return;
3648
+
3649
+ blockloop = true;
3650
+
3651
+ ClearVersionList();
3652
+ for (int i = 0; i < Size(); i++)
3653
+ {
3654
+ Object3D child = (Object3D) get(i);
3655
+ if (child == null)
3656
+ continue;
3657
+ child.ClearVersions();
3658
+ }
3659
+
3660
+ blockloop = false;
34773661 }
34783662
34793663 void FlipV(boolean flip)
....@@ -3501,7 +3685,8 @@
35013685 if (blockloop)
35023686 return;
35033687
3504
- if (marked || (bRep != null && material != null)) // borderline...
3688
+ if (//marked || // does not make sense
3689
+ (bRep != null || material != null)) // borderline...
35053690 live = h;
35063691
35073692 for (int i = 0; i < Size(); i++)
....@@ -3522,7 +3707,8 @@
35223707 return;
35233708
35243709 //if (bRep != null)
3525
- if (marked || (bRep != null && material != null)) // borderline...
3710
+ if (//marked || // does not make sense
3711
+ (bRep != null || material != null)) // borderline...
35263712 link2master = h;
35273713
35283714 for (int i = 0; i < Size(); i++)
....@@ -3542,7 +3728,8 @@
35423728 if (blockloop)
35433729 return;
35443730
3545
- if (marked || (bRep != null && material != null)) // borderline...
3731
+ if (//marked || // does not make sense
3732
+ (bRep != null || material != null)) // borderline...
35463733 hide = h;
35473734
35483735 for (int i = 0; i < Size(); i++)
....@@ -3562,7 +3749,7 @@
35623749 if (blockloop)
35633750 return;
35643751
3565
- if (bRep != null && material != null) // borderline...
3752
+ if (bRep != null || material != null) // borderline...
35663753 marked = h;
35673754
35683755 for (int i = 0; i < Size(); i++)
....@@ -3572,6 +3759,46 @@
35723759 continue;
35733760 blockloop = true;
35743761 child.MarkLeaves(h);
3762
+ blockloop = false;
3763
+ // release(i);
3764
+ }
3765
+ }
3766
+
3767
+ void RewindLeaves(boolean h)
3768
+ {
3769
+ if (blockloop)
3770
+ return;
3771
+
3772
+ if (bRep != null || material != null) // borderline...
3773
+ rewind = h;
3774
+
3775
+ for (int i = 0; i < Size(); i++)
3776
+ {
3777
+ Object3D child = (Object3D) get(i); // reserve(i);
3778
+ if (child == null)
3779
+ continue;
3780
+ blockloop = true;
3781
+ child.RewindLeaves(h);
3782
+ blockloop = false;
3783
+ // release(i);
3784
+ }
3785
+ }
3786
+
3787
+ void RandomLeaves(boolean h)
3788
+ {
3789
+ if (blockloop)
3790
+ return;
3791
+
3792
+ if (bRep != null || material != null) // borderline...
3793
+ random = h;
3794
+
3795
+ for (int i = 0; i < Size(); i++)
3796
+ {
3797
+ Object3D child = (Object3D) get(i); // reserve(i);
3798
+ if (child == null)
3799
+ continue;
3800
+ blockloop = true;
3801
+ child.RandomLeaves(h);
35753802 blockloop = false;
35763803 // release(i);
35773804 }
....@@ -4349,6 +4576,55 @@
43494576 }
43504577 }
43514578
4579
+ void RepairSOV()
4580
+ {
4581
+ if (blockloop)
4582
+ return;
4583
+
4584
+ String texname = this.GetPigmentTexture();
4585
+
4586
+ if (texname.startsWith("sov"))
4587
+ {
4588
+ String[] s = texname.split("/");
4589
+
4590
+ String[] sname = s[1].split("Color.pn");
4591
+
4592
+ texname = sname[0];
4593
+
4594
+ if (sname.length > 1)
4595
+ {
4596
+ texname += "Color.jpg";
4597
+ }
4598
+
4599
+ this.SetPigmentTexture("sov/" + texname);
4600
+ }
4601
+
4602
+ texname = this.GetBumpTexture();
4603
+
4604
+ if (texname.startsWith("sov"))
4605
+ {
4606
+ String[] s = texname.split("/");
4607
+
4608
+ String[] sname = s[1].split("Bump.pn");
4609
+
4610
+ texname = sname[0];
4611
+
4612
+ if (sname.length > 1)
4613
+ {
4614
+ texname += "Bump.jpg";
4615
+ }
4616
+
4617
+ this.SetBumpTexture("sov/" + texname);
4618
+ }
4619
+
4620
+ for (int i=0; i<Size(); i++)
4621
+ {
4622
+ blockloop = true;
4623
+ get(i).RepairSOV();
4624
+ blockloop = false;
4625
+ }
4626
+ }
4627
+
43524628 void RepairTexture()
43534629 {
43544630 if (this instanceof FileObject || blockloop)
....@@ -4863,6 +5139,14 @@
48635139 }
48645140 }
48655141
5142
+ ObjEditor GetWindow()
5143
+ {
5144
+ if (editWindow != null)
5145
+ return editWindow;
5146
+
5147
+ return manipWindow;
5148
+ }
5149
+
48665150 cTreePath Select(int indexcount, boolean deselect)
48675151 {
48685152 if (hide || dontselect)
....@@ -4899,10 +5183,11 @@
48995183 if (leaf != null)
49005184 {
49015185 cTreePath tp = new cTreePath(this, leaf);
4902
- if (editWindow != null)
5186
+ ObjEditor window = GetWindow();
5187
+ if (window != null)
49035188 {
49045189 //System.out.println("editWindow = " + editWindow + " vs " + this);
4905
- editWindow.Select(tp, deselect, true);
5190
+ window.Select(tp, deselect, true);
49065191 }
49075192
49085193 return tp;
....@@ -4919,6 +5204,7 @@
49195204
49205205 if (child == null)
49215206 continue;
5207
+
49225208 if (child.HasTransparency() && child.size() != 0)
49235209 {
49245210 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -4928,9 +5214,10 @@
49285214 if (leaf != null)
49295215 {
49305216 cTreePath tp = new cTreePath(this, leaf);
4931
- if (editWindow != null)
5217
+ ObjEditor window = GetWindow();
5218
+ if (window != null)
49325219 {
4933
- editWindow.Select(tp, deselect, true);
5220
+ window.Select(tp, deselect, true);
49345221 }
49355222
49365223 return tp;
....@@ -5255,6 +5542,51 @@
52555542 blockloop = false;
52565543 }
52575544
5545
+ void ResetSelectable()
5546
+ {
5547
+ if (blockloop)
5548
+ return;
5549
+
5550
+ blockloop = true;
5551
+
5552
+ keepdontselect = dontselect;
5553
+ dontselect = true;
5554
+
5555
+ Object3D child;
5556
+ int nb = Size();
5557
+ for (int i = 0; i < nb; i++)
5558
+ {
5559
+ child = (Object3D) get(i);
5560
+ if (child == null)
5561
+ continue;
5562
+ child.ResetSelectable();
5563
+ }
5564
+
5565
+ blockloop = false;
5566
+ }
5567
+
5568
+ void RestoreSelectable()
5569
+ {
5570
+ if (blockloop)
5571
+ return;
5572
+
5573
+ blockloop = true;
5574
+
5575
+ dontselect = keepdontselect;
5576
+
5577
+ Object3D child;
5578
+ int nb = Size();
5579
+ for (int i = 0; i < nb; i++)
5580
+ {
5581
+ child = (Object3D) get(i);
5582
+ if (child == null)
5583
+ continue;
5584
+ child.RestoreSelectable();
5585
+ }
5586
+
5587
+ blockloop = false;
5588
+ }
5589
+
52585590 boolean IsSelected()
52595591 {
52605592 if (parent == null)
....@@ -5315,6 +5647,11 @@
53155647 if (fullname == null)
53165648 return "";
53175649
5650
+ if (fullname.pigment != null)
5651
+ {
5652
+ return fullname.pigment;
5653
+ }
5654
+
53185655 // System.out.println("Fullname = " + fullname);
53195656
53205657 // Does not work on Windows due to C:
....@@ -5327,7 +5664,7 @@
53275664
53285665 if (split.length == 0)
53295666 {
5330
- return "";
5667
+ return fullname.pigment = "";
53315668 }
53325669
53335670 if (split.length <= 2)
....@@ -5335,22 +5672,27 @@
53355672 if (fullname.name.endsWith(":"))
53365673 {
53375674 // Windows
5338
- return fullname.name.substring(0, fullname.name.length()-1);
5675
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
53395676 }
53405677
5341
- return split[0];
5678
+ return fullname.pigment = split[0];
53425679 }
53435680
53445681 // Windows
53455682 assert(split.length == 4);
53465683
5347
- return split[0] + ":" + split[1];
5684
+ return fullname.pigment = split[0] + ":" + split[1];
53485685 }
53495686
53505687 static String GetBump(cTexture fullname)
53515688 {
53525689 if (fullname == null)
53535690 return "";
5691
+
5692
+ if (fullname.bump != null)
5693
+ {
5694
+ return fullname.bump;
5695
+ }
53545696
53555697 // System.out.println("Fullname = " + fullname);
53565698 // Does not work on Windows due to C:
....@@ -5362,12 +5704,12 @@
53625704
53635705 if (split.length == 0)
53645706 {
5365
- return "";
5707
+ return fullname.bump = "";
53665708 }
53675709
53685710 if (split.length == 1)
53695711 {
5370
- return "";
5712
+ return fullname.bump = "";
53715713 }
53725714
53735715 if (split.length == 2)
....@@ -5375,16 +5717,16 @@
53755717 if (fullname.name.endsWith(":"))
53765718 {
53775719 // Windows
5378
- return "";
5720
+ return fullname.bump = "";
53795721 }
53805722
5381
- return split[1];
5723
+ return fullname.bump = split[1];
53825724 }
53835725
53845726 // Windows
53855727 assert(split.length == 4);
53865728
5387
- return split[2] + ":" + split[3];
5729
+ return fullname.bump = split[2] + ":" + split[3];
53885730 }
53895731
53905732 String GetPigmentTexture()
....@@ -5467,6 +5809,9 @@
54675809 texname = "";
54685810
54695811 GetTextures().name = texname + ":" + GetBump(GetTextures());
5812
+
5813
+ GetTextures().pigment = null;
5814
+
54705815 Touch();
54715816 }
54725817
....@@ -5540,6 +5885,8 @@
55405885
55415886 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
55425887
5888
+ GetTextures().bump = null;
5889
+
55435890 Touch();
55445891 }
55455892
....@@ -5564,6 +5911,38 @@
55645911 }
55655912 }
55665913
5914
+ void EmbedTextures(boolean embed)
5915
+ {
5916
+ if (blockloop)
5917
+ return;
5918
+
5919
+ //if (GetTextures() != null)
5920
+ if (embed)
5921
+ CameraPane.EmbedTextures(GetTextures());
5922
+ else
5923
+ {
5924
+ GetTextures().pigmentdata = null;
5925
+ GetTextures().bumpdata = null;
5926
+ GetTextures().pw = 0;
5927
+ GetTextures().ph = 0;
5928
+ GetTextures().bw = 0;
5929
+ GetTextures().bh = 0;
5930
+ }
5931
+
5932
+ int nb = Size();
5933
+ for (int i = 0; i < nb; i++)
5934
+ {
5935
+ Object3D child = (Object3D) get(i);
5936
+
5937
+ if (child == null)
5938
+ continue;
5939
+
5940
+ blockloop = true;
5941
+ child.EmbedTextures(embed);
5942
+ blockloop = false;
5943
+ }
5944
+ }
5945
+
55675946 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55685947 {
55695948 Draw(display, root, selected, blocked);
....@@ -5572,12 +5951,23 @@
55725951 boolean NeedSupport()
55735952 {
55745953 return
5575
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5954
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
55765955 // PROBLEM with CROWD!!
55775956 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
55785957 }
55795958
55805959 static boolean DEBUG_SELECTION = false;
5960
+
5961
+ boolean IsLive()
5962
+ {
5963
+ if (live)
5964
+ return true;
5965
+
5966
+ if (parent == null)
5967
+ return false;
5968
+
5969
+ return parent.IsLive();
5970
+ }
55815971
55825972 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55835973 {
....@@ -5639,8 +6029,10 @@
56396029 if (support != null)
56406030 support = support;
56416031
5642
- //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5643
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6032
+ boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6033
+ //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
6034
+
6035
+ //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
56446036
56456037 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56466038 {
....@@ -5650,8 +6042,9 @@
56506042 // usecalllists &= !(parent instanceof RandomNode);
56516043 // usecalllists = false;
56526044
5653
- if (GetBRep() != null)
5654
- usecalllists = usecalllists;
6045
+ if (display.DrawMode() == display.SHADOW)
6046
+ //GetBRep() != null)
6047
+ usecalllists = !!usecalllists;
56556048 //System.out.println("draw " + this);
56566049 //new Exception().printStackTrace();
56576050
....@@ -5660,10 +6053,12 @@
56606053 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56616054
56626055 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5663
- (touched || (bRep != null && bRep.displaylist <= 0)))
6056
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
6057
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
56646058 {
56656059 Globals.lighttouched = true;
56666060 } // all panes...
6061
+
56676062 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56686063 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56696064 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5671,7 +6066,7 @@
56716066 if (!(this instanceof Composite))
56726067 touched = false;
56736068 //if (displaylist == -1 && usecalllists)
5674
- if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
6069
+ if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
56756070 {
56766071 bRep.displaylist = display.GenList();
56776072 assert(bRep.displaylist != 0);
....@@ -5682,7 +6077,7 @@
56826077
56836078 //System.out.println("\tnew list " + list);
56846079 //gl.glDrawBuffer(gl.GL_NONE);
5685
- if (usecalllists)
6080
+ if (usecalllists && bRep.displaylist > 0)
56866081 {
56876082 // System.err.println("new list " + bRep.displaylist + " for " + this);
56886083 display.NewList(bRep.displaylist);
....@@ -5691,7 +6086,7 @@
56916086 CallList(display, root, selected, blocked);
56926087
56936088 // compiled = true;
5694
- if (usecalllists)
6089
+ if (usecalllists && bRep.displaylist > 0)
56956090 {
56966091 // System.err.println("end list " + bRep.displaylist + " for " + this);
56976092 display.EndList();
....@@ -5791,6 +6186,7 @@
57916186 if (GetBRep() != null)
57926187 {
57936188 display.NextIndex();
6189
+
57946190 // vertex color conflict : gl.glCallList(list);
57956191 DrawNode(display, root, selected);
57966192 if (this instanceof BezierPatch)
....@@ -5831,16 +6227,27 @@
58316227 tex = GetTextures();
58326228 }
58336229
5834
- boolean failed = false;
6230
+ boolean failedPigment = false;
6231
+ boolean failedBump = false;
58356232
58366233 try
58376234 {
5838
- display.BindTextures(tex, texres);
6235
+ display.BindPigmentTexture(tex, texres);
58396236 }
58406237 catch (Exception e)
58416238 {
58426239 System.err.println("FAILED: " + this);
5843
- failed = true;
6240
+ failedPigment = true;
6241
+ }
6242
+
6243
+ try
6244
+ {
6245
+ display.BindBumpTexture(tex, texres);
6246
+ }
6247
+ catch (Exception e)
6248
+ {
6249
+ //System.err.println("FAILED: " + this);
6250
+ failedBump = true;
58446251 }
58456252
58466253 if (!compiled)
....@@ -5863,8 +6270,11 @@
58636270 }
58646271 }
58656272
5866
- if (!failed)
5867
- display.ReleaseTextures(tex);
6273
+ if (!failedBump)
6274
+ display.ReleaseBumpTexture(tex);
6275
+
6276
+ if (!failedPigment)
6277
+ display.ReleasePigmentTexture(tex);
58686278
58696279 display.PopMaterial(this, selected);
58706280 }
....@@ -6237,6 +6647,11 @@
62376647 // dec 2012
62386648 new Exception().printStackTrace();
62396649 return;
6650
+ }
6651
+
6652
+ if (dontselect)
6653
+ {
6654
+ //bRep.GenerateNormalsMINE();
62406655 }
62416656
62426657 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7022,20 +7437,23 @@
70227437 }
70237438 }
70247439
7025
- protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec)
7440
+ static ClickInfo clickInfo = new ClickInfo();
7441
+
7442
+ protected void calcHotSpot(cVector in, //ClickInfo clickInfo,
7443
+ Point outPt, Rectangle outRec)
70267444 {
7027
- int hc = info.bounds.x + info.bounds.width / 2;
7028
- int vc = info.bounds.y + info.bounds.height / 2;
7029
- double[][] toscreen = info.toScreen;
7445
+ int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2;
7446
+ int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2;
7447
+ double[][] toscreen = clickInfo.toScreen;
70307448 if (toscreen == null)
70317449 {
7032
- toscreen = new Camera(info.camera.viewCode).toScreen;
7450
+ toscreen = new Camera(clickInfo.camera.viewCode).toScreen;
70337451 }
70347452 cVector vec = in;
70357453 LA.xformPos(in, toscreen, in);
70367454 //System.out.println("Distance = " + info.camera.Distance());
7037
- vec.x *= 100 * info.camera.SCALE / info.camera.Distance();
7038
- vec.y *= 100 * info.camera.SCALE / info.camera.Distance();
7455
+ vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
7456
+ vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
70397457 outPt.x = hc + (int) vec.x;
70407458 outPt.y = vc - (int) vec.y;
70417459 outRec.x = outPt.x - 3;
....@@ -7043,15 +7461,18 @@
70437461 outRec.width = outRec.height = 6;
70447462 }
70457463
7046
- protected Rectangle calcHotSpot(cVector in, ClickInfo info)
7464
+ protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo
7465
+ )
70477466 {
70487467 Point pt = new Point(0, 0);
70497468 Rectangle rec = new Rectangle();
7050
- calcHotSpot(in, info, pt, rec);
7469
+ calcHotSpot(in, //clickInfo,
7470
+ pt, rec);
70517471 return rec;
70527472 }
70537473
7054
- void drawEditHandles0(ClickInfo info, int level)
7474
+ void drawEditHandles0(//ClickInfo clickInfo,
7475
+ int level)
70557476 {
70567477 if (level == 0)
70577478 {
....@@ -7060,16 +7481,19 @@
70607481 {
70617482 cVector origin = new cVector();
70627483 //LA.xformPos(origin, toParent, origin);
7063
- Rectangle spot = calcHotSpot(origin, info);
7484
+ if (this.clickInfo == null)
7485
+ this.clickInfo = new ClickInfo();
7486
+
7487
+ Rectangle spot = calcHotSpot(origin); //, clickInfo);
70647488 Rectangle boundary = new Rectangle();
70657489 boundary.x = spot.x - 30;
70667490 boundary.y = spot.y - 30;
70677491 boundary.width = spot.width + 60;
70687492 boundary.height = spot.height + 60;
7069
- info.g.setColor(Color.red);
7493
+ clickInfo.g.setColor(Color.white);
70707494 int spotw = spot.x + spot.width;
70717495 int spoth = spot.y + spot.height;
7072
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7496
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70737497 // if (CameraPane.Xmin > spot.x)
70747498 // {
70757499 // CameraPane.Xmin = spot.x;
....@@ -7086,11 +7510,33 @@
70867510 // {
70877511 // CameraPane.Ymax = spoth;
70887512 // }
7089
- spot.translate(32, 32);
7513
+// if (CameraPane.Xmin > spot.x)
7514
+// {
7515
+// CameraPane.Xmin = spot.x;
7516
+// }
7517
+// if (CameraPane.Xmax < spotw)
7518
+// {
7519
+// CameraPane.Xmax = spotw;
7520
+// }
7521
+// if (CameraPane.Ymin > spot.y)
7522
+// {
7523
+// CameraPane.Ymin = spot.y;
7524
+// }
7525
+// if (CameraPane.Ymax < spoth)
7526
+// {
7527
+// CameraPane.Ymax = spoth;
7528
+// }
7529
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7530
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7531
+ spot.translate(32, 0);
7532
+ clickInfo.g.setColor(Color.yellow);
7533
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7534
+
7535
+ spot.translate(32, 64);
70907536 spotw = spot.x + spot.width;
70917537 spoth = spot.y + spot.height;
7092
- info.g.setColor(Color.blue);
7093
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7538
+ clickInfo.g.setColor(Color.cyan);
7539
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70947540 // if (CameraPane.Xmin > spot.x)
70957541 // {
70967542 // CameraPane.Xmin = spot.x;
....@@ -7107,29 +7553,9 @@
71077553 // {
71087554 // CameraPane.Ymax = spoth;
71097555 // }
7110
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7111
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7112
- spot.translate(0, -32);
7113
- info.g.setColor(Color.green);
7114
- info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7115
-// if (CameraPane.Xmin > spot.x)
7116
-// {
7117
-// CameraPane.Xmin = spot.x;
7118
-// }
7119
-// if (CameraPane.Xmax < spotw)
7120
-// {
7121
-// CameraPane.Xmax = spotw;
7122
-// }
7123
-// if (CameraPane.Ymin > spot.y)
7124
-// {
7125
-// CameraPane.Ymin = spot.y;
7126
-// }
7127
-// if (CameraPane.Ymax < spoth)
7128
-// {
7129
-// CameraPane.Ymax = spoth;
7130
-// }
7131
- info.g.drawArc(boundary.x, boundary.y,
7132
- boundary.width, boundary.height, 0, 360);
7556
+ clickInfo.g.setColor(Color.green);
7557
+ clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
7558
+ (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
71337559 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
71347560 // if (CameraPane.Xmin > boundary.x)
71357561 // {
....@@ -7151,7 +7577,8 @@
71517577 }
71527578 }
71537579
7154
- boolean doEditClick0(ClickInfo info, int level)
7580
+ boolean doEditClick0(//ClickInfo clickInfo,
7581
+ int level)
71557582 {
71567583 if (level == 0)
71577584 {
....@@ -7160,8 +7587,8 @@
71607587
71617588 boolean retval = false;
71627589
7163
- startX = info.x;
7164
- startY = info.y;
7590
+ startX = clickInfo.x;
7591
+ startY = clickInfo.y;
71657592
71667593 hitSomething = -1;
71677594 cVector origin = new cVector();
....@@ -7171,22 +7598,53 @@
71717598 {
71727599 centerPt = new Point(0, 0);
71737600 }
7174
- calcHotSpot(origin, info, centerPt, spot);
7175
- if (spot.contains(info.x, info.y))
7601
+ calcHotSpot(origin, //info,
7602
+ centerPt, spot);
7603
+ if (spot.contains(clickInfo.x, clickInfo.y))
71767604 {
71777605 hitSomething = hitCenter;
71787606 retval = true;
71797607 }
71807608 spot.translate(32, 0);
7181
- if (spot.contains(info.x, info.y))
7609
+ if (spot.contains(clickInfo.x, clickInfo.y))
71827610 {
71837611 hitSomething = hitRotate;
71847612 retval = true;
71857613 }
71867614 spot.translate(0, 32);
7187
- if (spot.contains(info.x, info.y))
7615
+ spot.translate(32, 0);
7616
+ spot.translate(0, 32);
7617
+ if (spot.contains(clickInfo.x, clickInfo.y))
71887618 {
71897619 hitSomething = hitScale;
7620
+
7621
+ double scale = 0.005f * clickInfo.camera.Distance();
7622
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
7623
+ double sign = 1;
7624
+ if (hScale < 0)
7625
+ {
7626
+ sign = -1;
7627
+ }
7628
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
7629
+ if (hScale < 0.01)
7630
+ {
7631
+ //hScale = 0.01;
7632
+ }
7633
+
7634
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
7635
+ sign = 1;
7636
+ if (vScale < 0)
7637
+ {
7638
+ sign = -1;
7639
+ }
7640
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
7641
+ if (vScale < 0.01)
7642
+ {
7643
+ //vScale = 0.01;
7644
+ }
7645
+
7646
+ clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale);
7647
+
71907648 retval = true;
71917649 }
71927650
....@@ -7196,7 +7654,7 @@
71967654 }
71977655
71987656 //System.out.println("info.modifiers = " + info.modifiers);
7199
- modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
7657
+ modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META
72007658 //System.out.println("modified = " + modified);
72017659 //new Exception().printStackTrace();
72027660 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7224,7 +7682,8 @@
72247682 return true;
72257683 }
72267684
7227
- void doEditDrag0(ClickInfo info, boolean opposite)
7685
+ void doEditDrag0(//ClickInfo info,
7686
+ boolean opposite)
72287687 {
72297688 if (hitSomething == 0)
72307689 {
....@@ -7238,7 +7697,7 @@
72387697
72397698 //System.out.println("hitSomething = " + hitSomething);
72407699
7241
- double scale = 0.005f * info.camera.Distance();
7700
+ double scale = 0.005f * clickInfo.camera.Distance();
72427701
72437702 cVector xlate = new cVector();
72447703 //cVector xlate2 = new cVector();
....@@ -7252,7 +7711,9 @@
72527711
72537712 scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
72547713
7255
- if (modified || opposite)
7714
+ // Modified could snap
7715
+ if (//modified ||
7716
+ opposite)
72567717 {
72577718 //assert(false);
72587719 /*
....@@ -7272,8 +7733,8 @@
72727733 toParent[3][i] = xlate.get(i);
72737734 LA.matInvert(toParent, fromParent);
72747735 */
7275
- cVector delta = LA.newVector(0, 0, startY - info.y);
7276
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7736
+ cVector delta = LA.newVector(0, 0, startY - clickInfo.y);
7737
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
72777738
72787739 LA.matCopy(startMat, toParent);
72797740 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7282,7 +7743,7 @@
72827743 } else
72837744 {
72847745 //LA.xformDir(delta, info.camera.fromScreen, delta);
7285
- cVector up = new cVector(info.camera.up);
7746
+ cVector up = new cVector(clickInfo.camera.up);
72867747 cVector away = new cVector();
72877748 //cVector right2 = new cVector();
72887749 //LA.vecCross(up, cVector.Z, right);
....@@ -7299,19 +7760,19 @@
72997760 LA.xformDir(up, ClickInfo.matbuffer, up);
73007761 // if (!CameraPane.LOCALTRANSFORM)
73017762 LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
7302
- LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
7763
+ LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away);
73037764 // if (!CameraPane.LOCALTRANSFORM)
73047765 LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
73057766 //LA.vecCross(up, cVector.Z, right2);
73067767
7307
- cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
7768
+ cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0);
73087769
73097770 //System.out.println("DELTA0 = " + delta);
73107771 //System.out.println("AWAY = " + info.camera.away);
73117772 //System.out.println("UP = " + info.camera.up);
73127773 if (away.z > 0)
73137774 {
7314
- if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0)
7775
+ if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0)
73157776 {
73167777 delta.x = -delta.x;
73177778 } else
....@@ -7326,7 +7787,7 @@
73267787 //System.out.println("DELTA1 = " + delta);
73277788 LA.xformDir(delta, ClickInfo.matbuffer, delta);
73287789 //System.out.println("DELTA2 = " + delta);
7329
- LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta);
7790
+ LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta);
73307791 LA.matCopy(startMat, toParent);
73317792 //System.out.println("DELTA3 = " + delta);
73327793 LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale);
....@@ -7336,8 +7797,8 @@
73367797 break;
73377798
73387799 case hitRotate: // rotate
7339
- int dx = info.x - centerPt.x;
7340
- int dy = -(info.y - centerPt.y);
7800
+ int dx = clickInfo.x - centerPt.x;
7801
+ int dy = -(clickInfo.y - centerPt.y);
73417802 double angle = (double) Math.atan2(dx, dy);
73427803 angle = -(1.570796 - angle);
73437804
....@@ -7346,7 +7807,7 @@
73467807
73477808 if (modified)
73487809 {
7349
- // Rotate 90 degrees
7810
+ // Rotate 45 degrees
73507811 angle /= (Math.PI / 4);
73517812 angle = Math.floor(angle + 0.5);
73527813 angle *= (Math.PI / 4);
....@@ -7360,7 +7821,7 @@
73607821 }
73617822 /**/
73627823
7363
- switch (info.pane.RenderCamera().viewCode)
7824
+ switch (clickInfo.pane.RenderCamera().viewCode)
73647825 {
73657826 case 1: // '\001'
73667827 LA.matZRotate(toParent, angle);
....@@ -7387,7 +7848,7 @@
73877848 break;
73887849
73897850 case hitScale: // scale
7390
- double hScale = (double) (info.x - centerPt.x) / 32;
7851
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
73917852 double sign = 1;
73927853 if (hScale < 0)
73937854 {
....@@ -7399,7 +7860,7 @@
73997860 //hScale = 0.01;
74007861 }
74017862
7402
- double vScale = (double) (info.y - centerPt.y) / 32;
7863
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
74037864 sign = 1;
74047865 if (vScale < 0)
74057866 {
....@@ -7410,6 +7871,7 @@
74107871 {
74117872 //vScale = 0.01;
74127873 }
7874
+
74137875 LA.matCopy(startMat, toParent);
74147876 /**/
74157877 for (int i = 0; i < 3; i++)
....@@ -7419,32 +7881,39 @@
74197881 }
74207882 /**/
74217883
7422
- double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7884
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale;
74237885
74247886 if (totalScale < 0.01)
74257887 {
74267888 totalScale = 0.01;
74277889 }
74287890
7429
- switch (info.pane.RenderCamera().viewCode)
7891
+ switch (clickInfo.pane.RenderCamera().viewCode)
74307892 {
74317893 case 3: // '\001'
7432
- if (modified)
7894
+ if (modified || opposite)
74337895 {
7896
+ if (modified) // && opposite)
7897
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7898
+ else
74347899 //LA.matScale(toParent, 1, hScale, vScale);
7435
- LA.matScale(toParent, totalScale, 1, 1);
7900
+ LA.matScale(toParent, totalScale, 1, 1);
74367901 } // vScale, 1);
74377902 else
74387903 {
7439
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7904
+ // EXCEPTION!
7905
+ LA.matScale(toParent, 1, totalScale, totalScale);
74407906 } // vScale, 1);
74417907 break;
74427908
74437909 case 2: // '\002'
7444
- if (modified)
7910
+ if (modified || opposite)
74457911 {
7446
- //LA.matScale(toParent, hScale, 1, vScale);
7447
- LA.matScale(toParent, 1, totalScale, 1);
7912
+ if (modified) // && opposite)
7913
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7914
+ else
7915
+ //LA.matScale(toParent, hScale, 1, vScale);
7916
+ LA.matScale(toParent, 1, totalScale, 1);
74487917 } else
74497918 {
74507919 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7452,10 +7921,13 @@
74527921 break;
74537922
74547923 case 1: // '\003'
7455
- if (modified)
7924
+ if (modified || opposite)
74567925 {
7457
- //LA.matScale(toParent, hScale, vScale, 1);
7458
- LA.matScale(toParent, 1, 1, totalScale);
7926
+ if (modified) // && opposite)
7927
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7928
+ else
7929
+ //LA.matScale(toParent, hScale, vScale, 1);
7930
+ LA.matScale(toParent, 1, 1, totalScale);
74597931 } else
74607932 {
74617933 LA.matScale(toParent, totalScale, totalScale, 1);
....@@ -7492,7 +7964,7 @@
74927964 } // NEW ...
74937965
74947966
7495
- info.pane.repaint();
7967
+ clickInfo.pane.repaint();
74967968 }
74977969
74987970 boolean overflow = false;
....@@ -7672,6 +8144,10 @@
76728144 editWindow = null;
76738145 } // ?
76748146 }
8147
+ else
8148
+ {
8149
+ //editWindow.closeUI();
8150
+ }
76758151 }
76768152
76778153 boolean root; // patch for edit windows
....@@ -7829,6 +8305,10 @@
78298305 }
78308306
78318307 transient ObjEditor editWindow;
8308
+ transient ObjEditor manipWindow;
8309
+
8310
+ transient boolean pinned;
8311
+
78328312 transient ObjectUI objectUI;
78338313 public static int povDepth = 0;
78348314 private static cVector tbMin = new cVector();