Normand Briere
2019-07-21 d32f24f147068e6cbecb31c7f98047f68bc8b58a
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,11 +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
- 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"));
158185 duplicateItem.addActionListener(this);
159186 cloneItem = menu.add(new MenuItem("Clone"));
160187 cloneItem.addActionListener(this);
....@@ -170,7 +197,6 @@
170197 copyItem.addActionListener(this);
171198 pasteItem = menu.add(new MenuItem("Paste"));
172199 pasteItem.addActionListener(this);
173
- menu.add("-");
174200
175201 menu.add("-");
176202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -182,8 +208,8 @@
182208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
183209 // pasteExpandItem.addActionListener(this);
184210 menu.add("-");
185
- clearItem = menu.add(new MenuItem("Clear"));
186
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
187213
188214 if (Globals.ADVANCED)
189215 {
....@@ -197,23 +223,23 @@
197223 //zBufferItem.addActionListener(this);
198224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199225 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
202228
203
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
- toggleFullScreenItem.addItemListener(this);
205
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
- 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);
207241
208
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
- toggleTextureItem.addItemListener(this);
210
- toggleTextureItem.setState(CameraPane.textureon);
211
-
212
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
- toggleSwitchItem.addItemListener(this);
214
- toggleSwitchItem.setState(CameraPane.SWITCH);
215
-
216
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
217243 toggleHandleItem.addItemListener(this);
218244 toggleHandleItem.setState(CameraPane.HANDLES);
219245
....@@ -240,7 +266,7 @@
240266
241267 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242268 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
269
+ toggleDebugItem.setState(Globals.DEBUG);
244270
245271 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246272 toggleFrustumItem.addItemListener(this);
....@@ -261,14 +287,14 @@
261287 // animationItem.addItemListener(this);
262288 // animationItem.setState(CameraPane.ANIMATION);
263289 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265291 editCameraItem.addActionListener(this);
266292
267293 if (Globals.ADVANCED)
268294 {
269295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
272298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273299 oe.cameraMenu.add("-");
274300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -276,7 +302,7 @@
276302 editLeafItem.addActionListener(this);
277303 lookAtItem.addActionListener(this);
278304 //lookFromItem.addActinoListener(this);
279
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
280306 }
281307
282308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -321,21 +347,29 @@
321347 }
322348
323349 oe.menuBar.add(menu = new Menu("Group"));
324
- grabItem = menu.add(new MenuItem("Grab"));
325
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
326352 backItem = menu.add(new MenuItem("Back"));
327353 backItem.addActionListener(this);
328354 frontItem = menu.add(new MenuItem("Front"));
329355 frontItem.addActionListener(this);
330
- compositeItem = menu.add(new MenuItem("Composite"));
331
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
332361 hideItem = menu.add(new MenuItem("Hidden Group"));
333362 hideItem.addActionListener(this);
363
+ }
334364 ungroupItem = menu.add(new MenuItem("Ungroup"));
335365 ungroupItem.addActionListener(this);
336
- menu.add("-");
337
- randomItem = menu.add(new MenuItem("Switch node"));
338
- 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
+ {
339373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340374 switchGeoItem.addActionListener(this);
341375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +377,6 @@
343377 morphItem = menu.add(new MenuItem("Morph Group"));
344378 morphItem.addActionListener(this);
345379
346
- if (Globals.ADVANCED)
347
- {
348380 menu.add("-");
349381 physicsItem = menu.add(new MenuItem("Physics"));
350382 physicsItem.addActionListener(this);
....@@ -352,30 +384,29 @@
352384 frameselectorItem.addActionListener(this);
353385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
354386 scriptNodeItem.addActionListener(this);
355
- cameraItem = menu.add(new MenuItem("Camera"));
356
- cameraItem.addActionListener(this);
357387 }
358388
359389 oe.menuBar.add(menu = new Menu("Object"));
360
- textureItem = menu.add(new MenuItem("Texture"));
361
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
362392 billboardItem = menu.add(new MenuItem("Billboard"));
363393 billboardItem.addActionListener(this);
364394 csgItem = menu.add(new MenuItem("CSG"));
365395 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367397 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369399 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
372405 if (Globals.ADVANCED)
373406 {
374407 menu.add("-");
375408 linkerItem = menu.add(new MenuItem("Linker"));
376409 linkerItem.addActionListener(this);
377
- attributeItem = menu.add(new MenuItem("Attribute"));
378
- attributeItem.addActionListener(this);
379410 templateItem = menu.add(new MenuItem("Template"));
380411 templateItem.addActionListener(this);
381412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -404,7 +435,7 @@
404435 genNormalsMESHItem.addActionListener(this);
405436 if (Globals.ADVANCED)
406437 {
407
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
408439 genNormalsMINEItem.addActionListener(this);
409440 }
410441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -464,6 +495,14 @@
464495 markleavesItem.addActionListener(this);
465496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466497 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);
467506 menu.add("-");
468507 flipVItem = menu.add(new MenuItem("Flip V"));
469508 flipVItem.addActionListener(this);
....@@ -519,8 +558,21 @@
519558 buildToolsMenu(menu);
520559 }
521560
561
+
522562 void SetupUI2(ObjEditor oe)
523563 {
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
+
524576 //new Exception().printStackTrace();
525577
526578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +601,79 @@
549601 oe.radioPanel.add(dummyButton);
550602 oe.buttonGroup.add(dummyButton);
551603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
552608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553609
554
- 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);
555661 liveCB.setToolTipText("Enable animation");
556662 liveCB.addItemListener(this);
557663
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559665 oneStepButton.setToolTipText("Animate one step forward");
560666 oneStepButton.addActionListener(this);
561667
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563669 fastCB.setToolTipText("Fast mode");
564670 fastCB.addItemListener(this);
565671
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
567
- trackCB.setToolTipText("Enable tracking");
568
- trackCB.addItemListener(this);
569
-
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571
- screenfitButton.setToolTipText("Screen fit");
572
- screenfitButton.addActionListener(this);
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);
573677
574678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575679 // screenfitpointButton.addActionListener(this);
....@@ -581,65 +685,146 @@
581685 snapobjectButton.setToolTipText("Snap Object");
582686 }
583687
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587689
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
- twoButton.setToolTipText("Show center view only");
592
- twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594691 fourButton.addActionListener(this);
595692 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- 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");
598701 sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- threeButton.setToolTipText("2-column layout right");
601
- threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- sevenButton.setToolTipText("3-column layout");
604
- 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);
605708 //
606709
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- 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");
609712 rootButton.addActionListener(this);
610713
611
- 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);
612715 closeButton.setToolTipText("Close tab");
613716 closeButton.addActionListener(this);
614717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615718 //clearButton.addActionListener(this);
616
-
617
- 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
+ }
618751
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- 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");
621801 editButton.addActionListener(this);
622802
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
625805 uneditButton.addActionListener(this);
626806
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
629809 allParamsButton.addActionListener(this);
630810
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632812 clearPanelButton.setToolTipText("Clear edit panel");
633813 clearPanelButton.addActionListener(this);
634814
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636816 unselectButton.setToolTipText("Unselect");
637817 unselectButton.addActionListener(this);
638818
639
- 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);
640822
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
643828
644829 // oe.aConstraints.gridx += 1;
645830 // oe.aConstraints.weighty = 0;
....@@ -656,29 +841,17 @@
656841
657842 JScrollPane jSP;
658843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660845 ResetModel();
661846
662847 oe.treePanel.add(jSPPanel);
663848 oe.treePanel.Return();
664849
665
- cGridBag copyOptionsPanel = new cGridBag();
666
-
667
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
668
- colorCB.setToolTipText("Copy color when dropped");
669
- colorCB.addItemListener(this);
670
-
671
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
672
- materialCB.setToolTipText("Copy material when dropped");
673
- materialCB.addItemListener(this);
674
-
675
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
676
- textureCB.setToolTipText("Copy texture when dropped");
677
- textureCB.addItemListener(this);
678
-
679
- copyOptionsPanel.preferredHeight = 1;
680850 oe.treePanel.add(copyOptionsPanel);
681851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
682855
683856 // mainPanel.setDividerLocation(0.5); //1.0);
684857 // mainPanel.setResizeWeight(0.5);
....@@ -701,29 +874,49 @@
701874 dgr.addDragGestureListener(this);
702875 }catch(Exception e) {}
703876 */
704
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
705878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
706879 }
707880
708881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709882 {
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
+
710897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711898 boxCB.setToolTipText("Display bounding boxes");
712899 boxCB.addItemListener(this);
713900
714901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
716903 zoomBoxCB.addItemListener(this);
717904
718905 if (true) // Globals.ADVANCED)
719906 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- 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);
723914
724915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725916 // localCB.addItemListener(this);
726917
918
+ panel.Return();
919
+
727920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728921 crowdCB.setToolTipText("Used for crowds");
729922 crowdCB.addItemListener(this);
....@@ -740,6 +933,8 @@
740933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741934 // speakerMocapCB.addItemListener(this);
742935
936
+ panel.Return();
937
+
743938 if (false)
744939 {
745940 // handled in scripts
....@@ -754,34 +949,74 @@
754949 //constraints.gridy += 1;
755950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
757953 }
758954
759955 //constraints.gridx += 1;
760956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761957 // debugCB.addItemListener(this);
762958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
763963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
764965 oeilCB.addItemListener(this);
765966
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
+ {
766987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767988 lookAtCB.setToolTipText("Look-at target");
768989 lookAtCB.addItemListener(this);
990
+ }
769991
770992 }
771993
772994 cGridBag fill = new cGridBag();
773
-
774995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
7751000
7761001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
7771004
7781005 }
7791006
7801007 void EditObject(Object3D obj)
7811008 {
7821009 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
+
7831018 radioButton.SetObject(obj);
784
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
7851020 radioButton.SetCamera(cameraView.renderCamera, false);
7861021 radioButton.addActionListener(this);
7871022 radioPanel.add(radioButton);
....@@ -791,6 +1026,8 @@
7911026
7921027 void SetupViews(ObjEditor oe)
7931028 {
1029
+ theFrame = this;
1030
+
7941031 oe.SetupViews();
7951032
7961033 System.out.println("SetupViews");
....@@ -799,23 +1036,28 @@
7991036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8001037 }
8011038
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- JCheckBox smoothfocusCB;
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;
8131052 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
8191061
8201062 // static int COLOR = 1;
8211063 // static int MATERIAL = 2;
....@@ -823,9 +1065,9 @@
8231065
8241066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251067
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
8291071
8301072 public void itemStateChanged(ItemEvent e)
8311073 {
....@@ -853,6 +1095,7 @@
8531095 } else if(e.getSource() == liveCB)
8541096 {
8551097 cameraView.ToggleLive();
1098
+ refreshContents(false);
8561099 }
8571100 else if(e.getSource() == supportCB)
8581101 {
....@@ -917,6 +1160,18 @@
9171160 {
9181161 cameraView.ToggleOeil();
9191162 }
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
+ }
9201175 else if(e.getSource() == lookAtCB)
9211176 {
9221177 cameraView.ToggleLookAt();
....@@ -933,7 +1188,8 @@
9331188
9341189 /**/
9351190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
9371193 if ((path == null) || (path.getPathCount() <= 1)) {
9381194 // We can't move the root node or an empty selection
9391195 return;
....@@ -996,8 +1252,6 @@
9961252 }
9971253 }
9981254
999
- String string = (String) object;
1000
-
10011255 System.out.println("Transfer = " + object + "; drop : " + target);
10021256 // if( object instanceof java.io.File[])
10031257 // {
....@@ -1005,6 +1259,8 @@
10051259 // objEditor.DropFile((java.io.File[]) object, true);
10061260 // return;
10071261 // }
1262
+
1263
+ String string = object.toString();
10081264
10091265 // File path for Mac and Windows
10101266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1050,23 +1306,33 @@
10501306
10511307 assert target == objEditor.jTree;
10521308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
10531310 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551312 } catch (Exception e) {
10561313 System.out.println("destinationPath : " + destinationPath);
10571314 return;
10581315 }
10591316
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
10611318 {
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
+// {
10621328 loadClipboard(true);
10631329 objEditor.jTree.setSelectionPath(destinationPath);
10641330 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
10701336 }
10711337 public void dropActionChanged(DropTargetDragEvent dtde)
10721338 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1437,30 @@
11711437 {
11721438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731439 //heightFieldItem.addActionListener(this);
1174
- gridItem = menu.add(new MenuItem("Grid"));
1175
- gridItem.addActionListener(this);
1176
- rectoidItem = menu.add(new MenuItem("Box"));
1177
- rectoidItem.addActionListener(this);
1178
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1179
- ellipsoidItem.addActionListener(this);
1180
- coneItem = menu.add(new MenuItem("Cone"));
1181
- coneItem.addActionListener(this);
1182
- torusItem = menu.add(new MenuItem("Torus"));
1183
- torusItem.addActionListener(this);
1184
- superItem = menu.add(new MenuItem("Superellipsoid"));
1185
- superItem.addActionListener(this);
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
+ {
11861458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871459 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
11901464 if (Globals.ADVANCED)
11911465 {
11921466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1486,15 @@
12121486 }
12131487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141488 bezierItem.addActionListener(this);
1215
- overlayItem = menu.add(new MenuItem("Overlay"));
1216
- overlayItem.addActionListener(this);
1217
- lightItem = menu.add(new MenuItem("Light"));
1218
- lightItem.addActionListener(this);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
12191493 menu.add("-");
12201494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211495 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
12241498 doubleItem = menu.add(new MenuItem("Fork"));
12251499 doubleItem.addActionListener(this);
12261500 if (Globals.ADVANCED)
....@@ -1236,6 +1510,9 @@
12361510 animationItem.addItemListener(this);
12371511 animationItem.setState(Globals.ANIMATION);
12381512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
12391516 menu.add("-");
12401517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12411518 parseverticesItem.addActionListener(this);
....@@ -1248,6 +1525,8 @@
12481525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12491526 reduce34MorphItem.addActionListener(this);
12501527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
12511530 menu.add(computeAOItem = new MenuItem("Compute AO"));
12521531 computeAOItem.addActionListener(this);
12531532
....@@ -1256,11 +1535,9 @@
12561535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12571536 mirrorItem.addActionListener(this);
12581537 menu.add("-");
1259
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1260
- memoryItem.addActionListener(this);
12611538 menu.add(analyzeItem = new MenuItem("Analyze"));
12621539 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
12641541 dumpItem.addActionListener(this);
12651542 // menu.add(pathItem = new MenuItem("From-to path"));
12661543 // pathItem.addActionListener(this);
....@@ -1401,9 +1678,34 @@
14011678 shadow.material = new cMaterial(obj.material);
14021679 shadow.material.diffuse = 0.0001f;
14031680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
14041682
14051683 makeSomething(shadow);
14061684 }
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
+ }
14071709
14081710 /**
14091711 * applyExample
....@@ -1648,7 +1950,7 @@
16481950 {
16491951 ScreenFit();
16501952 } else
1651
- if (source == switchItem)
1953
+ if (source == switchViewItem)
16521954 {
16531955 cVector v1 = new cVector();
16541956 cVector v2 = new cVector();
....@@ -1657,11 +1959,11 @@
16571959 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581960 objEditor.cameraView.repaint();
16591961 } else
1660
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
16611963 {
16621964 makeSomething(new Box());
16631965 } else
1664
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
16651967 {
16661968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +2042,27 @@
17402042
17412043 makeSomething(obj);
17422044 } else
1743
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
17442046 {
17452047 makeSomething(new Grid());
17462048 } else
1747
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
17482050 {
17492051 makeSomething(new Sphere());
17502052 } else
1751
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
17522054 {
17532055 makeSomething(new Cone());
17542056 } else
1755
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
17562058 {
17572059 makeSomething(new Torus());
17582060 } else
1759
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
17602062 {
17612063 makeSomething(new Superellipsoid());
17622064 } else
1763
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
17642066 {
17652067 makeSomething(new Klein());
17662068 } else
....@@ -1780,7 +2082,7 @@
17802082 {
17812083 makeSomething(new BezierSurface());
17822084 } else
1783
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
17842086 {
17852087 /*
17862088 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2130,7 @@
18282130 s.setup();
18292131 makeSomething(s);
18302132 } else
1831
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
18322134 {
18332135 makeSomething(new Light());
18342136 } else
....@@ -1878,30 +2180,30 @@
18782180
18792181 group(g);
18802182 } else
1881
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
18822184 {
18832185 Composite csg = new GroupLeaf();
18842186 csg.count = 5;
18852187 group(csg);
1886
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
18872189 csg.addChild(child);
18882190 child.addChild(csg);
18892191 } else
18902192 if (source == doubleItem)
18912193 {
1892
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
18932195 csg.count = 5;
18942196 group(csg);
1895
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
18962198 csg.addChild(child);
18972199 child.addChild(csg);
1898
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
18992201 csg.addChild(child);
19002202 child.addChild(csg);
19012203 } else
19022204 if (source == tripleItem)
19032205 {
1904
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
19052207 csg.count = 4;
19062208 group(csg);
19072209 Composite child = new cGroup();
....@@ -1951,6 +2253,46 @@
19512253 {
19522254 DumpObject();
19532255 } 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
19542296 if (source == oneStepButton)
19552297 {
19562298 Globals.ONESTEP = true;
....@@ -1958,17 +2300,14 @@
19582300 } else
19592301 if (source == screenfitButton)
19602302 {
1961
- //Reload(lastConverter, lastFilename, true);
19622303 ScreenFit();
19632304 } else
19642305 if (source == screenfitpointButton)
19652306 {
1966
- //Reload(lastConverter, lastFilename, true);
19672307 ScreenFitPoint();
19682308 } else
19692309 if (source == snapobjectButton)
19702310 {
1971
- //Reload(lastConverter, lastFilename, true);
19722311 SnapObject();
19732312 } else
19742313 // if (event.getSource() == recompileButton)
....@@ -2004,6 +2343,14 @@
20042343 if (source == cutItem || source == clearButton)
20052344 {
20062345 loadClipboard(true);
2346
+ } else
2347
+ if (source == undoItem)
2348
+ {
2349
+ Undo();
2350
+ } else
2351
+ if (source == redoItem)
2352
+ {
2353
+ Redo();
20072354 } else
20082355 if (source == duplicateItem)
20092356 {
....@@ -2324,7 +2671,7 @@
23242671 {
23252672 StepAll();
23262673 } else
2327
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
23282675 {
23292676 //int indices[] = jList.getSelectedIndices();
23302677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2336,9 +2683,9 @@
23362683 {
23372684 ClearSelection(true);
23382685 } else
2339
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
23402687 {
2341
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
23422689 } else
23432690 if (source == hideItem)
23442691 {
....@@ -2356,11 +2703,11 @@
23562703 {
23572704 makeSomething(new Camera());
23582705 } else
2359
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
23602707 {
23612708 group(new Composite());
23622709 } else
2363
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
23642711 {
23652712 RandomNode random = new RandomNode();
23662713 group(random);
....@@ -2462,7 +2809,7 @@
24622809 {
24632810 group(new cLinker());
24642811 } else
2465
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
24662813 {
24672814 group(new TextureNode());
24682815 } else
....@@ -2482,17 +2829,30 @@
24822829 {
24832830 CastShadow(2);
24842831 } else
2485
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
24862833 {
2487
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
24882836 for (int i=0; i<group.selection.size(); i++)
24892837 {
2490
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
24912843 }
24922844
2493
- ClearSelection(false);
2494
-
2495
- 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
+ }
24962856 } else
24972857 if (source == genUVItem)
24982858 {
....@@ -2504,7 +2864,7 @@
25042864 } else
25052865 if (source == genNormalsMESHItem)
25062866 {
2507
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
25082868 } else
25092869 if (source == genNormalsORGANItem)
25102870 {
....@@ -2569,6 +2929,22 @@
25692929 if (source == unmarkleavesItem)
25702930 {
25712931 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);
25722948 } else
25732949 if (source == flipVItem)
25742950 {
....@@ -2777,7 +3153,7 @@
27773153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27783154 {
27793155 obj = (Object3D)e.nextElement();
2780
- obj.SetBumpTexture(null);
3156
+ obj.ResetBumpTexture();
27813157 }
27823158
27833159 refreshContents();
....@@ -2804,6 +3180,10 @@
28043180 if (source == twoButton)
28053181 {
28063182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
28073187 // bug
28083188 //gridPanel.setDividerLocation(1.0);
28093189 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3216,31 @@
28363216 bigThree.ClearUI();
28373217 bigThree.add(centralPanel);
28383218 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
+
28393237 } else
28403238 if (source == threeButton)
28413239 {
28423240 radio.layout = threeButton;
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
28433244
28443245 // bigThree.remove(scenePanel);
28453246 // bigThree.remove(centralPanel);
....@@ -2872,10 +3273,15 @@
28723273 bigThree.add(centralPanel);
28733274 bigThree.add(XYZPanel);
28743275 bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
28753278 } else
28763279 if (source == fourButton)
28773280 {
28783281 radio.layout = fourButton;
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
28793285
28803286 // bigThree.remove(scenePanel);
28813287 // bigThree.remove(centralPanel);
....@@ -2907,10 +3313,15 @@
29073313 bigThree.ClearUI();
29083314 bigThree.add(scenePanel);
29093315 bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
29103318 } else
29113319 if (source == sixButton)
29123320 {
29133321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
29143325
29153326 // bigThree.remove(scenePanel);
29163327 // bigThree.remove(centralPanel);
....@@ -2943,10 +3354,15 @@
29433354 bigThree.add(scenePanel);
29443355 bigThree.add(centralPanel);
29453356 bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
29463359 } else
29473360 if (source == sevenButton)
29483361 {
29493362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
29503366
29513367 // bigThree.remove(scenePanel);
29523368 // bigThree.remove(centralPanel);
....@@ -2980,6 +3396,8 @@
29803396 bigThree.add(centralPanel);
29813397 bigThree.add(XYZPanel);
29823398 bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
29833401 } else
29843402 if (source == rootButton)
29853403 {
....@@ -2991,6 +3409,7 @@
29913409 EditObject(obj);
29923410 }
29933411
3412
+ cameraView.requestFocusInWindow();
29943413 refreshContents(true);
29953414 } else
29963415 if (source == closeButton)
....@@ -3000,22 +3419,37 @@
30003419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013420 {
30023421 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
30053430 buttonGroup.remove(ab);
30063431 radioPanel.remove(ab);
30073432
3008
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
30093435 // ab.GetObject().objectUI = null; // ?????????
30103436
30113437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123438 break;
30133439 }
30143440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
30153443 refreshContents(true);
30163444 } else
30173445 if (source == editItem || source == editButton)
30183446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
30193453 EditSelection(false);
30203454 } else
30213455 if (source == uneditButton)
....@@ -3025,10 +3459,11 @@
30253459 Object3D child = (Object3D)e.nextElement();
30263460 if(child.editWindow != null)
30273461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
30283463 child.CloseUI();
30293464 listUI.remove(child);
30303465
3031
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
30323467 }
30333468 objEditor.ctrlPanel.FlushUI();
30343469 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3476,7 @@
30413476 //copy.ClearUI();
30423477 for (Object3D obj : listUI)
30433478 {
3479
+ obj.pinned = false;
30443480 obj.CloseUI();
30453481 }
30463482 listUI.clear();
....@@ -3050,7 +3486,7 @@
30503486 {
30513487 assert(copy == group);
30523488
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543490
30553491 for (Object3D obj : listUI)
30563492 {
....@@ -3099,6 +3535,9 @@
30993535 }
31003536
31013537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
31023541 //Globals.theRenderer.object = group;
31033542 if(!useclient)
31043543 {
....@@ -3115,7 +3554,9 @@
31153554 sideView.object = group;
31163555 }
31173556
3118
-// fix "+" issue group.editWindow = this;
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
31193560
31203561 /*
31213562 currentLayout = radio.layout;
....@@ -3123,18 +3564,27 @@
31233564 currentLayout = sevenButton;
31243565 */
31253566 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);
31263574 keepparent = group.parent;
31273575 // PARENT = NULL or not???
31283576 //group.parent = null; // ROOT
31293577 //group.attributes = -1;
31303578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
31313581 refreshContents(true);
31323582 } else if (event.getSource() == editCameraItem)
31333583 {
31343584 cameraView.ProtectCamera();
31353585 cameraView.repaint();
31363586 return;
3137
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383588 {
31393589 cameraView.RevertCamera();
31403590 cameraView.repaint();
....@@ -3151,7 +3601,6 @@
31513601 }
31523602
31533603 boolean useclient = false;
3154
- cRadio radio;
31553604
31563605 void ToggleRoot()
31573606 {
....@@ -3390,7 +3839,8 @@
33903839
33913840 int size = obj.MemorySize();
33923841
3393
- 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)");
33943844 }
33953845 }
33963846 catch (Exception e)
....@@ -3471,6 +3921,13 @@
34713921 void GenNormals(boolean crease)
34723922 {
34733923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
34743931
34753932 refreshContents();
34763933 }
....@@ -3706,7 +4163,7 @@
37064163
37074164 try
37084165 {
3709
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
37104167 }
37114168 catch (Exception e)
37124169 {
....@@ -4098,6 +4555,18 @@
40984555 refreshContents();
40994556 }
41004557
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
+
41014570 void SetTexRes(int tr)
41024571 {
41034572 group.selection.SetTexRes(tr);
....@@ -4169,28 +4638,25 @@
41694638 // }
41704639 // }
41714640
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764641 void EditSelection(boolean newWindow)
41774642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
41784649 // aConstraints.gridy = 0;
41794650 for (int i=0; i<group.selection.size(); i++)
41804651 {
41814652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844655
41854656 Object3D elem = (Object3D)group.selection.elementAt(i);
41864657 if(elem != group || !newWindow)
41874658 {
4188
- // if (!(elem instanceof Composite))
4189
- // newWindow = false;
4190
- listUI.add(elem);
4191
- elem.openEditWindow(this, newWindow); //, false);
4192
- System.out.println("edit : " + elem);
4193
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
41944660 }
41954661 }
41964662 }
....@@ -4265,7 +4731,8 @@
42654731 //new Exception().printStackTrace();
42664732
42674733 freezemodel = true;
4268
-
4734
+ ClearUnpinned();
4735
+
42694736 /**/
42704737 //switch (event.id)
42714738 {
....@@ -4273,7 +4740,6 @@
42734740 //case 702: // Event.LIST_DESELECT
42744741 group.deselectAll();
42754742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774743 if (tps != null)
42784744 {
42794745 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4748,8 @@
42824748
42834749 //if (child.parent != null)
42844750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
42854752 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894753 }
42904754 }
42914755 // else
....@@ -4295,20 +4759,28 @@
42954759 // System.err.println("info : " + group.GetPath());
42964760 // }
42974761
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014763 CameraPane.flash = true;
43024764
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044766 // a camera
43054767 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4769
+ {
4770
+ CameraPane.camerachangeframe = 0; // don't refuse it
4771
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4772
+ }
43084773 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104775 }
43114776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
43124784 refreshContents();
43134785 //return true;
43144786 }
....@@ -4317,6 +4789,35 @@
43174789
43184790 freezemodel = false;
43194791 }
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
+ }
43204821
43214822 void linkSomething(Object3D thing)
43224823 {
....@@ -4388,6 +4889,7 @@
43884889 {
43894890 if (group.selection.isEmpty())
43904891 return;
4892
+
43914893 Grafreed.clipboardIsTempGroup = false;
43924894 Composite tGroup = null;
43934895 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4900,8 @@
43984900
43994901 if (cut)
44004902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
44014905 //int indices[] = jList.getSelectedIndices();
44024906 //for (int i = indices.length - 1; i >= 0; i--)
44034907 //jList.remove(indices[i]);
....@@ -4487,8 +4991,10 @@
44874991 }
44884992
44894993 }
4994
+
44904995 if (Grafreed.clipboardIsTempGroup)
44914996 Grafreed.clipboard = tGroup;
4997
+
44924998 if (cut)
44934999 {
44945000 ResetModel();
....@@ -4498,6 +5004,10 @@
44985004
44995005 void paste(boolean expand)
45005006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
45015011 // if (GrafreeD.clipboard == null)
45025012 // return;
45035013 boolean first = true;
....@@ -4557,6 +5067,7 @@
45575067 Grafreed.clipboard.get(0).parent = keepparent;
45585068 }
45595069
5070
+ Globals.REPLACEONMAKE = keep;
45605071 ResetModel();
45615072 refreshContents();
45625073 }
....@@ -4692,6 +5203,10 @@
46925203
46935204 void group(Object3D csg, boolean grab)
46945205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
46955210 if (//false) // why??
46965211 !group.selection.isEmpty())
46975212 {
....@@ -4805,10 +5320,15 @@
48055320 //node.add(csg);
48065321 //makeSomething(node);
48075322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
48085324 }
48095325
48105326 void Ungroup(Object3D g)
48115327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
48125332 if (g instanceof HiddenObject)
48135333 {
48145334 HiddenObject h = (HiddenObject) g;
....@@ -4825,6 +5345,7 @@
48255345 objEditor.makeSomething(g.get(i), false);
48265346 }
48275347 }
5348
+ Globals.REPLACEONMAKE = keep;
48285349 }
48295350
48305351 void ungroup()
....@@ -5113,7 +5634,28 @@
51135634 cButton clearpanelButton;
51145635 cButton unselectButton;
51155636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
51165640 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;
51175659
51185660 cButton screenfitButton;
51195661 cButton screenfitpointButton;
....@@ -5126,14 +5668,6 @@
51265668
51275669 cButton setsupportButton;
51285670
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375671 //
51385672 //Composite
51395673 Object3D // to do !!
....@@ -5143,9 +5677,11 @@
51435677 //JTree jTree;
51445678 private MenuItem lookAtItem;
51455679 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
51475681 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
51495685 private MenuItem cloneItem;
51505686 private MenuItem cloneSupportItem;
51515687 private MenuItem overwriteGeoItem;
....@@ -5173,7 +5709,7 @@
51735709 private MenuItem pasteLinkItem;
51745710 private MenuItem pasteCloneItem;
51755711 private MenuItem pasteExpandItem;
5176
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
51775713 private MenuItem clearAllItem;
51785714 private MenuItem genUVItem;
51795715 private MenuItem genNormalsMESHItem;
....@@ -5208,6 +5744,10 @@
52085744 private MenuItem showleavesItem;
52095745 private MenuItem markleavesItem;
52105746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
52115751
52125752 private MenuItem flipVItem;
52135753 private MenuItem unflipVItem;
....@@ -5229,7 +5769,7 @@
52295769 private MenuItem frontItem;
52305770 private MenuItem cameraItem;
52315771 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
52335773 private MenuItem physicsItem;
52345774 private MenuItem frameselectorItem;
52355775 private MenuItem scriptNodeItem;
....@@ -5303,5 +5843,5 @@
53035843
53045844 Menu cameraMenu;
53055845 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
53075847 }