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,11 +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
- 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"));
158210 duplicateItem.addActionListener(this);
159211 cloneItem = menu.add(new MenuItem("Clone"));
160212 cloneItem.addActionListener(this);
....@@ -170,7 +222,6 @@
170222 copyItem.addActionListener(this);
171223 pasteItem = menu.add(new MenuItem("Paste"));
172224 pasteItem.addActionListener(this);
173
- menu.add("-");
174225
175226 menu.add("-");
176227 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -182,8 +233,8 @@
182233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
183234 // pasteExpandItem.addActionListener(this);
184235 menu.add("-");
185
- clearItem = menu.add(new MenuItem("Clear"));
186
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
187238
188239 if (Globals.ADVANCED)
189240 {
....@@ -197,23 +248,23 @@
197248 //zBufferItem.addActionListener(this);
198249 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199250 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
- revertCameraItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
202253
203
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
- toggleFullScreenItem.addItemListener(this);
205
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
- 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);
207266
208
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
- toggleTextureItem.addItemListener(this);
210
- toggleTextureItem.setState(CameraPane.textureon);
211
-
212
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
- toggleSwitchItem.addItemListener(this);
214
- toggleSwitchItem.setState(CameraPane.SWITCH);
215
-
216
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
217268 toggleHandleItem.addItemListener(this);
218269 toggleHandleItem.setState(CameraPane.HANDLES);
219270
....@@ -240,7 +291,7 @@
240291
241292 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242293 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
294
+ toggleDebugItem.setState(Globals.DEBUG);
244295
245296 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246297 toggleFrustumItem.addItemListener(this);
....@@ -261,14 +312,14 @@
261312 // animationItem.addItemListener(this);
262313 // animationItem.setState(CameraPane.ANIMATION);
263314 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
315
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265316 editCameraItem.addActionListener(this);
266317
267318 if (Globals.ADVANCED)
268319 {
269320 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270321 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
272323 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273324 oe.cameraMenu.add("-");
274325 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -276,7 +327,7 @@
276327 editLeafItem.addActionListener(this);
277328 lookAtItem.addActionListener(this);
278329 //lookFromItem.addActinoListener(this);
279
- //switchItem.addActionListener(this);
330
+ //switchViewItem.addActionListener(this);
280331 }
281332
282333 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -321,21 +372,29 @@
321372 }
322373
323374 oe.menuBar.add(menu = new Menu("Group"));
324
- grabItem = menu.add(new MenuItem("Grab"));
325
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
326377 backItem = menu.add(new MenuItem("Back"));
327378 backItem.addActionListener(this);
328379 frontItem = menu.add(new MenuItem("Front"));
329380 frontItem.addActionListener(this);
330
- compositeItem = menu.add(new MenuItem("Composite"));
331
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
332386 hideItem = menu.add(new MenuItem("Hidden Group"));
333387 hideItem.addActionListener(this);
388
+ }
334389 ungroupItem = menu.add(new MenuItem("Ungroup"));
335390 ungroupItem.addActionListener(this);
336
- menu.add("-");
337
- randomItem = menu.add(new MenuItem("Switch node"));
338
- 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
+ {
339398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340399 switchGeoItem.addActionListener(this);
341400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +402,6 @@
343402 morphItem = menu.add(new MenuItem("Morph Group"));
344403 morphItem.addActionListener(this);
345404
346
- if (Globals.ADVANCED)
347
- {
348405 menu.add("-");
349406 physicsItem = menu.add(new MenuItem("Physics"));
350407 physicsItem.addActionListener(this);
....@@ -352,30 +409,29 @@
352409 frameselectorItem.addActionListener(this);
353410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
354411 scriptNodeItem.addActionListener(this);
355
- cameraItem = menu.add(new MenuItem("Camera"));
356
- cameraItem.addActionListener(this);
357412 }
358413
359414 oe.menuBar.add(menu = new Menu("Object"));
360
- textureItem = menu.add(new MenuItem("Texture"));
361
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
362417 billboardItem = menu.add(new MenuItem("Billboard"));
363418 billboardItem.addActionListener(this);
364419 csgItem = menu.add(new MenuItem("CSG"));
365420 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367422 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369424 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
372430 if (Globals.ADVANCED)
373431 {
374432 menu.add("-");
375433 linkerItem = menu.add(new MenuItem("Linker"));
376434 linkerItem.addActionListener(this);
377
- attributeItem = menu.add(new MenuItem("Attribute"));
378
- attributeItem.addActionListener(this);
379435 templateItem = menu.add(new MenuItem("Template"));
380436 templateItem.addActionListener(this);
381437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -404,7 +460,7 @@
404460 genNormalsMESHItem.addActionListener(this);
405461 if (Globals.ADVANCED)
406462 {
407
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
408464 genNormalsMINEItem.addActionListener(this);
409465 }
410466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -464,6 +520,14 @@
464520 markleavesItem.addActionListener(this);
465521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466522 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);
467531 menu.add("-");
468532 flipVItem = menu.add(new MenuItem("Flip V"));
469533 flipVItem.addActionListener(this);
....@@ -489,10 +553,15 @@
489553 attachBumpItem.addActionListener(this);
490554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
491555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
492557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
493558 detachPigmentItem.addActionListener(this);
494559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
495560 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);
496565 menu.add("-");
497566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
498567 sortbysizeItem.addActionListener(this);
....@@ -519,8 +588,21 @@
519588 buildToolsMenu(menu);
520589 }
521590
591
+
522592 void SetupUI2(ObjEditor oe)
523593 {
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
+
524606 //new Exception().printStackTrace();
525607
526608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +631,79 @@
549631 oe.radioPanel.add(dummyButton);
550632 oe.buttonGroup.add(dummyButton);
551633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
552638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553639
554
- 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);
555691 liveCB.setToolTipText("Enable animation");
556692 liveCB.addItemListener(this);
557693
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559695 oneStepButton.setToolTipText("Animate one step forward");
560696 oneStepButton.addActionListener(this);
561697
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563699 fastCB.setToolTipText("Fast mode");
564700 fastCB.addItemListener(this);
565701
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
567
- trackCB.setToolTipText("Enable tracking");
568
- trackCB.addItemListener(this);
569
-
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571
- screenfitButton.setToolTipText("Screen fit");
572
- 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);
573707
574708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575709 // screenfitpointButton.addActionListener(this);
....@@ -579,67 +713,244 @@
579713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580714 snapobjectButton.addActionListener(this);
581715 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");
582720 }
583721
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587723
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
- 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");
592726 twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- fourButton.addActionListener(this);
595
- fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- sixButton.setToolTipText("2-column layout left");
598
- sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- 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");
601731 threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- sevenButton.setToolTipText("3-column layout");
604
- 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);
605738 //
606739
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- 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");
609742 rootButton.addActionListener(this);
610743
611
- 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);
612745 closeButton.setToolTipText("Close tab");
613746 closeButton.addActionListener(this);
614747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615748 //clearButton.addActionListener(this);
616
-
617
- cGridBag commandsPanel = new cGridBag();
749
+
750
+ cGridBag row1 = new cGridBag();
618751
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- 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");
621927 editButton.addActionListener(this);
622928
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
625931 uneditButton.addActionListener(this);
626932
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
629935 allParamsButton.addActionListener(this);
630936
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
937
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632938 clearPanelButton.setToolTipText("Clear edit panel");
633939 clearPanelButton.addActionListener(this);
634940
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
941
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636942 unselectButton.setToolTipText("Unselect");
637943 unselectButton.addActionListener(this);
638944
639
- 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);
640948
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
949
+ editCommandsPanel.preferredHeight = 1;
950
+
951
+ SetPinStates(false);
952
+// oe.treePanel.add(commandsPanel);
953
+// oe.treePanel.Return();
643954
644955 // oe.aConstraints.gridx += 1;
645956 // oe.aConstraints.weighty = 0;
....@@ -656,32 +967,20 @@
656967
657968 JScrollPane jSP;
658969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660971 ResetModel();
661972
662973 oe.treePanel.add(jSPPanel);
663974 oe.treePanel.Return();
664975
665
- cGridBag copyOptionsPanel = new cGridBag();
666
-
667
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
668
- colorCB.setToolTipText("Copy color when dropped");
669
- colorCB.addItemListener(this);
670
-
671
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
672
- materialCB.setToolTipText("Copy material when dropped");
673
- materialCB.addItemListener(this);
674
-
675
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
676
- textureCB.setToolTipText("Copy texture when dropped");
677
- textureCB.addItemListener(this);
678
-
679
- copyOptionsPanel.preferredHeight = 1;
680976 oe.treePanel.add(copyOptionsPanel);
681977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
682981
683
-// mainPanel.setDividerLocation(0.5); //1.0);
684
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
685984
686985 //jList.addListSelectionListener(this);
687986 oe.jTree.addTreeSelectionListener(this);
....@@ -689,7 +988,7 @@
689988 //jTree.setEditable(true);
690989 oe.jTree.setDragEnabled(true);
691990 //jTree.setPreferredSize(new Dimension(10,10));
692
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
693992
694993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
695994
....@@ -701,29 +1000,49 @@
7011000 dgr.addDragGestureListener(this);
7021001 }catch(Exception e) {}
7031002 */
704
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
7051004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7061005 }
7071006
7081007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7091008 {
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
+
7101023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7111024 boxCB.setToolTipText("Display bounding boxes");
7121025 boxCB.addItemListener(this);
7131026
7141027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
7161029 zoomBoxCB.addItemListener(this);
7171030
7181031 if (true) // Globals.ADVANCED)
7191032 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- 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);
7231040
7241041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7251042 // localCB.addItemListener(this);
7261043
1044
+ panel.Return();
1045
+
7271046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7281047 crowdCB.setToolTipText("Used for crowds");
7291048 crowdCB.addItemListener(this);
....@@ -740,6 +1059,8 @@
7401059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7411060 // speakerMocapCB.addItemListener(this);
7421061
1062
+ panel.Return();
1063
+
7431064 if (false)
7441065 {
7451066 // handled in scripts
....@@ -754,34 +1075,74 @@
7541075 //constraints.gridy += 1;
7551076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7561077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
7571079 }
7581080
7591081 //constraints.gridx += 1;
7601082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7611083 // debugCB.addItemListener(this);
7621084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
7631089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
7641091 oeilCB.addItemListener(this);
7651092
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
+ {
7661113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7671114 lookAtCB.setToolTipText("Look-at target");
7681115 lookAtCB.addItemListener(this);
1116
+ }
7691117
7701118 }
7711119
7721120 cGridBag fill = new cGridBag();
773
-
7741121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
7751126
7761127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
7771130
7781131 }
7791132
7801133 void EditObject(Object3D obj)
7811134 {
7821135 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
+
7831144 radioButton.SetObject(obj);
784
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
7851146 radioButton.SetCamera(cameraView.renderCamera, false);
7861147 radioButton.addActionListener(this);
7871148 radioPanel.add(radioButton);
....@@ -791,6 +1152,8 @@
7911152
7921153 void SetupViews(ObjEditor oe)
7931154 {
1155
+ theFrame = this;
1156
+
7941157 oe.SetupViews();
7951158
7961159 System.out.println("SetupViews");
....@@ -799,23 +1162,28 @@
7991162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8001163 }
8011164
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- 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;
8131178 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
8191187
8201188 // static int COLOR = 1;
8211189 // static int MATERIAL = 2;
....@@ -823,9 +1191,9 @@
8231191
8241192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251193
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
8291197
8301198 public void itemStateChanged(ItemEvent e)
8311199 {
....@@ -853,6 +1221,7 @@
8531221 } else if(e.getSource() == liveCB)
8541222 {
8551223 cameraView.ToggleLive();
1224
+ refreshContents(false);
8561225 }
8571226 else if(e.getSource() == supportCB)
8581227 {
....@@ -917,6 +1286,18 @@
9171286 {
9181287 cameraView.ToggleOeil();
9191288 }
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
+ }
9201301 else if(e.getSource() == lookAtCB)
9211302 {
9221303 cameraView.ToggleLookAt();
....@@ -933,7 +1314,8 @@
9331314
9341315 /**/
9351316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
9371319 if ((path == null) || (path.getPathCount() <= 1)) {
9381320 // We can't move the root node or an empty selection
9391321 return;
....@@ -996,8 +1378,6 @@
9961378 }
9971379 }
9981380
999
- String string = (String) object;
1000
-
10011381 System.out.println("Transfer = " + object + "; drop : " + target);
10021382 // if( object instanceof java.io.File[])
10031383 // {
....@@ -1005,6 +1385,8 @@
10051385 // objEditor.DropFile((java.io.File[]) object, true);
10061386 // return;
10071387 // }
1388
+
1389
+ String string = object.toString();
10081390
10091391 // File path for Mac and Windows
10101392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1050,23 +1432,33 @@
10501432
10511433 assert target == objEditor.jTree;
10521434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
10531436 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551438 } catch (Exception e) {
10561439 System.out.println("destinationPath : " + destinationPath);
10571440 return;
10581441 }
10591442
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
10611444 {
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
+// {
10621454 loadClipboard(true);
10631455 objEditor.jTree.setSelectionPath(destinationPath);
10641456 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
10701462 }
10711463 public void dropActionChanged(DropTargetDragEvent dtde)
10721464 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1563,30 @@
11711563 {
11721564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731565 //heightFieldItem.addActionListener(this);
1174
- gridItem = menu.add(new MenuItem("Grid"));
1175
- gridItem.addActionListener(this);
1176
- rectoidItem = menu.add(new MenuItem("Box"));
1177
- rectoidItem.addActionListener(this);
1178
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1179
- ellipsoidItem.addActionListener(this);
1180
- coneItem = menu.add(new MenuItem("Cone"));
1181
- coneItem.addActionListener(this);
1182
- torusItem = menu.add(new MenuItem("Torus"));
1183
- torusItem.addActionListener(this);
1184
- superItem = menu.add(new MenuItem("Superellipsoid"));
1185
- 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
+ {
11861584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871585 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
11901590 if (Globals.ADVANCED)
11911591 {
11921592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1612,15 @@
12121612 }
12131613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141614 bezierItem.addActionListener(this);
1215
- overlayItem = menu.add(new MenuItem("Overlay"));
1216
- overlayItem.addActionListener(this);
1217
- lightItem = menu.add(new MenuItem("Light"));
1218
- 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);
12191619 menu.add("-");
12201620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211621 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
12241624 doubleItem = menu.add(new MenuItem("Fork"));
12251625 doubleItem.addActionListener(this);
12261626 if (Globals.ADVANCED)
....@@ -1236,6 +1636,9 @@
12361636 animationItem.addItemListener(this);
12371637 animationItem.setState(Globals.ANIMATION);
12381638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
12391642 menu.add("-");
12401643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12411644 parseverticesItem.addActionListener(this);
....@@ -1248,6 +1651,8 @@
12481651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12491652 reduce34MorphItem.addActionListener(this);
12501653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
12511656 menu.add(computeAOItem = new MenuItem("Compute AO"));
12521657 computeAOItem.addActionListener(this);
12531658
....@@ -1256,11 +1661,9 @@
12561661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12571662 mirrorItem.addActionListener(this);
12581663 menu.add("-");
1259
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1260
- memoryItem.addActionListener(this);
12611664 menu.add(analyzeItem = new MenuItem("Analyze"));
12621665 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1666
+ menu.add(dumpItem = new MenuItem("Print"));
12641667 dumpItem.addActionListener(this);
12651668 // menu.add(pathItem = new MenuItem("From-to path"));
12661669 // pathItem.addActionListener(this);
....@@ -1401,9 +1804,34 @@
14011804 shadow.material = new cMaterial(obj.material);
14021805 shadow.material.diffuse = 0.0001f;
14031806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
14041808
14051809 makeSomething(shadow);
14061810 }
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
+ }
14071835
14081836 /**
14091837 * applyExample
....@@ -1648,7 +2076,7 @@
16482076 {
16492077 ScreenFit();
16502078 } else
1651
- if (source == switchItem)
2079
+ if (source == switchViewItem)
16522080 {
16532081 cVector v1 = new cVector();
16542082 cVector v2 = new cVector();
....@@ -1657,11 +2085,11 @@
16572085 objEditor.cameraView.renderCamera.setAim(v2, v1);
16582086 objEditor.cameraView.repaint();
16592087 } else
1660
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
16612089 {
16622090 makeSomething(new Box());
16632091 } else
1664
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
16652093 {
16662094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16672095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +2168,27 @@
17402168
17412169 makeSomething(obj);
17422170 } else
1743
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
17442172 {
17452173 makeSomething(new Grid());
17462174 } else
1747
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
17482176 {
17492177 makeSomething(new Sphere());
17502178 } else
1751
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
17522180 {
17532181 makeSomething(new Cone());
17542182 } else
1755
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
17562184 {
17572185 makeSomething(new Torus());
17582186 } else
1759
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
17602188 {
17612189 makeSomething(new Superellipsoid());
17622190 } else
1763
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
17642192 {
17652193 makeSomething(new Klein());
17662194 } else
....@@ -1780,7 +2208,7 @@
17802208 {
17812209 makeSomething(new BezierSurface());
17822210 } else
1783
- if (source == overlayItem)
2211
+ if (source == overlayItem || source == overlayButton)
17842212 {
17852213 /*
17862214 Object3D obj = new BezierSurface(5,8);
....@@ -1828,10 +2256,27 @@
18282256 s.setup();
18292257 makeSomething(s);
18302258 } else
1831
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
18322260 {
18332261 makeSomething(new Light());
18342262 } 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
18352280 if (source == csgItem)
18362281 {
18372282 group(new CSG());
....@@ -1878,30 +2323,30 @@
18782323
18792324 group(g);
18802325 } else
1881
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
18822327 {
18832328 Composite csg = new GroupLeaf();
18842329 csg.count = 5;
18852330 group(csg);
1886
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
18872332 csg.addChild(child);
18882333 child.addChild(csg);
18892334 } else
18902335 if (source == doubleItem)
18912336 {
1892
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
18932338 csg.count = 5;
18942339 group(csg);
1895
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
18962341 csg.addChild(child);
18972342 child.addChild(csg);
1898
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
18992344 csg.addChild(child);
19002345 child.addChild(csg);
19012346 } else
19022347 if (source == tripleItem)
19032348 {
1904
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
19052350 csg.count = 4;
19062351 group(csg);
19072352 Composite child = new cGroup();
....@@ -1917,7 +2362,7 @@
19172362 if (source == computeAOItem)
19182363 {
19192364 Globals.drawMode = CameraPane.OCCLUSION;
1920
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
19212366 } else
19222367 if (source == recompileItem)
19232368 {
....@@ -1951,6 +2396,46 @@
19512396 {
19522397 DumpObject();
19532398 } 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
19542439 if (source == oneStepButton)
19552440 {
19562441 Globals.ONESTEP = true;
....@@ -1958,17 +2443,14 @@
19582443 } else
19592444 if (source == screenfitButton)
19602445 {
1961
- //Reload(lastConverter, lastFilename, true);
19622446 ScreenFit();
19632447 } else
19642448 if (source == screenfitpointButton)
19652449 {
1966
- //Reload(lastConverter, lastFilename, true);
19672450 ScreenFitPoint();
19682451 } else
19692452 if (source == snapobjectButton)
19702453 {
1971
- //Reload(lastConverter, lastFilename, true);
19722454 SnapObject();
19732455 } else
19742456 // if (event.getSource() == recompileButton)
....@@ -2004,6 +2486,14 @@
20042486 if (source == cutItem || source == clearButton)
20052487 {
20062488 loadClipboard(true);
2489
+ } else
2490
+ if (source == undoItem)
2491
+ {
2492
+ Undo();
2493
+ } else
2494
+ if (source == redoItem)
2495
+ {
2496
+ Redo();
20072497 } else
20082498 if (source == duplicateItem)
20092499 {
....@@ -2324,7 +2814,7 @@
23242814 {
23252815 StepAll();
23262816 } else
2327
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
23282818 {
23292819 //int indices[] = jList.getSelectedIndices();
23302820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2336,9 +2826,9 @@
23362826 {
23372827 ClearSelection(true);
23382828 } else
2339
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
23402830 {
2341
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
23422832 } else
23432833 if (source == hideItem)
23442834 {
....@@ -2356,11 +2846,11 @@
23562846 {
23572847 makeSomething(new Camera());
23582848 } else
2359
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
23602850 {
23612851 group(new Composite());
23622852 } else
2363
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
23642854 {
23652855 RandomNode random = new RandomNode();
23662856 group(random);
....@@ -2462,7 +2952,7 @@
24622952 {
24632953 group(new cLinker());
24642954 } else
2465
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
24662956 {
24672957 group(new TextureNode());
24682958 } else
....@@ -2482,17 +2972,30 @@
24822972 {
24832973 CastShadow(2);
24842974 } else
2485
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
24862976 {
2487
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
24882979 for (int i=0; i<group.selection.size(); i++)
24892980 {
2490
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
24912986 }
24922987
2493
- ClearSelection(false);
2494
-
2495
- 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
+ }
24962999 } else
24973000 if (source == genUVItem)
24983001 {
....@@ -2504,7 +3007,7 @@
25043007 } else
25053008 if (source == genNormalsMESHItem)
25063009 {
2507
- GenNormals(true); // TODO
3010
+ GenNormalsMESH();
25083011 } else
25093012 if (source == genNormalsORGANItem)
25103013 {
....@@ -2569,6 +3072,22 @@
25693072 if (source == unmarkleavesItem)
25703073 {
25713074 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);
25723091 } else
25733092 if (source == flipVItem)
25743093 {
....@@ -2777,7 +3296,7 @@
27773296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27783297 {
27793298 obj = (Object3D)e.nextElement();
2780
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
27813300 }
27823301
27833302 refreshContents();
....@@ -2793,6 +3312,31 @@
27933312
27943313 refreshContents();
27953314 } 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
27963340 if (source == flashSelectionButton)
27973341 {
27983342 CameraPane.flash = true;
....@@ -2804,6 +3348,10 @@
28043348 if (source == twoButton)
28053349 {
28063350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
28073355 // bug
28083356 //gridPanel.setDividerLocation(1.0);
28093357 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3384,31 @@
28363384 bigThree.ClearUI();
28373385 bigThree.add(centralPanel);
28383386 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
+
28393405 } else
28403406 if (source == threeButton)
28413407 {
28423408 radio.layout = threeButton;
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
28433412
28443413 // bigThree.remove(scenePanel);
28453414 // bigThree.remove(centralPanel);
....@@ -2869,13 +3438,18 @@
28693438 // centralPanel.setVisible(true);
28703439 // XYZPanel.setVisible(true);
28713440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
28723442 bigThree.add(centralPanel);
2873
- bigThree.add(XYZPanel);
28743443 bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
28753446 } else
28763447 if (source == fourButton)
28773448 {
28783449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
28793453
28803454 // bigThree.remove(scenePanel);
28813455 // bigThree.remove(centralPanel);
....@@ -2907,10 +3481,15 @@
29073481 bigThree.ClearUI();
29083482 bigThree.add(scenePanel);
29093483 bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
29103486 } else
29113487 if (source == sixButton)
29123488 {
29133489 radio.layout = sixButton;
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
29143493
29153494 // bigThree.remove(scenePanel);
29163495 // bigThree.remove(centralPanel);
....@@ -2940,13 +3519,18 @@
29403519 // centralPanel.setVisible(true);
29413520 // XYZPanel.setVisible(false);
29423521 bigThree.ClearUI();
2943
- bigThree.add(scenePanel);
29443522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
29453524 bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
29463527 } else
29473528 if (source == sevenButton)
29483529 {
29493530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
29503534
29513535 // bigThree.remove(scenePanel);
29523536 // bigThree.remove(centralPanel);
....@@ -2980,6 +3564,8 @@
29803564 bigThree.add(centralPanel);
29813565 bigThree.add(XYZPanel);
29823566 bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
29833569 } else
29843570 if (source == rootButton)
29853571 {
....@@ -2991,6 +3577,7 @@
29913577 EditObject(obj);
29923578 }
29933579
3580
+ cameraView.requestFocusInWindow();
29943581 refreshContents(true);
29953582 } else
29963583 if (source == closeButton)
....@@ -3000,22 +3587,37 @@
30003587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013588 {
30023589 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
30053598 buttonGroup.remove(ab);
30063599 radioPanel.remove(ab);
30073600
3008
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
30093603 // ab.GetObject().objectUI = null; // ?????????
30103604
30113605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123606 break;
30133607 }
30143608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
30153611 refreshContents(true);
30163612 } else
30173613 if (source == editItem || source == editButton)
30183614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
30193621 EditSelection(false);
30203622 } else
30213623 if (source == uneditButton)
....@@ -3025,10 +3627,11 @@
30253627 Object3D child = (Object3D)e.nextElement();
30263628 if(child.editWindow != null)
30273629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
30283631 child.CloseUI();
30293632 listUI.remove(child);
30303633
3031
- child.editWindow = null; // ???????????
3634
+ //child.editWindow = null; // ???????????
30323635 }
30333636 objEditor.ctrlPanel.FlushUI();
30343637 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3644,7 @@
30413644 //copy.ClearUI();
30423645 for (Object3D obj : listUI)
30433646 {
3647
+ obj.pinned = false;
30443648 obj.CloseUI();
30453649 }
30463650 listUI.clear();
....@@ -3050,7 +3654,7 @@
30503654 {
30513655 assert(copy == group);
30523656
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543658
30553659 for (Object3D obj : listUI)
30563660 {
....@@ -3099,6 +3703,9 @@
30993703 }
31003704
31013705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
31023709 //Globals.theRenderer.object = group;
31033710 if(!useclient)
31043711 {
....@@ -3115,7 +3722,9 @@
31153722 sideView.object = group;
31163723 }
31173724
3118
-// fix "+" issue group.editWindow = this;
3725
+// fix "+" issue
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
31193728
31203729 /*
31213730 currentLayout = radio.layout;
....@@ -3123,18 +3732,27 @@
31233732 currentLayout = sevenButton;
31243733 */
31253734 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);
31263742 keepparent = group.parent;
31273743 // PARENT = NULL or not???
31283744 //group.parent = null; // ROOT
31293745 //group.attributes = -1;
31303746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
31313749 refreshContents(true);
31323750 } else if (event.getSource() == editCameraItem)
31333751 {
31343752 cameraView.ProtectCamera();
31353753 cameraView.repaint();
31363754 return;
3137
- } else if (event.getSource() == revertCameraItem)
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383756 {
31393757 cameraView.RevertCamera();
31403758 cameraView.repaint();
....@@ -3151,7 +3769,6 @@
31513769 }
31523770
31533771 boolean useclient = false;
3154
- cRadio radio;
31553772
31563773 void ToggleRoot()
31573774 {
....@@ -3390,7 +4007,8 @@
33904007
33914008 int size = obj.MemorySize();
33924009
3393
- 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)");
33944012 }
33954013 }
33964014 catch (Exception e)
....@@ -3471,6 +4089,13 @@
34714089 void GenNormals(boolean crease)
34724090 {
34734091 group.GenNormalsS(crease);
4092
+
4093
+ refreshContents();
4094
+ }
4095
+
4096
+ void GenNormalsMESH()
4097
+ {
4098
+ group.GenNormalsMeshS();
34744099
34754100 refreshContents();
34764101 }
....@@ -3706,7 +4331,7 @@
37064331
37074332 try
37084333 {
3709
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37104335 }
37114336 catch (Exception e)
37124337 {
....@@ -4098,6 +4723,18 @@
40984723 refreshContents();
40994724 }
41004725
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
+
41014738 void SetTexRes(int tr)
41024739 {
41034740 group.selection.SetTexRes(tr);
....@@ -4169,28 +4806,25 @@
41694806 // }
41704807 // }
41714808
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764809 void EditSelection(boolean newWindow)
41774810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
41784817 // aConstraints.gridy = 0;
41794818 for (int i=0; i<group.selection.size(); i++)
41804819 {
41814820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844823
41854824 Object3D elem = (Object3D)group.selection.elementAt(i);
41864825 if(elem != group || !newWindow)
41874826 {
4188
- // if (!(elem instanceof Composite))
4189
- // newWindow = false;
4190
- listUI.add(elem);
4191
- elem.openEditWindow(this, newWindow); //, false);
4192
- System.out.println("edit : " + elem);
4193
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
41944828 }
41954829 }
41964830 }
....@@ -4265,7 +4899,8 @@
42654899 //new Exception().printStackTrace();
42664900
42674901 freezemodel = true;
4268
-
4902
+ ClearUnpinned();
4903
+
42694904 /**/
42704905 //switch (event.id)
42714906 {
....@@ -4273,7 +4908,6 @@
42734908 //case 702: // Event.LIST_DESELECT
42744909 group.deselectAll();
42754910 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774911 if (tps != null)
42784912 {
42794913 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4916,8 @@
42824916
42834917 //if (child.parent != null)
42844918 //child.parent.addSelectee(child);
4919
+ objEditor.SetMaterial(child);
42854920 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894921 }
42904922 }
42914923 // else
....@@ -4295,20 +4927,28 @@
42954927 // System.err.println("info : " + group.GetPath());
42964928 // }
42974929
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4930
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014931 CameraPane.flash = true;
43024932
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4933
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044934 // a camera
43054935 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4937
+ {
4938
+ CameraPane.camerachangeframe = 0; // don't refuse it
4939
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4940
+ }
43084941 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104943 }
43114944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
43124952 refreshContents();
43134953 //return true;
43144954 }
....@@ -4317,6 +4957,35 @@
43174957
43184958 freezemodel = false;
43194959 }
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
+ }
43204989
43214990 void linkSomething(Object3D thing)
43224991 {
....@@ -4388,6 +5057,7 @@
43885057 {
43895058 if (group.selection.isEmpty())
43905059 return;
5060
+
43915061 Grafreed.clipboardIsTempGroup = false;
43925062 Composite tGroup = null;
43935063 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +5068,8 @@
43985068
43995069 if (cut)
44005070 {
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
44015073 //int indices[] = jList.getSelectedIndices();
44025074 //for (int i = indices.length - 1; i >= 0; i--)
44035075 //jList.remove(indices[i]);
....@@ -4487,8 +5159,10 @@
44875159 }
44885160
44895161 }
5162
+
44905163 if (Grafreed.clipboardIsTempGroup)
44915164 Grafreed.clipboard = tGroup;
5165
+
44925166 if (cut)
44935167 {
44945168 ResetModel();
....@@ -4498,6 +5172,10 @@
44985172
44995173 void paste(boolean expand)
45005174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
45015179 // if (GrafreeD.clipboard == null)
45025180 // return;
45035181 boolean first = true;
....@@ -4557,6 +5235,7 @@
45575235 Grafreed.clipboard.get(0).parent = keepparent;
45585236 }
45595237
5238
+ Globals.REPLACEONMAKE = keep;
45605239 ResetModel();
45615240 refreshContents();
45625241 }
....@@ -4692,6 +5371,10 @@
46925371
46935372 void group(Object3D csg, boolean grab)
46945373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
46955378 if (//false) // why??
46965379 !group.selection.isEmpty())
46975380 {
....@@ -4805,10 +5488,15 @@
48055488 //node.add(csg);
48065489 //makeSomething(node);
48075490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
48085492 }
48095493
48105494 void Ungroup(Object3D g)
48115495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
48125500 if (g instanceof HiddenObject)
48135501 {
48145502 HiddenObject h = (HiddenObject) g;
....@@ -4825,6 +5513,7 @@
48255513 objEditor.makeSomething(g.get(i), false);
48265514 }
48275515 }
5516
+ Globals.REPLACEONMAKE = keep;
48285517 }
48295518
48305519 void ungroup()
....@@ -5113,7 +5802,44 @@
51135802 cButton clearpanelButton;
51145803 cButton unselectButton;
51155804
5805
+ cButton restoreCameraButton;
5806
+
5807
+ cButton saveButton;
51165808 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;
51175843
51185844 cButton screenfitButton;
51195845 cButton screenfitpointButton;
....@@ -5126,14 +5852,6 @@
51265852
51275853 cButton setsupportButton;
51285854
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375855 //
51385856 //Composite
51395857 Object3D // to do !!
....@@ -5143,9 +5861,11 @@
51435861 //JTree jTree;
51445862 private MenuItem lookAtItem;
51455863 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
51475865 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5866
+ private MenuItem undoItem;
5867
+ private MenuItem redoItem;
5868
+ private JMenuItem duplicateItem;
51495869 private MenuItem cloneItem;
51505870 private MenuItem cloneSupportItem;
51515871 private MenuItem overwriteGeoItem;
....@@ -5173,7 +5893,7 @@
51735893 private MenuItem pasteLinkItem;
51745894 private MenuItem pasteCloneItem;
51755895 private MenuItem pasteExpandItem;
5176
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
51775897 private MenuItem clearAllItem;
51785898 private MenuItem genUVItem;
51795899 private MenuItem genNormalsMESHItem;
....@@ -5208,6 +5928,10 @@
52085928 private MenuItem showleavesItem;
52095929 private MenuItem markleavesItem;
52105930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
52115935
52125936 private MenuItem flipVItem;
52135937 private MenuItem unflipVItem;
....@@ -5229,7 +5953,7 @@
52295953 private MenuItem frontItem;
52305954 private MenuItem cameraItem;
52315955 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
52335957 private MenuItem physicsItem;
52345958 private MenuItem frameselectorItem;
52355959 private MenuItem scriptNodeItem;
....@@ -5253,6 +5977,8 @@
52535977 private MenuItem attachBumpItem;
52545978 private MenuItem detachBumpItem;
52555979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
52565982
52575983 private MenuItem particleItem;
52585984 private MenuItem ragdollItem;
....@@ -5303,5 +6029,5 @@
53036029
53046030 Menu cameraMenu;
53056031 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
6032
+ MenuItem restoreCameraItem;
53076033 }