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 /*
....@@ -2370,7 +2370,7 @@
23702370 {
23712371 public void mouseClicked(MouseEvent e)
23722372 {
2373
- borderfadeField.setFloat(0.5);
2373
+ borderfadeField.setFloat(0.4);
23742374 opacityField.setFloat(0.75);
23752375
23762376 materialtouched = true;
....@@ -2429,13 +2429,55 @@
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();
24362436 }
24372437 });
24382438 presetpanel.add(shadowShader);
2439
+
2440
+ cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
2441
+ para0.setToolTipText("No parallax");
2442
+ para0.addMouseListener(new MouseAdapter()
2443
+ {
2444
+ public void mouseClicked(MouseEvent e)
2445
+ {
2446
+ parallaxField.setFloat(0.125);
2447
+
2448
+ materialtouched = true;
2449
+ applySelf();
2450
+ }
2451
+ });
2452
+ presetpanel.add(para0);
2453
+
2454
+ cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
2455
+ para1.setToolTipText("With parallax");
2456
+ para1.addMouseListener(new MouseAdapter()
2457
+ {
2458
+ public void mouseClicked(MouseEvent e)
2459
+ {
2460
+ parallaxField.setFloat(0.13);
2461
+
2462
+ materialtouched = true;
2463
+ applySelf();
2464
+ }
2465
+ });
2466
+ presetpanel.add(para1);
2467
+
2468
+ cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
2469
+ para2.setToolTipText("Reset parallax");
2470
+ para2.addMouseListener(new MouseAdapter()
2471
+ {
2472
+ public void mouseClicked(MouseEvent e)
2473
+ {
2474
+ parallaxField.setFloat(0.14);
2475
+
2476
+ materialtouched = true;
2477
+ applySelf();
2478
+ }
2479
+ });
2480
+ presetpanel.add(para2);
24392481
24402482 cGridBag panel = new cGridBag().setVertical(true);
24412483
....@@ -2685,7 +2727,7 @@
26852727 cGridBag parallax = new cGridBag();
26862728 parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
26872729 parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2688
- parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.5, -0.25)); // , aConstraints);
2730
+ parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints);
26892731 colorSection.add(parallax);
26902732
26912733 //panel.add(new JSeparator());
....@@ -3739,7 +3781,7 @@
37393781 shadowField.setFloat(mat.shadow);
37403782 textureField.setFloat(mat.texture);
37413783 opacityField.setFloat(mat.opacity);
3742
- parallaxField.setFloat(mat.parallax + 0.25f);
3784
+ parallaxField.setFloat(mat.parallax + 0.125f);
37433785 fakedepthField.setFloat(mat.fakedepth);
37443786 shadowbiasField.setFloat(mat.shadowbias);
37453787 bumpField.setInteger(1); // dec 2013
....@@ -4033,6 +4075,7 @@
40334075 } else if (event.getSource() == link2masterCB)
40344076 {
40354077 copy.link2master ^= true;
4078
+ objEditor.refreshContents();
40364079 return;
40374080 }
40384081 if (event.getSource() == randomCB)
....@@ -4423,7 +4466,7 @@
44234466 copy.versionindex -= 1;
44244467
44254468 if (copy.versionindex != -1)
4426
- CopyChanged();
4469
+ CopyChanged(copy);
44274470
44284471 SetVersionStates();
44294472 }
....@@ -4433,7 +4476,11 @@
44334476 System.err.println("Save");
44344477 Replace();
44354478
4436
- //cRadio tab = GetCurrentTab();
4479
+ if (copy.versionlist == null)
4480
+ {
4481
+ copy.versionlist = new Object3D[100];
4482
+ copy.versionindex = -1;
4483
+ }
44374484
44384485 Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
44394486
....@@ -4501,20 +4548,20 @@
45014548 {
45024549 Object3D selection = new Object3D();
45034550
4504
- for (int i = 0; i < copy.selection.size(); i++)
4551
+ for (int i = 0; i < objEditor.copy.selection.size(); i++)
45054552 {
4506
- Object3D elem = copy.selection.elementAt(i);
4553
+ Object3D elem = objEditor.copy.selection.elementAt(i);
45074554
4508
- Object3D obj = copy.GetObject(elem.GetUUID());
4555
+ Object3D obj = objEditor.copy.GetObject(elem.GetUUID());
45094556
45104557 if (obj == null)
45114558 {
4512
- copy.selection.remove(i--);
4559
+ objEditor.copy.selection.remove(i--);
45134560 }
45144561 else
45154562 {
45164563 selection.add(obj);
4517
- copy.selection.setElementAt(obj, i);
4564
+ objEditor.copy.selection.setElementAt(obj, i);
45184565 }
45194566 }
45204567
....@@ -4527,44 +4574,43 @@
45274574 //refreshContents(false);
45284575 }
45294576
4530
- void CopyChanged()
4577
+ void CopyChanged(Object3D changed)
45314578 {
4532
- Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4533
-
4534
- SetVersionStates();
4579
+ Object3D obj = (Object3D)Grafreed.clone(changed.versionlist[copy.versionindex]);
45354580
45364581 boolean temp = CameraPane.SWITCH;
45374582 CameraPane.SWITCH = false;
45384583
4539
- copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4584
+ changed.ExtractBigData(Grafreed.grafreed.universe.versiontable);
45404585
4541
- copy.clear();
4586
+ changed.clear();
45424587
4543
- copy.skyboxname = obj.skyboxname;
4544
- copy.skyboxext = obj.skyboxext;
4588
+ changed.skyboxname = obj.skyboxname;
4589
+ changed.skyboxext = obj.skyboxext;
45454590
45464591 for (int i=0; i<obj.Size(); i++)
45474592 {
4548
- copy.add(obj.get(i));
4593
+ changed.add(obj.get(i));
45494594 }
45504595
4551
- copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4596
+ changed.RestoreBigData(Grafreed.grafreed.universe.versiontable);
45524597
45534598 CameraPane.SWITCH = temp;
45544599
4555
- RefreshSelection();
4600
+ if (objEditor == this)
4601
+ RefreshSelection();
45564602 //assert(hashtable.isEmpty());
45574603
4558
- copy.Touch();
4604
+ objEditor.copy.Touch();
45594605
45604606 ResetModel();
4561
- copy.HardTouch(); // recompile?
4607
+ objEditor.copy.HardTouch(); // recompile?
45624608
45634609 cRadio ab;
4564
- for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4610
+ for (java.util.Enumeration e = objEditor.buttonGroup.getElements(); e.hasMoreElements();)
45654611 {
45664612 ab = (cRadio)e.nextElement();
4567
- Object3D test = copy.GetObject(ab.object.GetUUID());
4613
+ Object3D test = objEditor.copy.GetObject(ab.object.GetUUID());
45684614 //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
45694615 if (test != null)
45704616 {
....@@ -4573,7 +4619,7 @@
45734619 }
45744620 }
45754621
4576
- refreshContents(true);
4622
+ objEditor.refreshContents(true);
45774623 }
45784624
45794625 cButton previousVersionButton;
....@@ -4587,15 +4633,7 @@
45874633
45884634 int VersionCount()
45894635 {
4590
- int count = 0;
4591
-
4592
- for (int i = copy.versionlist.length; --i >= 0;)
4593
- {
4594
- if (copy.versionlist[i] != null)
4595
- count++;
4596
- }
4597
-
4598
- return count;
4636
+ return copy.VersionCount();
45994637 }
46004638
46014639 public cGridBag versionSliderPane;
....@@ -4607,7 +4645,7 @@
46074645
46084646 //cRadio tab = GetCurrentTab();
46094647
4610
- if (copy.versionlist == null)
4648
+ if (copy.versionindex == -2)
46114649 {
46124650 saveVersionButton.setEnabled(false);
46134651 restoreButton.setEnabled(false);
....@@ -4669,7 +4707,9 @@
46694707
46704708 copy.versionindex -= 1;
46714709
4672
- CopyChanged();
4710
+ CopyChanged(copy);
4711
+
4712
+ SetVersionStates();
46734713
46744714 return true;
46754715 }
....@@ -4687,7 +4727,9 @@
46874727 }
46884728
46894729 //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4690
- CopyChanged();
4730
+ CopyChanged(copy);
4731
+
4732
+ SetVersionStates();
46914733
46924734 return true;
46934735 }
....@@ -4724,10 +4766,12 @@
47244766
47254767 copy.versionindex += 1;
47264768
4727
- CopyChanged();
4769
+ CopyChanged(copy);
47284770
47294771 //if (!tab.user[tab.versionindex])
47304772 // tab.graphs[tab.versionindex] = null;
4773
+
4774
+ SetVersionStates();
47314775 }
47324776
47334777 void ImportGFD()
....@@ -4964,7 +5008,7 @@
49645008 current.shadow = (float) shadowField.getFloat();
49655009 current.texture = (float) textureField.getFloat();
49665010 current.opacity = (float) opacityField.getFloat();
4967
- current.parallax = (float) parallaxField.getFloat() - 0.25f;
5011
+ current.parallax = (float) parallaxField.getFloat() - 0.125f;
49685012 current.fakedepth = (float) fakedepthField.getFloat();
49695013 current.shadowbias = (float) shadowbiasField.getFloat();
49705014
....@@ -5056,6 +5100,7 @@
50565100 }
50575101
50585102 cNumberSlider versionSlider;
5103
+ cNumberSlider versionField;
50595104
50605105 public void stateChanged(ChangeEvent e)
50615106 {
....@@ -5072,12 +5117,26 @@
50725117 if (version != -1 && copy.versionlist[version] != null)
50735118 {
50745119 copy.versionindex = version;
5075
- CopyChanged();
5120
+ CopyChanged(copy);
5121
+ SetVersionStates();
50765122 }
50775123
50785124 return;
50795125 }
50805126
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
+
50815140 if (freezematerial)
50825141 {
50835142 return;
....@@ -5167,7 +5226,7 @@
51675226 }
51685227
51695228 if (normalpushField != null)
5170
- copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
5229
+ copy.NORMALPUSH = (float)normalpushField.getFloat() / 100;
51715230 }
51725231
51735232 void SnapObject()
....@@ -5541,7 +5600,7 @@
55415600 void ResetModel()
55425601 {
55435602 //assert(copy instanceof Composite);
5544
- Object3D /*Composite*/ group = (Object3D /*Composite*/) copy;
5603
+ Object3D /*Composite*/ group = (Object3D /*Composite*/) objEditor.copy;
55455604
55465605 // necessary? group.selection = new Object3D(); // java.util.Vector();
55475606
....@@ -5552,14 +5611,14 @@
55525611 //group.refreshEditWindow();
55535612 //refreshContents();
55545613
5555
- if (copy.selection == null)
5614
+ if (objEditor.copy.selection == null)
55565615 {
5557
- copy.selection = new Object3D();
5616
+ objEditor.copy.selection = new Object3D();
55585617 }
55595618
5560
- for (int j = 0; j < copy.selection.size(); j++)
5619
+ for (int j = 0; j < objEditor.copy.selection.size(); j++)
55615620 {
5562
- Object3D item = copy.selection.get(j);
5621
+ Object3D item = objEditor.copy.selection.get(j);
55635622
55645623 if (item instanceof cGroup && ((cGroup) item).transientlink)
55655624 {
....@@ -5568,15 +5627,15 @@
55685627
55695628 if (item.count <= 1) // ??? == 0)
55705629 {
5571
- copy.selection.remove(item);
5630
+ objEditor.copy.selection.remove(item);
55725631 }
55735632 }
55745633
55755634 boolean first = true;
55765635
5577
- for (int i = copy.selection.size(); --i >= 0;)
5636
+ for (int i = objEditor.copy.selection.size(); --i >= 0;)
55785637 {
5579
- Object3D item = copy.selection.get(i);
5638
+ Object3D item = objEditor.copy.selection.get(i);
55805639
55815640 if (item instanceof cGroup && ((cGroup) item).transientlink)
55825641 {