Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
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,6 +169,8 @@
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"));
....@@ -160,7 +181,7 @@
160181 // redoItem = menu.add(new MenuItem("Redo"));
161182 // redoItem.addActionListener(this);
162183 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164185 duplicateItem.addActionListener(this);
165186 cloneItem = menu.add(new MenuItem("Clone"));
166187 cloneItem.addActionListener(this);
....@@ -176,7 +197,6 @@
176197 copyItem.addActionListener(this);
177198 pasteItem = menu.add(new MenuItem("Paste"));
178199 pasteItem.addActionListener(this);
179
- menu.add("-");
180200
181201 menu.add("-");
182202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +208,8 @@
188208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189209 // pasteExpandItem.addActionListener(this);
190210 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
193213
194214 if (Globals.ADVANCED)
195215 {
....@@ -203,23 +223,23 @@
203223 //zBufferItem.addActionListener(this);
204224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205225 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
208228
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213241
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223243 toggleHandleItem.addItemListener(this);
224244 toggleHandleItem.setState(CameraPane.HANDLES);
225245
....@@ -246,7 +266,7 @@
246266
247267 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248268 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
269
+ toggleDebugItem.setState(Globals.DEBUG);
250270
251271 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252272 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +294,7 @@
274294 {
275295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279299 oe.cameraMenu.add("-");
280300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +302,7 @@
282302 editLeafItem.addActionListener(this);
283303 lookAtItem.addActionListener(this);
284304 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
286306 }
287307
288308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +347,29 @@
327347 }
328348
329349 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
332352 backItem = menu.add(new MenuItem("Back"));
333353 backItem.addActionListener(this);
334354 frontItem = menu.add(new MenuItem("Front"));
335355 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
338361 hideItem = menu.add(new MenuItem("Hidden Group"));
339362 hideItem.addActionListener(this);
363
+ }
340364 ungroupItem = menu.add(new MenuItem("Ungroup"));
341365 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346374 switchGeoItem.addActionListener(this);
347375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +377,6 @@
349377 morphItem = menu.add(new MenuItem("Morph Group"));
350378 morphItem.addActionListener(this);
351379
352
- if (Globals.ADVANCED)
353
- {
354380 menu.add("-");
355381 physicsItem = menu.add(new MenuItem("Physics"));
356382 physicsItem.addActionListener(this);
....@@ -358,30 +384,29 @@
358384 frameselectorItem.addActionListener(this);
359385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360386 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363387 }
364388
365389 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
368392 billboardItem = menu.add(new MenuItem("Billboard"));
369393 billboardItem.addActionListener(this);
370394 csgItem = menu.add(new MenuItem("CSG"));
371395 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373397 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375399 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
378405 if (Globals.ADVANCED)
379406 {
380407 menu.add("-");
381408 linkerItem = menu.add(new MenuItem("Linker"));
382409 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385410 templateItem = menu.add(new MenuItem("Template"));
386411 templateItem.addActionListener(this);
387412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +435,7 @@
410435 genNormalsMESHItem.addActionListener(this);
411436 if (Globals.ADVANCED)
412437 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414439 genNormalsMINEItem.addActionListener(this);
415440 }
416441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -470,6 +495,14 @@
470495 markleavesItem.addActionListener(this);
471496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472497 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);
473506 menu.add("-");
474507 flipVItem = menu.add(new MenuItem("Flip V"));
475508 flipVItem.addActionListener(this);
....@@ -495,10 +528,15 @@
495528 attachBumpItem.addActionListener(this);
496529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
497530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
498532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
499533 detachPigmentItem.addActionListener(this);
500534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
501535 detachBumpItem.addActionListener(this);
536
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
537
+ embedTexturesItem.addActionListener(this);
538
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
539
+ deEmbedTexturesItem.addActionListener(this);
502540 menu.add("-");
503541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
504542 sortbysizeItem.addActionListener(this);
....@@ -525,8 +563,21 @@
525563 buildToolsMenu(menu);
526564 }
527565
566
+
528567 void SetupUI2(ObjEditor oe)
529568 {
569
+ // June 2019
570
+ if (oe == null)
571
+ {
572
+ //super.SetupUI2(this);
573
+ //return;
574
+ }
575
+
576
+ if (copy != group)
577
+ {
578
+ //super.SetupUI2(this);
579
+ }
580
+
530581 //new Exception().printStackTrace();
531582
532583 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +606,79 @@
555606 oe.radioPanel.add(dummyButton);
556607 oe.buttonGroup.add(dummyButton);
557608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
558613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559614
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- undoButton.setToolTipText("Undo changes");
562
- undoButton.addActionListener(this);
615
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ //minButton.setToolTipText("Minimize window");
617
+ //minButton.addActionListener(this);
563618
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- redoButton.setToolTipText("Redo changes");
566
- redoButton.addActionListener(this);
619
+ if (Globals.ADVANCED)
620
+ {
621
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ maxButton.setToolTipText("Maximize window");
623
+ maxButton.addActionListener(this);
624
+ }
567625
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- saveButton.setToolTipText("Save changes");
626
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
627
+ fullButton.setToolTipText("Full-screen window");
628
+ fullButton.addActionListener(this);
629
+
630
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ screenfitButton.setToolTipText("Screen fit");
632
+ screenfitButton.addActionListener(this);
633
+
634
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ restoreCameraButton.setToolTipText("Restore viewpoint");
636
+ restoreCameraButton.addActionListener(this);
637
+
638
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ saveButton.setToolTipText("New version");
570640 saveButton.addActionListener(this);
641
+
642
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643
+ undoButton.setToolTipText("Previous version");
644
+ undoButton.addActionListener(this);
645
+ undoButton.setEnabled(false);
571646
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
647
+ cGridBag updown = new cGridBag().setVertical(true);
648
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ restoreButton.setToolTipText("Restore current");
650
+ restoreButton.addActionListener(this);
651
+ restoreButton.setEnabled(false);
652
+
653
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ replaceButton.setToolTipText("Replace current");
655
+ replaceButton.addActionListener(this);
656
+ replaceButton.setEnabled(false);
657
+
658
+ copyOptionsPanel.add(updown);
659
+
660
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ redoButton.setToolTipText("Next version");
662
+ redoButton.addActionListener(this);
663
+ redoButton.setEnabled(false);
664
+
665
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573666 liveCB.setToolTipText("Enable animation");
574667 liveCB.addItemListener(this);
575668
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577670 oneStepButton.setToolTipText("Animate one step forward");
578671 oneStepButton.addActionListener(this);
579672
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581674 fastCB.setToolTipText("Fast mode");
582675 fastCB.addItemListener(this);
583676
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
- screenfitButton.setToolTipText("Screen fit");
590
- screenfitButton.addActionListener(this);
677
+ //oe.toolboxPanel.Return();
678
+
679
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
680
+// trackCB.setToolTipText("Enable tracking");
681
+// trackCB.addItemListener(this);
591682
592683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593684 // screenfitpointButton.addActionListener(this);
....@@ -597,67 +688,148 @@
597688 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598689 snapobjectButton.addActionListener(this);
599690 snapobjectButton.setToolTipText("Snap Object");
691
+
692
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ fourButton.addActionListener(this);
694
+ fourButton.setToolTipText("Show control panel only");
600695 }
601696
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
697
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605698
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- twoButton.setToolTipText("Show center view only");
699
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ twoButton.setToolTipText("Show 3D view only");
610701 twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
- fourButton.addActionListener(this);
613
- fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
- sixButton.setToolTipText("2-column layout left");
616
- sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
- threeButton.setToolTipText("2-column layout right");
702
+ this.fullscreenLayout = twoButton;
703
+
704
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ threeButton.setToolTipText("Show controls and 3D view");
619706 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- sevenButton.setToolTipText("3-column layout");
622
- sevenButton.addActionListener(this);
707
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ sixButton.setToolTipText("Show 3D view and controls");
709
+ sixButton.addActionListener(this);
710
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+// sevenButton.setToolTipText("3-column layout");
712
+// sevenButton.addActionListener(this);
623713 //
624714
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- rootButton.setToolTipText("Edit selection in new tab");
715
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
716
+ rootButton.setToolTipText("Open selection in new tab");
627717 rootButton.addActionListener(this);
628718
629
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630720 closeButton.setToolTipText("Close tab");
631721 closeButton.addActionListener(this);
632722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633723 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
724
+
725
+ // INSERT
726
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ gridButton.setToolTipText("Create grid");
728
+ gridButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ boxButton.setToolTipText("Create box");
732
+ boxButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ sphereButton.setToolTipText("Create sphere");
736
+ sphereButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ coneButton.setToolTipText("Create cone");
740
+ coneButton.addActionListener(this);
741
+
742
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
743
+ torusButton.setToolTipText("Create torus");
744
+ torusButton.addActionListener(this);
745
+
746
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
747
+ superButton.setToolTipText("Create superellipsoid");
748
+ superButton.addActionListener(this);
749
+
750
+ if (Globals.ADVANCED)
751
+ {
752
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ kleinButton.setToolTipText("Create Klein bottle");
754
+ kleinButton.addActionListener(this);
755
+ }
636756
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- editButton.setToolTipText("Edit selection");
757
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ particlesButton.setToolTipText("Create particle system");
759
+ particlesButton.addActionListener(this);
760
+
761
+ oe.toolboxPanel.Return();
762
+
763
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ groupButton.setToolTipText("Create group");
765
+ groupButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ compositeButton.setToolTipText("Create composite");
769
+ compositeButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ switchButton.setToolTipText("Create item switcher");
773
+ switchButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ loopButton.setToolTipText("Create loop");
777
+ loopButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ textureButton.setToolTipText("Create texture");
781
+ textureButton.addActionListener(this);
782
+
783
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ overlayButton.setToolTipText("Create overlay");
785
+ overlayButton.addActionListener(this);
786
+
787
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
788
+ lightButton.setToolTipText("Create light");
789
+ lightButton.addActionListener(this);
790
+
791
+ for (int i=6; --i>=0;)
792
+ {
793
+ oe.toolboxPanel.Return();
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ oe.toolboxPanel.add(new cGridBag());
797
+ oe.toolboxPanel.add(new cGridBag());
798
+ oe.toolboxPanel.add(new cGridBag());
799
+ oe.toolboxPanel.add(new cGridBag());
800
+ oe.toolboxPanel.add(new cGridBag());
801
+ }
802
+
803
+ // EDIT panel
804
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ editButton.setToolTipText("Pin selection controls");
639806 editButton.addActionListener(this);
640807
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
643810 uneditButton.addActionListener(this);
644811
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
812
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
813
+ allParamsButton.setToolTipText("Show all controle");
647814 allParamsButton.addActionListener(this);
648815
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650817 clearPanelButton.setToolTipText("Clear edit panel");
651818 clearPanelButton.addActionListener(this);
652819
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654821 unselectButton.setToolTipText("Unselect");
655822 unselectButton.addActionListener(this);
656823
657
- commandsPanel.preferredHeight = 1;
824
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
825
+ flashSelectionButton.setToolTipText("Highlight selection");
826
+ flashSelectionButton.addActionListener(this);
658827
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
828
+ editCommandsPanel.preferredHeight = 1;
829
+
830
+ SetPinStates(false);
831
+// oe.treePanel.add(commandsPanel);
832
+// oe.treePanel.Return();
661833
662834 // oe.aConstraints.gridx += 1;
663835 // oe.aConstraints.weighty = 0;
....@@ -674,29 +846,17 @@
674846
675847 JScrollPane jSP;
676848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678850 ResetModel();
679851
680852 oe.treePanel.add(jSPPanel);
681853 oe.treePanel.Return();
682854
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
698855 oe.treePanel.add(copyOptionsPanel);
699856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
700860
701861 // mainPanel.setDividerLocation(0.5); //1.0);
702862 // mainPanel.setResizeWeight(0.5);
....@@ -719,29 +879,49 @@
719879 dgr.addDragGestureListener(this);
720880 }catch(Exception e) {}
721881 */
722
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
723883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
724884 }
725885
726886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727887 {
888
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
889
+ colorCB.setToolTipText("Copy color when dropped");
890
+ colorCB.addItemListener(this);
891
+
892
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
893
+ materialCB.setToolTipText("Copy material when dropped");
894
+ materialCB.addItemListener(this);
895
+
896
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
897
+ textureCB.setToolTipText("Copy texture when dropped");
898
+ textureCB.addItemListener(this);
899
+
900
+ panel.Return();
901
+
728902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729903 boxCB.setToolTipText("Display bounding boxes");
730904 boxCB.addItemListener(this);
731905
732906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
734908 zoomBoxCB.addItemListener(this);
735909
736910 if (true) // Globals.ADVANCED)
737911 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- supportCB.addItemListener(this);
912
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
913
+// supportCB.setToolTipText("Enable rigging");
914
+// supportCB.addItemListener(this);
915
+
916
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
917
+ freezeCB.setToolTipText("Fast moving camera");
918
+ freezeCB.addItemListener(this);
741919
742920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743921 // localCB.addItemListener(this);
744922
923
+ panel.Return();
924
+
745925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746926 crowdCB.setToolTipText("Used for crowds");
747927 crowdCB.addItemListener(this);
....@@ -758,6 +938,8 @@
758938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759939 // speakerMocapCB.addItemListener(this);
760940
941
+ panel.Return();
942
+
761943 if (false)
762944 {
763945 // handled in scripts
....@@ -772,34 +954,74 @@
772954 //constraints.gridy += 1;
773955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
775958 }
776959
777960 //constraints.gridx += 1;
778961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779962 // debugCB.addItemListener(this);
780963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
781968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
969
+ oeilCB.setToolTipText("Move camera when tracking");
782970 oeilCB.addItemListener(this);
783971
972
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
973
+ shadowCB.setToolTipText("When live compute shadows");
974
+ shadowCB.addItemListener(this);
975
+
976
+ panel.Return();
977
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
978
+ toggleTextureCB.setToolTipText("Load textures");
979
+ toggleTextureCB.addItemListener(this);
980
+
981
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
982
+ toggleSwitchCB.setToolTipText("Choose a single item");
983
+ toggleSwitchCB.addItemListener(this);
984
+
985
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
986
+ autokeepCB.setToolTipText("On structure change");
987
+ autokeepCB.addItemListener(this);
988
+
989
+ panel.Return();
990
+ if (Globals.ADVANCED)
991
+ {
784992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785993 lookAtCB.setToolTipText("Look-at target");
786994 lookAtCB.addItemListener(this);
995
+ }
787996
788997 }
789998
790999 cGridBag fill = new cGridBag();
791
-
7921000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
7931005
7941006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
7951009
7961010 }
7971011
7981012 void EditObject(Object3D obj)
7991013 {
8001014 cRadio radioButton = new cRadio(obj.name);
1015
+
1016
+ // June 2019. Patch to avoid bug with transparency.
1017
+ radioButton.hadMaterial = obj.material != null;
1018
+ if (!radioButton.hadMaterial)
1019
+ {
1020
+ obj.material = new cMaterial();
1021
+ }
1022
+
8011023 radioButton.SetObject(obj);
802
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
8031025 radioButton.SetCamera(cameraView.renderCamera, false);
8041026 radioButton.addActionListener(this);
8051027 radioPanel.add(radioButton);
....@@ -809,6 +1031,8 @@
8091031
8101032 void SetupViews(ObjEditor oe)
8111033 {
1034
+ theFrame = this;
1035
+
8121036 oe.SetupViews();
8131037
8141038 System.out.println("SetupViews");
....@@ -817,23 +1041,28 @@
8171041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8181042 }
8191043
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- JCheckBox smoothfocusCB;
1044
+ cToggleButton liveCB;
1045
+ cCheckBox supportCB;
1046
+ cCheckBox localCB;
1047
+ cCheckBox crowdCB;
1048
+ cCheckBox smoothCB;
1049
+ cToggleButton fastCB;
1050
+ cCheckBox slowCB;
1051
+ cCheckBox boxCB;
1052
+ cCheckBox zoomBoxCB;
1053
+ cCheckBox freezeCB;
1054
+ //cToggleButton trackCB;
1055
+ cCheckBox trackCB;
1056
+ cCheckBox smoothfocusCB;
8311057 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1058
+ cCheckBox speakerCameraCB;
1059
+ cCheckBox speakerFocusCB;
1060
+ cCheckBox debugCB;
1061
+
1062
+ cCheckBox oeilCB;
1063
+ cCheckBox shadowCB;
1064
+ cCheckBox autokeepCB;
1065
+ cCheckBox lookAtCB;
8371066
8381067 // static int COLOR = 1;
8391068 // static int MATERIAL = 2;
....@@ -841,9 +1070,9 @@
8411070
8421071 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431072
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1073
+ cCheckBox colorCB;
1074
+ cCheckBox materialCB;
1075
+ cCheckBox textureCB;
8471076
8481077 public void itemStateChanged(ItemEvent e)
8491078 {
....@@ -871,6 +1100,7 @@
8711100 } else if(e.getSource() == liveCB)
8721101 {
8731102 cameraView.ToggleLive();
1103
+ refreshContents(false);
8741104 }
8751105 else if(e.getSource() == supportCB)
8761106 {
....@@ -935,6 +1165,18 @@
9351165 {
9361166 cameraView.ToggleOeil();
9371167 }
1168
+ else if(e.getSource() == shadowCB)
1169
+ {
1170
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1171
+ }
1172
+ else if(e.getSource() == freezeCB)
1173
+ {
1174
+ Globals.FREEZEONMOVE ^= true;
1175
+ }
1176
+ else if(e.getSource() == autokeepCB)
1177
+ {
1178
+ Globals.REPLACEONMAKE ^= true;
1179
+ }
9381180 else if(e.getSource() == lookAtCB)
9391181 {
9401182 cameraView.ToggleLookAt();
....@@ -951,7 +1193,8 @@
9511193
9521194 /**/
9531195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
9551198 if ((path == null) || (path.getPathCount() <= 1)) {
9561199 // We can't move the root node or an empty selection
9571200 return;
....@@ -1014,8 +1257,6 @@
10141257 }
10151258 }
10161259
1017
- String string = (String) object;
1018
-
10191260 System.out.println("Transfer = " + object + "; drop : " + target);
10201261 // if( object instanceof java.io.File[])
10211262 // {
....@@ -1023,6 +1264,8 @@
10231264 // objEditor.DropFile((java.io.File[]) object, true);
10241265 // return;
10251266 // }
1267
+
1268
+ String string = object.toString();
10261269
10271270 // File path for Mac and Windows
10281271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1068,23 +1311,33 @@
10681311
10691312 assert target == objEditor.jTree;
10701313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
10711315 try {
1072
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10731317 } catch (Exception e) {
10741318 System.out.println("destinationPath : " + destinationPath);
10751319 return;
10761320 }
10771321
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
10791323 {
1324
+ Object3D child = (Object3D)group.selection.elementAt(i);
1325
+
1326
+ // Cannot move into itself
1327
+ if (child == destinationLeaf)
1328
+ return;
1329
+ }
1330
+
1331
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1332
+// {
10801333 loadClipboard(true);
10811334 objEditor.jTree.setSelectionPath(destinationPath);
10821335 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
10881341 }
10891342 public void dropActionChanged(DropTargetDragEvent dtde)
10901343 // Called if the user has modified the current drop gesture
....@@ -1189,22 +1442,30 @@
11891442 {
11901443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11911444 //heightFieldItem.addActionListener(this);
1192
- gridItem = menu.add(new MenuItem("Grid"));
1193
- gridItem.addActionListener(this);
1194
- rectoidItem = menu.add(new MenuItem("Box"));
1195
- rectoidItem.addActionListener(this);
1196
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1197
- ellipsoidItem.addActionListener(this);
1198
- coneItem = menu.add(new MenuItem("Cone"));
1199
- coneItem.addActionListener(this);
1200
- torusItem = menu.add(new MenuItem("Torus"));
1201
- torusItem.addActionListener(this);
1202
- superItem = menu.add(new MenuItem("Superellipsoid"));
1203
- superItem.addActionListener(this);
1445
+// gridItem = menu.add(new MenuItem("Grid"));
1446
+// gridItem.addActionListener(this);
1447
+// rectoidItem = menu.add(new MenuItem("Box"));
1448
+// rectoidItem.addActionListener(this);
1449
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1450
+// ellipsoidItem.addActionListener(this);
1451
+// coneItem = menu.add(new MenuItem("Cone"));
1452
+// coneItem.addActionListener(this);
1453
+// torusItem = menu.add(new MenuItem("Torus"));
1454
+// torusItem.addActionListener(this);
1455
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1456
+// superItem.addActionListener(this);
1457
+
1458
+ cameraItem = menu.add(new MenuItem("Camera"));
1459
+ cameraItem.addActionListener(this);
1460
+
1461
+ if (!Globals.ADVANCED)
1462
+ {
12041463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12051464 kleinItem.addActionListener(this);
1206
- particleItem = menu.add(new MenuItem("Particle system"));
1207
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
12081469 if (Globals.ADVANCED)
12091470 {
12101471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1230,15 +1491,15 @@
12301491 }
12311492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12321493 bezierItem.addActionListener(this);
1233
- overlayItem = menu.add(new MenuItem("Overlay"));
1234
- overlayItem.addActionListener(this);
1235
- lightItem = menu.add(new MenuItem("Light"));
1236
- lightItem.addActionListener(this);
1494
+// overlayItem = menu.add(new MenuItem("Overlay"));
1495
+// overlayItem.addActionListener(this);
1496
+// lightItem = menu.add(new MenuItem("Light"));
1497
+// lightItem.addActionListener(this);
12371498 menu.add("-");
12381499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12391500 //superLoopItem.addActionListener(this);
1240
- loopItem = menu.add(new MenuItem("Loop"));
1241
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
12421503 doubleItem = menu.add(new MenuItem("Fork"));
12431504 doubleItem.addActionListener(this);
12441505 if (Globals.ADVANCED)
....@@ -1254,6 +1515,9 @@
12541515 animationItem.addItemListener(this);
12551516 animationItem.setState(Globals.ANIMATION);
12561517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
12571521 menu.add("-");
12581522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12591523 parseverticesItem.addActionListener(this);
....@@ -1266,6 +1530,8 @@
12661530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12671531 reduce34MorphItem.addActionListener(this);
12681532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
12691535 menu.add(computeAOItem = new MenuItem("Compute AO"));
12701536 computeAOItem.addActionListener(this);
12711537
....@@ -1274,11 +1540,9 @@
12741540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12751541 mirrorItem.addActionListener(this);
12761542 menu.add("-");
1277
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1278
- memoryItem.addActionListener(this);
12791543 menu.add(analyzeItem = new MenuItem("Analyze"));
12801544 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1545
+ menu.add(dumpItem = new MenuItem("Print"));
12821546 dumpItem.addActionListener(this);
12831547 // menu.add(pathItem = new MenuItem("From-to path"));
12841548 // pathItem.addActionListener(this);
....@@ -1419,9 +1683,34 @@
14191683 shadow.material = new cMaterial(obj.material);
14201684 shadow.material.diffuse = 0.0001f;
14211685 shadow.material.specular = 0.0001f;
1686
+ //shadow.projectedVertices[1].x = 300;
14221687
14231688 makeSomething(shadow);
14241689 }
1690
+
1691
+ private void ClearUnpinned()
1692
+ {
1693
+ //for (Object3D obj : listUI)
1694
+ for (int i=listUI.size(); --i>=0;)
1695
+ {
1696
+ Object3D obj = listUI.elementAt(i);
1697
+ if (!obj.pinned)
1698
+ {
1699
+ obj.CloseUI();
1700
+ listUI.remove(i);
1701
+ }
1702
+ }
1703
+ }
1704
+
1705
+ private void EditElement(Object3D elem, boolean newWindow)
1706
+ {
1707
+ // if (!(elem instanceof Composite))
1708
+ // newWindow = false;
1709
+ listUI.add(elem);
1710
+ elem.openEditWindow(this, newWindow); //, false);
1711
+ System.out.println("edit : " + elem);
1712
+ elem.editWindow.refreshContents(true); // ? new
1713
+ }
14251714
14261715 /**
14271716 * applyExample
....@@ -1666,7 +1955,7 @@
16661955 {
16671956 ScreenFit();
16681957 } else
1669
- if (source == switchItem)
1958
+ if (source == switchViewItem)
16701959 {
16711960 cVector v1 = new cVector();
16721961 cVector v2 = new cVector();
....@@ -1675,11 +1964,11 @@
16751964 objEditor.cameraView.renderCamera.setAim(v2, v1);
16761965 objEditor.cameraView.repaint();
16771966 } else
1678
- if (source == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
16791968 {
16801969 makeSomething(new Box());
16811970 } else
1682
- if (source == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
16831972 {
16841973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16851974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +2047,27 @@
17582047
17592048 makeSomething(obj);
17602049 } else
1761
- if (source == gridItem)
2050
+ if (source == gridItem || source == gridButton)
17622051 {
17632052 makeSomething(new Grid());
17642053 } else
1765
- if (source == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
17662055 {
17672056 makeSomething(new Sphere());
17682057 } else
1769
- if (source == coneItem)
2058
+ if (source == coneItem || source == coneButton)
17702059 {
17712060 makeSomething(new Cone());
17722061 } else
1773
- if (source == torusItem)
2062
+ if (source == torusItem || source == torusButton)
17742063 {
17752064 makeSomething(new Torus());
17762065 } else
1777
- if (source == superItem)
2066
+ if (source == superItem || source == superButton)
17782067 {
17792068 makeSomething(new Superellipsoid());
17802069 } else
1781
- if (source == kleinItem)
2070
+ if (source == kleinItem || source == kleinButton)
17822071 {
17832072 makeSomething(new Klein());
17842073 } else
....@@ -1798,7 +2087,7 @@
17982087 {
17992088 makeSomething(new BezierSurface());
18002089 } else
1801
- if (source == overlayItem)
2090
+ if (source == overlayItem || source == overlayButton)
18022091 {
18032092 /*
18042093 Object3D obj = new BezierSurface(5,8);
....@@ -1846,7 +2135,7 @@
18462135 s.setup();
18472136 makeSomething(s);
18482137 } else
1849
- if (source == lightItem)
2138
+ if (source == lightItem || source == lightButton)
18502139 {
18512140 makeSomething(new Light());
18522141 } else
....@@ -1896,30 +2185,30 @@
18962185
18972186 group(g);
18982187 } else
1899
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
19002189 {
19012190 Composite csg = new GroupLeaf();
19022191 csg.count = 5;
19032192 group(csg);
1904
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
19052194 csg.addChild(child);
19062195 child.addChild(csg);
19072196 } else
19082197 if (source == doubleItem)
19092198 {
1910
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
19112200 csg.count = 5;
19122201 group(csg);
1913
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
19142203 csg.addChild(child);
19152204 child.addChild(csg);
1916
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
19172206 csg.addChild(child);
19182207 child.addChild(csg);
19192208 } else
19202209 if (source == tripleItem)
19212210 {
1922
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
19232212 csg.count = 4;
19242213 group(csg);
19252214 Composite child = new cGroup();
....@@ -1969,17 +2258,45 @@
19692258 {
19702259 DumpObject();
19712260 } else
2261
+ if (source == minButton)
2262
+ {
2263
+ Minimize();
2264
+ } else
2265
+ if (source == maxButton)
2266
+ {
2267
+ Maximize();
2268
+ } else
2269
+ if (source == fullButton)
2270
+ {
2271
+ ToggleFullScreen();
2272
+ } else
19722273 if (source == undoButton)
19732274 {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19742278 Undo();
2279
+ } else
2280
+ if (source == restoreButton)
2281
+ {
2282
+ // Restore current version
2283
+ Restore();
2284
+ } else
2285
+ if (source == replaceButton)
2286
+ {
2287
+ // Overwrite current version
2288
+ Replace();
19752289 } else
19762290 if (source == redoButton)
19772291 {
2292
+ // Go to next version
19782293 Redo();
19792294 } else
19802295 if (source == saveButton)
19812296 {
1982
- Save();
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
19832300 } else
19842301 if (source == oneStepButton)
19852302 {
....@@ -1988,17 +2305,14 @@
19882305 } else
19892306 if (source == screenfitButton)
19902307 {
1991
- //Reload(lastConverter, lastFilename, true);
19922308 ScreenFit();
19932309 } else
19942310 if (source == screenfitpointButton)
19952311 {
1996
- //Reload(lastConverter, lastFilename, true);
19972312 ScreenFitPoint();
19982313 } else
19992314 if (source == snapobjectButton)
20002315 {
2001
- //Reload(lastConverter, lastFilename, true);
20022316 SnapObject();
20032317 } else
20042318 // if (event.getSource() == recompileButton)
....@@ -2362,7 +2676,7 @@
23622676 {
23632677 StepAll();
23642678 } else
2365
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
23662680 {
23672681 //int indices[] = jList.getSelectedIndices();
23682682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2374,9 +2688,9 @@
23742688 {
23752689 ClearSelection(true);
23762690 } else
2377
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
23782692 {
2379
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
23802694 } else
23812695 if (source == hideItem)
23822696 {
....@@ -2394,11 +2708,11 @@
23942708 {
23952709 makeSomething(new Camera());
23962710 } else
2397
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
23982712 {
23992713 group(new Composite());
24002714 } else
2401
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
24022716 {
24032717 RandomNode random = new RandomNode();
24042718 group(random);
....@@ -2500,7 +2814,7 @@
25002814 {
25012815 group(new cLinker());
25022816 } else
2503
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
25042818 {
25052819 group(new TextureNode());
25062820 } else
....@@ -2520,17 +2834,30 @@
25202834 {
25212835 CastShadow(2);
25222836 } else
2523
- if (source == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
25242838 {
2525
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
25262841 for (int i=0; i<group.selection.size(); i++)
25272842 {
2528
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
25292848 }
25302849
2531
- ClearSelection(false);
2532
-
2533
- refreshContents();
2850
+ if (!hasRoot)
2851
+ {
2852
+ for (int i=0; i<group.selection.size(); i++)
2853
+ {
2854
+ Ungroup(group.selection.get(i));
2855
+ }
2856
+
2857
+ ClearSelection(false);
2858
+
2859
+ refreshContents();
2860
+ }
25342861 } else
25352862 if (source == genUVItem)
25362863 {
....@@ -2607,6 +2934,22 @@
26072934 if (source == unmarkleavesItem)
26082935 {
26092936 MarkLeaves(false);
2937
+ } else
2938
+ if (source == rewindleavesItem)
2939
+ {
2940
+ RewindLeaves(true);
2941
+ } else
2942
+ if (source == unrewindleavesItem)
2943
+ {
2944
+ RewindLeaves(false);
2945
+ } else
2946
+ if (source == randomleavesItem)
2947
+ {
2948
+ RandomLeaves(true);
2949
+ } else
2950
+ if (source == unrandomleavesItem)
2951
+ {
2952
+ RandomLeaves(false);
26102953 } else
26112954 if (source == flipVItem)
26122955 {
....@@ -2815,7 +3158,7 @@
28153158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28163159 {
28173160 obj = (Object3D)e.nextElement();
2818
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
28193162 }
28203163
28213164 refreshContents();
....@@ -2831,6 +3174,31 @@
28313174
28323175 refreshContents();
28333176 } else
3177
+ if (source == embedTexturesItem)
3178
+ {
3179
+ Object3D obj;
3180
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3181
+ {
3182
+ obj = (Object3D)e.nextElement();
3183
+ obj.EmbedTextures(true);
3184
+ }
3185
+
3186
+ refreshContents();
3187
+ } else
3188
+ if (source == deEmbedTexturesItem)
3189
+ {
3190
+ Object3D obj;
3191
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3192
+ {
3193
+ obj = (Object3D)e.nextElement();
3194
+ obj.EmbedTextures(false);
3195
+ }
3196
+
3197
+ CameraPane.texturepigment.clear();
3198
+ CameraPane.texturebump.clear();
3199
+
3200
+ refreshContents();
3201
+ } else
28343202 if (source == flashSelectionButton)
28353203 {
28363204 CameraPane.flash = true;
....@@ -2842,6 +3210,10 @@
28423210 if (source == twoButton)
28433211 {
28443212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
28453217 // bug
28463218 //gridPanel.setDividerLocation(1.0);
28473219 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3246,31 @@
28743246 bigThree.ClearUI();
28753247 bigThree.add(centralPanel);
28763248 bigThree.FlushUI();
3249
+
3250
+ cameraView.requestFocusInWindow();
3251
+
3252
+// refreshContents(true);
3253
+//
3254
+// try
3255
+// {
3256
+// java.awt.Robot bot = new java.awt.Robot();
3257
+// int mask = InputEvent.BUTTON1_MASK;
3258
+// bot.mouseMove(100, 100);
3259
+// bot.mousePress(mask);
3260
+// bot.mouseRelease(mask);
3261
+// }
3262
+// catch (Exception e)
3263
+// {
3264
+//
3265
+// }
3266
+
28773267 } else
28783268 if (source == threeButton)
28793269 {
28803270 radio.layout = threeButton;
3271
+
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
28813274
28823275 // bigThree.remove(scenePanel);
28833276 // bigThree.remove(centralPanel);
....@@ -2907,13 +3300,18 @@
29073300 // centralPanel.setVisible(true);
29083301 // XYZPanel.setVisible(true);
29093302 bigThree.ClearUI();
3303
+ bigThree.add(scenePanel);
29103304 bigThree.add(centralPanel);
2911
- bigThree.add(XYZPanel);
29123305 bigThree.FlushUI();
3306
+
3307
+ cameraView.requestFocusInWindow();
29133308 } else
29143309 if (source == fourButton)
29153310 {
29163311 radio.layout = fourButton;
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
29173315
29183316 // bigThree.remove(scenePanel);
29193317 // bigThree.remove(centralPanel);
....@@ -2945,10 +3343,15 @@
29453343 bigThree.ClearUI();
29463344 bigThree.add(scenePanel);
29473345 bigThree.FlushUI();
3346
+
3347
+ cameraView.requestFocusInWindow();
29483348 } else
29493349 if (source == sixButton)
29503350 {
29513351 radio.layout = sixButton;
3352
+
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
29523355
29533356 // bigThree.remove(scenePanel);
29543357 // bigThree.remove(centralPanel);
....@@ -2978,13 +3381,18 @@
29783381 // centralPanel.setVisible(true);
29793382 // XYZPanel.setVisible(false);
29803383 bigThree.ClearUI();
2981
- bigThree.add(scenePanel);
29823384 bigThree.add(centralPanel);
3385
+ bigThree.add(scenePanel);
29833386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
29843389 } else
29853390 if (source == sevenButton)
29863391 {
29873392 radio.layout = sevenButton;
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
29883396
29893397 // bigThree.remove(scenePanel);
29903398 // bigThree.remove(centralPanel);
....@@ -3018,6 +3426,8 @@
30183426 bigThree.add(centralPanel);
30193427 bigThree.add(XYZPanel);
30203428 bigThree.FlushUI();
3429
+
3430
+ cameraView.requestFocusInWindow();
30213431 } else
30223432 if (source == rootButton)
30233433 {
....@@ -3029,6 +3439,7 @@
30293439 EditObject(obj);
30303440 }
30313441
3442
+ cameraView.requestFocusInWindow();
30323443 refreshContents(true);
30333444 } else
30343445 if (source == closeButton)
....@@ -3038,22 +3449,37 @@
30383449 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393450 {
30403451 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3452
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423453 {
3454
+ // Patch to avoid bug with transparency.
3455
+ if (!ab.hadMaterial)
3456
+ {
3457
+ ab.object.material = null;
3458
+ }
3459
+
30433460 buttonGroup.remove(ab);
30443461 radioPanel.remove(ab);
30453462
3046
- ab.GetObject().editWindow = null;
3463
+ //ab.GetObject().editWindow = null;
3464
+ ab.GetObject().manipWindow = null;
30473465 // ab.GetObject().objectUI = null; // ?????????
30483466
30493467 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503468 break;
30513469 }
30523470 }
3471
+
3472
+ cameraView.requestFocusInWindow();
30533473 refreshContents(true);
30543474 } else
30553475 if (source == editItem || source == editButton)
30563476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
30573483 EditSelection(false);
30583484 } else
30593485 if (source == uneditButton)
....@@ -3063,6 +3489,7 @@
30633489 Object3D child = (Object3D)e.nextElement();
30643490 if(child.editWindow != null)
30653491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
30663493 child.CloseUI();
30673494 listUI.remove(child);
30683495
....@@ -3079,6 +3506,7 @@
30793506 //copy.ClearUI();
30803507 for (Object3D obj : listUI)
30813508 {
3509
+ obj.pinned = false;
30823510 obj.CloseUI();
30833511 }
30843512 listUI.clear();
....@@ -3088,7 +3516,7 @@
30883516 {
30893517 assert(copy == group);
30903518
3091
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30923520
30933521 for (Object3D obj : listUI)
30943522 {
....@@ -3137,6 +3565,9 @@
31373565 }
31383566
31393567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
31403571 //Globals.theRenderer.object = group;
31413572 if(!useclient)
31423573 {
....@@ -3154,7 +3585,8 @@
31543585 }
31553586
31563587 // fix "+" issue
3157
- group.editWindow = this;
3588
+ //group.editWindow = this;
3589
+ group.manipWindow = this;
31583590
31593591 /*
31603592 currentLayout = radio.layout;
....@@ -3162,18 +3594,27 @@
31623594 currentLayout = sevenButton;
31633595 */
31643596 radio.layout.doClick();
3597
+
3598
+ ClearUnpinned();
3599
+ //Grafreed.Assert(group != null);
3600
+ //Grafreed.Assert(group.selection != null);
3601
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3602
+ if (group.selection == null || group.selection.size() == 1)
3603
+ EditSelection(false);
31653604 keepparent = group.parent;
31663605 // PARENT = NULL or not???
31673606 //group.parent = null; // ROOT
31683607 //group.attributes = -1;
31693608 ResetModel();
3609
+
3610
+ cameraView.requestFocusInWindow();
31703611 refreshContents(true);
31713612 } else if (event.getSource() == editCameraItem)
31723613 {
31733614 cameraView.ProtectCamera();
31743615 cameraView.repaint();
31753616 return;
3176
- } else if (event.getSource() == revertCameraItem)
3617
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31773618 {
31783619 cameraView.RevertCamera();
31793620 cameraView.repaint();
....@@ -3190,7 +3631,6 @@
31903631 }
31913632
31923633 boolean useclient = false;
3193
- cRadio radio;
31943634
31953635 void ToggleRoot()
31963636 {
....@@ -3753,7 +4193,7 @@
37534193
37544194 try
37554195 {
3756
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37574197 }
37584198 catch (Exception e)
37594199 {
....@@ -4145,6 +4585,18 @@
41454585 refreshContents();
41464586 }
41474587
4588
+ void RewindLeaves(boolean hide)
4589
+ {
4590
+ group.selection.RewindLeaves(hide);
4591
+ refreshContents();
4592
+ }
4593
+
4594
+ void RandomLeaves(boolean hide)
4595
+ {
4596
+ group.selection.RandomLeaves(hide);
4597
+ refreshContents();
4598
+ }
4599
+
41484600 void SetTexRes(int tr)
41494601 {
41504602 group.selection.SetTexRes(tr);
....@@ -4216,28 +4668,25 @@
42164668 // }
42174669 // }
42184670
4219
- static boolean allparams = true;
4220
-
4221
- static Vector<Object3D> listUI = new Vector<Object3D>();
4222
-
42234671 void EditSelection(boolean newWindow)
42244672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
42254679 // aConstraints.gridy = 0;
42264680 for (int i=0; i<group.selection.size(); i++)
42274681 {
42284682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42294683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4230
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42314685
42324686 Object3D elem = (Object3D)group.selection.elementAt(i);
42334687 if(elem != group || !newWindow)
42344688 {
4235
- // if (!(elem instanceof Composite))
4236
- // newWindow = false;
4237
- listUI.add(elem);
4238
- elem.openEditWindow(this, newWindow); //, false);
4239
- System.out.println("edit : " + elem);
4240
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
42414690 }
42424691 }
42434692 }
....@@ -4312,7 +4761,8 @@
43124761 //new Exception().printStackTrace();
43134762
43144763 freezemodel = true;
4315
-
4764
+ ClearUnpinned();
4765
+
43164766 /**/
43174767 //switch (event.id)
43184768 {
....@@ -4320,7 +4770,6 @@
43204770 //case 702: // Event.LIST_DESELECT
43214771 group.deselectAll();
43224772 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4323
- objEditor.ClearInfo(); // .GetMaterial());
43244773 if (tps != null)
43254774 {
43264775 for (int i=0; i < tps.length; i++)
....@@ -4329,10 +4778,8 @@
43294778
43304779 //if (child.parent != null)
43314780 //child.parent.addSelectee(child);
4781
+ objEditor.SetMaterial(child);
43324782 group.addSelectee(child);
4333
- objEditor.SetMaterial(child); // .GetMaterial());
4334
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4335
- System.err.println("info : " + child.GetPath());
43364783 }
43374784 }
43384785 // else
....@@ -4342,15 +4789,13 @@
43424789 // System.err.println("info : " + group.GetPath());
43434790 // }
43444791
4345
- objEditor.SetText(); // jan 2014
4346
-
43474792 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43484793 CameraPane.flash = true;
43494794
43504795 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43514796 // a camera
43524797 {
4353
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4798
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43544799 {
43554800 CameraPane.camerachangeframe = 0; // don't refuse it
43564801 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4359,6 +4804,13 @@
43594804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43604805 }
43614806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
43624814 refreshContents();
43634815 //return true;
43644816 }
....@@ -4367,6 +4819,35 @@
43674819
43684820 freezemodel = false;
43694821 }
4822
+
4823
+ void SetPinStates(boolean enabled)
4824
+ {
4825
+ editButton.setEnabled(enabled);
4826
+ uneditButton.setEnabled(enabled);
4827
+ unselectButton.setEnabled(enabled);
4828
+ flashSelectionButton.setEnabled(enabled);
4829
+ }
4830
+
4831
+ void refreshContents(boolean cp)
4832
+ {
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4834
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4835
+ {
4836
+ objEditor.ClearInfo(); // .GetMaterial());
4837
+
4838
+ for (int i=0; i < group.selection.Size(); i++)
4839
+ {
4840
+ Object3D child = (Object3D) group.selection.get(i);
4841
+
4842
+ objEditor.AddInfo(child, this, true);
4843
+ System.err.println("info : " + child.GetPath());
4844
+ }
4845
+
4846
+ objEditor.SetText(); // jan 2014
4847
+ }
4848
+
4849
+ super.refreshContents(cp);
4850
+ }
43704851
43714852 void linkSomething(Object3D thing)
43724853 {
....@@ -4449,7 +4930,8 @@
44494930
44504931 if (cut)
44514932 {
4452
- Save();
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
44534935 //int indices[] = jList.getSelectedIndices();
44544936 //for (int i = indices.length - 1; i >= 0; i--)
44554937 //jList.remove(indices[i]);
....@@ -4552,6 +5034,10 @@
45525034
45535035 void paste(boolean expand)
45545036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
45555041 // if (GrafreeD.clipboard == null)
45565042 // return;
45575043 boolean first = true;
....@@ -4611,6 +5097,7 @@
46115097 Grafreed.clipboard.get(0).parent = keepparent;
46125098 }
46135099
5100
+ Globals.REPLACEONMAKE = keep;
46145101 ResetModel();
46155102 refreshContents();
46165103 }
....@@ -4746,6 +5233,10 @@
47465233
47475234 void group(Object3D csg, boolean grab)
47485235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
47495240 if (//false) // why??
47505241 !group.selection.isEmpty())
47515242 {
....@@ -4859,10 +5350,15 @@
48595350 //node.add(csg);
48605351 //makeSomething(node);
48615352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
48625354 }
48635355
48645356 void Ungroup(Object3D g)
48655357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
48665362 if (g instanceof HiddenObject)
48675363 {
48685364 HiddenObject h = (HiddenObject) g;
....@@ -4879,6 +5375,7 @@
48795375 objEditor.makeSomething(g.get(i), false);
48805376 }
48815377 }
5378
+ Globals.REPLACEONMAKE = keep;
48825379 }
48835380
48845381 void ungroup()
....@@ -5167,10 +5664,28 @@
51675664 cButton clearpanelButton;
51685665 cButton unselectButton;
51695666
5667
+ cButton restoreCameraButton;
5668
+
51705669 cButton saveButton;
5171
- cButton undoButton;
5172
- cButton redoButton;
51735670 cButton oneStepButton;
5671
+
5672
+ cButton groupButton;
5673
+ cButton ungroupButton;
5674
+ cButton compositeButton;
5675
+ cButton switchButton;
5676
+ cButton loopButton;
5677
+ cButton textureButton;
5678
+
5679
+ cButton gridButton;
5680
+ cButton boxButton;
5681
+ cButton sphereButton;
5682
+ cButton coneButton;
5683
+ cButton torusButton;
5684
+ cButton superButton;
5685
+ cButton kleinButton;
5686
+ cButton particlesButton;
5687
+ cButton overlayButton;
5688
+ cButton lightButton;
51745689
51755690 cButton screenfitButton;
51765691 cButton screenfitpointButton;
....@@ -5183,14 +5698,6 @@
51835698
51845699 cButton setsupportButton;
51855700
5186
- cButton twoButton;
5187
- cButton sixButton;
5188
- cButton threeButton;
5189
- cButton sevenButton;
5190
- cButton fourButton; // full panel
5191
- cButton oneButton; // full XYZ
5192
- //cButton currentLayout;
5193
-
51945701 //
51955702 //Composite
51965703 Object3D // to do !!
....@@ -5200,11 +5707,11 @@
52005707 //JTree jTree;
52015708 private MenuItem lookAtItem;
52025709 private MenuItem lookFromItem;
5203
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
52045711 private MenuItem cutItem;
52055712 private MenuItem undoItem;
52065713 private MenuItem redoItem;
5207
- private MenuItem duplicateItem;
5714
+ private JMenuItem duplicateItem;
52085715 private MenuItem cloneItem;
52095716 private MenuItem cloneSupportItem;
52105717 private MenuItem overwriteGeoItem;
....@@ -5232,7 +5739,7 @@
52325739 private MenuItem pasteLinkItem;
52335740 private MenuItem pasteCloneItem;
52345741 private MenuItem pasteExpandItem;
5235
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
52365743 private MenuItem clearAllItem;
52375744 private MenuItem genUVItem;
52385745 private MenuItem genNormalsMESHItem;
....@@ -5267,6 +5774,10 @@
52675774 private MenuItem showleavesItem;
52685775 private MenuItem markleavesItem;
52695776 private MenuItem unmarkleavesItem;
5777
+ private MenuItem rewindleavesItem;
5778
+ private MenuItem unrewindleavesItem;
5779
+ private MenuItem randomleavesItem;
5780
+ private MenuItem unrandomleavesItem;
52705781
52715782 private MenuItem flipVItem;
52725783 private MenuItem unflipVItem;
....@@ -5288,7 +5799,7 @@
52885799 private MenuItem frontItem;
52895800 private MenuItem cameraItem;
52905801 private MenuItem compositeItem;
5291
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
52925803 private MenuItem physicsItem;
52935804 private MenuItem frameselectorItem;
52945805 private MenuItem scriptNodeItem;
....@@ -5312,6 +5823,8 @@
53125823 private MenuItem attachBumpItem;
53135824 private MenuItem detachBumpItem;
53145825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
53155828
53165829 private MenuItem particleItem;
53175830 private MenuItem ragdollItem;
....@@ -5362,5 +5875,5 @@
53625875
53635876 Menu cameraMenu;
53645877 MenuItem editCameraItem;
5365
- MenuItem revertCameraItem;
5878
+ MenuItem restoreCameraItem;
53665879 }