Normand Briere
2019-07-23 cf7cfa1c792eebba606a48aa648893f6e4873263
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);
....@@ -489,10 +528,15 @@
489528 attachBumpItem.addActionListener(this);
490529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
491530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
492532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
493533 detachPigmentItem.addActionListener(this);
494534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
495535 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);
496540 menu.add("-");
497541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
498542 sortbysizeItem.addActionListener(this);
....@@ -519,8 +563,21 @@
519563 buildToolsMenu(menu);
520564 }
521565
566
+
522567 void SetupUI2(ObjEditor oe)
523568 {
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
+
524581 //new Exception().printStackTrace();
525582
526583 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +606,79 @@
549606 oe.radioPanel.add(dummyButton);
550607 oe.buttonGroup.add(dummyButton);
551608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
552613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553614
554
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
615
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ //minButton.setToolTipText("Minimize window");
617
+ //minButton.addActionListener(this);
618
+
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
+ }
625
+
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");
640
+ 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);
646
+
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);
555666 liveCB.setToolTipText("Enable animation");
556667 liveCB.addItemListener(this);
557668
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559670 oneStepButton.setToolTipText("Animate one step forward");
560671 oneStepButton.addActionListener(this);
561672
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563674 fastCB.setToolTipText("Fast mode");
564675 fastCB.addItemListener(this);
565676
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);
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);
573682
574683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575684 // screenfitpointButton.addActionListener(this);
....@@ -581,65 +690,146 @@
581690 snapobjectButton.setToolTipText("Snap Object");
582691 }
583692
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
693
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587694
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);
695
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594696 fourButton.addActionListener(this);
595697 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- sixButton.setToolTipText("2-column layout left");
698
+
699
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ twoButton.setToolTipText("Show right view only");
701
+ twoButton.addActionListener(this);
702
+ this.fullscreenLayout = twoButton;
703
+
704
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ sixButton.setToolTipText("Show left and right");
598706 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);
707
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+// threeButton.setToolTipText("2-column layout right");
709
+// threeButton.addActionListener(this);
710
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+// sevenButton.setToolTipText("3-column layout");
712
+// sevenButton.addActionListener(this);
605713 //
606714
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- 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");
609717 rootButton.addActionListener(this);
610718
611
- 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);
612720 closeButton.setToolTipText("Close tab");
613721 closeButton.addActionListener(this);
614722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615723 //clearButton.addActionListener(this);
616
-
617
- 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
+ }
618756
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- 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");
621806 editButton.addActionListener(this);
622807
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
625810 uneditButton.addActionListener(this);
626811
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
812
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
813
+ allParamsButton.setToolTipText("Show all controle");
629814 allParamsButton.addActionListener(this);
630815
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632817 clearPanelButton.setToolTipText("Clear edit panel");
633818 clearPanelButton.addActionListener(this);
634819
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636821 unselectButton.setToolTipText("Unselect");
637822 unselectButton.addActionListener(this);
638823
639
- 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);
640827
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
828
+ editCommandsPanel.preferredHeight = 1;
829
+
830
+ SetPinStates(false);
831
+// oe.treePanel.add(commandsPanel);
832
+// oe.treePanel.Return();
643833
644834 // oe.aConstraints.gridx += 1;
645835 // oe.aConstraints.weighty = 0;
....@@ -656,29 +846,17 @@
656846
657847 JScrollPane jSP;
658848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660850 ResetModel();
661851
662852 oe.treePanel.add(jSPPanel);
663853 oe.treePanel.Return();
664854
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;
680855 oe.treePanel.add(copyOptionsPanel);
681856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
682860
683861 // mainPanel.setDividerLocation(0.5); //1.0);
684862 // mainPanel.setResizeWeight(0.5);
....@@ -701,29 +879,49 @@
701879 dgr.addDragGestureListener(this);
702880 }catch(Exception e) {}
703881 */
704
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
705883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
706884 }
707885
708886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709887 {
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
+
710902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711903 boxCB.setToolTipText("Display bounding boxes");
712904 boxCB.addItemListener(this);
713905
714906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
716908 zoomBoxCB.addItemListener(this);
717909
718910 if (true) // Globals.ADVANCED)
719911 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- 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);
723919
724920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725921 // localCB.addItemListener(this);
726922
923
+ panel.Return();
924
+
727925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728926 crowdCB.setToolTipText("Used for crowds");
729927 crowdCB.addItemListener(this);
....@@ -740,6 +938,8 @@
740938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741939 // speakerMocapCB.addItemListener(this);
742940
941
+ panel.Return();
942
+
743943 if (false)
744944 {
745945 // handled in scripts
....@@ -754,34 +954,74 @@
754954 //constraints.gridy += 1;
755955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
757958 }
758959
759960 //constraints.gridx += 1;
760961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761962 // debugCB.addItemListener(this);
762963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
763968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
969
+ oeilCB.setToolTipText("Move camera when tracking");
764970 oeilCB.addItemListener(this);
765971
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
+ {
766992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767993 lookAtCB.setToolTipText("Look-at target");
768994 lookAtCB.addItemListener(this);
995
+ }
769996
770997 }
771998
772999 cGridBag fill = new cGridBag();
773
-
7741000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
7751005
7761006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
7771009
7781010 }
7791011
7801012 void EditObject(Object3D obj)
7811013 {
7821014 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
+
7831023 radioButton.SetObject(obj);
784
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
7851025 radioButton.SetCamera(cameraView.renderCamera, false);
7861026 radioButton.addActionListener(this);
7871027 radioPanel.add(radioButton);
....@@ -791,6 +1031,8 @@
7911031
7921032 void SetupViews(ObjEditor oe)
7931033 {
1034
+ theFrame = this;
1035
+
7941036 oe.SetupViews();
7951037
7961038 System.out.println("SetupViews");
....@@ -799,23 +1041,28 @@
7991041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8001042 }
8011043
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;
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;
8131057 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1058
+ cCheckBox speakerCameraCB;
1059
+ cCheckBox speakerFocusCB;
1060
+ cCheckBox debugCB;
1061
+
1062
+ cCheckBox oeilCB;
1063
+ cCheckBox shadowCB;
1064
+ cCheckBox autokeepCB;
1065
+ cCheckBox lookAtCB;
8191066
8201067 // static int COLOR = 1;
8211068 // static int MATERIAL = 2;
....@@ -823,9 +1070,9 @@
8231070
8241071 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251072
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1073
+ cCheckBox colorCB;
1074
+ cCheckBox materialCB;
1075
+ cCheckBox textureCB;
8291076
8301077 public void itemStateChanged(ItemEvent e)
8311078 {
....@@ -853,6 +1100,7 @@
8531100 } else if(e.getSource() == liveCB)
8541101 {
8551102 cameraView.ToggleLive();
1103
+ refreshContents(false);
8561104 }
8571105 else if(e.getSource() == supportCB)
8581106 {
....@@ -917,6 +1165,18 @@
9171165 {
9181166 cameraView.ToggleOeil();
9191167 }
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
+ }
9201180 else if(e.getSource() == lookAtCB)
9211181 {
9221182 cameraView.ToggleLookAt();
....@@ -933,7 +1193,8 @@
9331193
9341194 /**/
9351195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
9371198 if ((path == null) || (path.getPathCount() <= 1)) {
9381199 // We can't move the root node or an empty selection
9391200 return;
....@@ -996,8 +1257,6 @@
9961257 }
9971258 }
9981259
999
- String string = (String) object;
1000
-
10011260 System.out.println("Transfer = " + object + "; drop : " + target);
10021261 // if( object instanceof java.io.File[])
10031262 // {
....@@ -1005,6 +1264,8 @@
10051264 // objEditor.DropFile((java.io.File[]) object, true);
10061265 // return;
10071266 // }
1267
+
1268
+ String string = object.toString();
10081269
10091270 // File path for Mac and Windows
10101271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1050,23 +1311,33 @@
10501311
10511312 assert target == objEditor.jTree;
10521313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
10531315 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551317 } catch (Exception e) {
10561318 System.out.println("destinationPath : " + destinationPath);
10571319 return;
10581320 }
10591321
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
10611323 {
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
+// {
10621333 loadClipboard(true);
10631334 objEditor.jTree.setSelectionPath(destinationPath);
10641335 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
10701341 }
10711342 public void dropActionChanged(DropTargetDragEvent dtde)
10721343 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1442,30 @@
11711442 {
11721443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731444 //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);
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
+ {
11861463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871464 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
11901469 if (Globals.ADVANCED)
11911470 {
11921471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1491,15 @@
12121491 }
12131492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141493 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);
1494
+// overlayItem = menu.add(new MenuItem("Overlay"));
1495
+// overlayItem.addActionListener(this);
1496
+// lightItem = menu.add(new MenuItem("Light"));
1497
+// lightItem.addActionListener(this);
12191498 menu.add("-");
12201499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211500 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
12241503 doubleItem = menu.add(new MenuItem("Fork"));
12251504 doubleItem.addActionListener(this);
12261505 if (Globals.ADVANCED)
....@@ -1236,6 +1515,9 @@
12361515 animationItem.addItemListener(this);
12371516 animationItem.setState(Globals.ANIMATION);
12381517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
12391521 menu.add("-");
12401522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12411523 parseverticesItem.addActionListener(this);
....@@ -1248,6 +1530,8 @@
12481530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12491531 reduce34MorphItem.addActionListener(this);
12501532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
12511535 menu.add(computeAOItem = new MenuItem("Compute AO"));
12521536 computeAOItem.addActionListener(this);
12531537
....@@ -1256,11 +1540,9 @@
12561540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12571541 mirrorItem.addActionListener(this);
12581542 menu.add("-");
1259
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1260
- memoryItem.addActionListener(this);
12611543 menu.add(analyzeItem = new MenuItem("Analyze"));
12621544 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1545
+ menu.add(dumpItem = new MenuItem("Print"));
12641546 dumpItem.addActionListener(this);
12651547 // menu.add(pathItem = new MenuItem("From-to path"));
12661548 // pathItem.addActionListener(this);
....@@ -1401,9 +1683,34 @@
14011683 shadow.material = new cMaterial(obj.material);
14021684 shadow.material.diffuse = 0.0001f;
14031685 shadow.material.specular = 0.0001f;
1686
+ //shadow.projectedVertices[1].x = 300;
14041687
14051688 makeSomething(shadow);
14061689 }
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
+ }
14071714
14081715 /**
14091716 * applyExample
....@@ -1648,7 +1955,7 @@
16481955 {
16491956 ScreenFit();
16501957 } else
1651
- if (source == switchItem)
1958
+ if (source == switchViewItem)
16521959 {
16531960 cVector v1 = new cVector();
16541961 cVector v2 = new cVector();
....@@ -1657,11 +1964,11 @@
16571964 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581965 objEditor.cameraView.repaint();
16591966 } else
1660
- if (source == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
16611968 {
16621969 makeSomething(new Box());
16631970 } else
1664
- if (source == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
16651972 {
16661973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +2047,27 @@
17402047
17412048 makeSomething(obj);
17422049 } else
1743
- if (source == gridItem)
2050
+ if (source == gridItem || source == gridButton)
17442051 {
17452052 makeSomething(new Grid());
17462053 } else
1747
- if (source == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
17482055 {
17492056 makeSomething(new Sphere());
17502057 } else
1751
- if (source == coneItem)
2058
+ if (source == coneItem || source == coneButton)
17522059 {
17532060 makeSomething(new Cone());
17542061 } else
1755
- if (source == torusItem)
2062
+ if (source == torusItem || source == torusButton)
17562063 {
17572064 makeSomething(new Torus());
17582065 } else
1759
- if (source == superItem)
2066
+ if (source == superItem || source == superButton)
17602067 {
17612068 makeSomething(new Superellipsoid());
17622069 } else
1763
- if (source == kleinItem)
2070
+ if (source == kleinItem || source == kleinButton)
17642071 {
17652072 makeSomething(new Klein());
17662073 } else
....@@ -1780,7 +2087,7 @@
17802087 {
17812088 makeSomething(new BezierSurface());
17822089 } else
1783
- if (source == overlayItem)
2090
+ if (source == overlayItem || source == overlayButton)
17842091 {
17852092 /*
17862093 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2135,7 @@
18282135 s.setup();
18292136 makeSomething(s);
18302137 } else
1831
- if (source == lightItem)
2138
+ if (source == lightItem || source == lightButton)
18322139 {
18332140 makeSomething(new Light());
18342141 } else
....@@ -1878,30 +2185,30 @@
18782185
18792186 group(g);
18802187 } else
1881
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
18822189 {
18832190 Composite csg = new GroupLeaf();
18842191 csg.count = 5;
18852192 group(csg);
1886
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
18872194 csg.addChild(child);
18882195 child.addChild(csg);
18892196 } else
18902197 if (source == doubleItem)
18912198 {
1892
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
18932200 csg.count = 5;
18942201 group(csg);
1895
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
18962203 csg.addChild(child);
18972204 child.addChild(csg);
1898
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
18992206 csg.addChild(child);
19002207 child.addChild(csg);
19012208 } else
19022209 if (source == tripleItem)
19032210 {
1904
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
19052212 csg.count = 4;
19062213 group(csg);
19072214 Composite child = new cGroup();
....@@ -1951,6 +2258,46 @@
19512258 {
19522259 DumpObject();
19532260 } 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
2273
+ if (source == undoButton)
2274
+ {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2278
+ 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();
2289
+ } else
2290
+ if (source == redoButton)
2291
+ {
2292
+ // Go to next version
2293
+ Redo();
2294
+ } else
2295
+ if (source == saveButton)
2296
+ {
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
2300
+ } else
19542301 if (source == oneStepButton)
19552302 {
19562303 Globals.ONESTEP = true;
....@@ -1958,17 +2305,14 @@
19582305 } else
19592306 if (source == screenfitButton)
19602307 {
1961
- //Reload(lastConverter, lastFilename, true);
19622308 ScreenFit();
19632309 } else
19642310 if (source == screenfitpointButton)
19652311 {
1966
- //Reload(lastConverter, lastFilename, true);
19672312 ScreenFitPoint();
19682313 } else
19692314 if (source == snapobjectButton)
19702315 {
1971
- //Reload(lastConverter, lastFilename, true);
19722316 SnapObject();
19732317 } else
19742318 // if (event.getSource() == recompileButton)
....@@ -2004,6 +2348,14 @@
20042348 if (source == cutItem || source == clearButton)
20052349 {
20062350 loadClipboard(true);
2351
+ } else
2352
+ if (source == undoItem)
2353
+ {
2354
+ Undo();
2355
+ } else
2356
+ if (source == redoItem)
2357
+ {
2358
+ Redo();
20072359 } else
20082360 if (source == duplicateItem)
20092361 {
....@@ -2324,7 +2676,7 @@
23242676 {
23252677 StepAll();
23262678 } else
2327
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
23282680 {
23292681 //int indices[] = jList.getSelectedIndices();
23302682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2336,9 +2688,9 @@
23362688 {
23372689 ClearSelection(true);
23382690 } else
2339
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
23402692 {
2341
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
23422694 } else
23432695 if (source == hideItem)
23442696 {
....@@ -2356,11 +2708,11 @@
23562708 {
23572709 makeSomething(new Camera());
23582710 } else
2359
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
23602712 {
23612713 group(new Composite());
23622714 } else
2363
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
23642716 {
23652717 RandomNode random = new RandomNode();
23662718 group(random);
....@@ -2462,7 +2814,7 @@
24622814 {
24632815 group(new cLinker());
24642816 } else
2465
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
24662818 {
24672819 group(new TextureNode());
24682820 } else
....@@ -2482,17 +2834,30 @@
24822834 {
24832835 CastShadow(2);
24842836 } else
2485
- if (source == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
24862838 {
2487
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
24882841 for (int i=0; i<group.selection.size(); i++)
24892842 {
2490
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
24912848 }
24922849
2493
- ClearSelection(false);
2494
-
2495
- 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
+ }
24962861 } else
24972862 if (source == genUVItem)
24982863 {
....@@ -2504,7 +2869,7 @@
25042869 } else
25052870 if (source == genNormalsMESHItem)
25062871 {
2507
- GenNormals(true); // TODO
2872
+ GenNormalsMESH();
25082873 } else
25092874 if (source == genNormalsORGANItem)
25102875 {
....@@ -2569,6 +2934,22 @@
25692934 if (source == unmarkleavesItem)
25702935 {
25712936 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);
25722953 } else
25732954 if (source == flipVItem)
25742955 {
....@@ -2777,7 +3158,7 @@
27773158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27783159 {
27793160 obj = (Object3D)e.nextElement();
2780
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
27813162 }
27823163
27833164 refreshContents();
....@@ -2793,6 +3174,31 @@
27933174
27943175 refreshContents();
27953176 } 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
27963202 if (source == flashSelectionButton)
27973203 {
27983204 CameraPane.flash = true;
....@@ -2804,6 +3210,10 @@
28043210 if (source == twoButton)
28053211 {
28063212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
28073217 // bug
28083218 //gridPanel.setDividerLocation(1.0);
28093219 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3246,31 @@
28363246 bigThree.ClearUI();
28373247 bigThree.add(centralPanel);
28383248 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
+
28393267 } else
28403268 if (source == threeButton)
28413269 {
28423270 radio.layout = threeButton;
3271
+
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
28433274
28443275 // bigThree.remove(scenePanel);
28453276 // bigThree.remove(centralPanel);
....@@ -2872,10 +3303,15 @@
28723303 bigThree.add(centralPanel);
28733304 bigThree.add(XYZPanel);
28743305 bigThree.FlushUI();
3306
+
3307
+ cameraView.requestFocusInWindow();
28753308 } else
28763309 if (source == fourButton)
28773310 {
28783311 radio.layout = fourButton;
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
28793315
28803316 // bigThree.remove(scenePanel);
28813317 // bigThree.remove(centralPanel);
....@@ -2907,10 +3343,15 @@
29073343 bigThree.ClearUI();
29083344 bigThree.add(scenePanel);
29093345 bigThree.FlushUI();
3346
+
3347
+ cameraView.requestFocusInWindow();
29103348 } else
29113349 if (source == sixButton)
29123350 {
29133351 radio.layout = sixButton;
3352
+
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
29143355
29153356 // bigThree.remove(scenePanel);
29163357 // bigThree.remove(centralPanel);
....@@ -2943,10 +3384,15 @@
29433384 bigThree.add(scenePanel);
29443385 bigThree.add(centralPanel);
29453386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
29463389 } else
29473390 if (source == sevenButton)
29483391 {
29493392 radio.layout = sevenButton;
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
29503396
29513397 // bigThree.remove(scenePanel);
29523398 // bigThree.remove(centralPanel);
....@@ -2980,6 +3426,8 @@
29803426 bigThree.add(centralPanel);
29813427 bigThree.add(XYZPanel);
29823428 bigThree.FlushUI();
3429
+
3430
+ cameraView.requestFocusInWindow();
29833431 } else
29843432 if (source == rootButton)
29853433 {
....@@ -2991,6 +3439,7 @@
29913439 EditObject(obj);
29923440 }
29933441
3442
+ cameraView.requestFocusInWindow();
29943443 refreshContents(true);
29953444 } else
29963445 if (source == closeButton)
....@@ -3000,22 +3449,37 @@
30003449 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013450 {
30023451 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3452
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043453 {
3454
+ // Patch to avoid bug with transparency.
3455
+ if (!ab.hadMaterial)
3456
+ {
3457
+ ab.object.material = null;
3458
+ }
3459
+
30053460 buttonGroup.remove(ab);
30063461 radioPanel.remove(ab);
30073462
3008
- ab.GetObject().editWindow = null;
3463
+ //ab.GetObject().editWindow = null;
3464
+ ab.GetObject().manipWindow = null;
30093465 // ab.GetObject().objectUI = null; // ?????????
30103466
30113467 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123468 break;
30133469 }
30143470 }
3471
+
3472
+ cameraView.requestFocusInWindow();
30153473 refreshContents(true);
30163474 } else
30173475 if (source == editItem || source == editButton)
30183476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
30193483 EditSelection(false);
30203484 } else
30213485 if (source == uneditButton)
....@@ -3025,10 +3489,11 @@
30253489 Object3D child = (Object3D)e.nextElement();
30263490 if(child.editWindow != null)
30273491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
30283493 child.CloseUI();
30293494 listUI.remove(child);
30303495
3031
- child.editWindow = null; // ???????????
3496
+ //child.editWindow = null; // ???????????
30323497 }
30333498 objEditor.ctrlPanel.FlushUI();
30343499 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3506,7 @@
30413506 //copy.ClearUI();
30423507 for (Object3D obj : listUI)
30433508 {
3509
+ obj.pinned = false;
30443510 obj.CloseUI();
30453511 }
30463512 listUI.clear();
....@@ -3050,7 +3516,7 @@
30503516 {
30513517 assert(copy == group);
30523518
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543520
30553521 for (Object3D obj : listUI)
30563522 {
....@@ -3099,6 +3565,9 @@
30993565 }
31003566
31013567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
31023571 //Globals.theRenderer.object = group;
31033572 if(!useclient)
31043573 {
....@@ -3115,7 +3584,9 @@
31153584 sideView.object = group;
31163585 }
31173586
3118
-// fix "+" issue group.editWindow = this;
3587
+// fix "+" issue
3588
+ //group.editWindow = this;
3589
+ group.manipWindow = this;
31193590
31203591 /*
31213592 currentLayout = radio.layout;
....@@ -3123,18 +3594,27 @@
31233594 currentLayout = sevenButton;
31243595 */
31253596 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);
31263604 keepparent = group.parent;
31273605 // PARENT = NULL or not???
31283606 //group.parent = null; // ROOT
31293607 //group.attributes = -1;
31303608 ResetModel();
3609
+
3610
+ cameraView.requestFocusInWindow();
31313611 refreshContents(true);
31323612 } else if (event.getSource() == editCameraItem)
31333613 {
31343614 cameraView.ProtectCamera();
31353615 cameraView.repaint();
31363616 return;
3137
- } else if (event.getSource() == revertCameraItem)
3617
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383618 {
31393619 cameraView.RevertCamera();
31403620 cameraView.repaint();
....@@ -3151,7 +3631,6 @@
31513631 }
31523632
31533633 boolean useclient = false;
3154
- cRadio radio;
31553634
31563635 void ToggleRoot()
31573636 {
....@@ -3390,7 +3869,8 @@
33903869
33913870 int size = obj.MemorySize();
33923871
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3872
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3873
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943874 }
33953875 }
33963876 catch (Exception e)
....@@ -3471,6 +3951,13 @@
34713951 void GenNormals(boolean crease)
34723952 {
34733953 group.GenNormalsS(crease);
3954
+
3955
+ refreshContents();
3956
+ }
3957
+
3958
+ void GenNormalsMESH()
3959
+ {
3960
+ group.GenNormalsMeshS();
34743961
34753962 refreshContents();
34763963 }
....@@ -3706,7 +4193,7 @@
37064193
37074194 try
37084195 {
3709
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37104197 }
37114198 catch (Exception e)
37124199 {
....@@ -4098,6 +4585,18 @@
40984585 refreshContents();
40994586 }
41004587
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
+
41014600 void SetTexRes(int tr)
41024601 {
41034602 group.selection.SetTexRes(tr);
....@@ -4169,28 +4668,25 @@
41694668 // }
41704669 // }
41714670
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764671 void EditSelection(boolean newWindow)
41774672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
41784679 // aConstraints.gridy = 0;
41794680 for (int i=0; i<group.selection.size(); i++)
41804681 {
41814682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844685
41854686 Object3D elem = (Object3D)group.selection.elementAt(i);
41864687 if(elem != group || !newWindow)
41874688 {
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
4689
+ EditElement(elem, newWindow); // ? new
41944690 }
41954691 }
41964692 }
....@@ -4265,7 +4761,8 @@
42654761 //new Exception().printStackTrace();
42664762
42674763 freezemodel = true;
4268
-
4764
+ ClearUnpinned();
4765
+
42694766 /**/
42704767 //switch (event.id)
42714768 {
....@@ -4273,7 +4770,6 @@
42734770 //case 702: // Event.LIST_DESELECT
42744771 group.deselectAll();
42754772 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774773 if (tps != null)
42784774 {
42794775 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4778,8 @@
42824778
42834779 //if (child.parent != null)
42844780 //child.parent.addSelectee(child);
4781
+ objEditor.SetMaterial(child);
42854782 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894783 }
42904784 }
42914785 // else
....@@ -4295,20 +4789,28 @@
42954789 // System.err.println("info : " + group.GetPath());
42964790 // }
42974791
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4792
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014793 CameraPane.flash = true;
43024794
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4795
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044796 // a camera
43054797 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4798
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4799
+ {
4800
+ CameraPane.camerachangeframe = 0; // don't refuse it
4801
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4802
+ }
43084803 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104805 }
43114806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
43124814 refreshContents();
43134815 //return true;
43144816 }
....@@ -4317,6 +4819,35 @@
43174819
43184820 freezemodel = false;
43194821 }
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
+ }
43204851
43214852 void linkSomething(Object3D thing)
43224853 {
....@@ -4388,6 +4919,7 @@
43884919 {
43894920 if (group.selection.isEmpty())
43904921 return;
4922
+
43914923 Grafreed.clipboardIsTempGroup = false;
43924924 Composite tGroup = null;
43934925 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4930,8 @@
43984930
43994931 if (cut)
44004932 {
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
44014935 //int indices[] = jList.getSelectedIndices();
44024936 //for (int i = indices.length - 1; i >= 0; i--)
44034937 //jList.remove(indices[i]);
....@@ -4487,8 +5021,10 @@
44875021 }
44885022
44895023 }
5024
+
44905025 if (Grafreed.clipboardIsTempGroup)
44915026 Grafreed.clipboard = tGroup;
5027
+
44925028 if (cut)
44935029 {
44945030 ResetModel();
....@@ -4498,6 +5034,10 @@
44985034
44995035 void paste(boolean expand)
45005036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
45015041 // if (GrafreeD.clipboard == null)
45025042 // return;
45035043 boolean first = true;
....@@ -4557,6 +5097,7 @@
45575097 Grafreed.clipboard.get(0).parent = keepparent;
45585098 }
45595099
5100
+ Globals.REPLACEONMAKE = keep;
45605101 ResetModel();
45615102 refreshContents();
45625103 }
....@@ -4692,6 +5233,10 @@
46925233
46935234 void group(Object3D csg, boolean grab)
46945235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
46955240 if (//false) // why??
46965241 !group.selection.isEmpty())
46975242 {
....@@ -4805,10 +5350,15 @@
48055350 //node.add(csg);
48065351 //makeSomething(node);
48075352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
48085354 }
48095355
48105356 void Ungroup(Object3D g)
48115357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
48125362 if (g instanceof HiddenObject)
48135363 {
48145364 HiddenObject h = (HiddenObject) g;
....@@ -4825,6 +5375,7 @@
48255375 objEditor.makeSomething(g.get(i), false);
48265376 }
48275377 }
5378
+ Globals.REPLACEONMAKE = keep;
48285379 }
48295380
48305381 void ungroup()
....@@ -5113,7 +5664,28 @@
51135664 cButton clearpanelButton;
51145665 cButton unselectButton;
51155666
5667
+ cButton restoreCameraButton;
5668
+
5669
+ cButton saveButton;
51165670 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;
51175689
51185690 cButton screenfitButton;
51195691 cButton screenfitpointButton;
....@@ -5126,14 +5698,6 @@
51265698
51275699 cButton setsupportButton;
51285700
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
-
51375701 //
51385702 //Composite
51395703 Object3D // to do !!
....@@ -5143,9 +5707,11 @@
51435707 //JTree jTree;
51445708 private MenuItem lookAtItem;
51455709 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
51475711 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5712
+ private MenuItem undoItem;
5713
+ private MenuItem redoItem;
5714
+ private JMenuItem duplicateItem;
51495715 private MenuItem cloneItem;
51505716 private MenuItem cloneSupportItem;
51515717 private MenuItem overwriteGeoItem;
....@@ -5173,7 +5739,7 @@
51735739 private MenuItem pasteLinkItem;
51745740 private MenuItem pasteCloneItem;
51755741 private MenuItem pasteExpandItem;
5176
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
51775743 private MenuItem clearAllItem;
51785744 private MenuItem genUVItem;
51795745 private MenuItem genNormalsMESHItem;
....@@ -5208,6 +5774,10 @@
52085774 private MenuItem showleavesItem;
52095775 private MenuItem markleavesItem;
52105776 private MenuItem unmarkleavesItem;
5777
+ private MenuItem rewindleavesItem;
5778
+ private MenuItem unrewindleavesItem;
5779
+ private MenuItem randomleavesItem;
5780
+ private MenuItem unrandomleavesItem;
52115781
52125782 private MenuItem flipVItem;
52135783 private MenuItem unflipVItem;
....@@ -5229,7 +5799,7 @@
52295799 private MenuItem frontItem;
52305800 private MenuItem cameraItem;
52315801 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
52335803 private MenuItem physicsItem;
52345804 private MenuItem frameselectorItem;
52355805 private MenuItem scriptNodeItem;
....@@ -5253,6 +5823,8 @@
52535823 private MenuItem attachBumpItem;
52545824 private MenuItem detachBumpItem;
52555825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
52565828
52575829 private MenuItem particleItem;
52585830 private MenuItem ragdollItem;
....@@ -5303,5 +5875,5 @@
53035875
53045876 Menu cameraMenu;
53055877 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5878
+ MenuItem restoreCameraItem;
53075879 }