Normand Briere
2019-07-23 de4f66e0239a736bce24e09c9a0b49b5bb92d84b
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,18 +112,19 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
100119 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
120
+ assert(Grafreed.clipboard.parent == null);
121
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
122
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
123
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
124
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106125 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
126
+ makeSomething(CloneObject(Grafreed.clipboard, false));
127
+ Grafreed.clipboard.get(0).parent = keepparent;
109128 }
110129
111130 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +138,7 @@
119138 // obj.support = null;
120139 if (!supports)
121140 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
141
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123142 obj.parent = parent;
124143 // obj.support = support;
125144 // clone.support = support; // aout 2013
....@@ -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,14 +217,97 @@
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 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218312 revertMeshItem.addActionListener(this);
219313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +347,29 @@
253347 }
254348
255349 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
258352 backItem = menu.add(new MenuItem("Back"));
259353 backItem.addActionListener(this);
260354 frontItem = menu.add(new MenuItem("Front"));
261355 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
264361 hideItem = menu.add(new MenuItem("Hidden Group"));
265362 hideItem.addActionListener(this);
363
+ }
266364 ungroupItem = menu.add(new MenuItem("Ungroup"));
267365 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- 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
+ {
271373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272374 switchGeoItem.addActionListener(this);
273375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +377,6 @@
275377 morphItem = menu.add(new MenuItem("Morph Group"));
276378 morphItem.addActionListener(this);
277379
278
- if (Globals.ADVANCED)
279
- {
280380 menu.add("-");
281381 physicsItem = menu.add(new MenuItem("Physics"));
282382 physicsItem.addActionListener(this);
....@@ -284,30 +384,29 @@
284384 frameselectorItem.addActionListener(this);
285385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286386 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289387 }
290388
291389 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
294392 billboardItem = menu.add(new MenuItem("Billboard"));
295393 billboardItem.addActionListener(this);
296394 csgItem = menu.add(new MenuItem("CSG"));
297395 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299397 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301399 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
304405 if (Globals.ADVANCED)
305406 {
306407 menu.add("-");
307408 linkerItem = menu.add(new MenuItem("Linker"));
308409 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311410 templateItem = menu.add(new MenuItem("Template"));
312411 templateItem.addActionListener(this);
313412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -318,8 +417,12 @@
318417 resetTransformItem.addActionListener(this);
319418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320419 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
420
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
421
+ resetCentroidXZItem.addActionListener(this);
422
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
423
+ transformGeometryItem.addActionListener(this);
424
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
425
+ transformChildrenItem.addActionListener(this);
323426
324427 oe.menuBar.add(menu = new Menu("Geometry"));
325428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -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"));
....@@ -368,6 +471,10 @@
368471 oe.menuBar.add(menu = new Menu("Attributes"));
369472 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370473 clearMaterialsItem.addActionListener(this);
474
+ resetAllItem = menu.add(new MenuItem("Reset All"));
475
+ resetAllItem.addActionListener(this);
476
+ stepAllItem = menu.add(new MenuItem("Step All"));
477
+ stepAllItem.addActionListener(this);
371478 menu.add("-");
372479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373480 liveleavesItem.addActionListener(this);
....@@ -388,6 +495,14 @@
388495 markleavesItem.addActionListener(this);
389496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390497 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);
391506 menu.add("-");
392507 flipVItem = menu.add(new MenuItem("Flip V"));
393508 flipVItem.addActionListener(this);
....@@ -413,47 +528,56 @@
413528 attachBumpItem.addActionListener(this);
414529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
415530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
416532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
417533 detachPigmentItem.addActionListener(this);
418534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
419535 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);
420540 menu.add("-");
421541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
422542 sortbysizeItem.addActionListener(this);
423543 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424544 sortbynameItem.addActionListener(this);
545
+ menu.add("-");
546
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
547
+ shareGeometriesItem.addActionListener(this);
548
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
549
+ mergeGeometriesItem.addActionListener(this);
425550 if (Globals.ADVANCED)
426551 {
427
- menu.add("-");
552
+ // Pretty much the same as duplicate and clone.
428553 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429554 extractGeometriesItem.addActionListener(this);
430555 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431556 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436557 }
437558
438559 oe.menuBar.add(menu = new Menu("Insert"));
439560 buildCreateMenu(menu);
440561
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
443
- importGFDItem.addActionListener(this);
444
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
445
- importVRMLX3DItem.addActionListener(this);
446
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
- importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
- import3DSItem.addActionListener(this);
450
-
451562 oe.menuBar.add(menu = new Menu("Tools"));
452563 buildToolsMenu(menu);
453564 }
454565
566
+
455567 void SetupUI2(ObjEditor oe)
456568 {
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
+
457581 //new Exception().printStackTrace();
458582
459583 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -482,97 +606,230 @@
482606 oe.radioPanel.add(dummyButton);
483607 oe.buttonGroup.add(dummyButton);
484608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
485613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486614
487
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- liveCB.setToolTipText("Enabled animation");
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);
666
+ liveCB.setToolTipText("Enable animation");
489667 liveCB.addItemListener(this);
490668
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492670 oneStepButton.setToolTipText("Animate one step forward");
493671 oneStepButton.addActionListener(this);
494672
495
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
496674 fastCB.setToolTipText("Fast mode");
497675 fastCB.addItemListener(this);
498676
499
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
500
- trackCB.setToolTipText("Enable tracking");
501
- trackCB.addItemListener(this);
502
-
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- screenfitButton.setToolTipText("Screen fit");
505
- 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);
506682
507683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
508684 // screenfitpointButton.addActionListener(this);
509685
510686 if (Globals.ADVANCED)
511687 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513689 snapobjectButton.addActionListener(this);
514690 snapobjectButton.setToolTipText("Snap Object");
515691 }
516692
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
518
- flashSelectionButton.setToolTipText("Show selection");
519
- flashSelectionButton.addActionListener(this);
693
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
520694
521
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522
-
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
524
- twoButton.setToolTipText("Show center view only");
525
- twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527696 fourButton.addActionListener(this);
528697 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
530
- 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");
531706 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
533
- threeButton.setToolTipText("2-column layout right");
534
- threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
536
- sevenButton.setToolTipText("3-column layout");
537
- 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);
538713 //
539714
540
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
541
- 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");
542717 rootButton.addActionListener(this);
543718
544
- 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);
545720 closeButton.setToolTipText("Close tab");
546721 closeButton.addActionListener(this);
547722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
548723 //clearButton.addActionListener(this);
549
-
550
- 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
+ }
551756
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
553
- 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");
554806 editButton.addActionListener(this);
555807
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
557
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
558810 uneditButton.addActionListener(this);
559811
560
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
561
- allParamsButton.setToolTipText("Edit all params");
812
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
813
+ allParamsButton.setToolTipText("Show all controle");
562814 allParamsButton.addActionListener(this);
563815
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
816
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565817 clearPanelButton.setToolTipText("Clear edit panel");
566818 clearPanelButton.addActionListener(this);
567819
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
820
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569821 unselectButton.setToolTipText("Unselect");
570822 unselectButton.addActionListener(this);
571823
572
- 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);
573827
574
- oe.treePanel.add(commandsPanel);
575
- oe.treePanel.Return();
828
+ editCommandsPanel.preferredHeight = 1;
829
+
830
+ SetPinStates(false);
831
+// oe.treePanel.add(commandsPanel);
832
+// oe.treePanel.Return();
576833
577834 // oe.aConstraints.gridx += 1;
578835 // oe.aConstraints.weighty = 0;
....@@ -589,29 +846,17 @@
589846
590847 JScrollPane jSP;
591848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
592
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
593850 ResetModel();
594851
595852 oe.treePanel.add(jSPPanel);
596853 oe.treePanel.Return();
597854
598
- cGridBag copyOptionsPanel = new cGridBag();
599
-
600
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
601
- colorCB.setToolTipText("Copy color when dropped");
602
- colorCB.addItemListener(this);
603
-
604
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
605
- materialCB.setToolTipText("Copy material when dropped");
606
- materialCB.addItemListener(this);
607
-
608
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
609
- textureCB.setToolTipText("Copy texture when dropped");
610
- textureCB.addItemListener(this);
611
-
612
- copyOptionsPanel.preferredHeight = 1;
613855 oe.treePanel.add(copyOptionsPanel);
614856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
615860
616861 // mainPanel.setDividerLocation(0.5); //1.0);
617862 // mainPanel.setResizeWeight(0.5);
....@@ -634,29 +879,49 @@
634879 dgr.addDragGestureListener(this);
635880 }catch(Exception e) {}
636881 */
637
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
638883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
639884 }
640885
641886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
642887 {
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
+
643902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
644903 boxCB.setToolTipText("Display bounding boxes");
645904 boxCB.addItemListener(this);
646905
647906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
648
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
649908 zoomBoxCB.addItemListener(this);
650909
651
- if (Globals.ADVANCED)
910
+ if (true) // Globals.ADVANCED)
652911 {
653
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654
- supportCB.setToolTipText("Enable rigging");
655
- 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);
656919
657920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
658921 // localCB.addItemListener(this);
659922
923
+ panel.Return();
924
+
660925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
661926 crowdCB.setToolTipText("Used for crowds");
662927 crowdCB.addItemListener(this);
....@@ -673,6 +938,8 @@
673938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
674939 // speakerMocapCB.addItemListener(this);
675940
941
+ panel.Return();
942
+
676943 if (false)
677944 {
678945 // handled in scripts
....@@ -687,42 +954,85 @@
687954 //constraints.gridy += 1;
688955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
689956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
690958 }
691959
692960 //constraints.gridx += 1;
693961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
694962 // debugCB.addItemListener(this);
695963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
696968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
969
+ oeilCB.setToolTipText("Move camera when tracking");
697970 oeilCB.addItemListener(this);
698971
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
+ {
699992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
700993 lookAtCB.setToolTipText("Look-at target");
701994 lookAtCB.addItemListener(this);
995
+ }
702996
703997 }
704998
705999 cGridBag fill = new cGridBag();
706
-
7071000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
7081005
7091006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
7101009
7111010 }
7121011
7131012 void EditObject(Object3D obj)
7141013 {
7151014 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
+
7161023 radioButton.SetObject(obj);
717
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
7181025 radioButton.SetCamera(cameraView.renderCamera, false);
7191026 radioButton.addActionListener(this);
7201027 radioPanel.add(radioButton);
7211028 buttonGroup.add(radioButton);
7221029 radioButton.doClick();
7231030 }
1031
+
7241032 void SetupViews(ObjEditor oe)
7251033 {
1034
+ theFrame = this;
1035
+
7261036 oe.SetupViews();
7271037
7281038 System.out.println("SetupViews");
....@@ -731,23 +1041,28 @@
7311041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7321042 }
7331043
734
- JCheckBox liveCB;
735
- JCheckBox supportCB;
736
- JCheckBox localCB;
737
- JCheckBox crowdCB;
738
- JCheckBox smoothCB;
739
- JCheckBox fastCB;
740
- JCheckBox slowCB;
741
- JCheckBox boxCB;
742
- JCheckBox zoomBoxCB;
743
- JCheckBox trackCB;
744
- 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;
7451057 // JCheckBox speakerMocapCB;
746
- JCheckBox speakerCameraCB;
747
- JCheckBox speakerFocusCB;
748
- JCheckBox debugCB;
749
- JCheckBox oeilCB;
750
- JCheckBox lookAtCB;
1058
+ cCheckBox speakerCameraCB;
1059
+ cCheckBox speakerFocusCB;
1060
+ cCheckBox debugCB;
1061
+
1062
+ cCheckBox oeilCB;
1063
+ cCheckBox shadowCB;
1064
+ cCheckBox autokeepCB;
1065
+ cCheckBox lookAtCB;
7511066
7521067 // static int COLOR = 1;
7531068 // static int MATERIAL = 2;
....@@ -755,9 +1070,9 @@
7551070
7561071 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7571072
758
- JCheckBox colorCB;
759
- JCheckBox materialCB;
760
- JCheckBox textureCB;
1073
+ cCheckBox colorCB;
1074
+ cCheckBox materialCB;
1075
+ cCheckBox textureCB;
7611076
7621077 public void itemStateChanged(ItemEvent e)
7631078 {
....@@ -785,6 +1100,7 @@
7851100 } else if(e.getSource() == liveCB)
7861101 {
7871102 cameraView.ToggleLive();
1103
+ refreshContents(false);
7881104 }
7891105 else if(e.getSource() == supportCB)
7901106 {
....@@ -849,6 +1165,18 @@
8491165 {
8501166 cameraView.ToggleOeil();
8511167 }
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
+ }
8521180 else if(e.getSource() == lookAtCB)
8531181 {
8541182 cameraView.ToggleLookAt();
....@@ -865,7 +1193,8 @@
8651193
8661194 /**/
8671195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
868
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
8691198 if ((path == null) || (path.getPathCount() <= 1)) {
8701199 // We can't move the root node or an empty selection
8711200 return;
....@@ -928,8 +1257,6 @@
9281257 }
9291258 }
9301259
931
- String string = (String) object;
932
-
9331260 System.out.println("Transfer = " + object + "; drop : " + target);
9341261 // if( object instanceof java.io.File[])
9351262 // {
....@@ -937,7 +1264,11 @@
9371264 // objEditor.DropFile((java.io.File[]) object, true);
9381265 // return;
9391266 // }
940
- if (string.charAt(0) == '/')
1267
+
1268
+ String string = object.toString();
1269
+
1270
+ // File path for Mac and Windows
1271
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9411272 {
9421273 // file(s)
9431274 String[] names = string.split("\n");
....@@ -964,7 +1295,7 @@
9641295
9651296 flashIt = false;
9661297 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1298
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681299 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691300
9701301 if (group.selection.size() == 1)
....@@ -980,23 +1311,33 @@
9801311
9811312 assert target == objEditor.jTree;
9821313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
9831315 try {
984
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9851317 } catch (Exception e) {
9861318 System.out.println("destinationPath : " + destinationPath);
9871319 return;
9881320 }
9891321
990
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
9911323 {
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
+// {
9921333 loadClipboard(true);
9931334 objEditor.jTree.setSelectionPath(destinationPath);
9941335 pasteInto(false, false);
995
- } else {
996
- loadClipboard(false);
997
- objEditor.jTree.setSelectionPath(destinationPath);
998
- pasteInto(false, false); // true); // ???
999
- }
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
10001341 }
10011342 public void dropActionChanged(DropTargetDragEvent dtde)
10021343 // Called if the user has modified the current drop gesture
....@@ -1101,22 +1442,30 @@
11011442 {
11021443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11031444 //heightFieldItem.addActionListener(this);
1104
- gridItem = menu.add(new MenuItem("Grid"));
1105
- gridItem.addActionListener(this);
1106
- rectoidItem = menu.add(new MenuItem("Box"));
1107
- rectoidItem.addActionListener(this);
1108
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1109
- ellipsoidItem.addActionListener(this);
1110
- coneItem = menu.add(new MenuItem("Cone"));
1111
- coneItem.addActionListener(this);
1112
- torusItem = menu.add(new MenuItem("Torus"));
1113
- torusItem.addActionListener(this);
1114
- superItem = menu.add(new MenuItem("Superellipsoid"));
1115
- 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
+ {
11161463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11171464 kleinItem.addActionListener(this);
1118
- particleItem = menu.add(new MenuItem("Particle system"));
1119
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
11201469 if (Globals.ADVANCED)
11211470 {
11221471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1142,15 +1491,15 @@
11421491 }
11431492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11441493 bezierItem.addActionListener(this);
1145
- overlayItem = menu.add(new MenuItem("Overlay"));
1146
- overlayItem.addActionListener(this);
1147
- lightItem = menu.add(new MenuItem("Light"));
1148
- 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);
11491498 menu.add("-");
11501499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11511500 //superLoopItem.addActionListener(this);
1152
- loopItem = menu.add(new MenuItem("Loop"));
1153
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
11541503 doubleItem = menu.add(new MenuItem("Fork"));
11551504 doubleItem.addActionListener(this);
11561505 if (Globals.ADVANCED)
....@@ -1166,6 +1515,9 @@
11661515 animationItem.addItemListener(this);
11671516 animationItem.setState(Globals.ANIMATION);
11681517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
11691521 menu.add("-");
11701522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11711523 parseverticesItem.addActionListener(this);
....@@ -1178,6 +1530,8 @@
11781530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11791531 reduce34MorphItem.addActionListener(this);
11801532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
11811535 menu.add(computeAOItem = new MenuItem("Compute AO"));
11821536 computeAOItem.addActionListener(this);
11831537
....@@ -1186,11 +1540,9 @@
11861540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11871541 mirrorItem.addActionListener(this);
11881542 menu.add("-");
1189
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1190
- memoryItem.addActionListener(this);
11911543 menu.add(analyzeItem = new MenuItem("Analyze"));
11921544 analyzeItem.addActionListener(this);
1193
- menu.add(dumpItem = new MenuItem("Dump"));
1545
+ menu.add(dumpItem = new MenuItem("Print"));
11941546 dumpItem.addActionListener(this);
11951547 // menu.add(pathItem = new MenuItem("From-to path"));
11961548 // pathItem.addActionListener(this);
....@@ -1331,9 +1683,34 @@
13311683 shadow.material = new cMaterial(obj.material);
13321684 shadow.material.diffuse = 0.0001f;
13331685 shadow.material.specular = 0.0001f;
1686
+ //shadow.projectedVertices[1].x = 300;
13341687
13351688 makeSomething(shadow);
13361689 }
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
+ }
13371714
13381715 /**
13391716 * applyExample
....@@ -1537,9 +1914,9 @@
15371914
15381915 void Overwrite(int mask)
15391916 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1917
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411918 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1919
+ Object3D content = Grafreed.clipboard.get(0);
15431920
15441921 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451922 content = ((cGroup)content).get(0);
....@@ -1578,7 +1955,7 @@
15781955 {
15791956 ScreenFit();
15801957 } else
1581
- if (source == switchItem)
1958
+ if (source == switchViewItem)
15821959 {
15831960 cVector v1 = new cVector();
15841961 cVector v2 = new cVector();
....@@ -1587,11 +1964,11 @@
15871964 objEditor.cameraView.renderCamera.setAim(v2, v1);
15881965 objEditor.cameraView.repaint();
15891966 } else
1590
- if (source == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
15911968 {
15921969 makeSomething(new Box());
15931970 } else
1594
- if (source == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
15951972 {
15961973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15971974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1670,27 +2047,27 @@
16702047
16712048 makeSomething(obj);
16722049 } else
1673
- if (source == gridItem)
2050
+ if (source == gridItem || source == gridButton)
16742051 {
16752052 makeSomething(new Grid());
16762053 } else
1677
- if (source == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
16782055 {
16792056 makeSomething(new Sphere());
16802057 } else
1681
- if (source == coneItem)
2058
+ if (source == coneItem || source == coneButton)
16822059 {
16832060 makeSomething(new Cone());
16842061 } else
1685
- if (source == torusItem)
2062
+ if (source == torusItem || source == torusButton)
16862063 {
16872064 makeSomething(new Torus());
16882065 } else
1689
- if (source == superItem)
2066
+ if (source == superItem || source == superButton)
16902067 {
16912068 makeSomething(new Superellipsoid());
16922069 } else
1693
- if (source == kleinItem)
2070
+ if (source == kleinItem || source == kleinButton)
16942071 {
16952072 makeSomething(new Klein());
16962073 } else
....@@ -1710,7 +2087,7 @@
17102087 {
17112088 makeSomething(new BezierSurface());
17122089 } else
1713
- if (source == overlayItem)
2090
+ if (source == overlayItem || source == overlayButton)
17142091 {
17152092 /*
17162093 Object3D obj = new BezierSurface(5,8);
....@@ -1758,7 +2135,7 @@
17582135 s.setup();
17592136 makeSomething(s);
17602137 } else
1761
- if (source == lightItem)
2138
+ if (source == lightItem || source == lightButton)
17622139 {
17632140 makeSomething(new Light());
17642141 } else
....@@ -1808,30 +2185,30 @@
18082185
18092186 group(g);
18102187 } else
1811
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
18122189 {
18132190 Composite csg = new GroupLeaf();
18142191 csg.count = 5;
18152192 group(csg);
1816
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
18172194 csg.addChild(child);
18182195 child.addChild(csg);
18192196 } else
18202197 if (source == doubleItem)
18212198 {
1822
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
18232200 csg.count = 5;
18242201 group(csg);
1825
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
18262203 csg.addChild(child);
18272204 child.addChild(csg);
1828
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
18292206 csg.addChild(child);
18302207 child.addChild(csg);
18312208 } else
18322209 if (source == tripleItem)
18332210 {
1834
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
18352212 csg.count = 4;
18362213 group(csg);
18372214 Composite child = new cGroup();
....@@ -1843,23 +2220,6 @@
18432220 child = new cGroup();
18442221 csg.addChild(child);
18452222 child.addChild(csg);
1846
- } else
1847
-
1848
- if (source == importGFDItem)
1849
- {
1850
- ImportGFD();
1851
- } else
1852
- if (source == importVRMLX3DItem)
1853
- {
1854
- ImportVRMLX3D();
1855
- } else
1856
- if (source == import3DSItem)
1857
- {
1858
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1859
- } else
1860
- if (source == importOBJItem)
1861
- {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18632223 } else
18642224 if (source == computeAOItem)
18652225 {
....@@ -1879,7 +2239,7 @@
18792239 if (source == invariantsItem)
18802240 {
18812241 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
2242
+ Grafreed.grafreeD.universe.invariants();
18832243 } else
18842244 if (source == memoryItem)
18852245 {
....@@ -1898,6 +2258,46 @@
18982258 {
18992259 DumpObject();
19002260 } 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
19012301 if (source == oneStepButton)
19022302 {
19032303 Globals.ONESTEP = true;
....@@ -1905,17 +2305,14 @@
19052305 } else
19062306 if (source == screenfitButton)
19072307 {
1908
- //Reload(lastConverter, lastFilename, true);
19092308 ScreenFit();
19102309 } else
19112310 if (source == screenfitpointButton)
19122311 {
1913
- //Reload(lastConverter, lastFilename, true);
19142312 ScreenFitPoint();
19152313 } else
19162314 if (source == snapobjectButton)
19172315 {
1918
- //Reload(lastConverter, lastFilename, true);
19192316 SnapObject();
19202317 } else
19212318 // if (event.getSource() == recompileButton)
....@@ -1952,12 +2349,20 @@
19522349 {
19532350 loadClipboard(true);
19542351 } else
2352
+ if (source == undoItem)
2353
+ {
2354
+ Undo();
2355
+ } else
2356
+ if (source == redoItem)
2357
+ {
2358
+ Redo();
2359
+ } else
19552360 if (source == duplicateItem)
19562361 {
1957
- Object3D keep = GrafreeD.clipboard;
2362
+ Object3D keep = Grafreed.clipboard;
19582363 loadClipboard(false);
19592364 paste(false);
1960
- GrafreeD.clipboard = keep;
2365
+ Grafreed.clipboard = keep;
19612366 } else
19622367 if (source == cloneItem)
19632368 {
....@@ -2177,9 +2582,9 @@
21772582 // group.selection.get(0).setMasterThis(content); // should be identity
21782583 // refreshContents();
21792584 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2585
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812586 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2587
+ Object3D content = Grafreed.clipboard.get(0);
21832588
21842589 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852590 content = ((cGroup)content).get(0);
....@@ -2229,9 +2634,9 @@
22292634 } else
22302635 if (source == setMasterItem)
22312636 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2637
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332638 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2639
+ Object3D content = Grafreed.clipboard.get(0);
22352640
22362641 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372642 content = ((cGroup)content).get(0);
....@@ -2244,9 +2649,9 @@
22442649 {
22452650 if (group.selection.size() == 1)
22462651 {
2247
- if (GrafreeD.clipboard.size() == 1)
2652
+ if (Grafreed.clipboard.size() == 1)
22482653 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2654
+ Object3D content = Grafreed.clipboard.get(0);
22502655
22512656 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522657 content = ((cGroup)content).get(0);
....@@ -2263,7 +2668,7 @@
22632668 {
22642669 RevertMeshes();
22652670 } else
2266
- if (source == resetMeshItem)
2671
+ if (source == resetAllItem)
22672672 {
22682673 ResetAll();
22692674 } else
....@@ -2271,7 +2676,7 @@
22712676 {
22722677 StepAll();
22732678 } else
2274
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
22752680 {
22762681 //int indices[] = jList.getSelectedIndices();
22772682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2283,9 +2688,9 @@
22832688 {
22842689 ClearSelection(true);
22852690 } else
2286
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
22872692 {
2288
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
22892694 } else
22902695 if (source == hideItem)
22912696 {
....@@ -2303,11 +2708,11 @@
23032708 {
23042709 makeSomething(new Camera());
23052710 } else
2306
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
23072712 {
23082713 group(new Composite());
23092714 } else
2310
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
23112716 {
23122717 RandomNode random = new RandomNode();
23132718 group(random);
....@@ -2409,7 +2814,7 @@
24092814 {
24102815 group(new cLinker());
24112816 } else
2412
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
24132818 {
24142819 group(new TextureNode());
24152820 } else
....@@ -2429,17 +2834,30 @@
24292834 {
24302835 CastShadow(2);
24312836 } else
2432
- if (source == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
24332838 {
2434
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
24352841 for (int i=0; i<group.selection.size(); i++)
24362842 {
2437
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
24382848 }
24392849
2440
- ClearSelection(false);
2441
-
2442
- 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
+ }
24432861 } else
24442862 if (source == genUVItem)
24452863 {
....@@ -2451,7 +2869,7 @@
24512869 } else
24522870 if (source == genNormalsMESHItem)
24532871 {
2454
- GenNormals(true); // TODO
2872
+ GenNormalsMESH();
24552873 } else
24562874 if (source == genNormalsORGANItem)
24572875 {
....@@ -2516,6 +2934,22 @@
25162934 if (source == unmarkleavesItem)
25172935 {
25182936 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);
25192953 } else
25202954 if (source == flipVItem)
25212955 {
....@@ -2601,9 +3035,13 @@
26013035 {
26023036 SmoothMesh();
26033037 } else
2604
- if (source == transformgeometryItem)
3038
+ if (source == transformGeometryItem)
26053039 {
26063040 TransformGeometry();
3041
+ } else
3042
+ if (source == transformChildrenItem)
3043
+ {
3044
+ TransformChildren();
26073045 } else
26083046 if (source == resetTransformItem)
26093047 {
....@@ -2611,7 +3049,11 @@
26113049 } else
26123050 if (source == resetCentroidItem)
26133051 {
2614
- ResetCentroid();
3052
+ ResetCentroid(true);
3053
+ } else
3054
+ if (source == resetCentroidXZItem)
3055
+ {
3056
+ ResetCentroid(false);
26153057 } else
26163058 if (source == resetParentItem)
26173059 {
....@@ -2716,7 +3158,7 @@
27163158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27173159 {
27183160 obj = (Object3D)e.nextElement();
2719
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
27203162 }
27213163
27223164 refreshContents();
....@@ -2732,6 +3174,31 @@
27323174
27333175 refreshContents();
27343176 } 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
27353202 if (source == flashSelectionButton)
27363203 {
27373204 CameraPane.flash = true;
....@@ -2743,6 +3210,10 @@
27433210 if (source == twoButton)
27443211 {
27453212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
27463217 // bug
27473218 //gridPanel.setDividerLocation(1.0);
27483219 //bigPanel.setDividerLocation(0.0);
....@@ -2775,10 +3246,31 @@
27753246 bigThree.ClearUI();
27763247 bigThree.add(centralPanel);
27773248 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
+
27783267 } else
27793268 if (source == threeButton)
27803269 {
27813270 radio.layout = threeButton;
3271
+
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
27823274
27833275 // bigThree.remove(scenePanel);
27843276 // bigThree.remove(centralPanel);
....@@ -2811,10 +3303,15 @@
28113303 bigThree.add(centralPanel);
28123304 bigThree.add(XYZPanel);
28133305 bigThree.FlushUI();
3306
+
3307
+ cameraView.requestFocusInWindow();
28143308 } else
28153309 if (source == fourButton)
28163310 {
28173311 radio.layout = fourButton;
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
28183315
28193316 // bigThree.remove(scenePanel);
28203317 // bigThree.remove(centralPanel);
....@@ -2846,10 +3343,15 @@
28463343 bigThree.ClearUI();
28473344 bigThree.add(scenePanel);
28483345 bigThree.FlushUI();
3346
+
3347
+ cameraView.requestFocusInWindow();
28493348 } else
28503349 if (source == sixButton)
28513350 {
28523351 radio.layout = sixButton;
3352
+
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
28533355
28543356 // bigThree.remove(scenePanel);
28553357 // bigThree.remove(centralPanel);
....@@ -2882,10 +3384,15 @@
28823384 bigThree.add(scenePanel);
28833385 bigThree.add(centralPanel);
28843386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
28853389 } else
28863390 if (source == sevenButton)
28873391 {
28883392 radio.layout = sevenButton;
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
28893396
28903397 // bigThree.remove(scenePanel);
28913398 // bigThree.remove(centralPanel);
....@@ -2919,6 +3426,8 @@
29193426 bigThree.add(centralPanel);
29203427 bigThree.add(XYZPanel);
29213428 bigThree.FlushUI();
3429
+
3430
+ cameraView.requestFocusInWindow();
29223431 } else
29233432 if (source == rootButton)
29243433 {
....@@ -2930,6 +3439,7 @@
29303439 EditObject(obj);
29313440 }
29323441
3442
+ cameraView.requestFocusInWindow();
29333443 refreshContents(true);
29343444 } else
29353445 if (source == closeButton)
....@@ -2939,22 +3449,37 @@
29393449 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29403450 {
29413451 ab = (cRadio)e.nextElement();
2942
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3452
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29433453 {
3454
+ // Patch to avoid bug with transparency.
3455
+ if (!ab.hadMaterial)
3456
+ {
3457
+ ab.object.material = null;
3458
+ }
3459
+
29443460 buttonGroup.remove(ab);
29453461 radioPanel.remove(ab);
29463462
2947
- ab.GetObject().editWindow = null;
3463
+ //ab.GetObject().editWindow = null;
3464
+ ab.GetObject().manipWindow = null;
29483465 // ab.GetObject().objectUI = null; // ?????????
29493466
29503467 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29513468 break;
29523469 }
29533470 }
3471
+
3472
+ cameraView.requestFocusInWindow();
29543473 refreshContents(true);
29553474 } else
29563475 if (source == editItem || source == editButton)
29573476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
29583483 EditSelection(false);
29593484 } else
29603485 if (source == uneditButton)
....@@ -2964,10 +3489,11 @@
29643489 Object3D child = (Object3D)e.nextElement();
29653490 if(child.editWindow != null)
29663491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
29673493 child.CloseUI();
29683494 listUI.remove(child);
29693495
2970
- child.editWindow = null; // ???????????
3496
+ //child.editWindow = null; // ???????????
29713497 }
29723498 objEditor.ctrlPanel.FlushUI();
29733499 //objEditor.jTree.clearSelection();
....@@ -2980,6 +3506,7 @@
29803506 //copy.ClearUI();
29813507 for (Object3D obj : listUI)
29823508 {
3509
+ obj.pinned = false;
29833510 obj.CloseUI();
29843511 }
29853512 listUI.clear();
....@@ -2989,7 +3516,7 @@
29893516 {
29903517 assert(copy == group);
29913518
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29933520
29943521 for (Object3D obj : listUI)
29953522 {
....@@ -3038,6 +3565,9 @@
30383565 }
30393566
30403567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
30413571 //Globals.theRenderer.object = group;
30423572 if(!useclient)
30433573 {
....@@ -3053,20 +3583,46 @@
30533583 frontView.object = group;
30543584 sideView.object = group;
30553585 }
3056
- group.editWindow = this;
3586
+
3587
+// fix "+" issue
3588
+ //group.editWindow = this;
3589
+ group.manipWindow = this;
3590
+
30573591 /*
30583592 currentLayout = radio.layout;
30593593 if (currentLayout == null)
30603594 currentLayout = sevenButton;
30613595 */
30623596 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);
30633604 keepparent = group.parent;
30643605 // PARENT = NULL or not???
30653606 //group.parent = null; // ROOT
30663607 //group.attributes = -1;
30673608 ResetModel();
3609
+
3610
+ cameraView.requestFocusInWindow();
30683611 refreshContents(true);
3069
- }
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
+ }
30703626 else
30713627 {
30723628 //return super.action(event, arg);
....@@ -3075,7 +3631,6 @@
30753631 }
30763632
30773633 boolean useclient = false;
3078
- cRadio radio;
30793634
30803635 void ToggleRoot()
30813636 {
....@@ -3127,6 +3682,28 @@
31273682 refreshContents();
31283683 }
31293684
3685
+ void TransformChildren()
3686
+ {
3687
+ Object3D obj;
3688
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3689
+ {
3690
+ obj = (Object3D)e.nextElement();
3691
+ obj.KeepTextureMatrices();
3692
+ obj.TransformChildren();
3693
+ obj.RestoreTextureMatrices();
3694
+
3695
+// if (obj.parent == null)
3696
+// {
3697
+// System.out.println("NULL PARENT!");
3698
+// new Exception().printStackTrace();
3699
+// }
3700
+// else
3701
+// TouchTransform(obj);
3702
+// //obj.parent.Touch();
3703
+ }
3704
+
3705
+ refreshContents();
3706
+ }
31303707
31313708 void ResetTransform()
31323709 {
....@@ -3239,7 +3816,7 @@
32393816 refreshContents();
32403817 }
32413818
3242
- void ResetCentroid()
3819
+ void ResetCentroid(boolean full)
32433820 {
32443821 Object3D obj;
32453822 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3831,16 @@
32543831 LA.matIdentity(Object3D.mat);
32553832 obj.getBounds(minima, maxima, false);
32563833 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3834
+ if (full)
3835
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583836 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593837 obj.TransformMesh(Object3D.mat);
3838
+
32603839 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3840
+ if (full)
3841
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623842 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3843
+
32633844 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643845 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653846 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3288,7 +3869,8 @@
32883869
32893870 int size = obj.MemorySize();
32903871
3291
- 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)");
32923874 }
32933875 }
32943876 catch (Exception e)
....@@ -3325,9 +3907,9 @@
33253907 obj = (Object3D)e.nextElement();
33263908
33273909 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3910
+ Grafreed.AnalyzeObject(obj);
33293911 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3912
+ Grafreed.AnalyzeObject(obj.bRep);
33313913
33323914 // System.err.println((size/1024) + " KB is the size of " + obj);
33333915 }
....@@ -3369,6 +3951,13 @@
33693951 void GenNormals(boolean crease)
33703952 {
33713953 group.GenNormalsS(crease);
3954
+
3955
+ refreshContents();
3956
+ }
3957
+
3958
+ void GenNormalsMESH()
3959
+ {
3960
+ group.GenNormalsMeshS();
33723961
33733962 refreshContents();
33743963 }
....@@ -3541,8 +4130,8 @@
35414130
35424131 void ParseVertices()
35434132 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
4133
+ boolean epsequal = Grafreed.epsequal;
4134
+ Grafreed.epsequal = true;
35464135
35474136 for (int i=0; i<group.selection.size(); i++)
35484137 {
....@@ -3567,7 +4156,7 @@
35674156 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35684157 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35694158
3570
- g.add(GrafreeD.clipboard);
4159
+ g.add(Grafreed.clipboard);
35714160
35724161 buffer.add(g);
35734162 }
....@@ -3582,7 +4171,7 @@
35824171 makeSomething(buffer, i==group.selection.size()-1);
35834172 }
35844173
3585
- GrafreeD.epsequal = epsequal;
4174
+ Grafreed.epsequal = epsequal;
35864175
35874176 refreshContents();
35884177 }
....@@ -3600,7 +4189,16 @@
36004189 String pigment = Object3D.GetPigment(tex);
36014190 //String bump = Object3D.GetBump(tex);
36024191
3603
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4192
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4193
+
4194
+ try
4195
+ {
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4197
+ }
4198
+ catch (Exception e)
4199
+ {
4200
+ System.err.println("FAIL: " + node);
4201
+ }
36044202
36054203 double s = v.s;
36064204
....@@ -3732,7 +4330,7 @@
37324330 return;
37334331
37344332 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
4333
+ Object3D ref = Grafreed.clipboard.get(0);
37364334
37374335 Object3D newgroup = new Object3D("Po:" + poses.name);
37384336
....@@ -3926,9 +4524,9 @@
39264524
39274525 void ClipMesh()
39284526 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4527
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304528 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4529
+ Object3D content = Grafreed.clipboard.get(0);
39324530
39334531 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344532 content = ((cGroup)content).get(0);
....@@ -3937,7 +4535,7 @@
39374535 // {
39384536 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394537 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4538
+ group.selection.ClipMesh(Grafreed.clipboard);
39414539 }
39424540 // group.selection.ClipMesh(GrafreeD.clipboard);
39434541 System.out.println("DONE.");
....@@ -3984,6 +4582,18 @@
39844582 void MarkLeaves(boolean hide)
39854583 {
39864584 group.selection.MarkLeaves(hide);
4585
+ refreshContents();
4586
+ }
4587
+
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);
39874597 refreshContents();
39884598 }
39894599
....@@ -4058,28 +4668,25 @@
40584668 // }
40594669 // }
40604670
4061
- static boolean allparams = true;
4062
-
4063
- static Vector<Object3D> listUI = new Vector<Object3D>();
4064
-
40654671 void EditSelection(boolean newWindow)
40664672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
40674679 // aConstraints.gridy = 0;
40684680 for (int i=0; i<group.selection.size(); i++)
40694681 {
40704682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40714683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4072
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734685
40744686 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4687
+ if(elem != group || !newWindow)
40764688 {
4077
- // if (!(elem instanceof Composite))
4078
- // newWindow = false;
4079
- listUI.add(elem);
4080
- elem.openEditWindow(this, newWindow); //, false);
4081
- System.out.println("edit : " + elem);
4082
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
40834690 }
40844691 }
40854692 }
....@@ -4154,7 +4761,8 @@
41544761 //new Exception().printStackTrace();
41554762
41564763 freezemodel = true;
4157
-
4764
+ ClearUnpinned();
4765
+
41584766 /**/
41594767 //switch (event.id)
41604768 {
....@@ -4162,7 +4770,6 @@
41624770 //case 702: // Event.LIST_DESELECT
41634771 group.deselectAll();
41644772 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4165
- objEditor.ClearInfo(); // .GetMaterial());
41664773 if (tps != null)
41674774 {
41684775 for (int i=0; i < tps.length; i++)
....@@ -4171,10 +4778,8 @@
41714778
41724779 //if (child.parent != null)
41734780 //child.parent.addSelectee(child);
4781
+ objEditor.SetMaterial(child);
41744782 group.addSelectee(child);
4175
- objEditor.SetMaterial(child); // .GetMaterial());
4176
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4177
- System.err.println("info : " + child.GetPath());
41784783 }
41794784 }
41804785 // else
....@@ -4184,20 +4789,28 @@
41844789 // System.err.println("info : " + group.GetPath());
41854790 // }
41864791
4187
- objEditor.SetText(); // jan 2014
4188
-
4189
- 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))
41904793 CameraPane.flash = true;
41914794
4192
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4795
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41934796 // a camera
41944797 {
4195
- CameraPane.camerachangeframe = 0; // don't refuse it
4196
- 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
+ }
41974803 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41984804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41994805 }
42004806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
42014814 refreshContents();
42024815 //return true;
42034816 }
....@@ -4206,6 +4819,35 @@
42064819
42074820 freezemodel = false;
42084821 }
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
+ }
42094851
42104852 void linkSomething(Object3D thing)
42114853 {
....@@ -4277,16 +4919,19 @@
42774919 {
42784920 if (group.selection.isEmpty())
42794921 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4922
+
4923
+ Grafreed.clipboardIsTempGroup = false;
42814924 Composite tGroup = null;
42824925 if (group.selection.size() > 0) // 1)
42834926 {
42844927 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4928
+ Grafreed.clipboardIsTempGroup = true;
42864929 }
42874930
42884931 if (cut)
42894932 {
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
42904935 //int indices[] = jList.getSelectedIndices();
42914936 //for (int i = indices.length - 1; i >= 0; i--)
42924937 //jList.remove(indices[i]);
....@@ -4322,16 +4967,16 @@
43224967 //System.out.println("cut " + child);
43234968 //System.out.println("parent = " + child.parent);
43244969 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4970
+ if (Grafreed.clipboardIsTempGroup)
43264971 tGroup.add/*Child*/(tmp);
43274972 else
4328
- GrafreeD.clipboard = tmp;
4973
+ Grafreed.clipboard = tmp;
43294974 }
43304975 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4976
+ if (Grafreed.clipboardIsTempGroup)
43324977 tGroup.add/*Child*/(child);
43334978 else
4334
- GrafreeD.clipboard = child;
4979
+ Grafreed.clipboard = child;
43354980 }
43364981
43374982 //ResetModel();
....@@ -4363,21 +5008,23 @@
43635008 //System.out.println("cut " + elem);
43645009 //System.out.println("parent = " + elem.parent);
43655010 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
5011
+ if (Grafreed.clipboardIsTempGroup)
43675012 tGroup.add/*Child*/(tmp);
43685013 else
4369
- GrafreeD.clipboard = tmp;
5014
+ Grafreed.clipboard = tmp;
43705015 }
43715016 else
4372
- if (GrafreeD.clipboardIsTempGroup)
5017
+ if (Grafreed.clipboardIsTempGroup)
43735018 tGroup.add/*Child*/(child);
43745019 else
4375
- GrafreeD.clipboard = child;
5020
+ Grafreed.clipboard = child;
43765021 }
43775022
43785023 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
5024
+
5025
+ if (Grafreed.clipboardIsTempGroup)
5026
+ Grafreed.clipboard = tGroup;
5027
+
43815028 if (cut)
43825029 {
43835030 ResetModel();
....@@ -4387,11 +5034,15 @@
43875034
43885035 void paste(boolean expand)
43895036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
43905041 // if (GrafreeD.clipboard == null)
43915042 // return;
43925043 boolean first = true;
43935044
4394
- if (GrafreeD.clipboardIsTempGroup)
5045
+ if (Grafreed.clipboardIsTempGroup)
43955046 {
43965047 Composite temp;
43975048
....@@ -4402,7 +5053,7 @@
44025053 temp = (Composite)Applet3D.clipboard.deepCopy();
44035054 */
44045055 Object3D elem;
4405
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5056
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44065057 {
44075058 Object3D child = (Object3D)e.nextElement();
44085059
....@@ -4436,16 +5087,17 @@
44365087 //Object3D cb = Applet3D.clipboard;
44375088 //temp.addChild(cb);
44385089 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4439
- assert(GrafreeD.clipboard.parent == null);
4440
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4441
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4442
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4443
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5090
+ assert(Grafreed.clipboard.parent == null);
5091
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5092
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5093
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5094
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44445095 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
5096
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5097
+ Grafreed.clipboard.get(0).parent = keepparent;
44475098 }
44485099
5100
+ Globals.REPLACEONMAKE = keep;
44495101 ResetModel();
44505102 refreshContents();
44515103 }
....@@ -4492,9 +5144,9 @@
44925144 {
44935145 boolean first = true;
44945146
4495
- if (GrafreeD.clipboardIsTempGroup)
5147
+ if (Grafreed.clipboardIsTempGroup)
44965148 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
5149
+ Composite temp = (Composite)Grafreed.clipboard;
44985150 Object3D copy;
44995151 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45005152 {
....@@ -4504,7 +5156,7 @@
45045156 }
45055157 } else
45065158 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
5159
+ linkSomething(Grafreed.clipboard); //.get(0));
45085160 }
45095161 }
45105162 }
....@@ -4581,6 +5233,10 @@
45815233
45825234 void group(Object3D csg, boolean grab)
45835235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
45845240 if (//false) // why??
45855241 !group.selection.isEmpty())
45865242 {
....@@ -4694,10 +5350,15 @@
46945350 //node.add(csg);
46955351 //makeSomething(node);
46965352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
46975354 }
46985355
46995356 void Ungroup(Object3D g)
47005357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
47015362 if (g instanceof HiddenObject)
47025363 {
47035364 HiddenObject h = (HiddenObject) g;
....@@ -4714,6 +5375,7 @@
47145375 objEditor.makeSomething(g.get(i), false);
47155376 }
47165377 }
5378
+ Globals.REPLACEONMAKE = keep;
47175379 }
47185380
47195381 void ungroup()
....@@ -4909,21 +5571,6 @@
49095571 }
49105572 */
49115573
4912
- void ImportGFD()
4913
- {
4914
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4915
- browser.show();
4916
- String filename = browser.getFile();
4917
- if (filename != null && filename.length() > 0)
4918
- {
4919
- String fullname = browser.getDirectory() + filename;
4920
-
4921
- //Object3D readobj =
4922
- objEditor.ReadGFD(fullname, objEditor);
4923
- //makeSomething(readobj);
4924
- }
4925
- }
4926
-
49275574 /*
49285575 public void Callback(Object obj)
49295576 {
....@@ -4947,26 +5594,9 @@
49475594 }
49485595 */
49495596
4950
- void ImportVRMLX3D()
4951
- {
4952
- if (GrafreeD.standAlone)
4953
- {
4954
- /**/
4955
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4956
- browser.show();
4957
- String filename = browser.getFile();
4958
- if (filename != null && filename.length() > 0)
4959
- {
4960
- String fullname = browser.getDirectory() + filename;
4961
- LoadVRMLX3D(fullname);
4962
- }
4963
- /**/
4964
- }
4965
- }
4966
-
49675597 String GetFile(String dialogName)
49685598 {
4969
- if (GrafreeD.standAlone)
5599
+ if (Grafreed.standAlone)
49705600 {
49715601 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725602 browser.show();
....@@ -5034,7 +5664,28 @@
50345664 cButton clearpanelButton;
50355665 cButton unselectButton;
50365666
5667
+ cButton restoreCameraButton;
5668
+
5669
+ cButton saveButton;
50375670 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;
50385689
50395690 cButton screenfitButton;
50405691 cButton screenfitpointButton;
....@@ -5047,14 +5698,6 @@
50475698
50485699 cButton setsupportButton;
50495700
5050
- cButton twoButton;
5051
- cButton sixButton;
5052
- cButton threeButton;
5053
- cButton sevenButton;
5054
- cButton fourButton; // full panel
5055
- cButton oneButton; // full XYZ
5056
- //cButton currentLayout;
5057
-
50585701 //
50595702 //Composite
50605703 Object3D // to do !!
....@@ -5064,9 +5707,11 @@
50645707 //JTree jTree;
50655708 private MenuItem lookAtItem;
50665709 private MenuItem lookFromItem;
5067
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
50685711 private MenuItem cutItem;
5069
- private MenuItem duplicateItem;
5712
+ private MenuItem undoItem;
5713
+ private MenuItem redoItem;
5714
+ private JMenuItem duplicateItem;
50705715 private MenuItem cloneItem;
50715716 private MenuItem cloneSupportItem;
50725717 private MenuItem overwriteGeoItem;
....@@ -5079,7 +5724,7 @@
50795724 private MenuItem linkverticesItem;
50805725 private MenuItem relinkverticesItem;
50815726 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5727
+ private MenuItem resetAllItem;
50835728 private MenuItem stepAllItem;
50845729 private MenuItem revertMeshItem;
50855730 private MenuItem poseMeshItem;
....@@ -5094,7 +5739,7 @@
50945739 private MenuItem pasteLinkItem;
50955740 private MenuItem pasteCloneItem;
50965741 private MenuItem pasteExpandItem;
5097
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
50985743 private MenuItem clearAllItem;
50995744 private MenuItem genUVItem;
51005745 private MenuItem genNormalsMESHItem;
....@@ -5129,6 +5774,10 @@
51295774 private MenuItem showleavesItem;
51305775 private MenuItem markleavesItem;
51315776 private MenuItem unmarkleavesItem;
5777
+ private MenuItem rewindleavesItem;
5778
+ private MenuItem unrewindleavesItem;
5779
+ private MenuItem randomleavesItem;
5780
+ private MenuItem unrandomleavesItem;
51325781
51335782 private MenuItem flipVItem;
51345783 private MenuItem unflipVItem;
....@@ -5140,15 +5789,17 @@
51405789 private MenuItem panoTexturesItem;
51415790
51425791 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5792
+ private MenuItem resetCentroidXZItem;
51445793 private MenuItem resetTransformItem;
5794
+ private MenuItem transformGeometryItem;
5795
+ private MenuItem transformChildrenItem;
51455796 private MenuItem hideItem;
51465797 private MenuItem grabItem;
51475798 private MenuItem backItem;
51485799 private MenuItem frontItem;
51495800 private MenuItem cameraItem;
51505801 private MenuItem compositeItem;
5151
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
51525803 private MenuItem physicsItem;
51535804 private MenuItem frameselectorItem;
51545805 private MenuItem scriptNodeItem;
....@@ -5172,6 +5823,8 @@
51725823 private MenuItem attachBumpItem;
51735824 private MenuItem detachBumpItem;
51745825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
51755828
51765829 private MenuItem particleItem;
51775830 private MenuItem ragdollItem;
....@@ -5210,11 +5863,6 @@
52105863 private MenuItem doubleItem;
52115864 private MenuItem tripleItem;
52125865
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52185866 private MenuItem computeAOItem;
52195867 private MenuItem recompileItem;
52205868 private MenuItem editScriptItem;
....@@ -5224,4 +5872,8 @@
52245872 private MenuItem analyzeItem;
52255873 private MenuItem dumpItem;
52265874 //boolean freezemodel = false;
5875
+
5876
+ Menu cameraMenu;
5877
+ MenuItem editCameraItem;
5878
+ MenuItem restoreCameraItem;
52275879 }