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,6 +194,8 @@
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"));
....@@ -160,7 +206,7 @@
160206 // redoItem = menu.add(new MenuItem("Redo"));
161207 // redoItem.addActionListener(this);
162208 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
209
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164210 duplicateItem.addActionListener(this);
165211 cloneItem = menu.add(new MenuItem("Clone"));
166212 cloneItem.addActionListener(this);
....@@ -176,7 +222,6 @@
176222 copyItem.addActionListener(this);
177223 pasteItem = menu.add(new MenuItem("Paste"));
178224 pasteItem.addActionListener(this);
179
- menu.add("-");
180225
181226 menu.add("-");
182227 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +233,8 @@
188233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189234 // pasteExpandItem.addActionListener(this);
190235 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
193238
194239 if (Globals.ADVANCED)
195240 {
....@@ -203,23 +248,23 @@
203248 //zBufferItem.addActionListener(this);
204249 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205250 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
208253
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213266
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223268 toggleHandleItem.addItemListener(this);
224269 toggleHandleItem.setState(CameraPane.HANDLES);
225270
....@@ -246,7 +291,7 @@
246291
247292 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248293 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
294
+ toggleDebugItem.setState(Globals.DEBUG);
250295
251296 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252297 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +319,7 @@
274319 {
275320 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276321 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278323 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279324 oe.cameraMenu.add("-");
280325 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +327,7 @@
282327 editLeafItem.addActionListener(this);
283328 lookAtItem.addActionListener(this);
284329 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
330
+ //switchViewItem.addActionListener(this);
286331 }
287332
288333 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +372,29 @@
327372 }
328373
329374 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
332377 backItem = menu.add(new MenuItem("Back"));
333378 backItem.addActionListener(this);
334379 frontItem = menu.add(new MenuItem("Front"));
335380 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
338386 hideItem = menu.add(new MenuItem("Hidden Group"));
339387 hideItem.addActionListener(this);
388
+ }
340389 ungroupItem = menu.add(new MenuItem("Ungroup"));
341390 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346399 switchGeoItem.addActionListener(this);
347400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +402,6 @@
349402 morphItem = menu.add(new MenuItem("Morph Group"));
350403 morphItem.addActionListener(this);
351404
352
- if (Globals.ADVANCED)
353
- {
354405 menu.add("-");
355406 physicsItem = menu.add(new MenuItem("Physics"));
356407 physicsItem.addActionListener(this);
....@@ -358,30 +409,29 @@
358409 frameselectorItem.addActionListener(this);
359410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360411 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363412 }
364413
365414 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
368417 billboardItem = menu.add(new MenuItem("Billboard"));
369418 billboardItem.addActionListener(this);
370419 csgItem = menu.add(new MenuItem("CSG"));
371420 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373422 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375424 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
378430 if (Globals.ADVANCED)
379431 {
380432 menu.add("-");
381433 linkerItem = menu.add(new MenuItem("Linker"));
382434 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385435 templateItem = menu.add(new MenuItem("Template"));
386436 templateItem.addActionListener(this);
387437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +460,7 @@
410460 genNormalsMESHItem.addActionListener(this);
411461 if (Globals.ADVANCED)
412462 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414464 genNormalsMINEItem.addActionListener(this);
415465 }
416466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -470,6 +520,14 @@
470520 markleavesItem.addActionListener(this);
471521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472522 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);
473531 menu.add("-");
474532 flipVItem = menu.add(new MenuItem("Flip V"));
475533 flipVItem.addActionListener(this);
....@@ -495,10 +553,15 @@
495553 attachBumpItem.addActionListener(this);
496554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
497555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
498557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
499558 detachPigmentItem.addActionListener(this);
500559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
501560 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);
502565 menu.add("-");
503566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
504567 sortbysizeItem.addActionListener(this);
....@@ -525,8 +588,21 @@
525588 buildToolsMenu(menu);
526589 }
527590
591
+
528592 void SetupUI2(ObjEditor oe)
529593 {
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
+
530606 //new Exception().printStackTrace();
531607
532608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +631,79 @@
555631 oe.radioPanel.add(dummyButton);
556632 oe.buttonGroup.add(dummyButton);
557633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
558638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559639
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- undoButton.setToolTipText("Undo changes");
562
- undoButton.addActionListener(this);
640
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
+ //minButton.setToolTipText("Minimize window");
642
+ //minButton.addActionListener(this);
563643
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- redoButton.setToolTipText("Redo changes");
566
- redoButton.addActionListener(this);
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
+ }
567650
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- saveButton.setToolTipText("Save changes");
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");
570665 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);
571671
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
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);
573691 liveCB.setToolTipText("Enable animation");
574692 liveCB.addItemListener(this);
575693
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577695 oneStepButton.setToolTipText("Animate one step forward");
578696 oneStepButton.addActionListener(this);
579697
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581699 fastCB.setToolTipText("Fast mode");
582700 fastCB.addItemListener(this);
583701
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
- screenfitButton.setToolTipText("Screen fit");
590
- 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);
591707
592708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593709 // screenfitpointButton.addActionListener(this);
....@@ -597,67 +713,244 @@
597713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598714 snapobjectButton.addActionListener(this);
599715 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");
600720 }
601721
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605723
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- 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");
610726 twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
- fourButton.addActionListener(this);
613
- fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
- sixButton.setToolTipText("2-column layout left");
616
- sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
- 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");
619731 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- sevenButton.setToolTipText("3-column layout");
622
- 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);
623738 //
624739
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- 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");
627742 rootButton.addActionListener(this);
628743
629
- 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);
630745 closeButton.setToolTipText("Close tab");
631746 closeButton.addActionListener(this);
632747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633748 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
749
+
750
+ cGridBag row1 = new cGridBag();
636751
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- 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");
639927 editButton.addActionListener(this);
640928
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
643931 uneditButton.addActionListener(this);
644932
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
647935 allParamsButton.addActionListener(this);
648936
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
937
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650938 clearPanelButton.setToolTipText("Clear edit panel");
651939 clearPanelButton.addActionListener(this);
652940
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
941
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654942 unselectButton.setToolTipText("Unselect");
655943 unselectButton.addActionListener(this);
656944
657
- 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);
658948
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
949
+ editCommandsPanel.preferredHeight = 1;
950
+
951
+ SetPinStates(false);
952
+// oe.treePanel.add(commandsPanel);
953
+// oe.treePanel.Return();
661954
662955 // oe.aConstraints.gridx += 1;
663956 // oe.aConstraints.weighty = 0;
....@@ -674,32 +967,20 @@
674967
675968 JScrollPane jSP;
676969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678971 ResetModel();
679972
680973 oe.treePanel.add(jSPPanel);
681974 oe.treePanel.Return();
682975
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
698976 oe.treePanel.add(copyOptionsPanel);
699977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
700981
701
-// mainPanel.setDividerLocation(0.5); //1.0);
702
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
703984
704985 //jList.addListSelectionListener(this);
705986 oe.jTree.addTreeSelectionListener(this);
....@@ -707,7 +988,7 @@
707988 //jTree.setEditable(true);
708989 oe.jTree.setDragEnabled(true);
709990 //jTree.setPreferredSize(new Dimension(10,10));
710
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
711992
712993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
713994
....@@ -719,29 +1000,49 @@
7191000 dgr.addDragGestureListener(this);
7201001 }catch(Exception e) {}
7211002 */
722
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
7231004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7241005 }
7251006
7261007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7271008 {
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
+
7281023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7291024 boxCB.setToolTipText("Display bounding boxes");
7301025 boxCB.addItemListener(this);
7311026
7321027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
7341029 zoomBoxCB.addItemListener(this);
7351030
7361031 if (true) // Globals.ADVANCED)
7371032 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- 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);
7411040
7421041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7431042 // localCB.addItemListener(this);
7441043
1044
+ panel.Return();
1045
+
7451046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7461047 crowdCB.setToolTipText("Used for crowds");
7471048 crowdCB.addItemListener(this);
....@@ -758,6 +1059,8 @@
7581059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7591060 // speakerMocapCB.addItemListener(this);
7601061
1062
+ panel.Return();
1063
+
7611064 if (false)
7621065 {
7631066 // handled in scripts
....@@ -772,34 +1075,74 @@
7721075 //constraints.gridy += 1;
7731076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7741077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
7751079 }
7761080
7771081 //constraints.gridx += 1;
7781082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7791083 // debugCB.addItemListener(this);
7801084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
7811089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
7821091 oeilCB.addItemListener(this);
7831092
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
+ {
7841113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7851114 lookAtCB.setToolTipText("Look-at target");
7861115 lookAtCB.addItemListener(this);
1116
+ }
7871117
7881118 }
7891119
7901120 cGridBag fill = new cGridBag();
791
-
7921121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
7931126
7941127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
7951130
7961131 }
7971132
7981133 void EditObject(Object3D obj)
7991134 {
8001135 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
+
8011144 radioButton.SetObject(obj);
802
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
8031146 radioButton.SetCamera(cameraView.renderCamera, false);
8041147 radioButton.addActionListener(this);
8051148 radioPanel.add(radioButton);
....@@ -809,6 +1152,8 @@
8091152
8101153 void SetupViews(ObjEditor oe)
8111154 {
1155
+ theFrame = this;
1156
+
8121157 oe.SetupViews();
8131158
8141159 System.out.println("SetupViews");
....@@ -817,23 +1162,28 @@
8171162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8181163 }
8191164
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- 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;
8311178 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
8371187
8381188 // static int COLOR = 1;
8391189 // static int MATERIAL = 2;
....@@ -841,9 +1191,9 @@
8411191
8421192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431193
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
8471197
8481198 public void itemStateChanged(ItemEvent e)
8491199 {
....@@ -936,6 +1286,18 @@
9361286 {
9371287 cameraView.ToggleOeil();
9381288 }
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
+ }
9391301 else if(e.getSource() == lookAtCB)
9401302 {
9411303 cameraView.ToggleLookAt();
....@@ -952,7 +1314,8 @@
9521314
9531315 /**/
9541316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
955
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
9561319 if ((path == null) || (path.getPathCount() <= 1)) {
9571320 // We can't move the root node or an empty selection
9581321 return;
....@@ -1015,8 +1378,6 @@
10151378 }
10161379 }
10171380
1018
- String string = (String) object;
1019
-
10201381 System.out.println("Transfer = " + object + "; drop : " + target);
10211382 // if( object instanceof java.io.File[])
10221383 // {
....@@ -1024,6 +1385,8 @@
10241385 // objEditor.DropFile((java.io.File[]) object, true);
10251386 // return;
10261387 // }
1388
+
1389
+ String string = object.toString();
10271390
10281391 // File path for Mac and Windows
10291392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1069,23 +1432,33 @@
10691432
10701433 assert target == objEditor.jTree;
10711434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
10721436 try {
1073
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10741438 } catch (Exception e) {
10751439 System.out.println("destinationPath : " + destinationPath);
10761440 return;
10771441 }
10781442
1079
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
10801444 {
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
+// {
10811454 loadClipboard(true);
10821455 objEditor.jTree.setSelectionPath(destinationPath);
10831456 pasteInto(false, false);
1084
- } else {
1085
- loadClipboard(false);
1086
- objEditor.jTree.setSelectionPath(destinationPath);
1087
- pasteInto(false, false); // true); // ???
1088
- }
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
10891462 }
10901463 public void dropActionChanged(DropTargetDragEvent dtde)
10911464 // Called if the user has modified the current drop gesture
....@@ -1190,22 +1563,30 @@
11901563 {
11911564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11921565 //heightFieldItem.addActionListener(this);
1193
- gridItem = menu.add(new MenuItem("Grid"));
1194
- gridItem.addActionListener(this);
1195
- rectoidItem = menu.add(new MenuItem("Box"));
1196
- rectoidItem.addActionListener(this);
1197
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1198
- ellipsoidItem.addActionListener(this);
1199
- coneItem = menu.add(new MenuItem("Cone"));
1200
- coneItem.addActionListener(this);
1201
- torusItem = menu.add(new MenuItem("Torus"));
1202
- torusItem.addActionListener(this);
1203
- superItem = menu.add(new MenuItem("Superellipsoid"));
1204
- 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
+ {
12051584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12061585 kleinItem.addActionListener(this);
1207
- particleItem = menu.add(new MenuItem("Particle system"));
1208
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
12091590 if (Globals.ADVANCED)
12101591 {
12111592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1231,15 +1612,15 @@
12311612 }
12321613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12331614 bezierItem.addActionListener(this);
1234
- overlayItem = menu.add(new MenuItem("Overlay"));
1235
- overlayItem.addActionListener(this);
1236
- lightItem = menu.add(new MenuItem("Light"));
1237
- 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);
12381619 menu.add("-");
12391620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12401621 //superLoopItem.addActionListener(this);
1241
- loopItem = menu.add(new MenuItem("Loop"));
1242
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
12431624 doubleItem = menu.add(new MenuItem("Fork"));
12441625 doubleItem.addActionListener(this);
12451626 if (Globals.ADVANCED)
....@@ -1255,6 +1636,9 @@
12551636 animationItem.addItemListener(this);
12561637 animationItem.setState(Globals.ANIMATION);
12571638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
12581642 menu.add("-");
12591643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12601644 parseverticesItem.addActionListener(this);
....@@ -1267,6 +1651,8 @@
12671651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12681652 reduce34MorphItem.addActionListener(this);
12691653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
12701656 menu.add(computeAOItem = new MenuItem("Compute AO"));
12711657 computeAOItem.addActionListener(this);
12721658
....@@ -1275,8 +1661,6 @@
12751661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12761662 mirrorItem.addActionListener(this);
12771663 menu.add("-");
1278
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1279
- memoryItem.addActionListener(this);
12801664 menu.add(analyzeItem = new MenuItem("Analyze"));
12811665 analyzeItem.addActionListener(this);
12821666 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1420,9 +1804,34 @@
14201804 shadow.material = new cMaterial(obj.material);
14211805 shadow.material.diffuse = 0.0001f;
14221806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
14231808
14241809 makeSomething(shadow);
14251810 }
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
+ }
14261835
14271836 /**
14281837 * applyExample
....@@ -1667,7 +2076,7 @@
16672076 {
16682077 ScreenFit();
16692078 } else
1670
- if (source == switchItem)
2079
+ if (source == switchViewItem)
16712080 {
16722081 cVector v1 = new cVector();
16732082 cVector v2 = new cVector();
....@@ -1676,11 +2085,11 @@
16762085 objEditor.cameraView.renderCamera.setAim(v2, v1);
16772086 objEditor.cameraView.repaint();
16782087 } else
1679
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
16802089 {
16812090 makeSomething(new Box());
16822091 } else
1683
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
16842093 {
16852094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16862095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1759,27 +2168,27 @@
17592168
17602169 makeSomething(obj);
17612170 } else
1762
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
17632172 {
17642173 makeSomething(new Grid());
17652174 } else
1766
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
17672176 {
17682177 makeSomething(new Sphere());
17692178 } else
1770
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
17712180 {
17722181 makeSomething(new Cone());
17732182 } else
1774
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
17752184 {
17762185 makeSomething(new Torus());
17772186 } else
1778
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
17792188 {
17802189 makeSomething(new Superellipsoid());
17812190 } else
1782
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
17832192 {
17842193 makeSomething(new Klein());
17852194 } else
....@@ -1799,7 +2208,7 @@
17992208 {
18002209 makeSomething(new BezierSurface());
18012210 } else
1802
- if (source == overlayItem)
2211
+ if (source == overlayItem || source == overlayButton)
18032212 {
18042213 /*
18052214 Object3D obj = new BezierSurface(5,8);
....@@ -1847,10 +2256,27 @@
18472256 s.setup();
18482257 makeSomething(s);
18492258 } else
1850
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
18512260 {
18522261 makeSomething(new Light());
18532262 } 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
18542280 if (source == csgItem)
18552281 {
18562282 group(new CSG());
....@@ -1897,30 +2323,30 @@
18972323
18982324 group(g);
18992325 } else
1900
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
19012327 {
19022328 Composite csg = new GroupLeaf();
19032329 csg.count = 5;
19042330 group(csg);
1905
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
19062332 csg.addChild(child);
19072333 child.addChild(csg);
19082334 } else
19092335 if (source == doubleItem)
19102336 {
1911
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
19122338 csg.count = 5;
19132339 group(csg);
1914
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
19152341 csg.addChild(child);
19162342 child.addChild(csg);
1917
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
19182344 csg.addChild(child);
19192345 child.addChild(csg);
19202346 } else
19212347 if (source == tripleItem)
19222348 {
1923
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
19242350 csg.count = 4;
19252351 group(csg);
19262352 Composite child = new cGroup();
....@@ -1936,7 +2362,7 @@
19362362 if (source == computeAOItem)
19372363 {
19382364 Globals.drawMode = CameraPane.OCCLUSION;
1939
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
19402366 } else
19412367 if (source == recompileItem)
19422368 {
....@@ -1970,17 +2396,45 @@
19702396 {
19712397 DumpObject();
19722398 } 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
19732411 if (source == undoButton)
19742412 {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19752416 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();
19762427 } else
19772428 if (source == redoButton)
19782429 {
2430
+ // Go to next version
19792431 Redo();
19802432 } else
19812433 if (source == saveButton)
19822434 {
1983
- Save();
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
19842438 } else
19852439 if (source == oneStepButton)
19862440 {
....@@ -1989,17 +2443,14 @@
19892443 } else
19902444 if (source == screenfitButton)
19912445 {
1992
- //Reload(lastConverter, lastFilename, true);
19932446 ScreenFit();
19942447 } else
19952448 if (source == screenfitpointButton)
19962449 {
1997
- //Reload(lastConverter, lastFilename, true);
19982450 ScreenFitPoint();
19992451 } else
20002452 if (source == snapobjectButton)
20012453 {
2002
- //Reload(lastConverter, lastFilename, true);
20032454 SnapObject();
20042455 } else
20052456 // if (event.getSource() == recompileButton)
....@@ -2363,7 +2814,7 @@
23632814 {
23642815 StepAll();
23652816 } else
2366
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
23672818 {
23682819 //int indices[] = jList.getSelectedIndices();
23692820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2375,9 +2826,9 @@
23752826 {
23762827 ClearSelection(true);
23772828 } else
2378
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
23792830 {
2380
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
23812832 } else
23822833 if (source == hideItem)
23832834 {
....@@ -2395,11 +2846,11 @@
23952846 {
23962847 makeSomething(new Camera());
23972848 } else
2398
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
23992850 {
24002851 group(new Composite());
24012852 } else
2402
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
24032854 {
24042855 RandomNode random = new RandomNode();
24052856 group(random);
....@@ -2501,7 +2952,7 @@
25012952 {
25022953 group(new cLinker());
25032954 } else
2504
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
25052956 {
25062957 group(new TextureNode());
25072958 } else
....@@ -2521,17 +2972,30 @@
25212972 {
25222973 CastShadow(2);
25232974 } else
2524
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
25252976 {
2526
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
25272979 for (int i=0; i<group.selection.size(); i++)
25282980 {
2529
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
25302986 }
25312987
2532
- ClearSelection(false);
2533
-
2534
- 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
+ }
25352999 } else
25363000 if (source == genUVItem)
25373001 {
....@@ -2608,6 +3072,22 @@
26083072 if (source == unmarkleavesItem)
26093073 {
26103074 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);
26113091 } else
26123092 if (source == flipVItem)
26133093 {
....@@ -2816,7 +3296,7 @@
28163296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28173297 {
28183298 obj = (Object3D)e.nextElement();
2819
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
28203300 }
28213301
28223302 refreshContents();
....@@ -2832,6 +3312,31 @@
28323312
28333313 refreshContents();
28343314 } 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
28353340 if (source == flashSelectionButton)
28363341 {
28373342 CameraPane.flash = true;
....@@ -2843,6 +3348,10 @@
28433348 if (source == twoButton)
28443349 {
28453350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
28463355 // bug
28473356 //gridPanel.setDividerLocation(1.0);
28483357 //bigPanel.setDividerLocation(0.0);
....@@ -2875,10 +3384,31 @@
28753384 bigThree.ClearUI();
28763385 bigThree.add(centralPanel);
28773386 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
+
28783405 } else
28793406 if (source == threeButton)
28803407 {
28813408 radio.layout = threeButton;
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
28823412
28833413 // bigThree.remove(scenePanel);
28843414 // bigThree.remove(centralPanel);
....@@ -2908,13 +3438,18 @@
29083438 // centralPanel.setVisible(true);
29093439 // XYZPanel.setVisible(true);
29103440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
29113442 bigThree.add(centralPanel);
2912
- bigThree.add(XYZPanel);
29133443 bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
29143446 } else
29153447 if (source == fourButton)
29163448 {
29173449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
29183453
29193454 // bigThree.remove(scenePanel);
29203455 // bigThree.remove(centralPanel);
....@@ -2946,10 +3481,15 @@
29463481 bigThree.ClearUI();
29473482 bigThree.add(scenePanel);
29483483 bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
29493486 } else
29503487 if (source == sixButton)
29513488 {
29523489 radio.layout = sixButton;
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
29533493
29543494 // bigThree.remove(scenePanel);
29553495 // bigThree.remove(centralPanel);
....@@ -2979,13 +3519,18 @@
29793519 // centralPanel.setVisible(true);
29803520 // XYZPanel.setVisible(false);
29813521 bigThree.ClearUI();
2982
- bigThree.add(scenePanel);
29833522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
29843524 bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
29853527 } else
29863528 if (source == sevenButton)
29873529 {
29883530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
29893534
29903535 // bigThree.remove(scenePanel);
29913536 // bigThree.remove(centralPanel);
....@@ -3019,6 +3564,8 @@
30193564 bigThree.add(centralPanel);
30203565 bigThree.add(XYZPanel);
30213566 bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
30223569 } else
30233570 if (source == rootButton)
30243571 {
....@@ -3030,6 +3577,7 @@
30303577 EditObject(obj);
30313578 }
30323579
3580
+ cameraView.requestFocusInWindow();
30333581 refreshContents(true);
30343582 } else
30353583 if (source == closeButton)
....@@ -3039,22 +3587,37 @@
30393587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30403588 {
30413589 ab = (cRadio)e.nextElement();
3042
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30433591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
30443598 buttonGroup.remove(ab);
30453599 radioPanel.remove(ab);
30463600
3047
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
30483603 // ab.GetObject().objectUI = null; // ?????????
30493604
30503605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30513606 break;
30523607 }
30533608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
30543611 refreshContents(true);
30553612 } else
30563613 if (source == editItem || source == editButton)
30573614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
30583621 EditSelection(false);
30593622 } else
30603623 if (source == uneditButton)
....@@ -3064,6 +3627,7 @@
30643627 Object3D child = (Object3D)e.nextElement();
30653628 if(child.editWindow != null)
30663629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
30673631 child.CloseUI();
30683632 listUI.remove(child);
30693633
....@@ -3080,6 +3644,7 @@
30803644 //copy.ClearUI();
30813645 for (Object3D obj : listUI)
30823646 {
3647
+ obj.pinned = false;
30833648 obj.CloseUI();
30843649 }
30853650 listUI.clear();
....@@ -3089,7 +3654,7 @@
30893654 {
30903655 assert(copy == group);
30913656
3092
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30933658
30943659 for (Object3D obj : listUI)
30953660 {
....@@ -3138,6 +3703,9 @@
31383703 }
31393704
31403705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
31413709 //Globals.theRenderer.object = group;
31423710 if(!useclient)
31433711 {
....@@ -3155,7 +3723,8 @@
31553723 }
31563724
31573725 // fix "+" issue
3158
- group.editWindow = this;
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
31593728
31603729 /*
31613730 currentLayout = radio.layout;
....@@ -3163,18 +3732,27 @@
31633732 currentLayout = sevenButton;
31643733 */
31653734 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);
31663742 keepparent = group.parent;
31673743 // PARENT = NULL or not???
31683744 //group.parent = null; // ROOT
31693745 //group.attributes = -1;
31703746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
31713749 refreshContents(true);
31723750 } else if (event.getSource() == editCameraItem)
31733751 {
31743752 cameraView.ProtectCamera();
31753753 cameraView.repaint();
31763754 return;
3177
- } else if (event.getSource() == revertCameraItem)
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31783756 {
31793757 cameraView.RevertCamera();
31803758 cameraView.repaint();
....@@ -3191,7 +3769,6 @@
31913769 }
31923770
31933771 boolean useclient = false;
3194
- cRadio radio;
31953772
31963773 void ToggleRoot()
31973774 {
....@@ -3754,7 +4331,7 @@
37544331
37554332 try
37564333 {
3757
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37584335 }
37594336 catch (Exception e)
37604337 {
....@@ -4146,6 +4723,18 @@
41464723 refreshContents();
41474724 }
41484725
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
+
41494738 void SetTexRes(int tr)
41504739 {
41514740 group.selection.SetTexRes(tr);
....@@ -4217,28 +4806,25 @@
42174806 // }
42184807 // }
42194808
4220
- static boolean allparams = true;
4221
-
4222
- static Vector<Object3D> listUI = new Vector<Object3D>();
4223
-
42244809 void EditSelection(boolean newWindow)
42254810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
42264817 // aConstraints.gridy = 0;
42274818 for (int i=0; i<group.selection.size(); i++)
42284819 {
42294820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42304821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4231
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42324823
42334824 Object3D elem = (Object3D)group.selection.elementAt(i);
42344825 if(elem != group || !newWindow)
42354826 {
4236
- // if (!(elem instanceof Composite))
4237
- // newWindow = false;
4238
- listUI.add(elem);
4239
- elem.openEditWindow(this, newWindow); //, false);
4240
- System.out.println("edit : " + elem);
4241
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
42424828 }
42434829 }
42444830 }
....@@ -4313,7 +4899,8 @@
43134899 //new Exception().printStackTrace();
43144900
43154901 freezemodel = true;
4316
-
4902
+ ClearUnpinned();
4903
+
43174904 /**/
43184905 //switch (event.id)
43194906 {
....@@ -4346,7 +4933,7 @@
43464933 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43474934 // a camera
43484935 {
4349
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43504937 {
43514938 CameraPane.camerachangeframe = 0; // don't refuse it
43524939 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4355,6 +4942,13 @@
43554942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43564943 }
43574944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
43584952 refreshContents();
43594953 //return true;
43604954 }
....@@ -4364,9 +4958,18 @@
43644958 freezemodel = false;
43654959 }
43664960
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
43674969 void refreshContents(boolean cp)
43684970 {
4369
- if (!Globals.MOUSEDRAGGED)
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
43704973 {
43714974 objEditor.ClearInfo(); // .GetMaterial());
43724975
....@@ -4465,7 +5068,8 @@
44655068
44665069 if (cut)
44675070 {
4468
- Save();
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
44695073 //int indices[] = jList.getSelectedIndices();
44705074 //for (int i = indices.length - 1; i >= 0; i--)
44715075 //jList.remove(indices[i]);
....@@ -4568,6 +5172,10 @@
45685172
45695173 void paste(boolean expand)
45705174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
45715179 // if (GrafreeD.clipboard == null)
45725180 // return;
45735181 boolean first = true;
....@@ -4627,6 +5235,7 @@
46275235 Grafreed.clipboard.get(0).parent = keepparent;
46285236 }
46295237
5238
+ Globals.REPLACEONMAKE = keep;
46305239 ResetModel();
46315240 refreshContents();
46325241 }
....@@ -4762,6 +5371,10 @@
47625371
47635372 void group(Object3D csg, boolean grab)
47645373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
47655378 if (//false) // why??
47665379 !group.selection.isEmpty())
47675380 {
....@@ -4875,10 +5488,15 @@
48755488 //node.add(csg);
48765489 //makeSomething(node);
48775490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
48785492 }
48795493
48805494 void Ungroup(Object3D g)
48815495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
48825500 if (g instanceof HiddenObject)
48835501 {
48845502 HiddenObject h = (HiddenObject) g;
....@@ -4895,6 +5513,7 @@
48955513 objEditor.makeSomething(g.get(i), false);
48965514 }
48975515 }
5516
+ Globals.REPLACEONMAKE = keep;
48985517 }
48995518
49005519 void ungroup()
....@@ -5183,10 +5802,44 @@
51835802 cButton clearpanelButton;
51845803 cButton unselectButton;
51855804
5805
+ cButton restoreCameraButton;
5806
+
51865807 cButton saveButton;
5187
- cButton undoButton;
5188
- cButton redoButton;
51895808 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;
51905843
51915844 cButton screenfitButton;
51925845 cButton screenfitpointButton;
....@@ -5199,14 +5852,6 @@
51995852
52005853 cButton setsupportButton;
52015854
5202
- cButton twoButton;
5203
- cButton sixButton;
5204
- cButton threeButton;
5205
- cButton sevenButton;
5206
- cButton fourButton; // full panel
5207
- cButton oneButton; // full XYZ
5208
- //cButton currentLayout;
5209
-
52105855 //
52115856 //Composite
52125857 Object3D // to do !!
....@@ -5216,11 +5861,11 @@
52165861 //JTree jTree;
52175862 private MenuItem lookAtItem;
52185863 private MenuItem lookFromItem;
5219
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
52205865 private MenuItem cutItem;
52215866 private MenuItem undoItem;
52225867 private MenuItem redoItem;
5223
- private MenuItem duplicateItem;
5868
+ private JMenuItem duplicateItem;
52245869 private MenuItem cloneItem;
52255870 private MenuItem cloneSupportItem;
52265871 private MenuItem overwriteGeoItem;
....@@ -5248,7 +5893,7 @@
52485893 private MenuItem pasteLinkItem;
52495894 private MenuItem pasteCloneItem;
52505895 private MenuItem pasteExpandItem;
5251
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
52525897 private MenuItem clearAllItem;
52535898 private MenuItem genUVItem;
52545899 private MenuItem genNormalsMESHItem;
....@@ -5283,6 +5928,10 @@
52835928 private MenuItem showleavesItem;
52845929 private MenuItem markleavesItem;
52855930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
52865935
52875936 private MenuItem flipVItem;
52885937 private MenuItem unflipVItem;
....@@ -5304,7 +5953,7 @@
53045953 private MenuItem frontItem;
53055954 private MenuItem cameraItem;
53065955 private MenuItem compositeItem;
5307
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
53085957 private MenuItem physicsItem;
53095958 private MenuItem frameselectorItem;
53105959 private MenuItem scriptNodeItem;
....@@ -5328,6 +5977,8 @@
53285977 private MenuItem attachBumpItem;
53295978 private MenuItem detachBumpItem;
53305979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
53315982
53325983 private MenuItem particleItem;
53335984 private MenuItem ragdollItem;
....@@ -5378,5 +6029,5 @@
53786029
53796030 Menu cameraMenu;
53806031 MenuItem editCameraItem;
5381
- MenuItem revertCameraItem;
6032
+ MenuItem restoreCameraItem;
53826033 }