Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
GroupEditor.java
....@@ -23,6 +23,31 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ skyboxButton.setToolTipText(s);
33
+ skyboxButton.addActionListener(new ActionListener()
34
+ {
35
+ @Override
36
+ public void actionPerformed(ActionEvent e)
37
+ {
38
+ ChangeSkybox(path);
39
+ }
40
+ });
41
+ }
42
+
43
+ public void ChangeSkybox(String name)
44
+ {
45
+ cameraView.envyoff = false;
46
+ cameraView.skyboxname = name;
47
+ cameraView.skyboxext = "jpg";
48
+ cameraView.repaint();
49
+ }
50
+
2651 //ObjEditor objEditor;
2752 public void closeUI2()
2853 {
....@@ -60,6 +85,12 @@
6085 this.copy = this.group = group;
6186 //selectees = this.group.selectees;
6287
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6394 if(ui)
6495 SetupUI(objEditor);
6596 }
....@@ -80,10 +111,22 @@
80111 SetupViews(objEditor);
81112
82113 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114
+
115
+ if (copy.versions == null)
116
+ {
117
+ copy.versions = new byte[100][];
118
+ copy.versionindex = -1;
119
+
120
+ Save(true);
121
+ }
83122 }
84123
85124 void CloneSelection(boolean supports)
86125 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
87130 // Object3D keep = GrafreeD.clipboard;
88131 //Object3D obj;
89132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +137,7 @@
94137
95138 makeSomething(clone, i==group.selection.size()-1);
96139 }
140
+ Globals.REPLACEONMAKE = keep;
97141 }
98142
99143 void CloneClipboard(boolean supports)
....@@ -150,16 +194,19 @@
150194
151195 void SetupMenu2(GroupEditor oe)
152196 {
197
+ oe.jTree = new cTree();
198
+
153199 Menu menu;
154200 oe.menuBar.add(menu = new Menu("Edit"));
155201 //editItem = menu.add(new MenuItem("Edit"));
156202 //editItem.addActionListener(this);
157
- undoItem = menu.add(new MenuItem("Undo"));
158
- undoItem.addActionListener(this);
159
- redoItem = menu.add(new MenuItem("Redo"));
160
- redoItem.addActionListener(this);
161
- menu.add("-");
162
- duplicateItem = menu.add(new MenuItem("Duplicate"));
203
+
204
+// undoItem = menu.add(new MenuItem("Undo"));
205
+// undoItem.addActionListener(this);
206
+// redoItem = menu.add(new MenuItem("Redo"));
207
+// redoItem.addActionListener(this);
208
+// menu.add("-");
209
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
163210 duplicateItem.addActionListener(this);
164211 cloneItem = menu.add(new MenuItem("Clone"));
165212 cloneItem.addActionListener(this);
....@@ -175,7 +222,6 @@
175222 copyItem.addActionListener(this);
176223 pasteItem = menu.add(new MenuItem("Paste"));
177224 pasteItem.addActionListener(this);
178
- menu.add("-");
179225
180226 menu.add("-");
181227 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -187,8 +233,8 @@
187233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188234 // pasteExpandItem.addActionListener(this);
189235 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
192238
193239 if (Globals.ADVANCED)
194240 {
....@@ -202,23 +248,23 @@
202248 //zBufferItem.addActionListener(this);
203249 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204250 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
- revertCameraItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
207253
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
254
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
255
+// toggleFullScreenItem.addItemListener(this);
256
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
257
+// cameraMenu.add("-");
258
+//
259
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
260
+// toggleTextureItem.addItemListener(this);
261
+// toggleTextureItem.setState(CameraPane.textureon);
262
+//
263
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
264
+// toggleSwitchItem.addItemListener(this);
265
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212266
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222268 toggleHandleItem.addItemListener(this);
223269 toggleHandleItem.setState(CameraPane.HANDLES);
224270
....@@ -245,7 +291,7 @@
245291
246292 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247293 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
294
+ toggleDebugItem.setState(Globals.DEBUG);
249295
250296 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251297 toggleFrustumItem.addItemListener(this);
....@@ -266,14 +312,14 @@
266312 // animationItem.addItemListener(this);
267313 // animationItem.setState(CameraPane.ANIMATION);
268314 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
315
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270316 editCameraItem.addActionListener(this);
271317
272318 if (Globals.ADVANCED)
273319 {
274320 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275321 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277323 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278324 oe.cameraMenu.add("-");
279325 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +327,7 @@
281327 editLeafItem.addActionListener(this);
282328 lookAtItem.addActionListener(this);
283329 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
330
+ //switchViewItem.addActionListener(this);
285331 }
286332
287333 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +372,29 @@
326372 }
327373
328374 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
331377 backItem = menu.add(new MenuItem("Back"));
332378 backItem.addActionListener(this);
333379 frontItem = menu.add(new MenuItem("Front"));
334380 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
337386 hideItem = menu.add(new MenuItem("Hidden Group"));
338387 hideItem.addActionListener(this);
388
+ }
339389 ungroupItem = menu.add(new MenuItem("Ungroup"));
340390 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
344398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345399 switchGeoItem.addActionListener(this);
346400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +402,6 @@
348402 morphItem = menu.add(new MenuItem("Morph Group"));
349403 morphItem.addActionListener(this);
350404
351
- if (Globals.ADVANCED)
352
- {
353405 menu.add("-");
354406 physicsItem = menu.add(new MenuItem("Physics"));
355407 physicsItem.addActionListener(this);
....@@ -357,30 +409,29 @@
357409 frameselectorItem.addActionListener(this);
358410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359411 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362412 }
363413
364414 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
367417 billboardItem = menu.add(new MenuItem("Billboard"));
368418 billboardItem.addActionListener(this);
369419 csgItem = menu.add(new MenuItem("CSG"));
370420 csgItem.addActionListener(this);
371
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
372422 shadowXItem.addActionListener(this);
373
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
374424 shadowYItem.addActionListener(this);
375
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
377430 if (Globals.ADVANCED)
378431 {
379432 menu.add("-");
380433 linkerItem = menu.add(new MenuItem("Linker"));
381434 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384435 templateItem = menu.add(new MenuItem("Template"));
385436 templateItem.addActionListener(this);
386437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +460,7 @@
409460 genNormalsMESHItem.addActionListener(this);
410461 if (Globals.ADVANCED)
411462 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413464 genNormalsMINEItem.addActionListener(this);
414465 }
415466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -469,6 +520,14 @@
469520 markleavesItem.addActionListener(this);
470521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471522 unmarkleavesItem.addActionListener(this);
523
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
524
+ rewindleavesItem.addActionListener(this);
525
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
526
+ unrewindleavesItem.addActionListener(this);
527
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
528
+ randomleavesItem.addActionListener(this);
529
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
530
+ unrandomleavesItem.addActionListener(this);
472531 menu.add("-");
473532 flipVItem = menu.add(new MenuItem("Flip V"));
474533 flipVItem.addActionListener(this);
....@@ -494,10 +553,15 @@
494553 attachBumpItem.addActionListener(this);
495554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
496555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
497557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
498558 detachPigmentItem.addActionListener(this);
499559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
500560 detachBumpItem.addActionListener(this);
561
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
562
+ embedTexturesItem.addActionListener(this);
563
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
564
+ deEmbedTexturesItem.addActionListener(this);
501565 menu.add("-");
502566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
503567 sortbysizeItem.addActionListener(this);
....@@ -524,8 +588,21 @@
524588 buildToolsMenu(menu);
525589 }
526590
591
+
527592 void SetupUI2(ObjEditor oe)
528593 {
594
+ // June 2019
595
+ if (oe == null)
596
+ {
597
+ //super.SetupUI2(this);
598
+ //return;
599
+ }
600
+
601
+ if (copy != group)
602
+ {
603
+ //super.SetupUI2(this);
604
+ }
605
+
529606 //new Exception().printStackTrace();
530607
531608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -554,27 +631,79 @@
554631 oe.radioPanel.add(dummyButton);
555632 oe.buttonGroup.add(dummyButton);
556633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
557638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558639
559
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
640
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
+ //minButton.setToolTipText("Minimize window");
642
+ //minButton.addActionListener(this);
643
+
644
+ if (Globals.ADVANCED)
645
+ {
646
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ maxButton.setToolTipText("Maximize window");
648
+ maxButton.addActionListener(this);
649
+ }
650
+
651
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ fullButton.setToolTipText("Full-screen window");
653
+ fullButton.addActionListener(this);
654
+
655
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ screenfitButton.setToolTipText("Screen fit");
657
+ screenfitButton.addActionListener(this);
658
+
659
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ restoreCameraButton.setToolTipText("Restore viewpoint");
661
+ restoreCameraButton.addActionListener(this);
662
+
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
665
+ saveButton.addActionListener(this);
666
+
667
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ undoButton.setToolTipText("Previous version");
669
+ undoButton.addActionListener(this);
670
+ undoButton.setEnabled(false);
671
+
672
+ cGridBag updown = new cGridBag().setVertical(true);
673
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ restoreButton.setToolTipText("Restore current");
675
+ restoreButton.addActionListener(this);
676
+ restoreButton.setEnabled(false);
677
+
678
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ replaceButton.setToolTipText("Replace current");
680
+ replaceButton.addActionListener(this);
681
+ replaceButton.setEnabled(false);
682
+
683
+ copyOptionsPanel.add(updown);
684
+
685
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ redoButton.setToolTipText("Next version");
687
+ redoButton.addActionListener(this);
688
+ redoButton.setEnabled(false);
689
+
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
560691 liveCB.setToolTipText("Enable animation");
561692 liveCB.addItemListener(this);
562693
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564695 oneStepButton.setToolTipText("Animate one step forward");
565696 oneStepButton.addActionListener(this);
566697
567
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
568699 fastCB.setToolTipText("Fast mode");
569700 fastCB.addItemListener(this);
570701
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
572
- trackCB.setToolTipText("Enable tracking");
573
- trackCB.addItemListener(this);
574
-
575
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
576
- screenfitButton.setToolTipText("Screen fit");
577
- screenfitButton.addActionListener(this);
702
+ //oe.toolboxPanel.Return();
703
+
704
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
705
+// trackCB.setToolTipText("Enable tracking");
706
+// trackCB.addItemListener(this);
578707
579708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
580709 // screenfitpointButton.addActionListener(this);
....@@ -584,67 +713,244 @@
584713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585714 snapobjectButton.addActionListener(this);
586715 snapobjectButton.setToolTipText("Snap Object");
716
+
717
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ fourButton.addActionListener(this);
719
+ fourButton.setToolTipText("Show control panel only");
587720 }
588721
589
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
- flashSelectionButton.setToolTipText("Show selection");
591
- flashSelectionButton.addActionListener(this);
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
592723
593
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
594
-
595
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- twoButton.setToolTipText("Show center view only");
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
597726 twoButton.addActionListener(this);
598
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599
- fourButton.addActionListener(this);
600
- fourButton.setToolTipText("Show left panel only");
601
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
- sixButton.setToolTipText("2-column layout left");
603
- sixButton.addActionListener(this);
604
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
- threeButton.setToolTipText("2-column layout right");
727
+ this.fullscreenLayout = twoButton;
728
+
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
606731 threeButton.addActionListener(this);
607
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- sevenButton.setToolTipText("3-column layout");
609
- sevenButton.addActionListener(this);
732
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ sixButton.setToolTipText("Show 3D view and controls");
734
+ sixButton.addActionListener(this);
735
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+// sevenButton.setToolTipText("3-column layout");
737
+// sevenButton.addActionListener(this);
610738 //
611739
612
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
613
- rootButton.setToolTipText("Edit selection in new tab");
740
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ rootButton.setToolTipText("Open selection in new tab");
614742 rootButton.addActionListener(this);
615743
616
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617745 closeButton.setToolTipText("Close tab");
618746 closeButton.addActionListener(this);
619747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
620748 //clearButton.addActionListener(this);
621
-
622
- cGridBag commandsPanel = new cGridBag();
749
+
750
+ cGridBag row1 = new cGridBag();
623751
624
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
625
- editButton.setToolTipText("Edit selection");
752
+ // INSERT
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ gridButton.setToolTipText("Create grid");
755
+ gridButton.addActionListener(this);
756
+
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ boxButton.setToolTipText("Create box");
759
+ boxButton.addActionListener(this);
760
+
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ sphereButton.setToolTipText("Create sphere");
763
+ sphereButton.addActionListener(this);
764
+
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ coneButton.setToolTipText("Create cone");
767
+ coneButton.addActionListener(this);
768
+
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ torusButton.setToolTipText("Create torus");
771
+ torusButton.addActionListener(this);
772
+
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
774
+ superButton.setToolTipText("Create superellipsoid");
775
+ superButton.addActionListener(this);
776
+
777
+ if (Globals.ADVANCED)
778
+ {
779
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ kleinButton.setToolTipText("Create Klein bottle");
781
+ kleinButton.addActionListener(this);
782
+ }
783
+
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ particlesButton.setToolTipText("Create particle system");
786
+ particlesButton.addActionListener(this);
787
+
788
+ oe.toolboxPanel.add(row1);
789
+
790
+ cGridBag row2 = new cGridBag();
791
+
792
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
793
+ groupButton.setToolTipText("Create group");
794
+ groupButton.addActionListener(this);
795
+
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ compositeButton.setToolTipText("Create composite");
798
+ compositeButton.addActionListener(this);
799
+
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ switchButton.setToolTipText("Create item switcher");
802
+ switchButton.addActionListener(this);
803
+
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ loopButton.setToolTipText("Create loop");
806
+ loopButton.addActionListener(this);
807
+
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ textureButton.setToolTipText("Create texture");
810
+ textureButton.addActionListener(this);
811
+
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ overlayButton.setToolTipText("Create overlay");
814
+ overlayButton.addActionListener(this);
815
+
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ lightButton.setToolTipText("Create light");
818
+ lightButton.addActionListener(this);
819
+
820
+ oe.toolboxPanel.add(row2);
821
+
822
+ // ENVYMAPS
823
+ cGridBag row3 = new cGridBag();
824
+ row3.preferredHeight = 20;
825
+
826
+ AddSkyboxButton("default", "rgb", row3);
827
+ AddSkyboxButton("default", "cornell", row3);
828
+ AddSkyboxButton("default", "uffizi", row3);
829
+ AddSkyboxButton("default", "CloudyHills", row3);
830
+ AddSkyboxButton("default", "skycube", row3);
831
+
832
+ oe.toolboxPanel.add(row3);
833
+
834
+ cGridBag row4 = new cGridBag();
835
+ row4.preferredHeight = 20;
836
+
837
+ AddSkyboxButton("bridge", "Bridge2", row4);
838
+ AddSkyboxButton("urban", "GamlaStan2", row4);
839
+ AddSkyboxButton("urban", "Parliament", row4);
840
+ AddSkyboxButton("urban", "Roundabout", row4);
841
+
842
+ oe.toolboxPanel.add(row4);
843
+
844
+ cGridBag row5 = new cGridBag();
845
+ row5.preferredHeight = 20;
846
+
847
+ AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
+ AddSkyboxButton("urban", "UnionSquare", row5);
851
+
852
+ oe.toolboxPanel.add(row5);
853
+
854
+ cGridBag row6 = new cGridBag();
855
+ row6.preferredHeight = 20;
856
+
857
+ AddSkyboxButton("park", "BerzeliiPark", row6);
858
+ AddSkyboxButton("park", "Buddha", row6);
859
+ AddSkyboxButton("park", "CNTower2", row6);
860
+ //AddSkyboxButton("park", "Fatbursparken", row6);
861
+ AddSkyboxButton("park", "NiagaraFalls1", row6);
862
+
863
+ oe.toolboxPanel.add(row6);
864
+
865
+ cGridBag row7 = new cGridBag();
866
+ row7.preferredHeight = 20;
867
+
868
+ AddSkyboxButton("park", "NiagaraFalls3", row7);
869
+ AddSkyboxButton("park", "Park", row7);
870
+ //AddSkyboxButton("park", "Park2", row6);
871
+ //AddSkyboxButton("park", "Path", row6);
872
+ AddSkyboxButton("park", "Pond", row7);
873
+ AddSkyboxButton("park", "Skansen", row7);
874
+
875
+ oe.toolboxPanel.add(row7);
876
+
877
+ cGridBag row8 = new cGridBag();
878
+ row8.preferredHeight = 20;
879
+
880
+ AddSkyboxButton("park", "Skansen2", row8);
881
+ AddSkyboxButton("park", "Skansen3", row8);
882
+ AddSkyboxButton("park", "Skansen4", row8);
883
+ AddSkyboxButton("park", "Skansen5", row8);
884
+
885
+ oe.toolboxPanel.add(row8);
886
+
887
+ cGridBag row9 = new cGridBag();
888
+ row9.preferredHeight = 20;
889
+
890
+ AddSkyboxButton("park", "Stairs", row9);
891
+ //AddSkyboxButton("park", "Tantolunden", row6);
892
+ //AddSkyboxButton("park", "Tantolunden3", row6);
893
+ AddSkyboxButton("park", "Tantolunden4", row9);
894
+
895
+ oe.toolboxPanel.add(row9);
896
+/*
897
+BerzeliiPark
898
+Buddha
899
+CNTower2
900
+Fatbursparken
901
+NiagaraFalls1
902
+NiagaraFalls3
903
+Park
904
+Park2
905
+Path
906
+Pond
907
+Skansen
908
+Skansen2
909
+Skansen3
910
+Skansen4
911
+Skansen5
912
+Stairs
913
+Tantolunden
914
+Tantolunden3
915
+Tantolunden4
916
+ */
917
+
918
+ for (int i=1; --i>=0;)
919
+ {
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
922
+ }
923
+
924
+ // EDIT panel
925
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
926
+ editButton.setToolTipText("Pin selection controls");
626927 editButton.addActionListener(this);
627928
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
630931 uneditButton.addActionListener(this);
631932
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633
- allParamsButton.setToolTipText("Edit all params");
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
634935 allParamsButton.addActionListener(this);
635936
636
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
937
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637938 clearPanelButton.setToolTipText("Clear edit panel");
638939 clearPanelButton.addActionListener(this);
639940
640
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
941
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641942 unselectButton.setToolTipText("Unselect");
642943 unselectButton.addActionListener(this);
643944
644
- commandsPanel.preferredHeight = 1;
945
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
946
+ flashSelectionButton.setToolTipText("Highlight selection");
947
+ flashSelectionButton.addActionListener(this);
645948
646
- oe.treePanel.add(commandsPanel);
647
- oe.treePanel.Return();
949
+ editCommandsPanel.preferredHeight = 1;
950
+
951
+ SetPinStates(false);
952
+// oe.treePanel.add(commandsPanel);
953
+// oe.treePanel.Return();
648954
649955 // oe.aConstraints.gridx += 1;
650956 // oe.aConstraints.weighty = 0;
....@@ -661,32 +967,20 @@
661967
662968 JScrollPane jSP;
663969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
664
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
665971 ResetModel();
666972
667973 oe.treePanel.add(jSPPanel);
668974 oe.treePanel.Return();
669975
670
- cGridBag copyOptionsPanel = new cGridBag();
671
-
672
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
673
- colorCB.setToolTipText("Copy color when dropped");
674
- colorCB.addItemListener(this);
675
-
676
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
677
- materialCB.setToolTipText("Copy material when dropped");
678
- materialCB.addItemListener(this);
679
-
680
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
681
- textureCB.setToolTipText("Copy texture when dropped");
682
- textureCB.addItemListener(this);
683
-
684
- copyOptionsPanel.preferredHeight = 1;
685976 oe.treePanel.add(copyOptionsPanel);
686977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
687981
688
-// mainPanel.setDividerLocation(0.5); //1.0);
689
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
690984
691985 //jList.addListSelectionListener(this);
692986 oe.jTree.addTreeSelectionListener(this);
....@@ -694,7 +988,7 @@
694988 //jTree.setEditable(true);
695989 oe.jTree.setDragEnabled(true);
696990 //jTree.setPreferredSize(new Dimension(10,10));
697
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
698992
699993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
700994
....@@ -706,29 +1000,49 @@
7061000 dgr.addDragGestureListener(this);
7071001 }catch(Exception e) {}
7081002 */
709
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
7101004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7111005 }
7121006
7131007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7141008 {
1009
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1010
+ colorCB.setToolTipText("Copy color when dropped");
1011
+ colorCB.addItemListener(this);
1012
+
1013
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1014
+ materialCB.setToolTipText("Copy material when dropped");
1015
+ materialCB.addItemListener(this);
1016
+
1017
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1018
+ textureCB.setToolTipText("Copy texture when dropped");
1019
+ textureCB.addItemListener(this);
1020
+
1021
+ panel.Return();
1022
+
7151023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7161024 boxCB.setToolTipText("Display bounding boxes");
7171025 boxCB.addItemListener(this);
7181026
7191027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
720
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
7211029 zoomBoxCB.addItemListener(this);
7221030
7231031 if (true) // Globals.ADVANCED)
7241032 {
725
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
726
- supportCB.setToolTipText("Enable rigging");
727
- supportCB.addItemListener(this);
1033
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1034
+// supportCB.setToolTipText("Enable rigging");
1035
+// supportCB.addItemListener(this);
1036
+
1037
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1038
+ freezeCB.setToolTipText("Fast moving camera");
1039
+ freezeCB.addItemListener(this);
7281040
7291041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7301042 // localCB.addItemListener(this);
7311043
1044
+ panel.Return();
1045
+
7321046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7331047 crowdCB.setToolTipText("Used for crowds");
7341048 crowdCB.addItemListener(this);
....@@ -745,6 +1059,8 @@
7451059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7461060 // speakerMocapCB.addItemListener(this);
7471061
1062
+ panel.Return();
1063
+
7481064 if (false)
7491065 {
7501066 // handled in scripts
....@@ -759,34 +1075,74 @@
7591075 //constraints.gridy += 1;
7601076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7611077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
7621079 }
7631080
7641081 //constraints.gridx += 1;
7651082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7661083 // debugCB.addItemListener(this);
7671084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
7681089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
7691091 oeilCB.addItemListener(this);
7701092
1093
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1094
+ shadowCB.setToolTipText("When live compute shadows");
1095
+ shadowCB.addItemListener(this);
1096
+
1097
+ panel.Return();
1098
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1099
+ toggleTextureCB.setToolTipText("Load textures");
1100
+ toggleTextureCB.addItemListener(this);
1101
+
1102
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1103
+ toggleSwitchCB.setToolTipText("Choose a single item");
1104
+ toggleSwitchCB.addItemListener(this);
1105
+
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
1109
+
1110
+ panel.Return();
1111
+ if (Globals.ADVANCED)
1112
+ {
7711113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7721114 lookAtCB.setToolTipText("Look-at target");
7731115 lookAtCB.addItemListener(this);
1116
+ }
7741117
7751118 }
7761119
7771120 cGridBag fill = new cGridBag();
778
-
7791121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
7801126
7811127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
7821130
7831131 }
7841132
7851133 void EditObject(Object3D obj)
7861134 {
7871135 cRadio radioButton = new cRadio(obj.name);
1136
+
1137
+ // June 2019. Patch to avoid bug with transparency.
1138
+ radioButton.hadMaterial = obj.material != null;
1139
+ if (!radioButton.hadMaterial)
1140
+ {
1141
+ obj.material = new cMaterial();
1142
+ }
1143
+
7881144 radioButton.SetObject(obj);
789
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
7901146 radioButton.SetCamera(cameraView.renderCamera, false);
7911147 radioButton.addActionListener(this);
7921148 radioPanel.add(radioButton);
....@@ -796,6 +1152,8 @@
7961152
7971153 void SetupViews(ObjEditor oe)
7981154 {
1155
+ theFrame = this;
1156
+
7991157 oe.SetupViews();
8001158
8011159 System.out.println("SetupViews");
....@@ -804,23 +1162,28 @@
8041162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8051163 }
8061164
807
- JCheckBox liveCB;
808
- JCheckBox supportCB;
809
- JCheckBox localCB;
810
- JCheckBox crowdCB;
811
- JCheckBox smoothCB;
812
- JCheckBox fastCB;
813
- JCheckBox slowCB;
814
- JCheckBox boxCB;
815
- JCheckBox zoomBoxCB;
816
- JCheckBox trackCB;
817
- JCheckBox smoothfocusCB;
1165
+ cToggleButton liveCB;
1166
+ cCheckBox supportCB;
1167
+ cCheckBox localCB;
1168
+ cCheckBox crowdCB;
1169
+ cCheckBox smoothCB;
1170
+ cToggleButton fastCB;
1171
+ cCheckBox slowCB;
1172
+ cCheckBox boxCB;
1173
+ cCheckBox zoomBoxCB;
1174
+ cCheckBox freezeCB;
1175
+ //cToggleButton trackCB;
1176
+ cCheckBox trackCB;
1177
+ cCheckBox smoothfocusCB;
8181178 // JCheckBox speakerMocapCB;
819
- JCheckBox speakerCameraCB;
820
- JCheckBox speakerFocusCB;
821
- JCheckBox debugCB;
822
- JCheckBox oeilCB;
823
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
8241187
8251188 // static int COLOR = 1;
8261189 // static int MATERIAL = 2;
....@@ -828,9 +1191,9 @@
8281191
8291192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8301193
831
- JCheckBox colorCB;
832
- JCheckBox materialCB;
833
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
8341197
8351198 public void itemStateChanged(ItemEvent e)
8361199 {
....@@ -858,6 +1221,7 @@
8581221 } else if(e.getSource() == liveCB)
8591222 {
8601223 cameraView.ToggleLive();
1224
+ refreshContents(false);
8611225 }
8621226 else if(e.getSource() == supportCB)
8631227 {
....@@ -922,6 +1286,18 @@
9221286 {
9231287 cameraView.ToggleOeil();
9241288 }
1289
+ else if(e.getSource() == shadowCB)
1290
+ {
1291
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1292
+ }
1293
+ else if(e.getSource() == freezeCB)
1294
+ {
1295
+ Globals.FREEZEONMOVE ^= true;
1296
+ }
1297
+ else if(e.getSource() == autokeepCB)
1298
+ {
1299
+ Globals.REPLACEONMAKE ^= true;
1300
+ }
9251301 else if(e.getSource() == lookAtCB)
9261302 {
9271303 cameraView.ToggleLookAt();
....@@ -938,7 +1314,8 @@
9381314
9391315 /**/
9401316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
941
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
9421319 if ((path == null) || (path.getPathCount() <= 1)) {
9431320 // We can't move the root node or an empty selection
9441321 return;
....@@ -1001,8 +1378,6 @@
10011378 }
10021379 }
10031380
1004
- String string = (String) object;
1005
-
10061381 System.out.println("Transfer = " + object + "; drop : " + target);
10071382 // if( object instanceof java.io.File[])
10081383 // {
....@@ -1010,6 +1385,8 @@
10101385 // objEditor.DropFile((java.io.File[]) object, true);
10111386 // return;
10121387 // }
1388
+
1389
+ String string = object.toString();
10131390
10141391 // File path for Mac and Windows
10151392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1055,23 +1432,33 @@
10551432
10561433 assert target == objEditor.jTree;
10571434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
10581436 try {
1059
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10601438 } catch (Exception e) {
10611439 System.out.println("destinationPath : " + destinationPath);
10621440 return;
10631441 }
10641442
1065
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
10661444 {
1445
+ Object3D child = (Object3D)group.selection.elementAt(i);
1446
+
1447
+ // Cannot move into itself
1448
+ if (child == destinationLeaf)
1449
+ return;
1450
+ }
1451
+
1452
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1453
+// {
10671454 loadClipboard(true);
10681455 objEditor.jTree.setSelectionPath(destinationPath);
10691456 pasteInto(false, false);
1070
- } else {
1071
- loadClipboard(false);
1072
- objEditor.jTree.setSelectionPath(destinationPath);
1073
- pasteInto(false, false); // true); // ???
1074
- }
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
10751462 }
10761463 public void dropActionChanged(DropTargetDragEvent dtde)
10771464 // Called if the user has modified the current drop gesture
....@@ -1176,22 +1563,30 @@
11761563 {
11771564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11781565 //heightFieldItem.addActionListener(this);
1179
- gridItem = menu.add(new MenuItem("Grid"));
1180
- gridItem.addActionListener(this);
1181
- rectoidItem = menu.add(new MenuItem("Box"));
1182
- rectoidItem.addActionListener(this);
1183
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1184
- ellipsoidItem.addActionListener(this);
1185
- coneItem = menu.add(new MenuItem("Cone"));
1186
- coneItem.addActionListener(this);
1187
- torusItem = menu.add(new MenuItem("Torus"));
1188
- torusItem.addActionListener(this);
1189
- superItem = menu.add(new MenuItem("Superellipsoid"));
1190
- superItem.addActionListener(this);
1566
+// gridItem = menu.add(new MenuItem("Grid"));
1567
+// gridItem.addActionListener(this);
1568
+// rectoidItem = menu.add(new MenuItem("Box"));
1569
+// rectoidItem.addActionListener(this);
1570
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1571
+// ellipsoidItem.addActionListener(this);
1572
+// coneItem = menu.add(new MenuItem("Cone"));
1573
+// coneItem.addActionListener(this);
1574
+// torusItem = menu.add(new MenuItem("Torus"));
1575
+// torusItem.addActionListener(this);
1576
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1577
+// superItem.addActionListener(this);
1578
+
1579
+ cameraItem = menu.add(new MenuItem("Camera"));
1580
+ cameraItem.addActionListener(this);
1581
+
1582
+ if (!Globals.ADVANCED)
1583
+ {
11911584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11921585 kleinItem.addActionListener(this);
1193
- particleItem = menu.add(new MenuItem("Particle system"));
1194
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
11951590 if (Globals.ADVANCED)
11961591 {
11971592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1217,15 +1612,15 @@
12171612 }
12181613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12191614 bezierItem.addActionListener(this);
1220
- overlayItem = menu.add(new MenuItem("Overlay"));
1221
- overlayItem.addActionListener(this);
1222
- lightItem = menu.add(new MenuItem("Light"));
1223
- lightItem.addActionListener(this);
1615
+// overlayItem = menu.add(new MenuItem("Overlay"));
1616
+// overlayItem.addActionListener(this);
1617
+// lightItem = menu.add(new MenuItem("Light"));
1618
+// lightItem.addActionListener(this);
12241619 menu.add("-");
12251620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12261621 //superLoopItem.addActionListener(this);
1227
- loopItem = menu.add(new MenuItem("Loop"));
1228
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
12291624 doubleItem = menu.add(new MenuItem("Fork"));
12301625 doubleItem.addActionListener(this);
12311626 if (Globals.ADVANCED)
....@@ -1241,6 +1636,9 @@
12411636 animationItem.addItemListener(this);
12421637 animationItem.setState(Globals.ANIMATION);
12431638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
12441642 menu.add("-");
12451643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12461644 parseverticesItem.addActionListener(this);
....@@ -1253,6 +1651,8 @@
12531651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12541652 reduce34MorphItem.addActionListener(this);
12551653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
12561656 menu.add(computeAOItem = new MenuItem("Compute AO"));
12571657 computeAOItem.addActionListener(this);
12581658
....@@ -1261,11 +1661,9 @@
12611661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12621662 mirrorItem.addActionListener(this);
12631663 menu.add("-");
1264
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1265
- memoryItem.addActionListener(this);
12661664 menu.add(analyzeItem = new MenuItem("Analyze"));
12671665 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1666
+ menu.add(dumpItem = new MenuItem("Print"));
12691667 dumpItem.addActionListener(this);
12701668 // menu.add(pathItem = new MenuItem("From-to path"));
12711669 // pathItem.addActionListener(this);
....@@ -1406,9 +1804,34 @@
14061804 shadow.material = new cMaterial(obj.material);
14071805 shadow.material.diffuse = 0.0001f;
14081806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
14091808
14101809 makeSomething(shadow);
14111810 }
1811
+
1812
+ private void ClearUnpinned()
1813
+ {
1814
+ //for (Object3D obj : listUI)
1815
+ for (int i=listUI.size(); --i>=0;)
1816
+ {
1817
+ Object3D obj = listUI.elementAt(i);
1818
+ if (!obj.pinned)
1819
+ {
1820
+ obj.CloseUI();
1821
+ listUI.remove(i);
1822
+ }
1823
+ }
1824
+ }
1825
+
1826
+ private void EditElement(Object3D elem, boolean newWindow)
1827
+ {
1828
+ // if (!(elem instanceof Composite))
1829
+ // newWindow = false;
1830
+ listUI.add(elem);
1831
+ elem.openEditWindow(this, newWindow); //, false);
1832
+ System.out.println("edit : " + elem);
1833
+ elem.editWindow.refreshContents(true); // ? new
1834
+ }
14121835
14131836 /**
14141837 * applyExample
....@@ -1653,7 +2076,7 @@
16532076 {
16542077 ScreenFit();
16552078 } else
1656
- if (source == switchItem)
2079
+ if (source == switchViewItem)
16572080 {
16582081 cVector v1 = new cVector();
16592082 cVector v2 = new cVector();
....@@ -1662,11 +2085,11 @@
16622085 objEditor.cameraView.renderCamera.setAim(v2, v1);
16632086 objEditor.cameraView.repaint();
16642087 } else
1665
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
16662089 {
16672090 makeSomething(new Box());
16682091 } else
1669
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
16702093 {
16712094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16722095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1745,27 +2168,27 @@
17452168
17462169 makeSomething(obj);
17472170 } else
1748
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
17492172 {
17502173 makeSomething(new Grid());
17512174 } else
1752
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
17532176 {
17542177 makeSomething(new Sphere());
17552178 } else
1756
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
17572180 {
17582181 makeSomething(new Cone());
17592182 } else
1760
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
17612184 {
17622185 makeSomething(new Torus());
17632186 } else
1764
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
17652188 {
17662189 makeSomething(new Superellipsoid());
17672190 } else
1768
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
17692192 {
17702193 makeSomething(new Klein());
17712194 } else
....@@ -1785,7 +2208,7 @@
17852208 {
17862209 makeSomething(new BezierSurface());
17872210 } else
1788
- if (source == overlayItem)
2211
+ if (source == overlayItem || source == overlayButton)
17892212 {
17902213 /*
17912214 Object3D obj = new BezierSurface(5,8);
....@@ -1833,10 +2256,27 @@
18332256 s.setup();
18342257 makeSomething(s);
18352258 } else
1836
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
18372260 {
18382261 makeSomething(new Light());
18392262 } else
2263
+// if (source == skybox1Button ||
2264
+// source == skybox2Button ||
2265
+// source == skybox3Button ||
2266
+// source == skybox4Button ||
2267
+// source == skybox5Button ||
2268
+// source == skybox6Button ||
2269
+// source == skybox7Button ||
2270
+// source == skybox11Button ||
2271
+// source == skybox12Button ||
2272
+// source == skybox13Button ||
2273
+// source == skybox14Button ||
2274
+// source == skybox15Button ||
2275
+// source == skybox16Button ||
2276
+// source == skybox17Button)
2277
+// {
2278
+// ChangeSkybox(source);
2279
+// } else
18402280 if (source == csgItem)
18412281 {
18422282 group(new CSG());
....@@ -1883,30 +2323,30 @@
18832323
18842324 group(g);
18852325 } else
1886
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
18872327 {
18882328 Composite csg = new GroupLeaf();
18892329 csg.count = 5;
18902330 group(csg);
1891
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
18922332 csg.addChild(child);
18932333 child.addChild(csg);
18942334 } else
18952335 if (source == doubleItem)
18962336 {
1897
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
18982338 csg.count = 5;
18992339 group(csg);
1900
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
19012341 csg.addChild(child);
19022342 child.addChild(csg);
1903
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
19042344 csg.addChild(child);
19052345 child.addChild(csg);
19062346 } else
19072347 if (source == tripleItem)
19082348 {
1909
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
19102350 csg.count = 4;
19112351 group(csg);
19122352 Composite child = new cGroup();
....@@ -1922,7 +2362,7 @@
19222362 if (source == computeAOItem)
19232363 {
19242364 Globals.drawMode = CameraPane.OCCLUSION;
1925
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
19262366 } else
19272367 if (source == recompileItem)
19282368 {
....@@ -1956,6 +2396,46 @@
19562396 {
19572397 DumpObject();
19582398 } else
2399
+ if (source == minButton)
2400
+ {
2401
+ Minimize();
2402
+ } else
2403
+ if (source == maxButton)
2404
+ {
2405
+ Maximize();
2406
+ } else
2407
+ if (source == fullButton)
2408
+ {
2409
+ ToggleFullScreen();
2410
+ } else
2411
+ if (source == undoButton)
2412
+ {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2416
+ Undo();
2417
+ } else
2418
+ if (source == restoreButton)
2419
+ {
2420
+ // Restore current version
2421
+ Restore();
2422
+ } else
2423
+ if (source == replaceButton)
2424
+ {
2425
+ // Overwrite current version
2426
+ Replace();
2427
+ } else
2428
+ if (source == redoButton)
2429
+ {
2430
+ // Go to next version
2431
+ Redo();
2432
+ } else
2433
+ if (source == saveButton)
2434
+ {
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
2438
+ } else
19592439 if (source == oneStepButton)
19602440 {
19612441 Globals.ONESTEP = true;
....@@ -1963,17 +2443,14 @@
19632443 } else
19642444 if (source == screenfitButton)
19652445 {
1966
- //Reload(lastConverter, lastFilename, true);
19672446 ScreenFit();
19682447 } else
19692448 if (source == screenfitpointButton)
19702449 {
1971
- //Reload(lastConverter, lastFilename, true);
19722450 ScreenFitPoint();
19732451 } else
19742452 if (source == snapobjectButton)
19752453 {
1976
- //Reload(lastConverter, lastFilename, true);
19772454 SnapObject();
19782455 } else
19792456 // if (event.getSource() == recompileButton)
....@@ -2337,7 +2814,7 @@
23372814 {
23382815 StepAll();
23392816 } else
2340
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
23412818 {
23422819 //int indices[] = jList.getSelectedIndices();
23432820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2349,9 +2826,9 @@
23492826 {
23502827 ClearSelection(true);
23512828 } else
2352
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
23532830 {
2354
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
23552832 } else
23562833 if (source == hideItem)
23572834 {
....@@ -2369,11 +2846,11 @@
23692846 {
23702847 makeSomething(new Camera());
23712848 } else
2372
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
23732850 {
23742851 group(new Composite());
23752852 } else
2376
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
23772854 {
23782855 RandomNode random = new RandomNode();
23792856 group(random);
....@@ -2475,7 +2952,7 @@
24752952 {
24762953 group(new cLinker());
24772954 } else
2478
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
24792956 {
24802957 group(new TextureNode());
24812958 } else
....@@ -2495,17 +2972,30 @@
24952972 {
24962973 CastShadow(2);
24972974 } else
2498
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
24992976 {
2500
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
25012979 for (int i=0; i<group.selection.size(); i++)
25022980 {
2503
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
25042986 }
25052987
2506
- ClearSelection(false);
2507
-
2508
- refreshContents();
2988
+ if (!hasRoot)
2989
+ {
2990
+ for (int i=0; i<group.selection.size(); i++)
2991
+ {
2992
+ Ungroup(group.selection.get(i));
2993
+ }
2994
+
2995
+ ClearSelection(false);
2996
+
2997
+ refreshContents();
2998
+ }
25092999 } else
25103000 if (source == genUVItem)
25113001 {
....@@ -2517,7 +3007,7 @@
25173007 } else
25183008 if (source == genNormalsMESHItem)
25193009 {
2520
- GenNormals(true); // TODO
3010
+ GenNormalsMESH();
25213011 } else
25223012 if (source == genNormalsORGANItem)
25233013 {
....@@ -2582,6 +3072,22 @@
25823072 if (source == unmarkleavesItem)
25833073 {
25843074 MarkLeaves(false);
3075
+ } else
3076
+ if (source == rewindleavesItem)
3077
+ {
3078
+ RewindLeaves(true);
3079
+ } else
3080
+ if (source == unrewindleavesItem)
3081
+ {
3082
+ RewindLeaves(false);
3083
+ } else
3084
+ if (source == randomleavesItem)
3085
+ {
3086
+ RandomLeaves(true);
3087
+ } else
3088
+ if (source == unrandomleavesItem)
3089
+ {
3090
+ RandomLeaves(false);
25853091 } else
25863092 if (source == flipVItem)
25873093 {
....@@ -2790,7 +3296,7 @@
27903296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27913297 {
27923298 obj = (Object3D)e.nextElement();
2793
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
27943300 }
27953301
27963302 refreshContents();
....@@ -2806,6 +3312,31 @@
28063312
28073313 refreshContents();
28083314 } else
3315
+ if (source == embedTexturesItem)
3316
+ {
3317
+ Object3D obj;
3318
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3319
+ {
3320
+ obj = (Object3D)e.nextElement();
3321
+ obj.EmbedTextures(true);
3322
+ }
3323
+
3324
+ refreshContents();
3325
+ } else
3326
+ if (source == deEmbedTexturesItem)
3327
+ {
3328
+ Object3D obj;
3329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3330
+ {
3331
+ obj = (Object3D)e.nextElement();
3332
+ obj.EmbedTextures(false);
3333
+ }
3334
+
3335
+ CameraPane.texturepigment.clear();
3336
+ CameraPane.texturebump.clear();
3337
+
3338
+ refreshContents();
3339
+ } else
28093340 if (source == flashSelectionButton)
28103341 {
28113342 CameraPane.flash = true;
....@@ -2817,6 +3348,10 @@
28173348 if (source == twoButton)
28183349 {
28193350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
28203355 // bug
28213356 //gridPanel.setDividerLocation(1.0);
28223357 //bigPanel.setDividerLocation(0.0);
....@@ -2849,10 +3384,31 @@
28493384 bigThree.ClearUI();
28503385 bigThree.add(centralPanel);
28513386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
3389
+
3390
+// refreshContents(true);
3391
+//
3392
+// try
3393
+// {
3394
+// java.awt.Robot bot = new java.awt.Robot();
3395
+// int mask = InputEvent.BUTTON1_MASK;
3396
+// bot.mouseMove(100, 100);
3397
+// bot.mousePress(mask);
3398
+// bot.mouseRelease(mask);
3399
+// }
3400
+// catch (Exception e)
3401
+// {
3402
+//
3403
+// }
3404
+
28523405 } else
28533406 if (source == threeButton)
28543407 {
28553408 radio.layout = threeButton;
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
28563412
28573413 // bigThree.remove(scenePanel);
28583414 // bigThree.remove(centralPanel);
....@@ -2882,13 +3438,18 @@
28823438 // centralPanel.setVisible(true);
28833439 // XYZPanel.setVisible(true);
28843440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
28853442 bigThree.add(centralPanel);
2886
- bigThree.add(XYZPanel);
28873443 bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
28883446 } else
28893447 if (source == fourButton)
28903448 {
28913449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
28923453
28933454 // bigThree.remove(scenePanel);
28943455 // bigThree.remove(centralPanel);
....@@ -2920,10 +3481,15 @@
29203481 bigThree.ClearUI();
29213482 bigThree.add(scenePanel);
29223483 bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
29233486 } else
29243487 if (source == sixButton)
29253488 {
29263489 radio.layout = sixButton;
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
29273493
29283494 // bigThree.remove(scenePanel);
29293495 // bigThree.remove(centralPanel);
....@@ -2953,13 +3519,18 @@
29533519 // centralPanel.setVisible(true);
29543520 // XYZPanel.setVisible(false);
29553521 bigThree.ClearUI();
2956
- bigThree.add(scenePanel);
29573522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
29583524 bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
29593527 } else
29603528 if (source == sevenButton)
29613529 {
29623530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
29633534
29643535 // bigThree.remove(scenePanel);
29653536 // bigThree.remove(centralPanel);
....@@ -2993,6 +3564,8 @@
29933564 bigThree.add(centralPanel);
29943565 bigThree.add(XYZPanel);
29953566 bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
29963569 } else
29973570 if (source == rootButton)
29983571 {
....@@ -3004,6 +3577,7 @@
30043577 EditObject(obj);
30053578 }
30063579
3580
+ cameraView.requestFocusInWindow();
30073581 refreshContents(true);
30083582 } else
30093583 if (source == closeButton)
....@@ -3013,22 +3587,37 @@
30133587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30143588 {
30153589 ab = (cRadio)e.nextElement();
3016
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30173591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
30183598 buttonGroup.remove(ab);
30193599 radioPanel.remove(ab);
30203600
3021
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
30223603 // ab.GetObject().objectUI = null; // ?????????
30233604
30243605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30253606 break;
30263607 }
30273608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
30283611 refreshContents(true);
30293612 } else
30303613 if (source == editItem || source == editButton)
30313614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
30323621 EditSelection(false);
30333622 } else
30343623 if (source == uneditButton)
....@@ -3038,10 +3627,11 @@
30383627 Object3D child = (Object3D)e.nextElement();
30393628 if(child.editWindow != null)
30403629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
30413631 child.CloseUI();
30423632 listUI.remove(child);
30433633
3044
- child.editWindow = null; // ???????????
3634
+ //child.editWindow = null; // ???????????
30453635 }
30463636 objEditor.ctrlPanel.FlushUI();
30473637 //objEditor.jTree.clearSelection();
....@@ -3054,6 +3644,7 @@
30543644 //copy.ClearUI();
30553645 for (Object3D obj : listUI)
30563646 {
3647
+ obj.pinned = false;
30573648 obj.CloseUI();
30583649 }
30593650 listUI.clear();
....@@ -3063,7 +3654,7 @@
30633654 {
30643655 assert(copy == group);
30653656
3066
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30673658
30683659 for (Object3D obj : listUI)
30693660 {
....@@ -3112,6 +3703,9 @@
31123703 }
31133704
31143705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
31153709 //Globals.theRenderer.object = group;
31163710 if(!useclient)
31173711 {
....@@ -3128,7 +3722,9 @@
31283722 sideView.object = group;
31293723 }
31303724
3131
-// fix "+" issue group.editWindow = this;
3725
+// fix "+" issue
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
31323728
31333729 /*
31343730 currentLayout = radio.layout;
....@@ -3136,18 +3732,27 @@
31363732 currentLayout = sevenButton;
31373733 */
31383734 radio.layout.doClick();
3735
+
3736
+ ClearUnpinned();
3737
+ //Grafreed.Assert(group != null);
3738
+ //Grafreed.Assert(group.selection != null);
3739
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3740
+ if (group.selection == null || group.selection.size() == 1)
3741
+ EditSelection(false);
31393742 keepparent = group.parent;
31403743 // PARENT = NULL or not???
31413744 //group.parent = null; // ROOT
31423745 //group.attributes = -1;
31433746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
31443749 refreshContents(true);
31453750 } else if (event.getSource() == editCameraItem)
31463751 {
31473752 cameraView.ProtectCamera();
31483753 cameraView.repaint();
31493754 return;
3150
- } else if (event.getSource() == revertCameraItem)
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31513756 {
31523757 cameraView.RevertCamera();
31533758 cameraView.repaint();
....@@ -3164,7 +3769,6 @@
31643769 }
31653770
31663771 boolean useclient = false;
3167
- cRadio radio;
31683772
31693773 void ToggleRoot()
31703774 {
....@@ -3403,7 +4007,8 @@
34034007
34044008 int size = obj.MemorySize();
34054009
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
4010
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4011
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34074012 }
34084013 }
34094014 catch (Exception e)
....@@ -3484,6 +4089,13 @@
34844089 void GenNormals(boolean crease)
34854090 {
34864091 group.GenNormalsS(crease);
4092
+
4093
+ refreshContents();
4094
+ }
4095
+
4096
+ void GenNormalsMESH()
4097
+ {
4098
+ group.GenNormalsMeshS();
34874099
34884100 refreshContents();
34894101 }
....@@ -3719,7 +4331,7 @@
37194331
37204332 try
37214333 {
3722
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37234335 }
37244336 catch (Exception e)
37254337 {
....@@ -4111,6 +4723,18 @@
41114723 refreshContents();
41124724 }
41134725
4726
+ void RewindLeaves(boolean hide)
4727
+ {
4728
+ group.selection.RewindLeaves(hide);
4729
+ refreshContents();
4730
+ }
4731
+
4732
+ void RandomLeaves(boolean hide)
4733
+ {
4734
+ group.selection.RandomLeaves(hide);
4735
+ refreshContents();
4736
+ }
4737
+
41144738 void SetTexRes(int tr)
41154739 {
41164740 group.selection.SetTexRes(tr);
....@@ -4182,28 +4806,25 @@
41824806 // }
41834807 // }
41844808
4185
- static boolean allparams = true;
4186
-
4187
- static Vector<Object3D> listUI = new Vector<Object3D>();
4188
-
41894809 void EditSelection(boolean newWindow)
41904810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
41914817 // aConstraints.gridy = 0;
41924818 for (int i=0; i<group.selection.size(); i++)
41934819 {
41944820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41954821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4196
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41974823
41984824 Object3D elem = (Object3D)group.selection.elementAt(i);
41994825 if(elem != group || !newWindow)
42004826 {
4201
- // if (!(elem instanceof Composite))
4202
- // newWindow = false;
4203
- listUI.add(elem);
4204
- elem.openEditWindow(this, newWindow); //, false);
4205
- System.out.println("edit : " + elem);
4206
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
42074828 }
42084829 }
42094830 }
....@@ -4278,7 +4899,8 @@
42784899 //new Exception().printStackTrace();
42794900
42804901 freezemodel = true;
4281
-
4902
+ ClearUnpinned();
4903
+
42824904 /**/
42834905 //switch (event.id)
42844906 {
....@@ -4286,7 +4908,6 @@
42864908 //case 702: // Event.LIST_DESELECT
42874909 group.deselectAll();
42884910 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904911 if (tps != null)
42914912 {
42924913 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4916,8 @@
42954916
42964917 //if (child.parent != null)
42974918 //child.parent.addSelectee(child);
4919
+ objEditor.SetMaterial(child);
42984920 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024921 }
43034922 }
43044923 // else
....@@ -4308,17 +4927,13 @@
43084927 // System.err.println("info : " + group.GetPath());
43094928 // }
43104929
4311
- objEditor.SetText(); // jan 2014
4312
-
4313
- Object3D object = (Object3D) tps[0].getLastPathComponent();
4314
-
4315
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(object instanceof Camera))
4930
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43164931 CameraPane.flash = true;
43174932
4318
- if (tps != null && tps.length > 0 && object instanceof Camera)
4933
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43194934 // a camera
43204935 {
4321
- if (object != Globals.theRenderer.LightCamera())
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43224937 {
43234938 CameraPane.camerachangeframe = 0; // don't refuse it
43244939 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4327,6 +4942,13 @@
43274942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43284943 }
43294944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
43304952 refreshContents();
43314953 //return true;
43324954 }
....@@ -4335,6 +4957,35 @@
43354957
43364958 freezemodel = false;
43374959 }
4960
+
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
4969
+ void refreshContents(boolean cp)
4970
+ {
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4973
+ {
4974
+ objEditor.ClearInfo(); // .GetMaterial());
4975
+
4976
+ for (int i=0; i < group.selection.Size(); i++)
4977
+ {
4978
+ Object3D child = (Object3D) group.selection.get(i);
4979
+
4980
+ objEditor.AddInfo(child, this, true);
4981
+ System.err.println("info : " + child.GetPath());
4982
+ }
4983
+
4984
+ objEditor.SetText(); // jan 2014
4985
+ }
4986
+
4987
+ super.refreshContents(cp);
4988
+ }
43384989
43394990 void linkSomething(Object3D thing)
43404991 {
....@@ -4406,6 +5057,7 @@
44065057 {
44075058 if (group.selection.isEmpty())
44085059 return;
5060
+
44095061 Grafreed.clipboardIsTempGroup = false;
44105062 Composite tGroup = null;
44115063 if (group.selection.size() > 0) // 1)
....@@ -4416,6 +5068,8 @@
44165068
44175069 if (cut)
44185070 {
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
44195073 //int indices[] = jList.getSelectedIndices();
44205074 //for (int i = indices.length - 1; i >= 0; i--)
44215075 //jList.remove(indices[i]);
....@@ -4505,8 +5159,10 @@
45055159 }
45065160
45075161 }
5162
+
45085163 if (Grafreed.clipboardIsTempGroup)
45095164 Grafreed.clipboard = tGroup;
5165
+
45105166 if (cut)
45115167 {
45125168 ResetModel();
....@@ -4516,6 +5172,10 @@
45165172
45175173 void paste(boolean expand)
45185174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
45195179 // if (GrafreeD.clipboard == null)
45205180 // return;
45215181 boolean first = true;
....@@ -4575,6 +5235,7 @@
45755235 Grafreed.clipboard.get(0).parent = keepparent;
45765236 }
45775237
5238
+ Globals.REPLACEONMAKE = keep;
45785239 ResetModel();
45795240 refreshContents();
45805241 }
....@@ -4710,6 +5371,10 @@
47105371
47115372 void group(Object3D csg, boolean grab)
47125373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
47135378 if (//false) // why??
47145379 !group.selection.isEmpty())
47155380 {
....@@ -4823,10 +5488,15 @@
48235488 //node.add(csg);
48245489 //makeSomething(node);
48255490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
48265492 }
48275493
48285494 void Ungroup(Object3D g)
48295495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
48305500 if (g instanceof HiddenObject)
48315501 {
48325502 HiddenObject h = (HiddenObject) g;
....@@ -4843,6 +5513,7 @@
48435513 objEditor.makeSomething(g.get(i), false);
48445514 }
48455515 }
5516
+ Globals.REPLACEONMAKE = keep;
48465517 }
48475518
48485519 void ungroup()
....@@ -5131,7 +5802,44 @@
51315802 cButton clearpanelButton;
51325803 cButton unselectButton;
51335804
5805
+ cButton restoreCameraButton;
5806
+
5807
+ cButton saveButton;
51345808 cButton oneStepButton;
5809
+
5810
+ cButton groupButton;
5811
+ cButton ungroupButton;
5812
+ cButton compositeButton;
5813
+ cButton switchButton;
5814
+ cButton loopButton;
5815
+ cButton textureButton;
5816
+
5817
+ cButton skybox1Button;
5818
+ cButton skybox2Button;
5819
+ cButton skybox3Button;
5820
+ cButton skybox4Button;
5821
+ cButton skybox5Button;
5822
+ cButton skybox6Button;
5823
+ cButton skybox7Button;
5824
+
5825
+ cButton skybox11Button;
5826
+ cButton skybox12Button;
5827
+ cButton skybox13Button;
5828
+ cButton skybox14Button;
5829
+ cButton skybox15Button;
5830
+ cButton skybox16Button;
5831
+ cButton skybox17Button;
5832
+
5833
+ cButton gridButton;
5834
+ cButton boxButton;
5835
+ cButton sphereButton;
5836
+ cButton coneButton;
5837
+ cButton torusButton;
5838
+ cButton superButton;
5839
+ cButton kleinButton;
5840
+ cButton particlesButton;
5841
+ cButton overlayButton;
5842
+ cButton lightButton;
51355843
51365844 cButton screenfitButton;
51375845 cButton screenfitpointButton;
....@@ -5144,14 +5852,6 @@
51445852
51455853 cButton setsupportButton;
51465854
5147
- cButton twoButton;
5148
- cButton sixButton;
5149
- cButton threeButton;
5150
- cButton sevenButton;
5151
- cButton fourButton; // full panel
5152
- cButton oneButton; // full XYZ
5153
- //cButton currentLayout;
5154
-
51555855 //
51565856 //Composite
51575857 Object3D // to do !!
....@@ -5161,11 +5861,11 @@
51615861 //JTree jTree;
51625862 private MenuItem lookAtItem;
51635863 private MenuItem lookFromItem;
5164
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
51655865 private MenuItem cutItem;
51665866 private MenuItem undoItem;
51675867 private MenuItem redoItem;
5168
- private MenuItem duplicateItem;
5868
+ private JMenuItem duplicateItem;
51695869 private MenuItem cloneItem;
51705870 private MenuItem cloneSupportItem;
51715871 private MenuItem overwriteGeoItem;
....@@ -5193,7 +5893,7 @@
51935893 private MenuItem pasteLinkItem;
51945894 private MenuItem pasteCloneItem;
51955895 private MenuItem pasteExpandItem;
5196
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
51975897 private MenuItem clearAllItem;
51985898 private MenuItem genUVItem;
51995899 private MenuItem genNormalsMESHItem;
....@@ -5228,6 +5928,10 @@
52285928 private MenuItem showleavesItem;
52295929 private MenuItem markleavesItem;
52305930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
52315935
52325936 private MenuItem flipVItem;
52335937 private MenuItem unflipVItem;
....@@ -5249,7 +5953,7 @@
52495953 private MenuItem frontItem;
52505954 private MenuItem cameraItem;
52515955 private MenuItem compositeItem;
5252
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
52535957 private MenuItem physicsItem;
52545958 private MenuItem frameselectorItem;
52555959 private MenuItem scriptNodeItem;
....@@ -5273,6 +5977,8 @@
52735977 private MenuItem attachBumpItem;
52745978 private MenuItem detachBumpItem;
52755979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
52765982
52775983 private MenuItem particleItem;
52785984 private MenuItem ragdollItem;
....@@ -5323,5 +6029,5 @@
53236029
53246030 Menu cameraMenu;
53256031 MenuItem editCameraItem;
5326
- MenuItem revertCameraItem;
6032
+ MenuItem restoreCameraItem;
53276033 }