Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -148,28 +153,21 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
158
+ oe.jTree = new cTree();
159
+
168160 Menu menu;
169161 oe.menuBar.add(menu = new Menu("Edit"));
170162 //editItem = menu.add(new MenuItem("Edit"));
171163 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173171 duplicateItem.addActionListener(this);
174172 cloneItem = menu.add(new MenuItem("Clone"));
175173 cloneItem.addActionListener(this);
....@@ -185,7 +183,6 @@
185183 copyItem.addActionListener(this);
186184 pasteItem = menu.add(new MenuItem("Paste"));
187185 pasteItem.addActionListener(this);
188
- menu.add("-");
189186
190187 menu.add("-");
191188 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,14 +203,97 @@
206203 clearAllItem = menu.add(new MenuItem("Clear All"));
207204 clearAllItem.addActionListener(this);
208205 }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
209242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
210294 oe.menuBar.add(menu = new Menu("Setting"));
211295 if (Globals.ADVANCED)
212296 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218298 revertMeshItem.addActionListener(this);
219299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +333,29 @@
253333 }
254334
255335 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
258338 backItem = menu.add(new MenuItem("Back"));
259339 backItem.addActionListener(this);
260340 frontItem = menu.add(new MenuItem("Front"));
261341 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
264347 hideItem = menu.add(new MenuItem("Hidden Group"));
265348 hideItem.addActionListener(this);
349
+ }
266350 ungroupItem = menu.add(new MenuItem("Ungroup"));
267351 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
271359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272360 switchGeoItem.addActionListener(this);
273361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +363,6 @@
275363 morphItem = menu.add(new MenuItem("Morph Group"));
276364 morphItem.addActionListener(this);
277365
278
- if (Globals.ADVANCED)
279
- {
280366 menu.add("-");
281367 physicsItem = menu.add(new MenuItem("Physics"));
282368 physicsItem.addActionListener(this);
....@@ -284,30 +370,29 @@
284370 frameselectorItem.addActionListener(this);
285371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286372 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289373 }
290374
291375 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
294378 billboardItem = menu.add(new MenuItem("Billboard"));
295379 billboardItem.addActionListener(this);
296380 csgItem = menu.add(new MenuItem("CSG"));
297381 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299383 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301385 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
304391 if (Globals.ADVANCED)
305392 {
306393 menu.add("-");
307394 linkerItem = menu.add(new MenuItem("Linker"));
308395 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311396 templateItem = menu.add(new MenuItem("Template"));
312397 templateItem.addActionListener(this);
313398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -372,6 +457,10 @@
372457 oe.menuBar.add(menu = new Menu("Attributes"));
373458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
375464 menu.add("-");
376465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377466 liveleavesItem.addActionListener(this);
....@@ -392,6 +481,14 @@
392481 markleavesItem.addActionListener(this);
393482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
395492 menu.add("-");
396493 flipVItem = menu.add(new MenuItem("Flip V"));
397494 flipVItem.addActionListener(this);
....@@ -443,25 +540,25 @@
443540 oe.menuBar.add(menu = new Menu("Insert"));
444541 buildCreateMenu(menu);
445542
446
- oe.menuBar.add(menu = new Menu("Include"));
447
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
- importOBJItem.addActionListener(this);
449
- menu.add("-");
450
- import3DSItem = menu.add(new MenuItem("3DS file..."));
451
- import3DSItem.addActionListener(this);
452
- menu.add("-");
453
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
- importVRMLX3DItem.addActionListener(this);
455
- menu.add("-");
456
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
- importGFDItem.addActionListener(this);
458
-
459543 oe.menuBar.add(menu = new Menu("Tools"));
460544 buildToolsMenu(menu);
461545 }
462546
547
+
463548 void SetupUI2(ObjEditor oe)
464549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
465562 //new Exception().printStackTrace();
466563
467564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +587,79 @@
490587 oe.radioPanel.add(dummyButton);
491588 oe.buttonGroup.add(dummyButton);
492589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
493594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494595
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
- liveCB.setToolTipText("Enabled animation");
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
497648 liveCB.addItemListener(this);
498649
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500651 oneStepButton.setToolTipText("Animate one step forward");
501652 oneStepButton.addActionListener(this);
502653
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504655 fastCB.setToolTipText("Fast mode");
505656 fastCB.addItemListener(this);
506657
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
- trackCB.setToolTipText("Enable tracking");
509
- trackCB.addItemListener(this);
510
-
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
- screenfitButton.setToolTipText("Screen fit");
513
- screenfitButton.addActionListener(this);
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
514663
515664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516665 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +671,145 @@
522671 snapobjectButton.setToolTipText("Snap Object");
523672 }
524673
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528675
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532677 twoButton.setToolTipText("Show center view only");
533678 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535682 fourButton.addActionListener(this);
536683 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538685 sixButton.setToolTipText("2-column layout left");
539686 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541688 threeButton.setToolTipText("2-column layout right");
542689 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544691 sevenButton.setToolTipText("3-column layout");
545692 sevenButton.addActionListener(this);
546693 //
547694
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549696 rootButton.setToolTipText("Edit selection in new tab");
550697 rootButton.addActionListener(this);
551698
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553700 closeButton.setToolTipText("Close tab");
554701 closeButton.addActionListener(this);
555702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556703 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
559736
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
562786 editButton.addActionListener(this);
563787
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
566790 uneditButton.addActionListener(this);
567791
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
570794 allParamsButton.addActionListener(this);
571795
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573797 clearPanelButton.setToolTipText("Clear edit panel");
574798 clearPanelButton.addActionListener(this);
575799
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577801 unselectButton.setToolTipText("Unselect");
578802 unselectButton.addActionListener(this);
579803
580
- commandsPanel.preferredHeight = 1;
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
581807
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
584813
585814 // oe.aConstraints.gridx += 1;
586815 // oe.aConstraints.weighty = 0;
....@@ -597,29 +826,17 @@
597826
598827 JScrollPane jSP;
599828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601830 ResetModel();
602831
603832 oe.treePanel.add(jSPPanel);
604833 oe.treePanel.Return();
605834
606
- cGridBag copyOptionsPanel = new cGridBag();
607
-
608
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
- colorCB.setToolTipText("Copy color when dropped");
610
- colorCB.addItemListener(this);
611
-
612
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
- materialCB.setToolTipText("Copy material when dropped");
614
- materialCB.addItemListener(this);
615
-
616
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
- textureCB.setToolTipText("Copy texture when dropped");
618
- textureCB.addItemListener(this);
619
-
620
- copyOptionsPanel.preferredHeight = 1;
621835 oe.treePanel.add(copyOptionsPanel);
622836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
623840
624841 // mainPanel.setDividerLocation(0.5); //1.0);
625842 // mainPanel.setResizeWeight(0.5);
....@@ -648,23 +865,43 @@
648865
649866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650867 {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
651882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652883 boxCB.setToolTipText("Display bounding boxes");
653884 boxCB.addItemListener(this);
654885
655886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
657888 zoomBoxCB.addItemListener(this);
658889
659890 if (true) // Globals.ADVANCED)
660891 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
664899
665900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666901 // localCB.addItemListener(this);
667902
903
+ panel.Return();
904
+
668905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669906 crowdCB.setToolTipText("Used for crowds");
670907 crowdCB.addItemListener(this);
....@@ -681,6 +918,8 @@
681918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682919 // speakerMocapCB.addItemListener(this);
683920
921
+ panel.Return();
922
+
684923 if (false)
685924 {
686925 // handled in scripts
....@@ -695,32 +934,72 @@
695934 //constraints.gridy += 1;
696935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
698938 }
699939
700940 //constraints.gridx += 1;
701941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702942 // debugCB.addItemListener(this);
703943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
704948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
705950 oeilCB.addItemListener(this);
706951
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
707972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708973 lookAtCB.setToolTipText("Look-at target");
709974 lookAtCB.addItemListener(this);
975
+ }
710976
711977 }
712978
713979 cGridBag fill = new cGridBag();
714
-
715980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
716985
717986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
718989
719990 }
720991
721992 void EditObject(Object3D obj)
722993 {
723994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
7241003 radioButton.SetObject(obj);
7251004 radioButton.layout = sevenButton;
7261005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -729,8 +1008,11 @@
7291008 buttonGroup.add(radioButton);
7301009 radioButton.doClick();
7311010 }
1011
+
7321012 void SetupViews(ObjEditor oe)
7331013 {
1014
+ theFrame = this;
1015
+
7341016 oe.SetupViews();
7351017
7361018 System.out.println("SetupViews");
....@@ -739,23 +1021,28 @@
7391021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401022 }
7411023
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- JCheckBox smoothfocusCB;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
7531037 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7591046
7601047 // static int COLOR = 1;
7611048 // static int MATERIAL = 2;
....@@ -763,9 +1050,9 @@
7631050
7641051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651052
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7691056
7701057 public void itemStateChanged(ItemEvent e)
7711058 {
....@@ -793,6 +1080,7 @@
7931080 } else if(e.getSource() == liveCB)
7941081 {
7951082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7961084 }
7971085 else if(e.getSource() == supportCB)
7981086 {
....@@ -857,6 +1145,18 @@
8571145 {
8581146 cameraView.ToggleOeil();
8591147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
8601160 else if(e.getSource() == lookAtCB)
8611161 {
8621162 cameraView.ToggleLookAt();
....@@ -873,7 +1173,8 @@
8731173
8741174 /**/
8751175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8771178 if ((path == null) || (path.getPathCount() <= 1)) {
8781179 // We can't move the root node or an empty selection
8791180 return;
....@@ -936,8 +1237,6 @@
9361237 }
9371238 }
9381239
939
- String string = (String) object;
940
-
9411240 System.out.println("Transfer = " + object + "; drop : " + target);
9421241 // if( object instanceof java.io.File[])
9431242 // {
....@@ -945,6 +1244,8 @@
9451244 // objEditor.DropFile((java.io.File[]) object, true);
9461245 // return;
9471246 // }
1247
+
1248
+ String string = object.toString();
9481249
9491250 // File path for Mac and Windows
9501251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1291,33 @@
9901291
9911292 assert target == objEditor.jTree;
9921293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9931295 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951297 } catch (Exception e) {
9961298 System.out.println("destinationPath : " + destinationPath);
9971299 return;
9981300 }
9991301
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
10011303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
10021313 loadClipboard(true);
10031314 objEditor.jTree.setSelectionPath(destinationPath);
10041315 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
10101321 }
10111322 public void dropActionChanged(DropTargetDragEvent dtde)
10121323 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1422,30 @@
11111422 {
11121423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131424 //heightFieldItem.addActionListener(this);
1114
- gridItem = menu.add(new MenuItem("Grid"));
1115
- gridItem.addActionListener(this);
1116
- rectoidItem = menu.add(new MenuItem("Box"));
1117
- rectoidItem.addActionListener(this);
1118
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1119
- ellipsoidItem.addActionListener(this);
1120
- coneItem = menu.add(new MenuItem("Cone"));
1121
- coneItem.addActionListener(this);
1122
- torusItem = menu.add(new MenuItem("Torus"));
1123
- torusItem.addActionListener(this);
1124
- superItem = menu.add(new MenuItem("Superellipsoid"));
1125
- superItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
11261443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271444 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
11301449 if (Globals.ADVANCED)
11311450 {
11321451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1471,15 @@
11521471 }
11531472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541473 bezierItem.addActionListener(this);
1155
- overlayItem = menu.add(new MenuItem("Overlay"));
1156
- overlayItem.addActionListener(this);
1157
- lightItem = menu.add(new MenuItem("Light"));
1158
- lightItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
11591478 menu.add("-");
11601479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611480 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11641483 doubleItem = menu.add(new MenuItem("Fork"));
11651484 doubleItem.addActionListener(this);
11661485 if (Globals.ADVANCED)
....@@ -1176,6 +1495,9 @@
11761495 animationItem.addItemListener(this);
11771496 animationItem.setState(Globals.ANIMATION);
11781497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
11791501 menu.add("-");
11801502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811503 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1510,8 @@
11881510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891511 reduce34MorphItem.addActionListener(this);
11901512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
11911515 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921516 computeAOItem.addActionListener(this);
11931517
....@@ -1196,11 +1520,9 @@
11961520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971521 mirrorItem.addActionListener(this);
11981522 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011523 menu.add(analyzeItem = new MenuItem("Analyze"));
12021524 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
12041526 dumpItem.addActionListener(this);
12051527 // menu.add(pathItem = new MenuItem("From-to path"));
12061528 // pathItem.addActionListener(this);
....@@ -1341,9 +1663,24 @@
13411663 shadow.material = new cMaterial(obj.material);
13421664 shadow.material.diffuse = 0.0001f;
13431665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
13441667
13451668 makeSomething(shadow);
13461669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
13471684
13481685 /**
13491686 * applyExample
....@@ -1588,7 +1925,7 @@
15881925 {
15891926 ScreenFit();
15901927 } else
1591
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15921929 {
15931930 cVector v1 = new cVector();
15941931 cVector v2 = new cVector();
....@@ -1597,11 +1934,11 @@
15971934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15981935 objEditor.cameraView.repaint();
15991936 } else
1600
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
16011938 {
16021939 makeSomething(new Box());
16031940 } else
1604
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
16051942 {
16061943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16071944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2017,27 @@
16802017
16812018 makeSomething(obj);
16822019 } else
1683
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16842021 {
16852022 makeSomething(new Grid());
16862023 } else
1687
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16882025 {
16892026 makeSomething(new Sphere());
16902027 } else
1691
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16922029 {
16932030 makeSomething(new Cone());
16942031 } else
1695
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16962033 {
16972034 makeSomething(new Torus());
16982035 } else
1699
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
17002037 {
17012038 makeSomething(new Superellipsoid());
17022039 } else
1703
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
17042041 {
17052042 makeSomething(new Klein());
17062043 } else
....@@ -1720,7 +2057,7 @@
17202057 {
17212058 makeSomething(new BezierSurface());
17222059 } else
1723
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
17242061 {
17252062 /*
17262063 Object3D obj = new BezierSurface(5,8);
....@@ -1768,7 +2105,7 @@
17682105 s.setup();
17692106 makeSomething(s);
17702107 } else
1771
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17722109 {
17732110 makeSomething(new Light());
17742111 } else
....@@ -1818,30 +2155,30 @@
18182155
18192156 group(g);
18202157 } else
1821
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
18222159 {
18232160 Composite csg = new GroupLeaf();
18242161 csg.count = 5;
18252162 group(csg);
1826
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
18272164 csg.addChild(child);
18282165 child.addChild(csg);
18292166 } else
18302167 if (source == doubleItem)
18312168 {
1832
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
18332170 csg.count = 5;
18342171 group(csg);
1835
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
18362173 csg.addChild(child);
18372174 child.addChild(csg);
1838
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
18392176 csg.addChild(child);
18402177 child.addChild(csg);
18412178 } else
18422179 if (source == tripleItem)
18432180 {
1844
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
18452182 csg.count = 4;
18462183 group(csg);
18472184 Composite child = new cGroup();
....@@ -1853,31 +2190,6 @@
18532190 child = new cGroup();
18542191 csg.addChild(child);
18552192 child.addChild(csg);
1856
- } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
18812193 } else
18822194 if (source == computeAOItem)
18832195 {
....@@ -1916,6 +2228,46 @@
19162228 {
19172229 DumpObject();
19182230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
19192271 if (source == oneStepButton)
19202272 {
19212273 Globals.ONESTEP = true;
....@@ -1923,17 +2275,14 @@
19232275 } else
19242276 if (source == screenfitButton)
19252277 {
1926
- //Reload(lastConverter, lastFilename, true);
19272278 ScreenFit();
19282279 } else
19292280 if (source == screenfitpointButton)
19302281 {
1931
- //Reload(lastConverter, lastFilename, true);
19322282 ScreenFitPoint();
19332283 } else
19342284 if (source == snapobjectButton)
19352285 {
1936
- //Reload(lastConverter, lastFilename, true);
19372286 SnapObject();
19382287 } else
19392288 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2318,14 @@
19692318 if (source == cutItem || source == clearButton)
19702319 {
19712320 loadClipboard(true);
2321
+ } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
19722329 } else
19732330 if (source == duplicateItem)
19742331 {
....@@ -2281,7 +2638,7 @@
22812638 {
22822639 RevertMeshes();
22832640 } else
2284
- if (source == resetMeshItem)
2641
+ if (source == resetAllItem)
22852642 {
22862643 ResetAll();
22872644 } else
....@@ -2301,9 +2658,9 @@
23012658 {
23022659 ClearSelection(true);
23032660 } else
2304
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
23052662 {
2306
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
23072664 } else
23082665 if (source == hideItem)
23092666 {
....@@ -2321,11 +2678,11 @@
23212678 {
23222679 makeSomething(new Camera());
23232680 } else
2324
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
23252682 {
23262683 group(new Composite());
23272684 } else
2328
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
23292686 {
23302687 RandomNode random = new RandomNode();
23312688 group(random);
....@@ -2427,7 +2784,7 @@
24272784 {
24282785 group(new cLinker());
24292786 } else
2430
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
24312788 {
24322789 group(new TextureNode());
24332790 } else
....@@ -2447,17 +2804,30 @@
24472804 {
24482805 CastShadow(2);
24492806 } else
2450
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
24512808 {
2452
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
24532811 for (int i=0; i<group.selection.size(); i++)
24542812 {
2455
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
24562818 }
24572819
2458
- ClearSelection(false);
2459
-
2460
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
24612831 } else
24622832 if (source == genUVItem)
24632833 {
....@@ -2469,7 +2839,7 @@
24692839 } else
24702840 if (source == genNormalsMESHItem)
24712841 {
2472
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24732843 } else
24742844 if (source == genNormalsORGANItem)
24752845 {
....@@ -2534,6 +2904,22 @@
25342904 if (source == unmarkleavesItem)
25352905 {
25362906 MarkLeaves(false);
2907
+ } else
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
25372923 } else
25382924 if (source == flipVItem)
25392925 {
....@@ -2769,6 +3155,10 @@
27693155 if (source == twoButton)
27703156 {
27713157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
27723162 // bug
27733163 //gridPanel.setDividerLocation(1.0);
27743164 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3191,31 @@
28013191 bigThree.ClearUI();
28023192 bigThree.add(centralPanel);
28033193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
28043212 } else
28053213 if (source == threeButton)
28063214 {
28073215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
28083219
28093220 // bigThree.remove(scenePanel);
28103221 // bigThree.remove(centralPanel);
....@@ -2837,10 +3248,15 @@
28373248 bigThree.add(centralPanel);
28383249 bigThree.add(XYZPanel);
28393250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
28403253 } else
28413254 if (source == fourButton)
28423255 {
28433256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
28443260
28453261 // bigThree.remove(scenePanel);
28463262 // bigThree.remove(centralPanel);
....@@ -2872,10 +3288,15 @@
28723288 bigThree.ClearUI();
28733289 bigThree.add(scenePanel);
28743290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
28753293 } else
28763294 if (source == sixButton)
28773295 {
28783296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
28793300
28803301 // bigThree.remove(scenePanel);
28813302 // bigThree.remove(centralPanel);
....@@ -2908,10 +3329,15 @@
29083329 bigThree.add(scenePanel);
29093330 bigThree.add(centralPanel);
29103331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
29113334 } else
29123335 if (source == sevenButton)
29133336 {
29143337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
29153341
29163342 // bigThree.remove(scenePanel);
29173343 // bigThree.remove(centralPanel);
....@@ -2945,6 +3371,8 @@
29453371 bigThree.add(centralPanel);
29463372 bigThree.add(XYZPanel);
29473373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
29483376 } else
29493377 if (source == rootButton)
29503378 {
....@@ -2956,6 +3384,7 @@
29563384 EditObject(obj);
29573385 }
29583386
3387
+ cameraView.requestFocusInWindow();
29593388 refreshContents(true);
29603389 } else
29613390 if (source == closeButton)
....@@ -2965,22 +3394,37 @@
29653394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663395 {
29673396 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
29703405 buttonGroup.remove(ab);
29713406 radioPanel.remove(ab);
29723407
2973
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
29743410 // ab.GetObject().objectUI = null; // ?????????
29753411
29763412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773413 break;
29783414 }
29793415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
29803418 refreshContents(true);
29813419 } else
29823420 if (source == editItem || source == editButton)
29833421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
29843428 EditSelection(false);
29853429 } else
29863430 if (source == uneditButton)
....@@ -2990,10 +3434,11 @@
29903434 Object3D child = (Object3D)e.nextElement();
29913435 if(child.editWindow != null)
29923436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
29933438 child.CloseUI();
29943439 listUI.remove(child);
29953440
2996
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
29973442 }
29983443 objEditor.ctrlPanel.FlushUI();
29993444 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3451,7 @@
30063451 //copy.ClearUI();
30073452 for (Object3D obj : listUI)
30083453 {
3454
+ obj.pinned = false;
30093455 obj.CloseUI();
30103456 }
30113457 listUI.clear();
....@@ -3015,7 +3461,7 @@
30153461 {
30163462 assert(copy == group);
30173463
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193465
30203466 for (Object3D obj : listUI)
30213467 {
....@@ -3064,6 +3510,9 @@
30643510 }
30653511
30663512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
30673516 //Globals.theRenderer.object = group;
30683517 if(!useclient)
30693518 {
....@@ -3079,20 +3528,44 @@
30793528 frontView.object = group;
30803529 sideView.object = group;
30813530 }
3082
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
30833536 /*
30843537 currentLayout = radio.layout;
30853538 if (currentLayout == null)
30863539 currentLayout = sevenButton;
30873540 */
30883541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
30893547 keepparent = group.parent;
30903548 // PARENT = NULL or not???
30913549 //group.parent = null; // ROOT
30923550 //group.attributes = -1;
30933551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
30943554 refreshContents(true);
3095
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
30963569 else
30973570 {
30983571 //return super.action(event, arg);
....@@ -3101,7 +3574,6 @@
31013574 }
31023575
31033576 boolean useclient = false;
3104
- cRadio radio;
31053577
31063578 void ToggleRoot()
31073579 {
....@@ -3340,7 +3812,8 @@
33403812
33413813 int size = obj.MemorySize();
33423814
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33443817 }
33453818 }
33463819 catch (Exception e)
....@@ -3421,6 +3894,13 @@
34213894 void GenNormals(boolean crease)
34223895 {
34233896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
34243904
34253905 refreshContents();
34263906 }
....@@ -3652,7 +4132,16 @@
36524132 String pigment = Object3D.GetPigment(tex);
36534133 //String bump = Object3D.GetBump(tex);
36544134
3655
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4135
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4136
+
4137
+ try
4138
+ {
4139
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4140
+ }
4141
+ catch (Exception e)
4142
+ {
4143
+ System.err.println("FAIL: " + node);
4144
+ }
36564145
36574146 double s = v.s;
36584147
....@@ -4039,6 +4528,18 @@
40394528 refreshContents();
40404529 }
40414530
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
4540
+ refreshContents();
4541
+ }
4542
+
40424543 void SetTexRes(int tr)
40434544 {
40444545 group.selection.SetTexRes(tr);
....@@ -4110,10 +4611,6 @@
41104611 // }
41114612 // }
41124613
4113
- static boolean allparams = true;
4114
-
4115
- static Vector<Object3D> listUI = new Vector<Object3D>();
4116
-
41174614 void EditSelection(boolean newWindow)
41184615 {
41194616 // aConstraints.gridy = 0;
....@@ -4121,10 +4618,10 @@
41214618 {
41224619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41234620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4124
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41254622
41264623 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
4624
+ if(elem != group || !newWindow)
41284625 {
41294626 // if (!(elem instanceof Composite))
41304627 // newWindow = false;
....@@ -4206,7 +4703,8 @@
42064703 //new Exception().printStackTrace();
42074704
42084705 freezemodel = true;
4209
-
4706
+ ClearUnpinned();
4707
+
42104708 /**/
42114709 //switch (event.id)
42124710 {
....@@ -4214,7 +4712,6 @@
42144712 //case 702: // Event.LIST_DESELECT
42154713 group.deselectAll();
42164714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42184715 if (tps != null)
42194716 {
42204717 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +4720,8 @@
42234720
42244721 //if (child.parent != null)
42254722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
42264724 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42304725 }
42314726 }
42324727 // else
....@@ -4236,20 +4731,28 @@
42364731 // System.err.println("info : " + group.GetPath());
42374732 // }
42384733
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42424735 CameraPane.flash = true;
42434736
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42454738 // a camera
42464739 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
42494745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42504746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42514747 }
42524748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
42534756 refreshContents();
42544757 //return true;
42554758 }
....@@ -4258,6 +4761,35 @@
42584761
42594762 freezemodel = false;
42604763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
42614793
42624794 void linkSomething(Object3D thing)
42634795 {
....@@ -4329,6 +4861,7 @@
43294861 {
43304862 if (group.selection.isEmpty())
43314863 return;
4864
+
43324865 Grafreed.clipboardIsTempGroup = false;
43334866 Composite tGroup = null;
43344867 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +4872,8 @@
43394872
43404873 if (cut)
43414874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
43424877 //int indices[] = jList.getSelectedIndices();
43434878 //for (int i = indices.length - 1; i >= 0; i--)
43444879 //jList.remove(indices[i]);
....@@ -4428,8 +4963,10 @@
44284963 }
44294964
44304965 }
4966
+
44314967 if (Grafreed.clipboardIsTempGroup)
44324968 Grafreed.clipboard = tGroup;
4969
+
44334970 if (cut)
44344971 {
44354972 ResetModel();
....@@ -4439,6 +4976,10 @@
44394976
44404977 void paste(boolean expand)
44414978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
44424983 // if (GrafreeD.clipboard == null)
44434984 // return;
44444985 boolean first = true;
....@@ -4498,6 +5039,7 @@
44985039 Grafreed.clipboard.get(0).parent = keepparent;
44995040 }
45005041
5042
+ Globals.REPLACEONMAKE = keep;
45015043 ResetModel();
45025044 refreshContents();
45035045 }
....@@ -4633,6 +5175,10 @@
46335175
46345176 void group(Object3D csg, boolean grab)
46355177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
46365182 if (//false) // why??
46375183 !group.selection.isEmpty())
46385184 {
....@@ -4746,10 +5292,15 @@
47465292 //node.add(csg);
47475293 //makeSomething(node);
47485294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
47495296 }
47505297
47515298 void Ungroup(Object3D g)
47525299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
47535304 if (g instanceof HiddenObject)
47545305 {
47555306 HiddenObject h = (HiddenObject) g;
....@@ -4766,6 +5317,7 @@
47665317 objEditor.makeSomething(g.get(i), false);
47675318 }
47685319 }
5320
+ Globals.REPLACEONMAKE = keep;
47695321 }
47705322
47715323 void ungroup()
....@@ -4961,21 +5513,6 @@
49615513 }
49625514 */
49635515
4964
- void ImportGFD()
4965
- {
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
-
4973
- //Object3D readobj =
4974
- objEditor.ReadGFD(fullname, objEditor);
4975
- //makeSomething(readobj);
4976
- }
4977
- }
4978
-
49795516 /*
49805517 public void Callback(Object obj)
49815518 {
....@@ -4999,23 +5536,6 @@
49995536 }
50005537 */
50015538
5002
- void ImportVRMLX3D()
5003
- {
5004
- if (Grafreed.standAlone)
5005
- {
5006
- /**/
5007
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5008
- browser.show();
5009
- String filename = browser.getFile();
5010
- if (filename != null && filename.length() > 0)
5011
- {
5012
- String fullname = browser.getDirectory() + filename;
5013
- LoadVRMLX3D(fullname);
5014
- }
5015
- /**/
5016
- }
5017
- }
5018
-
50195539 String GetFile(String dialogName)
50205540 {
50215541 if (Grafreed.standAlone)
....@@ -5086,7 +5606,28 @@
50865606 cButton clearpanelButton;
50875607 cButton unselectButton;
50885608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
50895612 cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
50905631
50915632 cButton screenfitButton;
50925633 cButton screenfitpointButton;
....@@ -5099,14 +5640,6 @@
50995640
51005641 cButton setsupportButton;
51015642
5102
- cButton twoButton;
5103
- cButton sixButton;
5104
- cButton threeButton;
5105
- cButton sevenButton;
5106
- cButton fourButton; // full panel
5107
- cButton oneButton; // full XYZ
5108
- //cButton currentLayout;
5109
-
51105643 //
51115644 //Composite
51125645 Object3D // to do !!
....@@ -5116,9 +5649,11 @@
51165649 //JTree jTree;
51175650 private MenuItem lookAtItem;
51185651 private MenuItem lookFromItem;
5119
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
51205653 private MenuItem cutItem;
5121
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
51225657 private MenuItem cloneItem;
51235658 private MenuItem cloneSupportItem;
51245659 private MenuItem overwriteGeoItem;
....@@ -5131,7 +5666,7 @@
51315666 private MenuItem linkverticesItem;
51325667 private MenuItem relinkverticesItem;
51335668 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
51355670 private MenuItem stepAllItem;
51365671 private MenuItem revertMeshItem;
51375672 private MenuItem poseMeshItem;
....@@ -5181,6 +5716,10 @@
51815716 private MenuItem showleavesItem;
51825717 private MenuItem markleavesItem;
51835718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
51845723
51855724 private MenuItem flipVItem;
51865725 private MenuItem unflipVItem;
....@@ -5202,7 +5741,7 @@
52025741 private MenuItem frontItem;
52035742 private MenuItem cameraItem;
52045743 private MenuItem compositeItem;
5205
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
52065745 private MenuItem physicsItem;
52075746 private MenuItem frameselectorItem;
52085747 private MenuItem scriptNodeItem;
....@@ -5264,11 +5803,6 @@
52645803 private MenuItem doubleItem;
52655804 private MenuItem tripleItem;
52665805
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52725806 private MenuItem computeAOItem;
52735807 private MenuItem recompileItem;
52745808 private MenuItem editScriptItem;
....@@ -5278,4 +5812,8 @@
52785812 private MenuItem analyzeItem;
52795813 private MenuItem dumpItem;
52805814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
52815819 }