Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -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,40 +167,37 @@
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);
186
+ cloneItem = menu.add(new MenuItem("Clone"));
187
+ cloneItem.addActionListener(this);
188
+ if (Globals.ADVANCED)
189
+ {
190
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
191
+ cloneSupportItem.addActionListener(this);
192
+ }
193
+ menu.add("-");
174194 cutItem = menu.add(new MenuItem("Cut"));
175195 cutItem.addActionListener(this);
176196 copyItem = menu.add(new MenuItem("Copy"));
177197 copyItem.addActionListener(this);
178198 pasteItem = menu.add(new MenuItem("Paste"));
179199 pasteItem.addActionListener(this);
180
- menu.add("-");
181
- cloneItem = menu.add(new MenuItem("Clone"));
182
- cloneItem.addActionListener(this);
183
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
184
- cloneSupportItem.addActionListener(this);
200
+
185201 menu.add("-");
186202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187203 pasteIntoItem.addActionListener(this);
....@@ -192,8 +208,8 @@
192208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
193209 // pasteExpandItem.addActionListener(this);
194210 menu.add("-");
195
- clearItem = menu.add(new MenuItem("Clear"));
196
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
197213
198214 if (Globals.ADVANCED)
199215 {
....@@ -201,14 +217,97 @@
201217 clearAllItem = menu.add(new MenuItem("Clear All"));
202218 clearAllItem.addActionListener(this);
203219 }
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());
204256
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
+
205308 oe.menuBar.add(menu = new Menu("Setting"));
206309 if (Globals.ADVANCED)
207310 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213312 revertMeshItem.addActionListener(this);
214313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -248,21 +347,29 @@
248347 }
249348
250349 oe.menuBar.add(menu = new Menu("Group"));
251
- grabItem = menu.add(new MenuItem("Grab"));
252
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
253352 backItem = menu.add(new MenuItem("Back"));
254353 backItem.addActionListener(this);
255354 frontItem = menu.add(new MenuItem("Front"));
256355 frontItem.addActionListener(this);
257
- compositeItem = menu.add(new MenuItem("Composite"));
258
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
259361 hideItem = menu.add(new MenuItem("Hidden Group"));
260362 hideItem.addActionListener(this);
363
+ }
261364 ungroupItem = menu.add(new MenuItem("Ungroup"));
262365 ungroupItem.addActionListener(this);
263
- menu.add("-");
264
- randomItem = menu.add(new MenuItem("Switch node"));
265
- 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
+ {
266373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
267374 switchGeoItem.addActionListener(this);
268375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -270,49 +377,52 @@
270377 morphItem = menu.add(new MenuItem("Morph Group"));
271378 morphItem.addActionListener(this);
272379
273
- if (Globals.ADVANCED)
274
- {
380
+ menu.add("-");
275381 physicsItem = menu.add(new MenuItem("Physics"));
276382 physicsItem.addActionListener(this);
277383 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
278384 frameselectorItem.addActionListener(this);
279385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
280386 scriptNodeItem.addActionListener(this);
281
- cameraItem = menu.add(new MenuItem("Camera"));
282
- cameraItem.addActionListener(this);
283387 }
284388
285389 oe.menuBar.add(menu = new Menu("Object"));
286
- textureItem = menu.add(new MenuItem("Texture"));
287
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
288392 billboardItem = menu.add(new MenuItem("Billboard"));
289393 billboardItem.addActionListener(this);
290394 csgItem = menu.add(new MenuItem("CSG"));
291395 csgItem.addActionListener(this);
292
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
293397 shadowXItem.addActionListener(this);
294
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
295399 shadowYItem.addActionListener(this);
296
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
297401 shadowZItem.addActionListener(this);
298
- if (Globals.ADVANCED)
299
- {
300
- linkerItem = menu.add(new MenuItem("Linker"));
301
- linkerItem.addActionListener(this);
302402 attributeItem = menu.add(new MenuItem("Attribute"));
303403 attributeItem.addActionListener(this);
404
+
405
+ if (Globals.ADVANCED)
406
+ {
407
+ menu.add("-");
408
+ linkerItem = menu.add(new MenuItem("Linker"));
409
+ linkerItem.addActionListener(this);
304410 templateItem = menu.add(new MenuItem("Template"));
305411 templateItem.addActionListener(this);
306412 pointflowItem = menu.add(new MenuItem("Point Flow"));
307413 pointflowItem.addActionListener(this);
308
- menu.add("-");
309414 }
415
+ menu.add("-");
310416 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311417 resetTransformItem.addActionListener(this);
312418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313419 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- 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);
316426
317427 oe.menuBar.add(menu = new Menu("Geometry"));
318428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -325,7 +435,7 @@
325435 genNormalsMESHItem.addActionListener(this);
326436 if (Globals.ADVANCED)
327437 {
328
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
329439 genNormalsMINEItem.addActionListener(this);
330440 }
331441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -361,6 +471,10 @@
361471 oe.menuBar.add(menu = new Menu("Attributes"));
362472 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363473 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);
364478 menu.add("-");
365479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366480 liveleavesItem.addActionListener(this);
....@@ -381,6 +495,14 @@
381495 markleavesItem.addActionListener(this);
382496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
383497 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);
384506 menu.add("-");
385507 flipVItem = menu.add(new MenuItem("Flip V"));
386508 flipVItem.addActionListener(this);
....@@ -406,47 +528,56 @@
406528 attachBumpItem.addActionListener(this);
407529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
408530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
409532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
410533 detachPigmentItem.addActionListener(this);
411534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
412535 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);
413540 menu.add("-");
414541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
415542 sortbysizeItem.addActionListener(this);
416543 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417544 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);
418550 if (Globals.ADVANCED)
419551 {
420
- menu.add("-");
552
+ // Pretty much the same as duplicate and clone.
421553 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422554 extractGeometriesItem.addActionListener(this);
423555 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424556 cloneGeometriesItem.addActionListener(this);
425
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
426
- shareGeometriesItem.addActionListener(this);
427
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
428
- mergeGeometriesItem.addActionListener(this);
429557 }
430558
431559 oe.menuBar.add(menu = new Menu("Insert"));
432560 buildCreateMenu(menu);
433561
434
- oe.menuBar.add(menu = new Menu("Include"));
435
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
436
- importGFDItem.addActionListener(this);
437
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
438
- importVRMLX3DItem.addActionListener(this);
439
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
440
- importOBJItem.addActionListener(this);
441
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
442
- import3DSItem.addActionListener(this);
443
-
444562 oe.menuBar.add(menu = new Menu("Tools"));
445563 buildToolsMenu(menu);
446564 }
447565
566
+
448567 void SetupUI2(ObjEditor oe)
449568 {
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
+
450581 //new Exception().printStackTrace();
451582
452583 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -475,97 +606,230 @@
475606 oe.radioPanel.add(dummyButton);
476607 oe.buttonGroup.add(dummyButton);
477608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
478613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479614
480
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- 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");
482667 liveCB.addItemListener(this);
483668
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485670 oneStepButton.setToolTipText("Animate one step forward");
486671 oneStepButton.addActionListener(this);
487672
488
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
489674 fastCB.setToolTipText("Fast mode");
490675 fastCB.addItemListener(this);
491676
492
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
493
- trackCB.setToolTipText("Enable tracking");
494
- trackCB.addItemListener(this);
495
-
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
497
- screenfitButton.setToolTipText("Screen fit");
498
- 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);
499682
500683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
501684 // screenfitpointButton.addActionListener(this);
502685
503686 if (Globals.ADVANCED)
504687 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
506689 snapobjectButton.addActionListener(this);
507690 snapobjectButton.setToolTipText("Snap Object");
691
+
692
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ fourButton.addActionListener(this);
694
+ fourButton.setToolTipText("Show control panel only");
508695 }
509696
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
- flashSelectionButton.setToolTipText("Show selection");
512
- flashSelectionButton.addActionListener(this);
697
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
513698
514
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515
-
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
517
- twoButton.setToolTipText("Show center view only");
699
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ twoButton.setToolTipText("Show 3D view only");
518701 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
520
- fourButton.addActionListener(this);
521
- fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
523
- sixButton.setToolTipText("2-column layout left");
524
- sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
526
- threeButton.setToolTipText("2-column layout right");
702
+ this.fullscreenLayout = twoButton;
703
+
704
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ threeButton.setToolTipText("Show controls and 3D view");
527706 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
529
- sevenButton.setToolTipText("3-column layout");
530
- sevenButton.addActionListener(this);
707
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ sixButton.setToolTipText("Show 3D view and controls");
709
+ sixButton.addActionListener(this);
710
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+// sevenButton.setToolTipText("3-column layout");
712
+// sevenButton.addActionListener(this);
531713 //
532714
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
534
- 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");
535717 rootButton.addActionListener(this);
536718
537
- 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);
538720 closeButton.setToolTipText("Close tab");
539721 closeButton.addActionListener(this);
540722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
541723 //clearButton.addActionListener(this);
542
-
543
- 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
+ }
544756
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
546
- 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");
547806 editButton.addActionListener(this);
548807
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
550
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
551810 uneditButton.addActionListener(this);
552811
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554
- allParamsButton.setToolTipText("Edit all params");
812
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
813
+ allParamsButton.setToolTipText("Show all controle");
555814 allParamsButton.addActionListener(this);
556815
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
816
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
558817 clearPanelButton.setToolTipText("Clear edit panel");
559818 clearPanelButton.addActionListener(this);
560819
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
820
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
562821 unselectButton.setToolTipText("Unselect");
563822 unselectButton.addActionListener(this);
564823
565
- 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);
566827
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
828
+ editCommandsPanel.preferredHeight = 1;
829
+
830
+ SetPinStates(false);
831
+// oe.treePanel.add(commandsPanel);
832
+// oe.treePanel.Return();
569833
570834 // oe.aConstraints.gridx += 1;
571835 // oe.aConstraints.weighty = 0;
....@@ -582,29 +846,17 @@
582846
583847 JScrollPane jSP;
584848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
585
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
586850 ResetModel();
587851
588852 oe.treePanel.add(jSPPanel);
589853 oe.treePanel.Return();
590854
591
- cGridBag copyOptionsPanel = new cGridBag();
592
-
593
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
594
- colorCB.setToolTipText("Copy color when dropped");
595
- colorCB.addItemListener(this);
596
-
597
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
598
- materialCB.setToolTipText("Copy material when dropped");
599
- materialCB.addItemListener(this);
600
-
601
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
602
- textureCB.setToolTipText("Copy texture when dropped");
603
- textureCB.addItemListener(this);
604
-
605
- copyOptionsPanel.preferredHeight = 1;
606855 oe.treePanel.add(copyOptionsPanel);
607856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
608860
609861 // mainPanel.setDividerLocation(0.5); //1.0);
610862 // mainPanel.setResizeWeight(0.5);
....@@ -627,29 +879,49 @@
627879 dgr.addDragGestureListener(this);
628880 }catch(Exception e) {}
629881 */
630
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
631883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
632884 }
633885
634886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
635887 {
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
+
636902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
637903 boxCB.setToolTipText("Display bounding boxes");
638904 boxCB.addItemListener(this);
639905
640906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
641
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
642908 zoomBoxCB.addItemListener(this);
643909
644
- if (Globals.ADVANCED)
910
+ if (true) // Globals.ADVANCED)
645911 {
646
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647
- supportCB.setToolTipText("Enable rigging");
648
- 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);
649919
650920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
651921 // localCB.addItemListener(this);
652922
923
+ panel.Return();
924
+
653925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
654926 crowdCB.setToolTipText("Used for crowds");
655927 crowdCB.addItemListener(this);
....@@ -666,6 +938,8 @@
666938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
667939 // speakerMocapCB.addItemListener(this);
668940
941
+ panel.Return();
942
+
669943 if (false)
670944 {
671945 // handled in scripts
....@@ -680,42 +954,85 @@
680954 //constraints.gridy += 1;
681955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
682956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
683958 }
684959
685960 //constraints.gridx += 1;
686961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
687962 // debugCB.addItemListener(this);
688963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
689968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
969
+ oeilCB.setToolTipText("Move camera when tracking");
690970 oeilCB.addItemListener(this);
691971
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
+ {
692992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
693993 lookAtCB.setToolTipText("Look-at target");
694994 lookAtCB.addItemListener(this);
995
+ }
695996
696997 }
697998
698999 cGridBag fill = new cGridBag();
699
-
7001000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
7011005
7021006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
7031009
7041010 }
7051011
7061012 void EditObject(Object3D obj)
7071013 {
7081014 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
+
7091023 radioButton.SetObject(obj);
710
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
7111025 radioButton.SetCamera(cameraView.renderCamera, false);
7121026 radioButton.addActionListener(this);
7131027 radioPanel.add(radioButton);
7141028 buttonGroup.add(radioButton);
7151029 radioButton.doClick();
7161030 }
1031
+
7171032 void SetupViews(ObjEditor oe)
7181033 {
1034
+ theFrame = this;
1035
+
7191036 oe.SetupViews();
7201037
7211038 System.out.println("SetupViews");
....@@ -724,23 +1041,28 @@
7241041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7251042 }
7261043
727
- JCheckBox liveCB;
728
- JCheckBox supportCB;
729
- JCheckBox localCB;
730
- JCheckBox crowdCB;
731
- JCheckBox smoothCB;
732
- JCheckBox fastCB;
733
- JCheckBox slowCB;
734
- JCheckBox boxCB;
735
- JCheckBox zoomBoxCB;
736
- JCheckBox trackCB;
737
- 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;
7381057 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
1058
+ cCheckBox speakerCameraCB;
1059
+ cCheckBox speakerFocusCB;
1060
+ cCheckBox debugCB;
1061
+
1062
+ cCheckBox oeilCB;
1063
+ cCheckBox shadowCB;
1064
+ cCheckBox autokeepCB;
1065
+ cCheckBox lookAtCB;
7441066
7451067 // static int COLOR = 1;
7461068 // static int MATERIAL = 2;
....@@ -748,9 +1070,9 @@
7481070
7491071 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7501072
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
1073
+ cCheckBox colorCB;
1074
+ cCheckBox materialCB;
1075
+ cCheckBox textureCB;
7541076
7551077 public void itemStateChanged(ItemEvent e)
7561078 {
....@@ -778,6 +1100,7 @@
7781100 } else if(e.getSource() == liveCB)
7791101 {
7801102 cameraView.ToggleLive();
1103
+ refreshContents(false);
7811104 }
7821105 else if(e.getSource() == supportCB)
7831106 {
....@@ -842,6 +1165,18 @@
8421165 {
8431166 cameraView.ToggleOeil();
8441167 }
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
+ }
8451180 else if(e.getSource() == lookAtCB)
8461181 {
8471182 cameraView.ToggleLookAt();
....@@ -858,7 +1193,8 @@
8581193
8591194 /**/
8601195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
861
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
8621198 if ((path == null) || (path.getPathCount() <= 1)) {
8631199 // We can't move the root node or an empty selection
8641200 return;
....@@ -921,8 +1257,6 @@
9211257 }
9221258 }
9231259
924
- String string = (String) object;
925
-
9261260 System.out.println("Transfer = " + object + "; drop : " + target);
9271261 // if( object instanceof java.io.File[])
9281262 // {
....@@ -930,7 +1264,11 @@
9301264 // objEditor.DropFile((java.io.File[]) object, true);
9311265 // return;
9321266 // }
933
- 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) == ':')
9341272 {
9351273 // file(s)
9361274 String[] names = string.split("\n");
....@@ -957,7 +1295,7 @@
9571295
9581296 flashIt = false;
9591297 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1298
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611299 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621300
9631301 if (group.selection.size() == 1)
....@@ -973,23 +1311,33 @@
9731311
9741312 assert target == objEditor.jTree;
9751313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
9761315 try {
977
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9781317 } catch (Exception e) {
9791318 System.out.println("destinationPath : " + destinationPath);
9801319 return;
9811320 }
9821321
983
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
9841323 {
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
+// {
9851333 loadClipboard(true);
9861334 objEditor.jTree.setSelectionPath(destinationPath);
9871335 pasteInto(false, false);
988
- } else {
989
- loadClipboard(false);
990
- objEditor.jTree.setSelectionPath(destinationPath);
991
- pasteInto(false, false); // true); // ???
992
- }
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
9931341 }
9941342 public void dropActionChanged(DropTargetDragEvent dtde)
9951343 // Called if the user has modified the current drop gesture
....@@ -1094,22 +1442,30 @@
10941442 {
10951443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10961444 //heightFieldItem.addActionListener(this);
1097
- gridItem = menu.add(new MenuItem("Grid"));
1098
- gridItem.addActionListener(this);
1099
- rectoidItem = menu.add(new MenuItem("Box"));
1100
- rectoidItem.addActionListener(this);
1101
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1102
- ellipsoidItem.addActionListener(this);
1103
- coneItem = menu.add(new MenuItem("Cone"));
1104
- coneItem.addActionListener(this);
1105
- torusItem = menu.add(new MenuItem("Torus"));
1106
- torusItem.addActionListener(this);
1107
- superItem = menu.add(new MenuItem("Superellipsoid"));
1108
- 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
+ {
11091463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11101464 kleinItem.addActionListener(this);
1111
- particleItem = menu.add(new MenuItem("Particle system"));
1112
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
11131469 if (Globals.ADVANCED)
11141470 {
11151471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1135,15 +1491,15 @@
11351491 }
11361492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11371493 bezierItem.addActionListener(this);
1138
- overlayItem = menu.add(new MenuItem("Overlay"));
1139
- overlayItem.addActionListener(this);
1140
- lightItem = menu.add(new MenuItem("Light"));
1141
- 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);
11421498 menu.add("-");
11431499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11441500 //superLoopItem.addActionListener(this);
1145
- loopItem = menu.add(new MenuItem("Loop"));
1146
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
11471503 doubleItem = menu.add(new MenuItem("Fork"));
11481504 doubleItem.addActionListener(this);
11491505 if (Globals.ADVANCED)
....@@ -1159,18 +1515,23 @@
11591515 animationItem.addItemListener(this);
11601516 animationItem.setState(Globals.ANIMATION);
11611517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
11621521 menu.add("-");
11631522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11641523 parseverticesItem.addActionListener(this);
11651524 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661525 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1526
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681527 alignItem.addActionListener(this);
11691528 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701529 reduceMorphItem.addActionListener(this);
11711530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721531 reduce34MorphItem.addActionListener(this);
1173
-
1532
+ menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
11741535 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751536 computeAOItem.addActionListener(this);
11761537
....@@ -1179,11 +1540,9 @@
11791540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11801541 mirrorItem.addActionListener(this);
11811542 menu.add("-");
1182
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1183
- memoryItem.addActionListener(this);
11841543 menu.add(analyzeItem = new MenuItem("Analyze"));
11851544 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1545
+ menu.add(dumpItem = new MenuItem("Print"));
11871546 dumpItem.addActionListener(this);
11881547 // menu.add(pathItem = new MenuItem("From-to path"));
11891548 // pathItem.addActionListener(this);
....@@ -1324,9 +1683,34 @@
13241683 shadow.material = new cMaterial(obj.material);
13251684 shadow.material.diffuse = 0.0001f;
13261685 shadow.material.specular = 0.0001f;
1686
+ //shadow.projectedVertices[1].x = 300;
13271687
13281688 makeSomething(shadow);
13291689 }
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
+ }
13301714
13311715 /**
13321716 * applyExample
....@@ -1530,9 +1914,9 @@
15301914
15311915 void Overwrite(int mask)
15321916 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1917
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341918 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1919
+ Object3D content = Grafreed.clipboard.get(0);
15361920
15371921 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381922 content = ((cGroup)content).get(0);
....@@ -1571,7 +1955,7 @@
15711955 {
15721956 ScreenFit();
15731957 } else
1574
- if (source == switchItem)
1958
+ if (source == switchViewItem)
15751959 {
15761960 cVector v1 = new cVector();
15771961 cVector v2 = new cVector();
....@@ -1580,11 +1964,11 @@
15801964 objEditor.cameraView.renderCamera.setAim(v2, v1);
15811965 objEditor.cameraView.repaint();
15821966 } else
1583
- if (source == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
15841968 {
15851969 makeSomething(new Box());
15861970 } else
1587
- if (source == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
15881972 {
15891973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15901974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1663,27 +2047,27 @@
16632047
16642048 makeSomething(obj);
16652049 } else
1666
- if (source == gridItem)
2050
+ if (source == gridItem || source == gridButton)
16672051 {
16682052 makeSomething(new Grid());
16692053 } else
1670
- if (source == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
16712055 {
16722056 makeSomething(new Sphere());
16732057 } else
1674
- if (source == coneItem)
2058
+ if (source == coneItem || source == coneButton)
16752059 {
16762060 makeSomething(new Cone());
16772061 } else
1678
- if (source == torusItem)
2062
+ if (source == torusItem || source == torusButton)
16792063 {
16802064 makeSomething(new Torus());
16812065 } else
1682
- if (source == superItem)
2066
+ if (source == superItem || source == superButton)
16832067 {
16842068 makeSomething(new Superellipsoid());
16852069 } else
1686
- if (source == kleinItem)
2070
+ if (source == kleinItem || source == kleinButton)
16872071 {
16882072 makeSomething(new Klein());
16892073 } else
....@@ -1703,7 +2087,7 @@
17032087 {
17042088 makeSomething(new BezierSurface());
17052089 } else
1706
- if (source == overlayItem)
2090
+ if (source == overlayItem || source == overlayButton)
17072091 {
17082092 /*
17092093 Object3D obj = new BezierSurface(5,8);
....@@ -1751,7 +2135,7 @@
17512135 s.setup();
17522136 makeSomething(s);
17532137 } else
1754
- if (source == lightItem)
2138
+ if (source == lightItem || source == lightButton)
17552139 {
17562140 makeSomething(new Light());
17572141 } else
....@@ -1801,30 +2185,30 @@
18012185
18022186 group(g);
18032187 } else
1804
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
18052189 {
18062190 Composite csg = new GroupLeaf();
18072191 csg.count = 5;
18082192 group(csg);
1809
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
18102194 csg.addChild(child);
18112195 child.addChild(csg);
18122196 } else
18132197 if (source == doubleItem)
18142198 {
1815
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
18162200 csg.count = 5;
18172201 group(csg);
1818
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
18192203 csg.addChild(child);
18202204 child.addChild(csg);
1821
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
18222206 csg.addChild(child);
18232207 child.addChild(csg);
18242208 } else
18252209 if (source == tripleItem)
18262210 {
1827
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
18282212 csg.count = 4;
18292213 group(csg);
18302214 Composite child = new cGroup();
....@@ -1836,23 +2220,6 @@
18362220 child = new cGroup();
18372221 csg.addChild(child);
18382222 child.addChild(csg);
1839
- } else
1840
-
1841
- if (source == importGFDItem)
1842
- {
1843
- ImportGFD();
1844
- } else
1845
- if (source == importVRMLX3DItem)
1846
- {
1847
- ImportVRMLX3D();
1848
- } else
1849
- if (source == import3DSItem)
1850
- {
1851
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1852
- } else
1853
- if (source == importOBJItem)
1854
- {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18562223 } else
18572224 if (source == computeAOItem)
18582225 {
....@@ -1872,7 +2239,7 @@
18722239 if (source == invariantsItem)
18732240 {
18742241 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2242
+ Grafreed.grafreeD.universe.invariants();
18762243 } else
18772244 if (source == memoryItem)
18782245 {
....@@ -1891,6 +2258,46 @@
18912258 {
18922259 DumpObject();
18932260 } 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
18942301 if (source == oneStepButton)
18952302 {
18962303 Globals.ONESTEP = true;
....@@ -1898,17 +2305,14 @@
18982305 } else
18992306 if (source == screenfitButton)
19002307 {
1901
- //Reload(lastConverter, lastFilename, true);
19022308 ScreenFit();
19032309 } else
19042310 if (source == screenfitpointButton)
19052311 {
1906
- //Reload(lastConverter, lastFilename, true);
19072312 ScreenFitPoint();
19082313 } else
19092314 if (source == snapobjectButton)
19102315 {
1911
- //Reload(lastConverter, lastFilename, true);
19122316 SnapObject();
19132317 } else
19142318 // if (event.getSource() == recompileButton)
....@@ -1945,12 +2349,20 @@
19452349 {
19462350 loadClipboard(true);
19472351 } else
2352
+ if (source == undoItem)
2353
+ {
2354
+ Undo();
2355
+ } else
2356
+ if (source == redoItem)
2357
+ {
2358
+ Redo();
2359
+ } else
19482360 if (source == duplicateItem)
19492361 {
1950
- Object3D keep = GrafreeD.clipboard;
2362
+ Object3D keep = Grafreed.clipboard;
19512363 loadClipboard(false);
19522364 paste(false);
1953
- GrafreeD.clipboard = keep;
2365
+ Grafreed.clipboard = keep;
19542366 } else
19552367 if (source == cloneItem)
19562368 {
....@@ -2170,9 +2582,9 @@
21702582 // group.selection.get(0).setMasterThis(content); // should be identity
21712583 // refreshContents();
21722584 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2585
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742586 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2587
+ Object3D content = Grafreed.clipboard.get(0);
21762588
21772589 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782590 content = ((cGroup)content).get(0);
....@@ -2222,9 +2634,9 @@
22222634 } else
22232635 if (source == setMasterItem)
22242636 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2637
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262638 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2639
+ Object3D content = Grafreed.clipboard.get(0);
22282640
22292641 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302642 content = ((cGroup)content).get(0);
....@@ -2237,9 +2649,9 @@
22372649 {
22382650 if (group.selection.size() == 1)
22392651 {
2240
- if (GrafreeD.clipboard.size() == 1)
2652
+ if (Grafreed.clipboard.size() == 1)
22412653 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2654
+ Object3D content = Grafreed.clipboard.get(0);
22432655
22442656 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452657 content = ((cGroup)content).get(0);
....@@ -2256,7 +2668,7 @@
22562668 {
22572669 RevertMeshes();
22582670 } else
2259
- if (source == resetMeshItem)
2671
+ if (source == resetAllItem)
22602672 {
22612673 ResetAll();
22622674 } else
....@@ -2264,7 +2676,7 @@
22642676 {
22652677 StepAll();
22662678 } else
2267
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
22682680 {
22692681 //int indices[] = jList.getSelectedIndices();
22702682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2276,9 +2688,9 @@
22762688 {
22772689 ClearSelection(true);
22782690 } else
2279
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
22802692 {
2281
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
22822694 } else
22832695 if (source == hideItem)
22842696 {
....@@ -2296,11 +2708,11 @@
22962708 {
22972709 makeSomething(new Camera());
22982710 } else
2299
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
23002712 {
23012713 group(new Composite());
23022714 } else
2303
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
23042716 {
23052717 RandomNode random = new RandomNode();
23062718 group(random);
....@@ -2402,7 +2814,7 @@
24022814 {
24032815 group(new cLinker());
24042816 } else
2405
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
24062818 {
24072819 group(new TextureNode());
24082820 } else
....@@ -2422,17 +2834,30 @@
24222834 {
24232835 CastShadow(2);
24242836 } else
2425
- if (source == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
24262838 {
2427
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
24282841 for (int i=0; i<group.selection.size(); i++)
24292842 {
2430
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
24312848 }
24322849
2433
- ClearSelection(false);
2434
-
2435
- 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
+ }
24362861 } else
24372862 if (source == genUVItem)
24382863 {
....@@ -2444,7 +2869,7 @@
24442869 } else
24452870 if (source == genNormalsMESHItem)
24462871 {
2447
- GenNormals(true); // TODO
2872
+ GenNormalsMESH();
24482873 } else
24492874 if (source == genNormalsORGANItem)
24502875 {
....@@ -2509,6 +2934,22 @@
25092934 if (source == unmarkleavesItem)
25102935 {
25112936 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);
25122953 } else
25132954 if (source == flipVItem)
25142955 {
....@@ -2594,9 +3035,13 @@
25943035 {
25953036 SmoothMesh();
25963037 } else
2597
- if (source == transformgeometryItem)
3038
+ if (source == transformGeometryItem)
25983039 {
25993040 TransformGeometry();
3041
+ } else
3042
+ if (source == transformChildrenItem)
3043
+ {
3044
+ TransformChildren();
26003045 } else
26013046 if (source == resetTransformItem)
26023047 {
....@@ -2604,7 +3049,11 @@
26043049 } else
26053050 if (source == resetCentroidItem)
26063051 {
2607
- ResetCentroid();
3052
+ ResetCentroid(true);
3053
+ } else
3054
+ if (source == resetCentroidXZItem)
3055
+ {
3056
+ ResetCentroid(false);
26083057 } else
26093058 if (source == resetParentItem)
26103059 {
....@@ -2709,7 +3158,7 @@
27093158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27103159 {
27113160 obj = (Object3D)e.nextElement();
2712
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
27133162 }
27143163
27153164 refreshContents();
....@@ -2725,6 +3174,31 @@
27253174
27263175 refreshContents();
27273176 } 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
27283202 if (source == flashSelectionButton)
27293203 {
27303204 CameraPane.flash = true;
....@@ -2736,6 +3210,10 @@
27363210 if (source == twoButton)
27373211 {
27383212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
27393217 // bug
27403218 //gridPanel.setDividerLocation(1.0);
27413219 //bigPanel.setDividerLocation(0.0);
....@@ -2768,10 +3246,31 @@
27683246 bigThree.ClearUI();
27693247 bigThree.add(centralPanel);
27703248 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
+
27713267 } else
27723268 if (source == threeButton)
27733269 {
27743270 radio.layout = threeButton;
3271
+
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
27753274
27763275 // bigThree.remove(scenePanel);
27773276 // bigThree.remove(centralPanel);
....@@ -2801,13 +3300,18 @@
28013300 // centralPanel.setVisible(true);
28023301 // XYZPanel.setVisible(true);
28033302 bigThree.ClearUI();
3303
+ bigThree.add(scenePanel);
28043304 bigThree.add(centralPanel);
2805
- bigThree.add(XYZPanel);
28063305 bigThree.FlushUI();
3306
+
3307
+ cameraView.requestFocusInWindow();
28073308 } else
28083309 if (source == fourButton)
28093310 {
28103311 radio.layout = fourButton;
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
28113315
28123316 // bigThree.remove(scenePanel);
28133317 // bigThree.remove(centralPanel);
....@@ -2839,10 +3343,15 @@
28393343 bigThree.ClearUI();
28403344 bigThree.add(scenePanel);
28413345 bigThree.FlushUI();
3346
+
3347
+ cameraView.requestFocusInWindow();
28423348 } else
28433349 if (source == sixButton)
28443350 {
28453351 radio.layout = sixButton;
3352
+
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
28463355
28473356 // bigThree.remove(scenePanel);
28483357 // bigThree.remove(centralPanel);
....@@ -2872,13 +3381,18 @@
28723381 // centralPanel.setVisible(true);
28733382 // XYZPanel.setVisible(false);
28743383 bigThree.ClearUI();
2875
- bigThree.add(scenePanel);
28763384 bigThree.add(centralPanel);
3385
+ bigThree.add(scenePanel);
28773386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
28783389 } else
28793390 if (source == sevenButton)
28803391 {
28813392 radio.layout = sevenButton;
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
28823396
28833397 // bigThree.remove(scenePanel);
28843398 // bigThree.remove(centralPanel);
....@@ -2912,6 +3426,8 @@
29123426 bigThree.add(centralPanel);
29133427 bigThree.add(XYZPanel);
29143428 bigThree.FlushUI();
3429
+
3430
+ cameraView.requestFocusInWindow();
29153431 } else
29163432 if (source == rootButton)
29173433 {
....@@ -2923,6 +3439,7 @@
29233439 EditObject(obj);
29243440 }
29253441
3442
+ cameraView.requestFocusInWindow();
29263443 refreshContents(true);
29273444 } else
29283445 if (source == closeButton)
....@@ -2932,22 +3449,37 @@
29323449 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333450 {
29343451 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3452
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363453 {
3454
+ // Patch to avoid bug with transparency.
3455
+ if (!ab.hadMaterial)
3456
+ {
3457
+ ab.object.material = null;
3458
+ }
3459
+
29373460 buttonGroup.remove(ab);
29383461 radioPanel.remove(ab);
29393462
2940
- ab.GetObject().editWindow = null;
3463
+ //ab.GetObject().editWindow = null;
3464
+ ab.GetObject().manipWindow = null;
29413465 // ab.GetObject().objectUI = null; // ?????????
29423466
29433467 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443468 break;
29453469 }
29463470 }
3471
+
3472
+ cameraView.requestFocusInWindow();
29473473 refreshContents(true);
29483474 } else
29493475 if (source == editItem || source == editButton)
29503476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
29513483 EditSelection(false);
29523484 } else
29533485 if (source == uneditButton)
....@@ -2957,10 +3489,11 @@
29573489 Object3D child = (Object3D)e.nextElement();
29583490 if(child.editWindow != null)
29593491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
29603493 child.CloseUI();
29613494 listUI.remove(child);
29623495
2963
- child.editWindow = null; // ???????????
3496
+ //child.editWindow = null; // ???????????
29643497 }
29653498 objEditor.ctrlPanel.FlushUI();
29663499 //objEditor.jTree.clearSelection();
....@@ -2973,6 +3506,7 @@
29733506 //copy.ClearUI();
29743507 for (Object3D obj : listUI)
29753508 {
3509
+ obj.pinned = false;
29763510 obj.CloseUI();
29773511 }
29783512 listUI.clear();
....@@ -2982,7 +3516,7 @@
29823516 {
29833517 assert(copy == group);
29843518
2985
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29863520
29873521 for (Object3D obj : listUI)
29883522 {
....@@ -3031,6 +3565,9 @@
30313565 }
30323566
30333567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
30343571 //Globals.theRenderer.object = group;
30353572 if(!useclient)
30363573 {
....@@ -3046,20 +3583,46 @@
30463583 frontView.object = group;
30473584 sideView.object = group;
30483585 }
3049
- group.editWindow = this;
3586
+
3587
+// fix "+" issue
3588
+ //group.editWindow = this;
3589
+ group.manipWindow = this;
3590
+
30503591 /*
30513592 currentLayout = radio.layout;
30523593 if (currentLayout == null)
30533594 currentLayout = sevenButton;
30543595 */
30553596 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);
30563604 keepparent = group.parent;
30573605 // PARENT = NULL or not???
30583606 //group.parent = null; // ROOT
30593607 //group.attributes = -1;
30603608 ResetModel();
3609
+
3610
+ cameraView.requestFocusInWindow();
30613611 refreshContents(true);
3062
- }
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
+ }
30633626 else
30643627 {
30653628 //return super.action(event, arg);
....@@ -3068,7 +3631,6 @@
30683631 }
30693632
30703633 boolean useclient = false;
3071
- cRadio radio;
30723634
30733635 void ToggleRoot()
30743636 {
....@@ -3120,6 +3682,28 @@
31203682 refreshContents();
31213683 }
31223684
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
+ }
31233707
31243708 void ResetTransform()
31253709 {
....@@ -3232,7 +3816,7 @@
32323816 refreshContents();
32333817 }
32343818
3235
- void ResetCentroid()
3819
+ void ResetCentroid(boolean full)
32363820 {
32373821 Object3D obj;
32383822 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3831,16 @@
32473831 LA.matIdentity(Object3D.mat);
32483832 obj.getBounds(minima, maxima, false);
32493833 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3834
+ if (full)
3835
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513836 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523837 obj.TransformMesh(Object3D.mat);
3838
+
32533839 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3840
+ if (full)
3841
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553842 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3843
+
32563844 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573845 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583846 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +3869,8 @@
32813869
32823870 int size = obj.MemorySize();
32833871
3284
- 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)");
32853874 }
32863875 }
32873876 catch (Exception e)
....@@ -3318,9 +3907,9 @@
33183907 obj = (Object3D)e.nextElement();
33193908
33203909 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3910
+ Grafreed.AnalyzeObject(obj);
33223911 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3912
+ Grafreed.AnalyzeObject(obj.bRep);
33243913
33253914 // System.err.println((size/1024) + " KB is the size of " + obj);
33263915 }
....@@ -3362,6 +3951,13 @@
33623951 void GenNormals(boolean crease)
33633952 {
33643953 group.GenNormalsS(crease);
3954
+
3955
+ refreshContents();
3956
+ }
3957
+
3958
+ void GenNormalsMESH()
3959
+ {
3960
+ group.GenNormalsMeshS();
33653961
33663962 refreshContents();
33673963 }
....@@ -3534,8 +4130,8 @@
35344130
35354131 void ParseVertices()
35364132 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
4133
+ boolean epsequal = Grafreed.epsequal;
4134
+ Grafreed.epsequal = true;
35394135
35404136 for (int i=0; i<group.selection.size(); i++)
35414137 {
....@@ -3560,7 +4156,7 @@
35604156 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35614157 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35624158
3563
- g.add(GrafreeD.clipboard);
4159
+ g.add(Grafreed.clipboard);
35644160
35654161 buffer.add(g);
35664162 }
....@@ -3575,7 +4171,7 @@
35754171 makeSomething(buffer, i==group.selection.size()-1);
35764172 }
35774173
3578
- GrafreeD.epsequal = epsequal;
4174
+ Grafreed.epsequal = epsequal;
35794175
35804176 refreshContents();
35814177 }
....@@ -3593,7 +4189,16 @@
35934189 String pigment = Object3D.GetPigment(tex);
35944190 //String bump = Object3D.GetBump(tex);
35954191
3596
- 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
+ }
35974202
35984203 double s = v.s;
35994204
....@@ -3725,7 +4330,7 @@
37254330 return;
37264331
37274332 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4333
+ Object3D ref = Grafreed.clipboard.get(0);
37294334
37304335 Object3D newgroup = new Object3D("Po:" + poses.name);
37314336
....@@ -3919,9 +4524,9 @@
39194524
39204525 void ClipMesh()
39214526 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4527
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234528 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4529
+ Object3D content = Grafreed.clipboard.get(0);
39254530
39264531 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274532 content = ((cGroup)content).get(0);
....@@ -3930,7 +4535,7 @@
39304535 // {
39314536 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324537 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4538
+ group.selection.ClipMesh(Grafreed.clipboard);
39344539 }
39354540 // group.selection.ClipMesh(GrafreeD.clipboard);
39364541 System.out.println("DONE.");
....@@ -3977,6 +4582,18 @@
39774582 void MarkLeaves(boolean hide)
39784583 {
39794584 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);
39804597 refreshContents();
39814598 }
39824599
....@@ -4051,28 +4668,25 @@
40514668 // }
40524669 // }
40534670
4054
- static boolean allparams = true;
4055
-
4056
- static Vector<Object3D> listUI = new Vector<Object3D>();
4057
-
40584671 void EditSelection(boolean newWindow)
40594672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
40604679 // aConstraints.gridy = 0;
40614680 for (int i=0; i<group.selection.size(); i++)
40624681 {
40634682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40644683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4065
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664685
40674686 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4687
+ if(elem != group || !newWindow)
40694688 {
4070
- // if (!(elem instanceof Composite))
4071
- // newWindow = false;
4072
- listUI.add(elem);
4073
- elem.openEditWindow(this, newWindow); //, false);
4074
- System.out.println("edit : " + elem);
4075
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
40764690 }
40774691 }
40784692 }
....@@ -4147,7 +4761,8 @@
41474761 //new Exception().printStackTrace();
41484762
41494763 freezemodel = true;
4150
-
4764
+ ClearUnpinned();
4765
+
41514766 /**/
41524767 //switch (event.id)
41534768 {
....@@ -4155,7 +4770,6 @@
41554770 //case 702: // Event.LIST_DESELECT
41564771 group.deselectAll();
41574772 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41594773 if (tps != null)
41604774 {
41614775 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +4778,8 @@
41644778
41654779 //if (child.parent != null)
41664780 //child.parent.addSelectee(child);
4781
+ objEditor.SetMaterial(child);
41674782 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41714783 }
41724784 }
41734785 // else
....@@ -4177,20 +4789,28 @@
41774789 // System.err.println("info : " + group.GetPath());
41784790 // }
41794791
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- 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))
41834793 CameraPane.flash = true;
41844794
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4795
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41864796 // a camera
41874797 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- 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
+ }
41904803 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41914804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41924805 }
41934806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
41944814 refreshContents();
41954815 //return true;
41964816 }
....@@ -4199,6 +4819,35 @@
41994819
42004820 freezemodel = false;
42014821 }
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
+ }
42024851
42034852 void linkSomething(Object3D thing)
42044853 {
....@@ -4270,16 +4919,19 @@
42704919 {
42714920 if (group.selection.isEmpty())
42724921 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4922
+
4923
+ Grafreed.clipboardIsTempGroup = false;
42744924 Composite tGroup = null;
42754925 if (group.selection.size() > 0) // 1)
42764926 {
42774927 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4928
+ Grafreed.clipboardIsTempGroup = true;
42794929 }
42804930
42814931 if (cut)
42824932 {
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
42834935 //int indices[] = jList.getSelectedIndices();
42844936 //for (int i = indices.length - 1; i >= 0; i--)
42854937 //jList.remove(indices[i]);
....@@ -4315,16 +4967,16 @@
43154967 //System.out.println("cut " + child);
43164968 //System.out.println("parent = " + child.parent);
43174969 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4970
+ if (Grafreed.clipboardIsTempGroup)
43194971 tGroup.add/*Child*/(tmp);
43204972 else
4321
- GrafreeD.clipboard = tmp;
4973
+ Grafreed.clipboard = tmp;
43224974 }
43234975 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4976
+ if (Grafreed.clipboardIsTempGroup)
43254977 tGroup.add/*Child*/(child);
43264978 else
4327
- GrafreeD.clipboard = child;
4979
+ Grafreed.clipboard = child;
43284980 }
43294981
43304982 //ResetModel();
....@@ -4356,21 +5008,23 @@
43565008 //System.out.println("cut " + elem);
43575009 //System.out.println("parent = " + elem.parent);
43585010 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
5011
+ if (Grafreed.clipboardIsTempGroup)
43605012 tGroup.add/*Child*/(tmp);
43615013 else
4362
- GrafreeD.clipboard = tmp;
5014
+ Grafreed.clipboard = tmp;
43635015 }
43645016 else
4365
- if (GrafreeD.clipboardIsTempGroup)
5017
+ if (Grafreed.clipboardIsTempGroup)
43665018 tGroup.add/*Child*/(child);
43675019 else
4368
- GrafreeD.clipboard = child;
5020
+ Grafreed.clipboard = child;
43695021 }
43705022
43715023 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
5024
+
5025
+ if (Grafreed.clipboardIsTempGroup)
5026
+ Grafreed.clipboard = tGroup;
5027
+
43745028 if (cut)
43755029 {
43765030 ResetModel();
....@@ -4380,11 +5034,15 @@
43805034
43815035 void paste(boolean expand)
43825036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
43835041 // if (GrafreeD.clipboard == null)
43845042 // return;
43855043 boolean first = true;
43865044
4387
- if (GrafreeD.clipboardIsTempGroup)
5045
+ if (Grafreed.clipboardIsTempGroup)
43885046 {
43895047 Composite temp;
43905048
....@@ -4395,7 +5053,7 @@
43955053 temp = (Composite)Applet3D.clipboard.deepCopy();
43965054 */
43975055 Object3D elem;
4398
- 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))
43995057 {
44005058 Object3D child = (Object3D)e.nextElement();
44015059
....@@ -4429,16 +5087,17 @@
44295087 //Object3D cb = Applet3D.clipboard;
44305088 //temp.addChild(cb);
44315089 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4432
- assert(GrafreeD.clipboard.parent == null);
4433
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4434
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4435
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4436
- 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());
44375095 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
5096
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5097
+ Grafreed.clipboard.get(0).parent = keepparent;
44405098 }
44415099
5100
+ Globals.REPLACEONMAKE = keep;
44425101 ResetModel();
44435102 refreshContents();
44445103 }
....@@ -4485,9 +5144,9 @@
44855144 {
44865145 boolean first = true;
44875146
4488
- if (GrafreeD.clipboardIsTempGroup)
5147
+ if (Grafreed.clipboardIsTempGroup)
44895148 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
5149
+ Composite temp = (Composite)Grafreed.clipboard;
44915150 Object3D copy;
44925151 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44935152 {
....@@ -4497,7 +5156,7 @@
44975156 }
44985157 } else
44995158 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
5159
+ linkSomething(Grafreed.clipboard); //.get(0));
45015160 }
45025161 }
45035162 }
....@@ -4574,6 +5233,10 @@
45745233
45755234 void group(Object3D csg, boolean grab)
45765235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
45775240 if (//false) // why??
45785241 !group.selection.isEmpty())
45795242 {
....@@ -4687,10 +5350,15 @@
46875350 //node.add(csg);
46885351 //makeSomething(node);
46895352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
46905354 }
46915355
46925356 void Ungroup(Object3D g)
46935357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
46945362 if (g instanceof HiddenObject)
46955363 {
46965364 HiddenObject h = (HiddenObject) g;
....@@ -4707,6 +5375,7 @@
47075375 objEditor.makeSomething(g.get(i), false);
47085376 }
47095377 }
5378
+ Globals.REPLACEONMAKE = keep;
47105379 }
47115380
47125381 void ungroup()
....@@ -4902,21 +5571,6 @@
49025571 }
49035572 */
49045573
4905
- void ImportGFD()
4906
- {
4907
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4908
- browser.show();
4909
- String filename = browser.getFile();
4910
- if (filename != null && filename.length() > 0)
4911
- {
4912
- String fullname = browser.getDirectory() + filename;
4913
-
4914
- //Object3D readobj =
4915
- objEditor.ReadGFD(fullname, objEditor);
4916
- //makeSomething(readobj);
4917
- }
4918
- }
4919
-
49205574 /*
49215575 public void Callback(Object obj)
49225576 {
....@@ -4940,26 +5594,9 @@
49405594 }
49415595 */
49425596
4943
- void ImportVRMLX3D()
4944
- {
4945
- if (GrafreeD.standAlone)
4946
- {
4947
- /**/
4948
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4949
- browser.show();
4950
- String filename = browser.getFile();
4951
- if (filename != null && filename.length() > 0)
4952
- {
4953
- String fullname = browser.getDirectory() + filename;
4954
- LoadVRMLX3D(fullname);
4955
- }
4956
- /**/
4957
- }
4958
- }
4959
-
49605597 String GetFile(String dialogName)
49615598 {
4962
- if (GrafreeD.standAlone)
5599
+ if (Grafreed.standAlone)
49635600 {
49645601 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655602 browser.show();
....@@ -5027,7 +5664,28 @@
50275664 cButton clearpanelButton;
50285665 cButton unselectButton;
50295666
5667
+ cButton restoreCameraButton;
5668
+
5669
+ cButton saveButton;
50305670 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;
50315689
50325690 cButton screenfitButton;
50335691 cButton screenfitpointButton;
....@@ -5040,14 +5698,6 @@
50405698
50415699 cButton setsupportButton;
50425700
5043
- cButton twoButton;
5044
- cButton sixButton;
5045
- cButton threeButton;
5046
- cButton sevenButton;
5047
- cButton fourButton; // full panel
5048
- cButton oneButton; // full XYZ
5049
- //cButton currentLayout;
5050
-
50515701 //
50525702 //Composite
50535703 Object3D // to do !!
....@@ -5057,9 +5707,11 @@
50575707 //JTree jTree;
50585708 private MenuItem lookAtItem;
50595709 private MenuItem lookFromItem;
5060
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
50615711 private MenuItem cutItem;
5062
- private MenuItem duplicateItem;
5712
+ private MenuItem undoItem;
5713
+ private MenuItem redoItem;
5714
+ private JMenuItem duplicateItem;
50635715 private MenuItem cloneItem;
50645716 private MenuItem cloneSupportItem;
50655717 private MenuItem overwriteGeoItem;
....@@ -5072,7 +5724,7 @@
50725724 private MenuItem linkverticesItem;
50735725 private MenuItem relinkverticesItem;
50745726 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5727
+ private MenuItem resetAllItem;
50765728 private MenuItem stepAllItem;
50775729 private MenuItem revertMeshItem;
50785730 private MenuItem poseMeshItem;
....@@ -5087,7 +5739,7 @@
50875739 private MenuItem pasteLinkItem;
50885740 private MenuItem pasteCloneItem;
50895741 private MenuItem pasteExpandItem;
5090
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
50915743 private MenuItem clearAllItem;
50925744 private MenuItem genUVItem;
50935745 private MenuItem genNormalsMESHItem;
....@@ -5122,6 +5774,10 @@
51225774 private MenuItem showleavesItem;
51235775 private MenuItem markleavesItem;
51245776 private MenuItem unmarkleavesItem;
5777
+ private MenuItem rewindleavesItem;
5778
+ private MenuItem unrewindleavesItem;
5779
+ private MenuItem randomleavesItem;
5780
+ private MenuItem unrandomleavesItem;
51255781
51265782 private MenuItem flipVItem;
51275783 private MenuItem unflipVItem;
....@@ -5133,15 +5789,17 @@
51335789 private MenuItem panoTexturesItem;
51345790
51355791 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5792
+ private MenuItem resetCentroidXZItem;
51375793 private MenuItem resetTransformItem;
5794
+ private MenuItem transformGeometryItem;
5795
+ private MenuItem transformChildrenItem;
51385796 private MenuItem hideItem;
51395797 private MenuItem grabItem;
51405798 private MenuItem backItem;
51415799 private MenuItem frontItem;
51425800 private MenuItem cameraItem;
51435801 private MenuItem compositeItem;
5144
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
51455803 private MenuItem physicsItem;
51465804 private MenuItem frameselectorItem;
51475805 private MenuItem scriptNodeItem;
....@@ -5165,6 +5823,8 @@
51655823 private MenuItem attachBumpItem;
51665824 private MenuItem detachBumpItem;
51675825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
51685828
51695829 private MenuItem particleItem;
51705830 private MenuItem ragdollItem;
....@@ -5203,11 +5863,6 @@
52035863 private MenuItem doubleItem;
52045864 private MenuItem tripleItem;
52055865
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52115866 private MenuItem computeAOItem;
52125867 private MenuItem recompileItem;
52135868 private MenuItem editScriptItem;
....@@ -5217,4 +5872,8 @@
52175872 private MenuItem analyzeItem;
52185873 private MenuItem dumpItem;
52195874 //boolean freezemodel = false;
5875
+
5876
+ Menu cameraMenu;
5877
+ MenuItem editCameraItem;
5878
+ MenuItem restoreCameraItem;
52205879 }