Normand Briere
2019-08-26 6266c8a4b2485b29a7d5bcb217460d7aad3e1c4a
ObjEditor.java
....@@ -316,6 +316,8 @@
316316 objEditor.ctrlPanel.remove(setupPanel2);
317317 objEditor.ctrlPanel.remove(objectCommandsPanel);
318318 objEditor.ctrlPanel.remove(pushPanel);
319
+ if (versionPanel != null)
320
+ objEditor.ctrlPanel.remove(versionPanel);
319321 //objEditor.ctrlPanel.remove(fillPanel);
320322
321323 //Remove(normalpushField);
....@@ -383,14 +385,6 @@
383385 client = inClient;
384386 copy = client;
385387
386
- if (copy.versionlist == null)
387
- {
388
- copy.versionlist = new Object3D[100];
389
- copy.versionindex = -1;
390
-
391
-// Save(true);
392
- }
393
-
394388 SetupUI2(callee.GetEditor());
395389 }
396390
....@@ -1171,6 +1165,7 @@
11711165 cGridBag setupPanel2;
11721166 cGridBag objectCommandsPanel;
11731167 cGridBag pushPanel;
1168
+ cGridBag versionPanel;
11741169 cGridBag fillPanel;
11751170
11761171 JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
....@@ -1417,9 +1412,14 @@
14171412 oe.ctrlPanel.add(objectCommandsPanel);
14181413 oe.ctrlPanel.Return();
14191414
1420
- pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1415
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH * 100, 1.1); // To have the buttons
14211416 normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1422
- //Return();
1417
+ if (false && copy.versionlist != null && copy.versionindex != -1)
1418
+ {
1419
+ oe.ctrlPanel.Return();
1420
+ versionPanel = AddSlider(oe.ctrlPanel, "Version", 0, copy.VersionCount() - 1, copy.versionindex);
1421
+ versionField = (cNumberSlider)versionPanel.getComponent(1);
1422
+ }
14231423
14241424 oe.ctrlPanel.Return();
14251425
....@@ -1775,7 +1775,7 @@
17751775 scrollpane.addMouseWheelListener(this); // Default not fast enough
17761776
17771777 /*JTabbedPane*/ scenePanel = new cGridBag();
1778
- scenePanel.preferredWidth = 6;
1778
+ scenePanel.preferredWidth = 5;
17791779
17801780 JTabbedPane tabbedPane = new JTabbedPane();
17811781 tabbedPane.add(scrollpane);
....@@ -1884,9 +1884,9 @@
18841884
18851885 if (Globals.ADVANCED)
18861886 {
1887
- tabbedPane.add(infoPanel);
1888
- tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1889
- tabbedPane.setToolTipTextAt(4, "Information");
1887
+ objectPanel.add(infoPanel);
1888
+ objectPanel.setIconAt(5, GetIcon("icons/info.png"));
1889
+ objectPanel.setToolTipTextAt(4, "Information");
18901890 }
18911891
18921892 /*
....@@ -2429,7 +2429,7 @@
24292429 cameraField.setFloat(0.001);
24302430 specularField.setFloat(0.001);
24312431 fakedepthField.setFloat(0.001);
2432
- opacityField.setFloat(0.6);
2432
+ opacityField.setFloat(0.4);
24332433
24342434 materialtouched = true;
24352435 applySelf();
....@@ -4075,6 +4075,7 @@
40754075 } else if (event.getSource() == link2masterCB)
40764076 {
40774077 copy.link2master ^= true;
4078
+ objEditor.refreshContents();
40784079 return;
40794080 }
40804081 if (event.getSource() == randomCB)
....@@ -4465,7 +4466,7 @@
44654466 copy.versionindex -= 1;
44664467
44674468 if (copy.versionindex != -1)
4468
- CopyChanged();
4469
+ CopyChanged(copy);
44694470
44704471 SetVersionStates();
44714472 }
....@@ -4475,7 +4476,11 @@
44754476 System.err.println("Save");
44764477 Replace();
44774478
4478
- //cRadio tab = GetCurrentTab();
4479
+ if (copy.versionlist == null)
4480
+ {
4481
+ copy.versionlist = new Object3D[100];
4482
+ copy.versionindex = -1;
4483
+ }
44794484
44804485 Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
44814486
....@@ -4543,20 +4548,20 @@
45434548 {
45444549 Object3D selection = new Object3D();
45454550
4546
- for (int i = 0; i < copy.selection.size(); i++)
4551
+ for (int i = 0; i < objEditor.copy.selection.size(); i++)
45474552 {
4548
- Object3D elem = copy.selection.elementAt(i);
4553
+ Object3D elem = objEditor.copy.selection.elementAt(i);
45494554
4550
- Object3D obj = copy.GetObject(elem.GetUUID());
4555
+ Object3D obj = objEditor.copy.GetObject(elem.GetUUID());
45514556
45524557 if (obj == null)
45534558 {
4554
- copy.selection.remove(i--);
4559
+ objEditor.copy.selection.remove(i--);
45554560 }
45564561 else
45574562 {
45584563 selection.add(obj);
4559
- copy.selection.setElementAt(obj, i);
4564
+ objEditor.copy.selection.setElementAt(obj, i);
45604565 }
45614566 }
45624567
....@@ -4569,44 +4574,43 @@
45694574 //refreshContents(false);
45704575 }
45714576
4572
- void CopyChanged()
4577
+ void CopyChanged(Object3D changed)
45734578 {
4574
- Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4575
-
4576
- SetVersionStates();
4579
+ Object3D obj = (Object3D)Grafreed.clone(changed.versionlist[copy.versionindex]);
45774580
45784581 boolean temp = CameraPane.SWITCH;
45794582 CameraPane.SWITCH = false;
45804583
4581
- copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4584
+ changed.ExtractBigData(Grafreed.grafreed.universe.versiontable);
45824585
4583
- copy.clear();
4586
+ changed.clear();
45844587
4585
- copy.skyboxname = obj.skyboxname;
4586
- copy.skyboxext = obj.skyboxext;
4588
+ changed.skyboxname = obj.skyboxname;
4589
+ changed.skyboxext = obj.skyboxext;
45874590
45884591 for (int i=0; i<obj.Size(); i++)
45894592 {
4590
- copy.add(obj.get(i));
4593
+ changed.add(obj.get(i));
45914594 }
45924595
4593
- copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4596
+ changed.RestoreBigData(Grafreed.grafreed.universe.versiontable);
45944597
45954598 CameraPane.SWITCH = temp;
45964599
4597
- RefreshSelection();
4600
+ if (objEditor == this)
4601
+ RefreshSelection();
45984602 //assert(hashtable.isEmpty());
45994603
4600
- copy.Touch();
4604
+ objEditor.copy.Touch();
46014605
46024606 ResetModel();
4603
- copy.HardTouch(); // recompile?
4607
+ objEditor.copy.HardTouch(); // recompile?
46044608
46054609 cRadio ab;
4606
- for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4610
+ for (java.util.Enumeration e = objEditor.buttonGroup.getElements(); e.hasMoreElements();)
46074611 {
46084612 ab = (cRadio)e.nextElement();
4609
- Object3D test = copy.GetObject(ab.object.GetUUID());
4613
+ Object3D test = objEditor.copy.GetObject(ab.object.GetUUID());
46104614 //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
46114615 if (test != null)
46124616 {
....@@ -4615,7 +4619,7 @@
46154619 }
46164620 }
46174621
4618
- refreshContents(true);
4622
+ objEditor.refreshContents(true);
46194623 }
46204624
46214625 cButton previousVersionButton;
....@@ -4629,15 +4633,7 @@
46294633
46304634 int VersionCount()
46314635 {
4632
- int count = 0;
4633
-
4634
- for (int i = copy.versionlist.length; --i >= 0;)
4635
- {
4636
- if (copy.versionlist[i] != null)
4637
- count++;
4638
- }
4639
-
4640
- return count;
4636
+ return copy.VersionCount();
46414637 }
46424638
46434639 public cGridBag versionSliderPane;
....@@ -4649,7 +4645,7 @@
46494645
46504646 //cRadio tab = GetCurrentTab();
46514647
4652
- if (copy.versionlist == null)
4648
+ if (copy.versionindex == -2)
46534649 {
46544650 saveVersionButton.setEnabled(false);
46554651 restoreButton.setEnabled(false);
....@@ -4711,7 +4707,9 @@
47114707
47124708 copy.versionindex -= 1;
47134709
4714
- CopyChanged();
4710
+ CopyChanged(copy);
4711
+
4712
+ SetVersionStates();
47154713
47164714 return true;
47174715 }
....@@ -4729,7 +4727,9 @@
47294727 }
47304728
47314729 //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4732
- CopyChanged();
4730
+ CopyChanged(copy);
4731
+
4732
+ SetVersionStates();
47334733
47344734 return true;
47354735 }
....@@ -4766,10 +4766,12 @@
47664766
47674767 copy.versionindex += 1;
47684768
4769
- CopyChanged();
4769
+ CopyChanged(copy);
47704770
47714771 //if (!tab.user[tab.versionindex])
47724772 // tab.graphs[tab.versionindex] = null;
4773
+
4774
+ SetVersionStates();
47734775 }
47744776
47754777 void ImportGFD()
....@@ -5098,6 +5100,7 @@
50985100 }
50995101
51005102 cNumberSlider versionSlider;
5103
+ cNumberSlider versionField;
51015104
51025105 public void stateChanged(ChangeEvent e)
51035106 {
....@@ -5114,12 +5117,26 @@
51145117 if (version != -1 && copy.versionlist[version] != null)
51155118 {
51165119 copy.versionindex = version;
5117
- CopyChanged();
5120
+ CopyChanged(copy);
5121
+ SetVersionStates();
51185122 }
51195123
51205124 return;
51215125 }
51225126
5127
+ if (e.getSource() == versionField)
5128
+ {
5129
+ int version = versionField.getInteger();
5130
+
5131
+ if (version != -1 && copy.versionindex != version && copy.versionlist[version] != null)
5132
+ {
5133
+ copy.versionindex = version;
5134
+ CopyChanged(copy);
5135
+ }
5136
+
5137
+ return;
5138
+ }
5139
+
51235140 if (freezematerial)
51245141 {
51255142 return;
....@@ -5209,7 +5226,7 @@
52095226 }
52105227
52115228 if (normalpushField != null)
5212
- copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
5229
+ copy.NORMALPUSH = (float)normalpushField.getFloat() / 100;
52135230 }
52145231
52155232 void SnapObject()
....@@ -5583,7 +5600,7 @@
55835600 void ResetModel()
55845601 {
55855602 //assert(copy instanceof Composite);
5586
- Object3D /*Composite*/ group = (Object3D /*Composite*/) copy;
5603
+ Object3D /*Composite*/ group = (Object3D /*Composite*/) objEditor.copy;
55875604
55885605 // necessary? group.selection = new Object3D(); // java.util.Vector();
55895606
....@@ -5594,14 +5611,14 @@
55945611 //group.refreshEditWindow();
55955612 //refreshContents();
55965613
5597
- if (copy.selection == null)
5614
+ if (objEditor.copy.selection == null)
55985615 {
5599
- copy.selection = new Object3D();
5616
+ objEditor.copy.selection = new Object3D();
56005617 }
56015618
5602
- for (int j = 0; j < copy.selection.size(); j++)
5619
+ for (int j = 0; j < objEditor.copy.selection.size(); j++)
56035620 {
5604
- Object3D item = copy.selection.get(j);
5621
+ Object3D item = objEditor.copy.selection.get(j);
56055622
56065623 if (item instanceof cGroup && ((cGroup) item).transientlink)
56075624 {
....@@ -5610,15 +5627,15 @@
56105627
56115628 if (item.count <= 1) // ??? == 0)
56125629 {
5613
- copy.selection.remove(item);
5630
+ objEditor.copy.selection.remove(item);
56145631 }
56155632 }
56165633
56175634 boolean first = true;
56185635
5619
- for (int i = copy.selection.size(); --i >= 0;)
5636
+ for (int i = objEditor.copy.selection.size(); --i >= 0;)
56205637 {
5621
- Object3D item = copy.selection.get(i);
5638
+ Object3D item = objEditor.copy.selection.get(i);
56225639
56235640 if (item instanceof cGroup && ((cGroup) item).transientlink)
56245641 {