Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -80,10 +86,22 @@
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +112,7 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
....@@ -150,16 +169,19 @@
150169
151170 void SetupMenu2(GroupEditor oe)
152171 {
172
+ oe.jTree = new cTree();
173
+
153174 Menu menu;
154175 oe.menuBar.add(menu = new Menu("Edit"));
155176 //editItem = menu.add(new MenuItem("Edit"));
156177 //editItem.addActionListener(this);
157
- undoItem = menu.add(new MenuItem("Undo"));
158
- undoItem.addActionListener(this);
159
- redoItem = menu.add(new MenuItem("Redo"));
160
- redoItem.addActionListener(this);
161
- menu.add("-");
162
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
163185 duplicateItem.addActionListener(this);
164186 cloneItem = menu.add(new MenuItem("Clone"));
165187 cloneItem.addActionListener(this);
....@@ -175,7 +197,6 @@
175197 copyItem.addActionListener(this);
176198 pasteItem = menu.add(new MenuItem("Paste"));
177199 pasteItem.addActionListener(this);
178
- menu.add("-");
179200
180201 menu.add("-");
181202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -187,8 +208,8 @@
187208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188209 // pasteExpandItem.addActionListener(this);
189210 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
192213
193214 if (Globals.ADVANCED)
194215 {
....@@ -202,23 +223,23 @@
202223 //zBufferItem.addActionListener(this);
203224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204225 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
207228
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212241
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222243 toggleHandleItem.addItemListener(this);
223244 toggleHandleItem.setState(CameraPane.HANDLES);
224245
....@@ -245,7 +266,7 @@
245266
246267 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247268 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
269
+ toggleDebugItem.setState(Globals.DEBUG);
249270
250271 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251272 toggleFrustumItem.addItemListener(this);
....@@ -266,14 +287,14 @@
266287 // animationItem.addItemListener(this);
267288 // animationItem.setState(CameraPane.ANIMATION);
268289 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270291 editCameraItem.addActionListener(this);
271292
272293 if (Globals.ADVANCED)
273294 {
274295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278299 oe.cameraMenu.add("-");
279300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +302,7 @@
281302 editLeafItem.addActionListener(this);
282303 lookAtItem.addActionListener(this);
283304 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
285306 }
286307
287308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +347,29 @@
326347 }
327348
328349 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
331352 backItem = menu.add(new MenuItem("Back"));
332353 backItem.addActionListener(this);
333354 frontItem = menu.add(new MenuItem("Front"));
334355 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
337361 hideItem = menu.add(new MenuItem("Hidden Group"));
338362 hideItem.addActionListener(this);
363
+ }
339364 ungroupItem = menu.add(new MenuItem("Ungroup"));
340365 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
344373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345374 switchGeoItem.addActionListener(this);
346375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +377,6 @@
348377 morphItem = menu.add(new MenuItem("Morph Group"));
349378 morphItem.addActionListener(this);
350379
351
- if (Globals.ADVANCED)
352
- {
353380 menu.add("-");
354381 physicsItem = menu.add(new MenuItem("Physics"));
355382 physicsItem.addActionListener(this);
....@@ -357,30 +384,29 @@
357384 frameselectorItem.addActionListener(this);
358385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359386 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362387 }
363388
364389 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
367392 billboardItem = menu.add(new MenuItem("Billboard"));
368393 billboardItem.addActionListener(this);
369394 csgItem = menu.add(new MenuItem("CSG"));
370395 csgItem.addActionListener(this);
371
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
372397 shadowXItem.addActionListener(this);
373
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
374399 shadowYItem.addActionListener(this);
375
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
377405 if (Globals.ADVANCED)
378406 {
379407 menu.add("-");
380408 linkerItem = menu.add(new MenuItem("Linker"));
381409 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384410 templateItem = menu.add(new MenuItem("Template"));
385411 templateItem.addActionListener(this);
386412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +435,7 @@
409435 genNormalsMESHItem.addActionListener(this);
410436 if (Globals.ADVANCED)
411437 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413439 genNormalsMINEItem.addActionListener(this);
414440 }
415441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -469,6 +495,14 @@
469495 markleavesItem.addActionListener(this);
470496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
472506 menu.add("-");
473507 flipVItem = menu.add(new MenuItem("Flip V"));
474508 flipVItem.addActionListener(this);
....@@ -524,8 +558,21 @@
524558 buildToolsMenu(menu);
525559 }
526560
561
+
527562 void SetupUI2(ObjEditor oe)
528563 {
564
+ // June 2019
565
+ if (oe == null)
566
+ {
567
+ //super.SetupUI2(this);
568
+ //return;
569
+ }
570
+
571
+ if (copy != group)
572
+ {
573
+ //super.SetupUI2(this);
574
+ }
575
+
529576 //new Exception().printStackTrace();
530577
531578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -554,27 +601,79 @@
554601 oe.radioPanel.add(dummyButton);
555602 oe.buttonGroup.add(dummyButton);
556603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
557608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558609
559
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
610
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ //minButton.setToolTipText("Minimize window");
612
+ //minButton.addActionListener(this);
613
+
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
620
+
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ fullButton.setToolTipText("Full-screen window");
623
+ fullButton.addActionListener(this);
624
+
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
632
+
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
560661 liveCB.setToolTipText("Enable animation");
561662 liveCB.addItemListener(this);
562663
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564665 oneStepButton.setToolTipText("Animate one step forward");
565666 oneStepButton.addActionListener(this);
566667
567
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
568669 fastCB.setToolTipText("Fast mode");
569670 fastCB.addItemListener(this);
570671
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
572
- trackCB.setToolTipText("Enable tracking");
573
- trackCB.addItemListener(this);
574
-
575
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
576
- screenfitButton.setToolTipText("Screen fit");
577
- screenfitButton.addActionListener(this);
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
578677
579678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
580679 // screenfitpointButton.addActionListener(this);
....@@ -586,65 +685,146 @@
586685 snapobjectButton.setToolTipText("Snap Object");
587686 }
588687
589
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
- flashSelectionButton.setToolTipText("Show selection");
591
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
592689
593
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
594
-
595
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- twoButton.setToolTipText("Show center view only");
597
- twoButton.addActionListener(this);
598
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599691 fourButton.addActionListener(this);
600692 fourButton.setToolTipText("Show left panel only");
601
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
- sixButton.setToolTipText("2-column layout left");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
603701 sixButton.addActionListener(this);
604
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
- threeButton.setToolTipText("2-column layout right");
606
- threeButton.addActionListener(this);
607
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- sevenButton.setToolTipText("3-column layout");
609
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
610708 //
611709
612
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
613
- rootButton.setToolTipText("Edit selection in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
614712 rootButton.addActionListener(this);
615713
616
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617715 closeButton.setToolTipText("Close tab");
618716 closeButton.addActionListener(this);
619717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
620718 //clearButton.addActionListener(this);
621
-
622
- cGridBag commandsPanel = new cGridBag();
719
+
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
623751
624
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
625
- editButton.setToolTipText("Edit selection");
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
626801 editButton.addActionListener(this);
627802
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
630805 uneditButton.addActionListener(this);
631806
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633
- allParamsButton.setToolTipText("Edit all params");
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
634809 allParamsButton.addActionListener(this);
635810
636
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637812 clearPanelButton.setToolTipText("Clear edit panel");
638813 clearPanelButton.addActionListener(this);
639814
640
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641816 unselectButton.setToolTipText("Unselect");
642817 unselectButton.addActionListener(this);
643818
644
- commandsPanel.preferredHeight = 1;
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
645822
646
- oe.treePanel.add(commandsPanel);
647
- oe.treePanel.Return();
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
648828
649829 // oe.aConstraints.gridx += 1;
650830 // oe.aConstraints.weighty = 0;
....@@ -661,29 +841,17 @@
661841
662842 JScrollPane jSP;
663843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
664
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
665845 ResetModel();
666846
667847 oe.treePanel.add(jSPPanel);
668848 oe.treePanel.Return();
669849
670
- cGridBag copyOptionsPanel = new cGridBag();
671
-
672
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
673
- colorCB.setToolTipText("Copy color when dropped");
674
- colorCB.addItemListener(this);
675
-
676
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
677
- materialCB.setToolTipText("Copy material when dropped");
678
- materialCB.addItemListener(this);
679
-
680
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
681
- textureCB.setToolTipText("Copy texture when dropped");
682
- textureCB.addItemListener(this);
683
-
684
- copyOptionsPanel.preferredHeight = 1;
685850 oe.treePanel.add(copyOptionsPanel);
686851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
687855
688856 // mainPanel.setDividerLocation(0.5); //1.0);
689857 // mainPanel.setResizeWeight(0.5);
....@@ -706,29 +874,49 @@
706874 dgr.addDragGestureListener(this);
707875 }catch(Exception e) {}
708876 */
709
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
710878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
711879 }
712880
713881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
714882 {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
715897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
716898 boxCB.setToolTipText("Display bounding boxes");
717899 boxCB.addItemListener(this);
718900
719901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
720
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
721903 zoomBoxCB.addItemListener(this);
722904
723905 if (true) // Globals.ADVANCED)
724906 {
725
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
726
- supportCB.setToolTipText("Enable rigging");
727
- supportCB.addItemListener(this);
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
728914
729915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
730916 // localCB.addItemListener(this);
731917
918
+ panel.Return();
919
+
732920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
733921 crowdCB.setToolTipText("Used for crowds");
734922 crowdCB.addItemListener(this);
....@@ -745,6 +933,8 @@
745933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
746934 // speakerMocapCB.addItemListener(this);
747935
936
+ panel.Return();
937
+
748938 if (false)
749939 {
750940 // handled in scripts
....@@ -759,34 +949,74 @@
759949 //constraints.gridy += 1;
760950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
761951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
762953 }
763954
764955 //constraints.gridx += 1;
765956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
766957 // debugCB.addItemListener(this);
767958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
768963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
769965 oeilCB.addItemListener(this);
770966
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
771987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
772988 lookAtCB.setToolTipText("Look-at target");
773989 lookAtCB.addItemListener(this);
990
+ }
774991
775992 }
776993
777994 cGridBag fill = new cGridBag();
778
-
779995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
7801000
7811001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
7821004
7831005 }
7841006
7851007 void EditObject(Object3D obj)
7861008 {
7871009 cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
7881018 radioButton.SetObject(obj);
789
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
7901020 radioButton.SetCamera(cameraView.renderCamera, false);
7911021 radioButton.addActionListener(this);
7921022 radioPanel.add(radioButton);
....@@ -796,6 +1026,8 @@
7961026
7971027 void SetupViews(ObjEditor oe)
7981028 {
1029
+ theFrame = this;
1030
+
7991031 oe.SetupViews();
8001032
8011033 System.out.println("SetupViews");
....@@ -804,23 +1036,28 @@
8041036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8051037 }
8061038
807
- JCheckBox liveCB;
808
- JCheckBox supportCB;
809
- JCheckBox localCB;
810
- JCheckBox crowdCB;
811
- JCheckBox smoothCB;
812
- JCheckBox fastCB;
813
- JCheckBox slowCB;
814
- JCheckBox boxCB;
815
- JCheckBox zoomBoxCB;
816
- JCheckBox trackCB;
817
- JCheckBox smoothfocusCB;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
8181052 // JCheckBox speakerMocapCB;
819
- JCheckBox speakerCameraCB;
820
- JCheckBox speakerFocusCB;
821
- JCheckBox debugCB;
822
- JCheckBox oeilCB;
823
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
8241061
8251062 // static int COLOR = 1;
8261063 // static int MATERIAL = 2;
....@@ -828,9 +1065,9 @@
8281065
8291066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8301067
831
- JCheckBox colorCB;
832
- JCheckBox materialCB;
833
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
8341071
8351072 public void itemStateChanged(ItemEvent e)
8361073 {
....@@ -858,6 +1095,7 @@
8581095 } else if(e.getSource() == liveCB)
8591096 {
8601097 cameraView.ToggleLive();
1098
+ refreshContents(false);
8611099 }
8621100 else if(e.getSource() == supportCB)
8631101 {
....@@ -922,6 +1160,18 @@
9221160 {
9231161 cameraView.ToggleOeil();
9241162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
9251175 else if(e.getSource() == lookAtCB)
9261176 {
9271177 cameraView.ToggleLookAt();
....@@ -938,7 +1188,8 @@
9381188
9391189 /**/
9401190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
941
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
9421193 if ((path == null) || (path.getPathCount() <= 1)) {
9431194 // We can't move the root node or an empty selection
9441195 return;
....@@ -1001,8 +1252,6 @@
10011252 }
10021253 }
10031254
1004
- String string = (String) object;
1005
-
10061255 System.out.println("Transfer = " + object + "; drop : " + target);
10071256 // if( object instanceof java.io.File[])
10081257 // {
....@@ -1010,6 +1259,8 @@
10101259 // objEditor.DropFile((java.io.File[]) object, true);
10111260 // return;
10121261 // }
1262
+
1263
+ String string = object.toString();
10131264
10141265 // File path for Mac and Windows
10151266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1055,23 +1306,33 @@
10551306
10561307 assert target == objEditor.jTree;
10571308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
10581310 try {
1059
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10601312 } catch (Exception e) {
10611313 System.out.println("destinationPath : " + destinationPath);
10621314 return;
10631315 }
10641316
1065
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
10661318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
10671328 loadClipboard(true);
10681329 objEditor.jTree.setSelectionPath(destinationPath);
10691330 pasteInto(false, false);
1070
- } else {
1071
- loadClipboard(false);
1072
- objEditor.jTree.setSelectionPath(destinationPath);
1073
- pasteInto(false, false); // true); // ???
1074
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
10751336 }
10761337 public void dropActionChanged(DropTargetDragEvent dtde)
10771338 // Called if the user has modified the current drop gesture
....@@ -1176,22 +1437,30 @@
11761437 {
11771438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11781439 //heightFieldItem.addActionListener(this);
1179
- gridItem = menu.add(new MenuItem("Grid"));
1180
- gridItem.addActionListener(this);
1181
- rectoidItem = menu.add(new MenuItem("Box"));
1182
- rectoidItem.addActionListener(this);
1183
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1184
- ellipsoidItem.addActionListener(this);
1185
- coneItem = menu.add(new MenuItem("Cone"));
1186
- coneItem.addActionListener(this);
1187
- torusItem = menu.add(new MenuItem("Torus"));
1188
- torusItem.addActionListener(this);
1189
- superItem = menu.add(new MenuItem("Superellipsoid"));
1190
- superItem.addActionListener(this);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
11911458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11921459 kleinItem.addActionListener(this);
1193
- particleItem = menu.add(new MenuItem("Particle system"));
1194
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
11951464 if (Globals.ADVANCED)
11961465 {
11971466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1217,15 +1486,15 @@
12171486 }
12181487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12191488 bezierItem.addActionListener(this);
1220
- overlayItem = menu.add(new MenuItem("Overlay"));
1221
- overlayItem.addActionListener(this);
1222
- lightItem = menu.add(new MenuItem("Light"));
1223
- lightItem.addActionListener(this);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
12241493 menu.add("-");
12251494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12261495 //superLoopItem.addActionListener(this);
1227
- loopItem = menu.add(new MenuItem("Loop"));
1228
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
12291498 doubleItem = menu.add(new MenuItem("Fork"));
12301499 doubleItem.addActionListener(this);
12311500 if (Globals.ADVANCED)
....@@ -1241,6 +1510,9 @@
12411510 animationItem.addItemListener(this);
12421511 animationItem.setState(Globals.ANIMATION);
12431512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
12441516 menu.add("-");
12451517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12461518 parseverticesItem.addActionListener(this);
....@@ -1253,6 +1525,8 @@
12531525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12541526 reduce34MorphItem.addActionListener(this);
12551527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
12561530 menu.add(computeAOItem = new MenuItem("Compute AO"));
12571531 computeAOItem.addActionListener(this);
12581532
....@@ -1261,11 +1535,9 @@
12611535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12621536 mirrorItem.addActionListener(this);
12631537 menu.add("-");
1264
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1265
- memoryItem.addActionListener(this);
12661538 menu.add(analyzeItem = new MenuItem("Analyze"));
12671539 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
12691541 dumpItem.addActionListener(this);
12701542 // menu.add(pathItem = new MenuItem("From-to path"));
12711543 // pathItem.addActionListener(this);
....@@ -1406,9 +1678,34 @@
14061678 shadow.material = new cMaterial(obj.material);
14071679 shadow.material.diffuse = 0.0001f;
14081680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
14091682
14101683 makeSomething(shadow);
14111684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
14121709
14131710 /**
14141711 * applyExample
....@@ -1653,7 +1950,7 @@
16531950 {
16541951 ScreenFit();
16551952 } else
1656
- if (source == switchItem)
1953
+ if (source == switchViewItem)
16571954 {
16581955 cVector v1 = new cVector();
16591956 cVector v2 = new cVector();
....@@ -1662,11 +1959,11 @@
16621959 objEditor.cameraView.renderCamera.setAim(v2, v1);
16631960 objEditor.cameraView.repaint();
16641961 } else
1665
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
16661963 {
16671964 makeSomething(new Box());
16681965 } else
1669
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
16701967 {
16711968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16721969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1745,27 +2042,27 @@
17452042
17462043 makeSomething(obj);
17472044 } else
1748
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
17492046 {
17502047 makeSomething(new Grid());
17512048 } else
1752
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
17532050 {
17542051 makeSomething(new Sphere());
17552052 } else
1756
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
17572054 {
17582055 makeSomething(new Cone());
17592056 } else
1760
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
17612058 {
17622059 makeSomething(new Torus());
17632060 } else
1764
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
17652062 {
17662063 makeSomething(new Superellipsoid());
17672064 } else
1768
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
17692066 {
17702067 makeSomething(new Klein());
17712068 } else
....@@ -1785,7 +2082,7 @@
17852082 {
17862083 makeSomething(new BezierSurface());
17872084 } else
1788
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
17892086 {
17902087 /*
17912088 Object3D obj = new BezierSurface(5,8);
....@@ -1833,7 +2130,7 @@
18332130 s.setup();
18342131 makeSomething(s);
18352132 } else
1836
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
18372134 {
18382135 makeSomething(new Light());
18392136 } else
....@@ -1883,30 +2180,30 @@
18832180
18842181 group(g);
18852182 } else
1886
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
18872184 {
18882185 Composite csg = new GroupLeaf();
18892186 csg.count = 5;
18902187 group(csg);
1891
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
18922189 csg.addChild(child);
18932190 child.addChild(csg);
18942191 } else
18952192 if (source == doubleItem)
18962193 {
1897
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
18982195 csg.count = 5;
18992196 group(csg);
1900
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
19012198 csg.addChild(child);
19022199 child.addChild(csg);
1903
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
19042201 csg.addChild(child);
19052202 child.addChild(csg);
19062203 } else
19072204 if (source == tripleItem)
19082205 {
1909
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
19102207 csg.count = 4;
19112208 group(csg);
19122209 Composite child = new cGroup();
....@@ -1956,6 +2253,46 @@
19562253 {
19572254 DumpObject();
19582255 } else
2256
+ if (source == minButton)
2257
+ {
2258
+ Minimize();
2259
+ } else
2260
+ if (source == maxButton)
2261
+ {
2262
+ Maximize();
2263
+ } else
2264
+ if (source == fullButton)
2265
+ {
2266
+ ToggleFullScreen();
2267
+ } else
2268
+ if (source == undoButton)
2269
+ {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2273
+ Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
2284
+ } else
2285
+ if (source == redoButton)
2286
+ {
2287
+ // Go to next version
2288
+ Redo();
2289
+ } else
2290
+ if (source == saveButton)
2291
+ {
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
2295
+ } else
19592296 if (source == oneStepButton)
19602297 {
19612298 Globals.ONESTEP = true;
....@@ -1963,17 +2300,14 @@
19632300 } else
19642301 if (source == screenfitButton)
19652302 {
1966
- //Reload(lastConverter, lastFilename, true);
19672303 ScreenFit();
19682304 } else
19692305 if (source == screenfitpointButton)
19702306 {
1971
- //Reload(lastConverter, lastFilename, true);
19722307 ScreenFitPoint();
19732308 } else
19742309 if (source == snapobjectButton)
19752310 {
1976
- //Reload(lastConverter, lastFilename, true);
19772311 SnapObject();
19782312 } else
19792313 // if (event.getSource() == recompileButton)
....@@ -2337,7 +2671,7 @@
23372671 {
23382672 StepAll();
23392673 } else
2340
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
23412675 {
23422676 //int indices[] = jList.getSelectedIndices();
23432677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2349,9 +2683,9 @@
23492683 {
23502684 ClearSelection(true);
23512685 } else
2352
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
23532687 {
2354
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
23552689 } else
23562690 if (source == hideItem)
23572691 {
....@@ -2369,11 +2703,11 @@
23692703 {
23702704 makeSomething(new Camera());
23712705 } else
2372
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
23732707 {
23742708 group(new Composite());
23752709 } else
2376
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
23772711 {
23782712 RandomNode random = new RandomNode();
23792713 group(random);
....@@ -2475,7 +2809,7 @@
24752809 {
24762810 group(new cLinker());
24772811 } else
2478
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
24792813 {
24802814 group(new TextureNode());
24812815 } else
....@@ -2495,17 +2829,30 @@
24952829 {
24962830 CastShadow(2);
24972831 } else
2498
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
24992833 {
2500
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
25012836 for (int i=0; i<group.selection.size(); i++)
25022837 {
2503
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
25042843 }
25052844
2506
- ClearSelection(false);
2507
-
2508
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
25092856 } else
25102857 if (source == genUVItem)
25112858 {
....@@ -2517,7 +2864,7 @@
25172864 } else
25182865 if (source == genNormalsMESHItem)
25192866 {
2520
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
25212868 } else
25222869 if (source == genNormalsORGANItem)
25232870 {
....@@ -2582,6 +2929,22 @@
25822929 if (source == unmarkleavesItem)
25832930 {
25842931 MarkLeaves(false);
2932
+ } else
2933
+ if (source == rewindleavesItem)
2934
+ {
2935
+ RewindLeaves(true);
2936
+ } else
2937
+ if (source == unrewindleavesItem)
2938
+ {
2939
+ RewindLeaves(false);
2940
+ } else
2941
+ if (source == randomleavesItem)
2942
+ {
2943
+ RandomLeaves(true);
2944
+ } else
2945
+ if (source == unrandomleavesItem)
2946
+ {
2947
+ RandomLeaves(false);
25852948 } else
25862949 if (source == flipVItem)
25872950 {
....@@ -2817,6 +3180,10 @@
28173180 if (source == twoButton)
28183181 {
28193182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
28203187 // bug
28213188 //gridPanel.setDividerLocation(1.0);
28223189 //bigPanel.setDividerLocation(0.0);
....@@ -2849,10 +3216,31 @@
28493216 bigThree.ClearUI();
28503217 bigThree.add(centralPanel);
28513218 bigThree.FlushUI();
3219
+
3220
+ cameraView.requestFocusInWindow();
3221
+
3222
+// refreshContents(true);
3223
+//
3224
+// try
3225
+// {
3226
+// java.awt.Robot bot = new java.awt.Robot();
3227
+// int mask = InputEvent.BUTTON1_MASK;
3228
+// bot.mouseMove(100, 100);
3229
+// bot.mousePress(mask);
3230
+// bot.mouseRelease(mask);
3231
+// }
3232
+// catch (Exception e)
3233
+// {
3234
+//
3235
+// }
3236
+
28523237 } else
28533238 if (source == threeButton)
28543239 {
28553240 radio.layout = threeButton;
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
28563244
28573245 // bigThree.remove(scenePanel);
28583246 // bigThree.remove(centralPanel);
....@@ -2885,10 +3273,15 @@
28853273 bigThree.add(centralPanel);
28863274 bigThree.add(XYZPanel);
28873275 bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
28883278 } else
28893279 if (source == fourButton)
28903280 {
28913281 radio.layout = fourButton;
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
28923285
28933286 // bigThree.remove(scenePanel);
28943287 // bigThree.remove(centralPanel);
....@@ -2920,10 +3313,15 @@
29203313 bigThree.ClearUI();
29213314 bigThree.add(scenePanel);
29223315 bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
29233318 } else
29243319 if (source == sixButton)
29253320 {
29263321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
29273325
29283326 // bigThree.remove(scenePanel);
29293327 // bigThree.remove(centralPanel);
....@@ -2956,10 +3354,15 @@
29563354 bigThree.add(scenePanel);
29573355 bigThree.add(centralPanel);
29583356 bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
29593359 } else
29603360 if (source == sevenButton)
29613361 {
29623362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
29633366
29643367 // bigThree.remove(scenePanel);
29653368 // bigThree.remove(centralPanel);
....@@ -2993,6 +3396,8 @@
29933396 bigThree.add(centralPanel);
29943397 bigThree.add(XYZPanel);
29953398 bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
29963401 } else
29973402 if (source == rootButton)
29983403 {
....@@ -3004,6 +3409,7 @@
30043409 EditObject(obj);
30053410 }
30063411
3412
+ cameraView.requestFocusInWindow();
30073413 refreshContents(true);
30083414 } else
30093415 if (source == closeButton)
....@@ -3013,22 +3419,37 @@
30133419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30143420 {
30153421 ab = (cRadio)e.nextElement();
3016
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30173423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
30183430 buttonGroup.remove(ab);
30193431 radioPanel.remove(ab);
30203432
3021
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
30223435 // ab.GetObject().objectUI = null; // ?????????
30233436
30243437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30253438 break;
30263439 }
30273440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
30283443 refreshContents(true);
30293444 } else
30303445 if (source == editItem || source == editButton)
30313446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
30323453 EditSelection(false);
30333454 } else
30343455 if (source == uneditButton)
....@@ -3038,10 +3459,11 @@
30383459 Object3D child = (Object3D)e.nextElement();
30393460 if(child.editWindow != null)
30403461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
30413463 child.CloseUI();
30423464 listUI.remove(child);
30433465
3044
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
30453467 }
30463468 objEditor.ctrlPanel.FlushUI();
30473469 //objEditor.jTree.clearSelection();
....@@ -3054,6 +3476,7 @@
30543476 //copy.ClearUI();
30553477 for (Object3D obj : listUI)
30563478 {
3479
+ obj.pinned = false;
30573480 obj.CloseUI();
30583481 }
30593482 listUI.clear();
....@@ -3063,7 +3486,7 @@
30633486 {
30643487 assert(copy == group);
30653488
3066
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30673490
30683491 for (Object3D obj : listUI)
30693492 {
....@@ -3112,6 +3535,9 @@
31123535 }
31133536
31143537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
31153541 //Globals.theRenderer.object = group;
31163542 if(!useclient)
31173543 {
....@@ -3128,7 +3554,9 @@
31283554 sideView.object = group;
31293555 }
31303556
3131
-// fix "+" issue group.editWindow = this;
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
31323560
31333561 /*
31343562 currentLayout = radio.layout;
....@@ -3136,18 +3564,27 @@
31363564 currentLayout = sevenButton;
31373565 */
31383566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
31393574 keepparent = group.parent;
31403575 // PARENT = NULL or not???
31413576 //group.parent = null; // ROOT
31423577 //group.attributes = -1;
31433578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
31443581 refreshContents(true);
31453582 } else if (event.getSource() == editCameraItem)
31463583 {
31473584 cameraView.ProtectCamera();
31483585 cameraView.repaint();
31493586 return;
3150
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31513588 {
31523589 cameraView.RevertCamera();
31533590 cameraView.repaint();
....@@ -3164,7 +3601,6 @@
31643601 }
31653602
31663603 boolean useclient = false;
3167
- cRadio radio;
31683604
31693605 void ToggleRoot()
31703606 {
....@@ -3403,7 +3839,8 @@
34033839
34043840 int size = obj.MemorySize();
34053841
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
3842
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3843
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34073844 }
34083845 }
34093846 catch (Exception e)
....@@ -3484,6 +3921,13 @@
34843921 void GenNormals(boolean crease)
34853922 {
34863923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
34873931
34883932 refreshContents();
34893933 }
....@@ -4111,6 +4555,18 @@
41114555 refreshContents();
41124556 }
41134557
4558
+ void RewindLeaves(boolean hide)
4559
+ {
4560
+ group.selection.RewindLeaves(hide);
4561
+ refreshContents();
4562
+ }
4563
+
4564
+ void RandomLeaves(boolean hide)
4565
+ {
4566
+ group.selection.RandomLeaves(hide);
4567
+ refreshContents();
4568
+ }
4569
+
41144570 void SetTexRes(int tr)
41154571 {
41164572 group.selection.SetTexRes(tr);
....@@ -4182,28 +4638,25 @@
41824638 // }
41834639 // }
41844640
4185
- static boolean allparams = true;
4186
-
4187
- static Vector<Object3D> listUI = new Vector<Object3D>();
4188
-
41894641 void EditSelection(boolean newWindow)
41904642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
41914649 // aConstraints.gridy = 0;
41924650 for (int i=0; i<group.selection.size(); i++)
41934651 {
41944652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41954653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4196
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41974655
41984656 Object3D elem = (Object3D)group.selection.elementAt(i);
41994657 if(elem != group || !newWindow)
42004658 {
4201
- // if (!(elem instanceof Composite))
4202
- // newWindow = false;
4203
- listUI.add(elem);
4204
- elem.openEditWindow(this, newWindow); //, false);
4205
- System.out.println("edit : " + elem);
4206
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
42074660 }
42084661 }
42094662 }
....@@ -4278,7 +4731,8 @@
42784731 //new Exception().printStackTrace();
42794732
42804733 freezemodel = true;
4281
-
4734
+ ClearUnpinned();
4735
+
42824736 /**/
42834737 //switch (event.id)
42844738 {
....@@ -4286,7 +4740,6 @@
42864740 //case 702: // Event.LIST_DESELECT
42874741 group.deselectAll();
42884742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904743 if (tps != null)
42914744 {
42924745 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4748,8 @@
42954748
42964749 //if (child.parent != null)
42974750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
42984752 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024753 }
43034754 }
43044755 // else
....@@ -4308,17 +4759,13 @@
43084759 // System.err.println("info : " + group.GetPath());
43094760 // }
43104761
4311
- objEditor.SetText(); // jan 2014
4312
-
4313
- Object3D object = (Object3D) tps[0].getLastPathComponent();
4314
-
4315
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(object instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43164763 CameraPane.flash = true;
43174764
4318
- if (tps != null && tps.length > 0 && object instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43194766 // a camera
43204767 {
4321
- if (object != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43224769 {
43234770 CameraPane.camerachangeframe = 0; // don't refuse it
43244771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4327,6 +4774,13 @@
43274774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43284775 }
43294776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
43304784 refreshContents();
43314785 //return true;
43324786 }
....@@ -4335,6 +4789,35 @@
43354789
43364790 freezemodel = false;
43374791 }
4792
+
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
4801
+ void refreshContents(boolean cp)
4802
+ {
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4805
+ {
4806
+ objEditor.ClearInfo(); // .GetMaterial());
4807
+
4808
+ for (int i=0; i < group.selection.Size(); i++)
4809
+ {
4810
+ Object3D child = (Object3D) group.selection.get(i);
4811
+
4812
+ objEditor.AddInfo(child, this, true);
4813
+ System.err.println("info : " + child.GetPath());
4814
+ }
4815
+
4816
+ objEditor.SetText(); // jan 2014
4817
+ }
4818
+
4819
+ super.refreshContents(cp);
4820
+ }
43384821
43394822 void linkSomething(Object3D thing)
43404823 {
....@@ -4406,6 +4889,7 @@
44064889 {
44074890 if (group.selection.isEmpty())
44084891 return;
4892
+
44094893 Grafreed.clipboardIsTempGroup = false;
44104894 Composite tGroup = null;
44114895 if (group.selection.size() > 0) // 1)
....@@ -4416,6 +4900,8 @@
44164900
44174901 if (cut)
44184902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
44194905 //int indices[] = jList.getSelectedIndices();
44204906 //for (int i = indices.length - 1; i >= 0; i--)
44214907 //jList.remove(indices[i]);
....@@ -4505,8 +4991,10 @@
45054991 }
45064992
45074993 }
4994
+
45084995 if (Grafreed.clipboardIsTempGroup)
45094996 Grafreed.clipboard = tGroup;
4997
+
45104998 if (cut)
45114999 {
45125000 ResetModel();
....@@ -4516,6 +5004,10 @@
45165004
45175005 void paste(boolean expand)
45185006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
45195011 // if (GrafreeD.clipboard == null)
45205012 // return;
45215013 boolean first = true;
....@@ -4575,6 +5067,7 @@
45755067 Grafreed.clipboard.get(0).parent = keepparent;
45765068 }
45775069
5070
+ Globals.REPLACEONMAKE = keep;
45785071 ResetModel();
45795072 refreshContents();
45805073 }
....@@ -4710,6 +5203,10 @@
47105203
47115204 void group(Object3D csg, boolean grab)
47125205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
47135210 if (//false) // why??
47145211 !group.selection.isEmpty())
47155212 {
....@@ -4823,10 +5320,15 @@
48235320 //node.add(csg);
48245321 //makeSomething(node);
48255322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
48265324 }
48275325
48285326 void Ungroup(Object3D g)
48295327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
48305332 if (g instanceof HiddenObject)
48315333 {
48325334 HiddenObject h = (HiddenObject) g;
....@@ -4843,6 +5345,7 @@
48435345 objEditor.makeSomething(g.get(i), false);
48445346 }
48455347 }
5348
+ Globals.REPLACEONMAKE = keep;
48465349 }
48475350
48485351 void ungroup()
....@@ -5131,7 +5634,28 @@
51315634 cButton clearpanelButton;
51325635 cButton unselectButton;
51335636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
51345640 cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
51355659
51365660 cButton screenfitButton;
51375661 cButton screenfitpointButton;
....@@ -5144,14 +5668,6 @@
51445668
51455669 cButton setsupportButton;
51465670
5147
- cButton twoButton;
5148
- cButton sixButton;
5149
- cButton threeButton;
5150
- cButton sevenButton;
5151
- cButton fourButton; // full panel
5152
- cButton oneButton; // full XYZ
5153
- //cButton currentLayout;
5154
-
51555671 //
51565672 //Composite
51575673 Object3D // to do !!
....@@ -5161,11 +5677,11 @@
51615677 //JTree jTree;
51625678 private MenuItem lookAtItem;
51635679 private MenuItem lookFromItem;
5164
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
51655681 private MenuItem cutItem;
51665682 private MenuItem undoItem;
51675683 private MenuItem redoItem;
5168
- private MenuItem duplicateItem;
5684
+ private JMenuItem duplicateItem;
51695685 private MenuItem cloneItem;
51705686 private MenuItem cloneSupportItem;
51715687 private MenuItem overwriteGeoItem;
....@@ -5193,7 +5709,7 @@
51935709 private MenuItem pasteLinkItem;
51945710 private MenuItem pasteCloneItem;
51955711 private MenuItem pasteExpandItem;
5196
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
51975713 private MenuItem clearAllItem;
51985714 private MenuItem genUVItem;
51995715 private MenuItem genNormalsMESHItem;
....@@ -5228,6 +5744,10 @@
52285744 private MenuItem showleavesItem;
52295745 private MenuItem markleavesItem;
52305746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
52315751
52325752 private MenuItem flipVItem;
52335753 private MenuItem unflipVItem;
....@@ -5249,7 +5769,7 @@
52495769 private MenuItem frontItem;
52505770 private MenuItem cameraItem;
52515771 private MenuItem compositeItem;
5252
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
52535773 private MenuItem physicsItem;
52545774 private MenuItem frameselectorItem;
52555775 private MenuItem scriptNodeItem;
....@@ -5323,5 +5843,5 @@
53235843
53245844 Menu cameraMenu;
53255845 MenuItem editCameraItem;
5326
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
53275847 }