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 }
....@@ -74,16 +80,28 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
77
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7884 SetupUI2(objEditor);
7985 objEditor.SetupUI(true);
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)
....@@ -148,28 +167,21 @@
148167
149168 //JTextField nameField;
150169
151
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
152171 {
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
-
172
+ oe.jTree = new cTree();
173
+
168174 Menu menu;
169175 oe.menuBar.add(menu = new Menu("Edit"));
170176 //editItem = menu.add(new MenuItem("Edit"));
171177 //editItem.addActionListener(this);
172
- 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"));
173185 duplicateItem.addActionListener(this);
174186 cloneItem = menu.add(new MenuItem("Clone"));
175187 cloneItem.addActionListener(this);
....@@ -185,7 +197,6 @@
185197 copyItem.addActionListener(this);
186198 pasteItem = menu.add(new MenuItem("Paste"));
187199 pasteItem.addActionListener(this);
188
- menu.add("-");
189200
190201 menu.add("-");
191202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +208,8 @@
197208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198209 // pasteExpandItem.addActionListener(this);
199210 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
202213
203214 if (Globals.ADVANCED)
204215 {
....@@ -206,7 +217,94 @@
206217 clearAllItem = menu.add(new MenuItem("Clear All"));
207218 clearAllItem.addActionListener(this);
208219 }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
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);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
209256
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
210308 oe.menuBar.add(menu = new Menu("Setting"));
211309 if (Globals.ADVANCED)
212310 {
....@@ -249,21 +347,29 @@
249347 }
250348
251349 oe.menuBar.add(menu = new Menu("Group"));
252
- grabItem = menu.add(new MenuItem("Grab"));
253
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
254352 backItem = menu.add(new MenuItem("Back"));
255353 backItem.addActionListener(this);
256354 frontItem = menu.add(new MenuItem("Front"));
257355 frontItem.addActionListener(this);
258
- compositeItem = menu.add(new MenuItem("Composite"));
259
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
260361 hideItem = menu.add(new MenuItem("Hidden Group"));
261362 hideItem.addActionListener(this);
363
+ }
262364 ungroupItem = menu.add(new MenuItem("Ungroup"));
263365 ungroupItem.addActionListener(this);
264
- menu.add("-");
265
- randomItem = menu.add(new MenuItem("Switch node"));
266
- 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
+ {
267373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
268374 switchGeoItem.addActionListener(this);
269375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -271,8 +377,6 @@
271377 morphItem = menu.add(new MenuItem("Morph Group"));
272378 morphItem.addActionListener(this);
273379
274
- if (Globals.ADVANCED)
275
- {
276380 menu.add("-");
277381 physicsItem = menu.add(new MenuItem("Physics"));
278382 physicsItem.addActionListener(this);
....@@ -280,30 +384,29 @@
280384 frameselectorItem.addActionListener(this);
281385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
282386 scriptNodeItem.addActionListener(this);
283
- cameraItem = menu.add(new MenuItem("Camera"));
284
- cameraItem.addActionListener(this);
285387 }
286388
287389 oe.menuBar.add(menu = new Menu("Object"));
288
- textureItem = menu.add(new MenuItem("Texture"));
289
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
290392 billboardItem = menu.add(new MenuItem("Billboard"));
291393 billboardItem.addActionListener(this);
292394 csgItem = menu.add(new MenuItem("CSG"));
293395 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295397 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297399 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
300405 if (Globals.ADVANCED)
301406 {
302407 menu.add("-");
303408 linkerItem = menu.add(new MenuItem("Linker"));
304409 linkerItem.addActionListener(this);
305
- attributeItem = menu.add(new MenuItem("Attribute"));
306
- attributeItem.addActionListener(this);
307410 templateItem = menu.add(new MenuItem("Template"));
308411 templateItem.addActionListener(this);
309412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -332,7 +435,7 @@
332435 genNormalsMESHItem.addActionListener(this);
333436 if (Globals.ADVANCED)
334437 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336439 genNormalsMINEItem.addActionListener(this);
337440 }
338441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -392,6 +495,14 @@
392495 markleavesItem.addActionListener(this);
393496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394497 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);
395506 menu.add("-");
396507 flipVItem = menu.add(new MenuItem("Flip V"));
397508 flipVItem.addActionListener(this);
....@@ -417,10 +528,15 @@
417528 attachBumpItem.addActionListener(this);
418529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
419530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
420532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
421533 detachPigmentItem.addActionListener(this);
422534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
423535 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);
424540 menu.add("-");
425541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
426542 sortbysizeItem.addActionListener(this);
....@@ -443,25 +559,25 @@
443559 oe.menuBar.add(menu = new Menu("Insert"));
444560 buildCreateMenu(menu);
445561
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
-
459562 oe.menuBar.add(menu = new Menu("Tools"));
460563 buildToolsMenu(menu);
461564 }
462565
566
+
463567 void SetupUI2(ObjEditor oe)
464568 {
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
+
465581 //new Exception().printStackTrace();
466582
467583 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +606,79 @@
490606 oe.radioPanel.add(dummyButton);
491607 oe.buttonGroup.add(dummyButton);
492608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
493613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494614
495
- 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);
496666 liveCB.setToolTipText("Enable animation");
497667 liveCB.addItemListener(this);
498668
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500670 oneStepButton.setToolTipText("Animate one step forward");
501671 oneStepButton.addActionListener(this);
502672
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504674 fastCB.setToolTipText("Fast mode");
505675 fastCB.addItemListener(this);
506676
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);
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);
514682
515683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516684 // screenfitpointButton.addActionListener(this);
....@@ -522,65 +690,146 @@
522690 snapobjectButton.setToolTipText("Snap Object");
523691 }
524692
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
693
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528694
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532
- twoButton.setToolTipText("Show center view only");
533
- twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535696 fourButton.addActionListener(this);
536697 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
- 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");
539706 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541
- threeButton.setToolTipText("2-column layout right");
542
- threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- 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);
546713 //
547714
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- 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");
550717 rootButton.addActionListener(this);
551718
552
- 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);
553720 closeButton.setToolTipText("Close tab");
554721 closeButton.addActionListener(this);
555722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556723 //clearButton.addActionListener(this);
557
-
558
- 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
+ }
559756
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- 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");
562806 editButton.addActionListener(this);
563807
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
566810 uneditButton.addActionListener(this);
567811
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
812
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
813
+ allParamsButton.setToolTipText("Show all controle");
570814 allParamsButton.addActionListener(this);
571815
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573817 clearPanelButton.setToolTipText("Clear edit panel");
574818 clearPanelButton.addActionListener(this);
575819
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577821 unselectButton.setToolTipText("Unselect");
578822 unselectButton.addActionListener(this);
579823
580
- 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);
581827
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
828
+ editCommandsPanel.preferredHeight = 1;
829
+
830
+ SetPinStates(false);
831
+// oe.treePanel.add(commandsPanel);
832
+// oe.treePanel.Return();
584833
585834 // oe.aConstraints.gridx += 1;
586835 // oe.aConstraints.weighty = 0;
....@@ -597,29 +846,17 @@
597846
598847 JScrollPane jSP;
599848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
601850 ResetModel();
602851
603852 oe.treePanel.add(jSPPanel);
604853 oe.treePanel.Return();
605854
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;
621855 oe.treePanel.add(copyOptionsPanel);
622856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
623860
624861 // mainPanel.setDividerLocation(0.5); //1.0);
625862 // mainPanel.setResizeWeight(0.5);
....@@ -642,29 +879,49 @@
642879 dgr.addDragGestureListener(this);
643880 }catch(Exception e) {}
644881 */
645
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
646883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
647884 }
648885
649886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
650887 {
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
+
651902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
652903 boxCB.setToolTipText("Display bounding boxes");
653904 boxCB.addItemListener(this);
654905
655906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
657908 zoomBoxCB.addItemListener(this);
658909
659910 if (true) // Globals.ADVANCED)
660911 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- 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);
664919
665920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666921 // localCB.addItemListener(this);
667922
923
+ panel.Return();
924
+
668925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669926 crowdCB.setToolTipText("Used for crowds");
670927 crowdCB.addItemListener(this);
....@@ -681,6 +938,8 @@
681938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
682939 // speakerMocapCB.addItemListener(this);
683940
941
+ panel.Return();
942
+
684943 if (false)
685944 {
686945 // handled in scripts
....@@ -695,42 +954,85 @@
695954 //constraints.gridy += 1;
696955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
697956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
698958 }
699959
700960 //constraints.gridx += 1;
701961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
702962 // debugCB.addItemListener(this);
703963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
704968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
969
+ oeilCB.setToolTipText("Move camera when tracking");
705970 oeilCB.addItemListener(this);
706971
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
+ {
707992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708993 lookAtCB.setToolTipText("Look-at target");
709994 lookAtCB.addItemListener(this);
995
+ }
710996
711997 }
712998
713999 cGridBag fill = new cGridBag();
714
-
7151000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
7161005
7171006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
7181009
7191010 }
7201011
7211012 void EditObject(Object3D obj)
7221013 {
7231014 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
+
7241023 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
7261025 radioButton.SetCamera(cameraView.renderCamera, false);
7271026 radioButton.addActionListener(this);
7281027 radioPanel.add(radioButton);
7291028 buttonGroup.add(radioButton);
7301029 radioButton.doClick();
7311030 }
1031
+
7321032 void SetupViews(ObjEditor oe)
7331033 {
1034
+ theFrame = this;
1035
+
7341036 oe.SetupViews();
7351037
7361038 System.out.println("SetupViews");
....@@ -739,23 +1041,28 @@
7391041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401042 }
7411043
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;
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;
7531057 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1058
+ cCheckBox speakerCameraCB;
1059
+ cCheckBox speakerFocusCB;
1060
+ cCheckBox debugCB;
1061
+
1062
+ cCheckBox oeilCB;
1063
+ cCheckBox shadowCB;
1064
+ cCheckBox autokeepCB;
1065
+ cCheckBox lookAtCB;
7591066
7601067 // static int COLOR = 1;
7611068 // static int MATERIAL = 2;
....@@ -763,9 +1070,9 @@
7631070
7641071 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651072
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1073
+ cCheckBox colorCB;
1074
+ cCheckBox materialCB;
1075
+ cCheckBox textureCB;
7691076
7701077 public void itemStateChanged(ItemEvent e)
7711078 {
....@@ -793,6 +1100,7 @@
7931100 } else if(e.getSource() == liveCB)
7941101 {
7951102 cameraView.ToggleLive();
1103
+ refreshContents(false);
7961104 }
7971105 else if(e.getSource() == supportCB)
7981106 {
....@@ -857,6 +1165,18 @@
8571165 {
8581166 cameraView.ToggleOeil();
8591167 }
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
+ }
8601180 else if(e.getSource() == lookAtCB)
8611181 {
8621182 cameraView.ToggleLookAt();
....@@ -873,7 +1193,8 @@
8731193
8741194 /**/
8751195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
8771198 if ((path == null) || (path.getPathCount() <= 1)) {
8781199 // We can't move the root node or an empty selection
8791200 return;
....@@ -936,8 +1257,6 @@
9361257 }
9371258 }
9381259
939
- String string = (String) object;
940
-
9411260 System.out.println("Transfer = " + object + "; drop : " + target);
9421261 // if( object instanceof java.io.File[])
9431262 // {
....@@ -945,6 +1264,8 @@
9451264 // objEditor.DropFile((java.io.File[]) object, true);
9461265 // return;
9471266 // }
1267
+
1268
+ String string = object.toString();
9481269
9491270 // File path for Mac and Windows
9501271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1311,33 @@
9901311
9911312 assert target == objEditor.jTree;
9921313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
9931315 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951317 } catch (Exception e) {
9961318 System.out.println("destinationPath : " + destinationPath);
9971319 return;
9981320 }
9991321
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
10011323 {
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
+// {
10021333 loadClipboard(true);
10031334 objEditor.jTree.setSelectionPath(destinationPath);
10041335 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
10101341 }
10111342 public void dropActionChanged(DropTargetDragEvent dtde)
10121343 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1442,30 @@
11111442 {
11121443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131444 //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);
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
+ {
11261463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271464 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
11301469 if (Globals.ADVANCED)
11311470 {
11321471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1491,15 @@
11521491 }
11531492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541493 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);
1494
+// overlayItem = menu.add(new MenuItem("Overlay"));
1495
+// overlayItem.addActionListener(this);
1496
+// lightItem = menu.add(new MenuItem("Light"));
1497
+// lightItem.addActionListener(this);
11591498 menu.add("-");
11601499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611500 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
11641503 doubleItem = menu.add(new MenuItem("Fork"));
11651504 doubleItem.addActionListener(this);
11661505 if (Globals.ADVANCED)
....@@ -1176,6 +1515,9 @@
11761515 animationItem.addItemListener(this);
11771516 animationItem.setState(Globals.ANIMATION);
11781517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
11791521 menu.add("-");
11801522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811523 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1530,8 @@
11881530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891531 reduce34MorphItem.addActionListener(this);
11901532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
11911535 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921536 computeAOItem.addActionListener(this);
11931537
....@@ -1196,11 +1540,9 @@
11961540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971541 mirrorItem.addActionListener(this);
11981542 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011543 menu.add(analyzeItem = new MenuItem("Analyze"));
12021544 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1545
+ menu.add(dumpItem = new MenuItem("Print"));
12041546 dumpItem.addActionListener(this);
12051547 // menu.add(pathItem = new MenuItem("From-to path"));
12061548 // pathItem.addActionListener(this);
....@@ -1341,9 +1683,34 @@
13411683 shadow.material = new cMaterial(obj.material);
13421684 shadow.material.diffuse = 0.0001f;
13431685 shadow.material.specular = 0.0001f;
1686
+ //shadow.projectedVertices[1].x = 300;
13441687
13451688 makeSomething(shadow);
13461689 }
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
+ }
13471714
13481715 /**
13491716 * applyExample
....@@ -1588,7 +1955,7 @@
15881955 {
15891956 ScreenFit();
15901957 } else
1591
- if (source == switchItem)
1958
+ if (source == switchViewItem)
15921959 {
15931960 cVector v1 = new cVector();
15941961 cVector v2 = new cVector();
....@@ -1597,11 +1964,11 @@
15971964 objEditor.cameraView.renderCamera.setAim(v2, v1);
15981965 objEditor.cameraView.repaint();
15991966 } else
1600
- if (source == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
16011968 {
16021969 makeSomething(new Box());
16031970 } else
1604
- if (source == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
16051972 {
16061973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16071974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2047,27 @@
16802047
16812048 makeSomething(obj);
16822049 } else
1683
- if (source == gridItem)
2050
+ if (source == gridItem || source == gridButton)
16842051 {
16852052 makeSomething(new Grid());
16862053 } else
1687
- if (source == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
16882055 {
16892056 makeSomething(new Sphere());
16902057 } else
1691
- if (source == coneItem)
2058
+ if (source == coneItem || source == coneButton)
16922059 {
16932060 makeSomething(new Cone());
16942061 } else
1695
- if (source == torusItem)
2062
+ if (source == torusItem || source == torusButton)
16962063 {
16972064 makeSomething(new Torus());
16982065 } else
1699
- if (source == superItem)
2066
+ if (source == superItem || source == superButton)
17002067 {
17012068 makeSomething(new Superellipsoid());
17022069 } else
1703
- if (source == kleinItem)
2070
+ if (source == kleinItem || source == kleinButton)
17042071 {
17052072 makeSomething(new Klein());
17062073 } else
....@@ -1720,7 +2087,7 @@
17202087 {
17212088 makeSomething(new BezierSurface());
17222089 } else
1723
- if (source == overlayItem)
2090
+ if (source == overlayItem || source == overlayButton)
17242091 {
17252092 /*
17262093 Object3D obj = new BezierSurface(5,8);
....@@ -1768,7 +2135,7 @@
17682135 s.setup();
17692136 makeSomething(s);
17702137 } else
1771
- if (source == lightItem)
2138
+ if (source == lightItem || source == lightButton)
17722139 {
17732140 makeSomething(new Light());
17742141 } else
....@@ -1818,30 +2185,30 @@
18182185
18192186 group(g);
18202187 } else
1821
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
18222189 {
18232190 Composite csg = new GroupLeaf();
18242191 csg.count = 5;
18252192 group(csg);
1826
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
18272194 csg.addChild(child);
18282195 child.addChild(csg);
18292196 } else
18302197 if (source == doubleItem)
18312198 {
1832
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
18332200 csg.count = 5;
18342201 group(csg);
1835
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
18362203 csg.addChild(child);
18372204 child.addChild(csg);
1838
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
18392206 csg.addChild(child);
18402207 child.addChild(csg);
18412208 } else
18422209 if (source == tripleItem)
18432210 {
1844
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
18452212 csg.count = 4;
18462213 group(csg);
18472214 Composite child = new cGroup();
....@@ -1853,31 +2220,6 @@
18532220 child = new cGroup();
18542221 csg.addChild(child);
18552222 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
- }
18812223 } else
18822224 if (source == computeAOItem)
18832225 {
....@@ -1916,6 +2258,46 @@
19162258 {
19172259 DumpObject();
19182260 } 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
19192301 if (source == oneStepButton)
19202302 {
19212303 Globals.ONESTEP = true;
....@@ -1923,17 +2305,14 @@
19232305 } else
19242306 if (source == screenfitButton)
19252307 {
1926
- //Reload(lastConverter, lastFilename, true);
19272308 ScreenFit();
19282309 } else
19292310 if (source == screenfitpointButton)
19302311 {
1931
- //Reload(lastConverter, lastFilename, true);
19322312 ScreenFitPoint();
19332313 } else
19342314 if (source == snapobjectButton)
19352315 {
1936
- //Reload(lastConverter, lastFilename, true);
19372316 SnapObject();
19382317 } else
19392318 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2348,14 @@
19692348 if (source == cutItem || source == clearButton)
19702349 {
19712350 loadClipboard(true);
2351
+ } else
2352
+ if (source == undoItem)
2353
+ {
2354
+ Undo();
2355
+ } else
2356
+ if (source == redoItem)
2357
+ {
2358
+ Redo();
19722359 } else
19732360 if (source == duplicateItem)
19742361 {
....@@ -2289,7 +2676,7 @@
22892676 {
22902677 StepAll();
22912678 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
22932680 {
22942681 //int indices[] = jList.getSelectedIndices();
22952682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +2688,9 @@
23012688 {
23022689 ClearSelection(true);
23032690 } else
2304
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
23052692 {
2306
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
23072694 } else
23082695 if (source == hideItem)
23092696 {
....@@ -2321,11 +2708,11 @@
23212708 {
23222709 makeSomething(new Camera());
23232710 } else
2324
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
23252712 {
23262713 group(new Composite());
23272714 } else
2328
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
23292716 {
23302717 RandomNode random = new RandomNode();
23312718 group(random);
....@@ -2427,7 +2814,7 @@
24272814 {
24282815 group(new cLinker());
24292816 } else
2430
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
24312818 {
24322819 group(new TextureNode());
24332820 } else
....@@ -2447,17 +2834,30 @@
24472834 {
24482835 CastShadow(2);
24492836 } else
2450
- if (source == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
24512838 {
2452
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
24532841 for (int i=0; i<group.selection.size(); i++)
24542842 {
2455
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
24562848 }
24572849
2458
- ClearSelection(false);
2459
-
2460
- 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
+ }
24612861 } else
24622862 if (source == genUVItem)
24632863 {
....@@ -2469,7 +2869,7 @@
24692869 } else
24702870 if (source == genNormalsMESHItem)
24712871 {
2472
- GenNormals(true); // TODO
2872
+ GenNormalsMESH();
24732873 } else
24742874 if (source == genNormalsORGANItem)
24752875 {
....@@ -2534,6 +2934,22 @@
25342934 if (source == unmarkleavesItem)
25352935 {
25362936 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);
25372953 } else
25382954 if (source == flipVItem)
25392955 {
....@@ -2742,7 +3158,7 @@
27423158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27433159 {
27443160 obj = (Object3D)e.nextElement();
2745
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
27463162 }
27473163
27483164 refreshContents();
....@@ -2758,6 +3174,31 @@
27583174
27593175 refreshContents();
27603176 } 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
27613202 if (source == flashSelectionButton)
27623203 {
27633204 CameraPane.flash = true;
....@@ -2769,6 +3210,10 @@
27693210 if (source == twoButton)
27703211 {
27713212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
27723217 // bug
27733218 //gridPanel.setDividerLocation(1.0);
27743219 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3246,31 @@
28013246 bigThree.ClearUI();
28023247 bigThree.add(centralPanel);
28033248 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
+
28043267 } else
28053268 if (source == threeButton)
28063269 {
28073270 radio.layout = threeButton;
3271
+
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
28083274
28093275 // bigThree.remove(scenePanel);
28103276 // bigThree.remove(centralPanel);
....@@ -2837,10 +3303,15 @@
28373303 bigThree.add(centralPanel);
28383304 bigThree.add(XYZPanel);
28393305 bigThree.FlushUI();
3306
+
3307
+ cameraView.requestFocusInWindow();
28403308 } else
28413309 if (source == fourButton)
28423310 {
28433311 radio.layout = fourButton;
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
28443315
28453316 // bigThree.remove(scenePanel);
28463317 // bigThree.remove(centralPanel);
....@@ -2872,10 +3343,15 @@
28723343 bigThree.ClearUI();
28733344 bigThree.add(scenePanel);
28743345 bigThree.FlushUI();
3346
+
3347
+ cameraView.requestFocusInWindow();
28753348 } else
28763349 if (source == sixButton)
28773350 {
28783351 radio.layout = sixButton;
3352
+
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
28793355
28803356 // bigThree.remove(scenePanel);
28813357 // bigThree.remove(centralPanel);
....@@ -2908,10 +3384,15 @@
29083384 bigThree.add(scenePanel);
29093385 bigThree.add(centralPanel);
29103386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
29113389 } else
29123390 if (source == sevenButton)
29133391 {
29143392 radio.layout = sevenButton;
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
29153396
29163397 // bigThree.remove(scenePanel);
29173398 // bigThree.remove(centralPanel);
....@@ -2945,6 +3426,8 @@
29453426 bigThree.add(centralPanel);
29463427 bigThree.add(XYZPanel);
29473428 bigThree.FlushUI();
3429
+
3430
+ cameraView.requestFocusInWindow();
29483431 } else
29493432 if (source == rootButton)
29503433 {
....@@ -2956,6 +3439,7 @@
29563439 EditObject(obj);
29573440 }
29583441
3442
+ cameraView.requestFocusInWindow();
29593443 refreshContents(true);
29603444 } else
29613445 if (source == closeButton)
....@@ -2965,22 +3449,37 @@
29653449 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663450 {
29673451 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3452
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693453 {
3454
+ // Patch to avoid bug with transparency.
3455
+ if (!ab.hadMaterial)
3456
+ {
3457
+ ab.object.material = null;
3458
+ }
3459
+
29703460 buttonGroup.remove(ab);
29713461 radioPanel.remove(ab);
29723462
2973
- ab.GetObject().editWindow = null;
3463
+ //ab.GetObject().editWindow = null;
3464
+ ab.GetObject().manipWindow = null;
29743465 // ab.GetObject().objectUI = null; // ?????????
29753466
29763467 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773468 break;
29783469 }
29793470 }
3471
+
3472
+ cameraView.requestFocusInWindow();
29803473 refreshContents(true);
29813474 } else
29823475 if (source == editItem || source == editButton)
29833476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
29843483 EditSelection(false);
29853484 } else
29863485 if (source == uneditButton)
....@@ -2990,10 +3489,11 @@
29903489 Object3D child = (Object3D)e.nextElement();
29913490 if(child.editWindow != null)
29923491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
29933493 child.CloseUI();
29943494 listUI.remove(child);
29953495
2996
- child.editWindow = null; // ???????????
3496
+ //child.editWindow = null; // ???????????
29973497 }
29983498 objEditor.ctrlPanel.FlushUI();
29993499 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3506,7 @@
30063506 //copy.ClearUI();
30073507 for (Object3D obj : listUI)
30083508 {
3509
+ obj.pinned = false;
30093510 obj.CloseUI();
30103511 }
30113512 listUI.clear();
....@@ -3015,7 +3516,7 @@
30153516 {
30163517 assert(copy == group);
30173518
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193520
30203521 for (Object3D obj : listUI)
30213522 {
....@@ -3064,6 +3565,9 @@
30643565 }
30653566
30663567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
30673571 //Globals.theRenderer.object = group;
30683572 if(!useclient)
30693573 {
....@@ -3079,20 +3583,46 @@
30793583 frontView.object = group;
30803584 sideView.object = group;
30813585 }
3082
- group.editWindow = this;
3586
+
3587
+// fix "+" issue
3588
+ //group.editWindow = this;
3589
+ group.manipWindow = this;
3590
+
30833591 /*
30843592 currentLayout = radio.layout;
30853593 if (currentLayout == null)
30863594 currentLayout = sevenButton;
30873595 */
30883596 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);
30893604 keepparent = group.parent;
30903605 // PARENT = NULL or not???
30913606 //group.parent = null; // ROOT
30923607 //group.attributes = -1;
30933608 ResetModel();
3609
+
3610
+ cameraView.requestFocusInWindow();
30943611 refreshContents(true);
3095
- }
3612
+ } else if (event.getSource() == editCameraItem)
3613
+ {
3614
+ cameraView.ProtectCamera();
3615
+ cameraView.repaint();
3616
+ return;
3617
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3618
+ {
3619
+ cameraView.RevertCamera();
3620
+ cameraView.repaint();
3621
+ return;
3622
+ // } else if (event.getSource() == textureButton)
3623
+ // {
3624
+ // return; // true;
3625
+ }
30963626 else
30973627 {
30983628 //return super.action(event, arg);
....@@ -3101,7 +3631,6 @@
31013631 }
31023632
31033633 boolean useclient = false;
3104
- cRadio radio;
31053634
31063635 void ToggleRoot()
31073636 {
....@@ -3340,7 +3869,8 @@
33403869
33413870 int size = obj.MemorySize();
33423871
3343
- 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)");
33443874 }
33453875 }
33463876 catch (Exception e)
....@@ -3421,6 +3951,13 @@
34213951 void GenNormals(boolean crease)
34223952 {
34233953 group.GenNormalsS(crease);
3954
+
3955
+ refreshContents();
3956
+ }
3957
+
3958
+ void GenNormalsMESH()
3959
+ {
3960
+ group.GenNormalsMeshS();
34243961
34253962 refreshContents();
34263963 }
....@@ -3656,7 +4193,7 @@
36564193
36574194 try
36584195 {
3659
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
36604197 }
36614198 catch (Exception e)
36624199 {
....@@ -4048,6 +4585,18 @@
40484585 refreshContents();
40494586 }
40504587
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
+
40514600 void SetTexRes(int tr)
40524601 {
40534602 group.selection.SetTexRes(tr);
....@@ -4119,28 +4668,25 @@
41194668 // }
41204669 // }
41214670
4122
- static boolean allparams = true;
4123
-
4124
- static Vector<Object3D> listUI = new Vector<Object3D>();
4125
-
41264671 void EditSelection(boolean newWindow)
41274672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
41284679 // aConstraints.gridy = 0;
41294680 for (int i=0; i<group.selection.size(); i++)
41304681 {
41314682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41324683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4133
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41344685
41354686 Object3D elem = (Object3D)group.selection.elementAt(i);
4136
- if(elem != group)
4687
+ if(elem != group || !newWindow)
41374688 {
4138
- // if (!(elem instanceof Composite))
4139
- // newWindow = false;
4140
- listUI.add(elem);
4141
- elem.openEditWindow(this, newWindow); //, false);
4142
- System.out.println("edit : " + elem);
4143
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
41444690 }
41454691 }
41464692 }
....@@ -4215,7 +4761,8 @@
42154761 //new Exception().printStackTrace();
42164762
42174763 freezemodel = true;
4218
-
4764
+ ClearUnpinned();
4765
+
42194766 /**/
42204767 //switch (event.id)
42214768 {
....@@ -4223,7 +4770,6 @@
42234770 //case 702: // Event.LIST_DESELECT
42244771 group.deselectAll();
42254772 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4226
- objEditor.ClearInfo(); // .GetMaterial());
42274773 if (tps != null)
42284774 {
42294775 for (int i=0; i < tps.length; i++)
....@@ -4232,10 +4778,8 @@
42324778
42334779 //if (child.parent != null)
42344780 //child.parent.addSelectee(child);
4781
+ objEditor.SetMaterial(child);
42354782 group.addSelectee(child);
4236
- objEditor.SetMaterial(child); // .GetMaterial());
4237
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4238
- System.err.println("info : " + child.GetPath());
42394783 }
42404784 }
42414785 // else
....@@ -4245,20 +4789,28 @@
42454789 // System.err.println("info : " + group.GetPath());
42464790 // }
42474791
4248
- objEditor.SetText(); // jan 2014
4249
-
4250
- 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))
42514793 CameraPane.flash = true;
42524794
4253
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4795
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42544796 // a camera
42554797 {
4256
- CameraPane.camerachangeframe = 0; // don't refuse it
4257
- 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
+ }
42584803 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42594804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42604805 }
42614806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
42624814 refreshContents();
42634815 //return true;
42644816 }
....@@ -4267,6 +4819,35 @@
42674819
42684820 freezemodel = false;
42694821 }
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
+ }
42704851
42714852 void linkSomething(Object3D thing)
42724853 {
....@@ -4338,6 +4919,7 @@
43384919 {
43394920 if (group.selection.isEmpty())
43404921 return;
4922
+
43414923 Grafreed.clipboardIsTempGroup = false;
43424924 Composite tGroup = null;
43434925 if (group.selection.size() > 0) // 1)
....@@ -4348,6 +4930,8 @@
43484930
43494931 if (cut)
43504932 {
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
43514935 //int indices[] = jList.getSelectedIndices();
43524936 //for (int i = indices.length - 1; i >= 0; i--)
43534937 //jList.remove(indices[i]);
....@@ -4437,8 +5021,10 @@
44375021 }
44385022
44395023 }
5024
+
44405025 if (Grafreed.clipboardIsTempGroup)
44415026 Grafreed.clipboard = tGroup;
5027
+
44425028 if (cut)
44435029 {
44445030 ResetModel();
....@@ -4448,6 +5034,10 @@
44485034
44495035 void paste(boolean expand)
44505036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
44515041 // if (GrafreeD.clipboard == null)
44525042 // return;
44535043 boolean first = true;
....@@ -4507,6 +5097,7 @@
45075097 Grafreed.clipboard.get(0).parent = keepparent;
45085098 }
45095099
5100
+ Globals.REPLACEONMAKE = keep;
45105101 ResetModel();
45115102 refreshContents();
45125103 }
....@@ -4642,6 +5233,10 @@
46425233
46435234 void group(Object3D csg, boolean grab)
46445235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
46455240 if (//false) // why??
46465241 !group.selection.isEmpty())
46475242 {
....@@ -4755,10 +5350,15 @@
47555350 //node.add(csg);
47565351 //makeSomething(node);
47575352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
47585354 }
47595355
47605356 void Ungroup(Object3D g)
47615357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
47625362 if (g instanceof HiddenObject)
47635363 {
47645364 HiddenObject h = (HiddenObject) g;
....@@ -4775,6 +5375,7 @@
47755375 objEditor.makeSomething(g.get(i), false);
47765376 }
47775377 }
5378
+ Globals.REPLACEONMAKE = keep;
47785379 }
47795380
47805381 void ungroup()
....@@ -4970,21 +5571,6 @@
49705571 }
49715572 */
49725573
4973
- void ImportGFD()
4974
- {
4975
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4976
- browser.show();
4977
- String filename = browser.getFile();
4978
- if (filename != null && filename.length() > 0)
4979
- {
4980
- String fullname = browser.getDirectory() + filename;
4981
-
4982
- //Object3D readobj =
4983
- objEditor.ReadGFD(fullname, objEditor);
4984
- //makeSomething(readobj);
4985
- }
4986
- }
4987
-
49885574 /*
49895575 public void Callback(Object obj)
49905576 {
....@@ -5008,23 +5594,6 @@
50085594 }
50095595 */
50105596
5011
- void ImportVRMLX3D()
5012
- {
5013
- if (Grafreed.standAlone)
5014
- {
5015
- /**/
5016
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5017
- browser.show();
5018
- String filename = browser.getFile();
5019
- if (filename != null && filename.length() > 0)
5020
- {
5021
- String fullname = browser.getDirectory() + filename;
5022
- LoadVRMLX3D(fullname);
5023
- }
5024
- /**/
5025
- }
5026
- }
5027
-
50285597 String GetFile(String dialogName)
50295598 {
50305599 if (Grafreed.standAlone)
....@@ -5095,7 +5664,28 @@
50955664 cButton clearpanelButton;
50965665 cButton unselectButton;
50975666
5667
+ cButton restoreCameraButton;
5668
+
5669
+ cButton saveButton;
50985670 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;
50995689
51005690 cButton screenfitButton;
51015691 cButton screenfitpointButton;
....@@ -5108,14 +5698,6 @@
51085698
51095699 cButton setsupportButton;
51105700
5111
- cButton twoButton;
5112
- cButton sixButton;
5113
- cButton threeButton;
5114
- cButton sevenButton;
5115
- cButton fourButton; // full panel
5116
- cButton oneButton; // full XYZ
5117
- //cButton currentLayout;
5118
-
51195701 //
51205702 //Composite
51215703 Object3D // to do !!
....@@ -5125,9 +5707,11 @@
51255707 //JTree jTree;
51265708 private MenuItem lookAtItem;
51275709 private MenuItem lookFromItem;
5128
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
51295711 private MenuItem cutItem;
5130
- private MenuItem duplicateItem;
5712
+ private MenuItem undoItem;
5713
+ private MenuItem redoItem;
5714
+ private JMenuItem duplicateItem;
51315715 private MenuItem cloneItem;
51325716 private MenuItem cloneSupportItem;
51335717 private MenuItem overwriteGeoItem;
....@@ -5155,7 +5739,7 @@
51555739 private MenuItem pasteLinkItem;
51565740 private MenuItem pasteCloneItem;
51575741 private MenuItem pasteExpandItem;
5158
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
51595743 private MenuItem clearAllItem;
51605744 private MenuItem genUVItem;
51615745 private MenuItem genNormalsMESHItem;
....@@ -5190,6 +5774,10 @@
51905774 private MenuItem showleavesItem;
51915775 private MenuItem markleavesItem;
51925776 private MenuItem unmarkleavesItem;
5777
+ private MenuItem rewindleavesItem;
5778
+ private MenuItem unrewindleavesItem;
5779
+ private MenuItem randomleavesItem;
5780
+ private MenuItem unrandomleavesItem;
51935781
51945782 private MenuItem flipVItem;
51955783 private MenuItem unflipVItem;
....@@ -5211,7 +5799,7 @@
52115799 private MenuItem frontItem;
52125800 private MenuItem cameraItem;
52135801 private MenuItem compositeItem;
5214
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
52155803 private MenuItem physicsItem;
52165804 private MenuItem frameselectorItem;
52175805 private MenuItem scriptNodeItem;
....@@ -5235,6 +5823,8 @@
52355823 private MenuItem attachBumpItem;
52365824 private MenuItem detachBumpItem;
52375825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
52385828
52395829 private MenuItem particleItem;
52405830 private MenuItem ragdollItem;
....@@ -5273,11 +5863,6 @@
52735863 private MenuItem doubleItem;
52745864 private MenuItem tripleItem;
52755865
5276
- private MenuItem importGFDItem;
5277
- private MenuItem importVRMLX3DItem;
5278
- private MenuItem import3DSItem;
5279
- private MenuItem importOBJItem;
5280
-
52815866 private MenuItem computeAOItem;
52825867 private MenuItem recompileItem;
52835868 private MenuItem editScriptItem;
....@@ -5287,4 +5872,8 @@
52875872 private MenuItem analyzeItem;
52885873 private MenuItem dumpItem;
52895874 //boolean freezemodel = false;
5875
+
5876
+ Menu cameraMenu;
5877
+ MenuItem editCameraItem;
5878
+ MenuItem restoreCameraItem;
52905879 }