Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +98,19 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.SAVEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
100105 {
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));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106111 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
109114 }
110115
111116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +124,7 @@
119124 // obj.support = null;
120125 if (!supports)
121126 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123128 obj.parent = parent;
124129 // obj.support = support;
125130 // clone.support = support; // aout 2013
....@@ -148,30 +153,29 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
158
+ oe.jTree = new cTree();
159
+
164160 Menu menu;
165161 oe.menuBar.add(menu = new Menu("Edit"));
166162 //editItem = menu.add(new MenuItem("Edit"));
167163 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169171 duplicateItem.addActionListener(this);
170
- menu.add("-");
171172 cloneItem = menu.add(new MenuItem("Clone"));
172173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
173176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174177 cloneSupportItem.addActionListener(this);
178
+ }
175179 menu.add("-");
176180 cutItem = menu.add(new MenuItem("Cut"));
177181 cutItem.addActionListener(this);
....@@ -179,27 +183,123 @@
179183 copyItem.addActionListener(this);
180184 pasteItem = menu.add(new MenuItem("Paste"));
181185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
182190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183191 pasteLinkItem.addActionListener(this);
184192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185193 pasteCloneItem.addActionListener(this);
186194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
188197 clearItem = menu.add(new MenuItem("Clear"));
189198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
190203 clearAllItem = menu.add(new MenuItem("Clear All"));
191204 clearAllItem.addActionListener(this);
205
+ }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
192242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
193294 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
295
+ if (Globals.ADVANCED)
296
+ {
198297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199298 revertMeshItem.addActionListener(this);
200299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201300 resetreferencesItem.addActionListener(this);
202301 menu.add("-");
302
+ }
203303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204304 overwriteGeoItem.addActionListener(this);
205305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +311,104 @@
211311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212312 overwriteUVItem.addActionListener(this);
213313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
214316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215317 generateMeshItem.addActionListener(this);
216318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217319 poseMeshItem.addActionListener(this);
218320 menu.add("-");
321
+ }
219322 resetsupportItem = menu.add(new MenuItem("Reset support"));
220323 resetsupportItem.addActionListener(this);
221324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222325 linkverticesItem.addActionListener(this);
223326 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224327 relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
225331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226332 setMasterItem.addActionListener(this);
333
+ }
227334
228335 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
231338 backItem = menu.add(new MenuItem("Back"));
232339 backItem.addActionListener(this);
233340 frontItem = menu.add(new MenuItem("Front"));
234341 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238348 hideItem.addActionListener(this);
349
+ }
239350 ungroupItem = menu.add(new MenuItem("Ungroup"));
240351 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
243
- randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
248359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249360 switchGeoItem.addActionListener(this);
250361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251362 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
253364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
254371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255372 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
373
+ }
258374
259375 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
262378 billboardItem = menu.add(new MenuItem("Billboard"));
263379 billboardItem.addActionListener(this);
264380 csgItem = menu.add(new MenuItem("CSG"));
265381 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267383 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269385 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
272394 linkerItem = menu.add(new MenuItem("Linker"));
273395 linkerItem.addActionListener(this);
274396 templateItem = menu.add(new MenuItem("Template"));
275397 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278398 pointflowItem = menu.add(new MenuItem("Point Flow"));
279399 pointflowItem.addActionListener(this);
400
+ }
280401 menu.add("-");
281402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282403 resetTransformItem.addActionListener(this);
283404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284405 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
287412
288413 oe.menuBar.add(menu = new Menu("Geometry"));
289414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +419,11 @@
294419 genNormalsCADItem.addActionListener(this);
295420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
297424 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298425 genNormalsMINEItem.addActionListener(this);
426
+ }
299427 stripifyItem = menu.add(new MenuItem("Stripify"));
300428 stripifyItem.addActionListener(this);
301429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +445,34 @@
317445 reduce34MeshItem.addActionListener(this);
318446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319447 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
324456
325457 oe.menuBar.add(menu = new Menu("Attributes"));
326458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
328464 menu.add("-");
329465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330466 liveleavesItem.addActionListener(this);
331467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
333471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334472 supportleavesItem.addActionListener(this);
335473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336474 unsupportleavesItem.addActionListener(this);
475
+ }
337476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338477 hideleavesItem.addActionListener(this);
339478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +481,14 @@
342481 markleavesItem.addActionListener(this);
343482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
345492 menu.add("-");
346493 flipVItem = menu.add(new MenuItem("Flip V"));
347494 flipVItem.addActionListener(this);
....@@ -377,35 +524,40 @@
377524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378525 sortbynameItem.addActionListener(this);
379526 menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
380534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381535 extractGeometriesItem.addActionListener(this);
382536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383537 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
538
+ }
388539
389540 oe.menuBar.add(menu = new Menu("Insert"));
390541 buildCreateMenu(menu);
391542
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403543 oe.menuBar.add(menu = new Menu("Tools"));
404544 buildToolsMenu(menu);
405545 }
406546
407547 void SetupUI2(ObjEditor oe)
408548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
409561 //new Exception().printStackTrace();
410562
411563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,96 +586,216 @@
434586 oe.radioPanel.add(dummyButton);
435587 oe.buttonGroup.add(dummyButton);
436588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
437593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438594
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
441
- liveCB.addItemListener(this);
442
-
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
444
- fastCB.setToolTipText("Fast mode");
445
- fastCB.addItemListener(this);
446
-
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
452611 screenfitButton.setToolTipText("Screen fit");
453612 screenfitButton.addActionListener(this);
454613
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633
+ liveCB.setToolTipText("Enable animation");
634
+ liveCB.addItemListener(this);
635
+
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ oneStepButton.setToolTipText("Animate one step forward");
638
+ oneStepButton.addActionListener(this);
639
+
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641
+ fastCB.setToolTipText("Fast mode");
642
+ fastCB.addItemListener(this);
643
+
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
649
+
455650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456651 // screenfitpointButton.addActionListener(this);
457
-// oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
459
- snapobjectButton.addActionListener(this);
460
- snapobjectButton.setToolTipText("Snap Object");
461
- oe.aConstraints.gridx += 1;
462652
463
- //aConstraints.gridx = 0;
464
- //aConstraints.gridy += 1;
465
- oe.aConstraints.weighty = 0;
466
- oe.aConstraints.gridwidth = 1;
467
-
468
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
469
- flashSelectionButton.setToolTipText("Show selection");
470
- flashSelectionButton.addActionListener(this);
653
+ if (Globals.ADVANCED)
654
+ {
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ snapobjectButton.addActionListener(this);
657
+ snapobjectButton.setToolTipText("Snap Object");
658
+ }
659
+
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
471661
472
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
473
-
474
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
475663 twoButton.setToolTipText("Show center view only");
476664 twoButton.addActionListener(this);
477
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
478668 fourButton.addActionListener(this);
479669 fourButton.setToolTipText("Show left panel only");
480
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
481671 sixButton.setToolTipText("2-column layout left");
482672 sixButton.addActionListener(this);
483
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
484674 threeButton.setToolTipText("2-column layout right");
485675 threeButton.addActionListener(this);
486
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
487677 sevenButton.setToolTipText("3-column layout");
488678 sevenButton.addActionListener(this);
489679 //
490680
491
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492682 rootButton.setToolTipText("Edit selection in new tab");
493683 rootButton.addActionListener(this);
494684
495
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
496686 closeButton.setToolTipText("Close tab");
497687 closeButton.addActionListener(this);
498688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
499689 //clearButton.addActionListener(this);
500
-
501
- cGridBag commandsPanel = new cGridBag();
690
+
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
502722
503
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- editButton.setToolTipText("Edit selection");
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
505772 editButton.addActionListener(this);
506773
507
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
508
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
509776 uneditButton.addActionListener(this);
510777
511
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
780
+ allParamsButton.addActionListener(this);
781
+
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512783 clearPanelButton.setToolTipText("Clear edit panel");
513784 clearPanelButton.addActionListener(this);
514785
515
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
516
- allParamsButton.setToolTipText("All params??");
517
- allParamsButton.addActionListener(this);
518
-
519
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520787 unselectButton.setToolTipText("Unselect");
521788 unselectButton.addActionListener(this);
522789
523
- commandsPanel.preferredHeight = 1;
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
524793
525
- oe.treePanel.add(commandsPanel);
526
- oe.treePanel.Return();
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
527799
528800 // oe.aConstraints.gridx += 1;
529801 // oe.aConstraints.weighty = 0;
....@@ -540,27 +812,12 @@
540812
541813 JScrollPane jSP;
542814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
543
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
544816 ResetModel();
545817
546818 oe.treePanel.add(jSPPanel);
547819 oe.treePanel.Return();
548820
549
- cGridBag copyOptionsPanel = new cGridBag();
550
-
551
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
552
- colorCB.setToolTipText("Copy color when dropped");
553
- colorCB.addItemListener(this);
554
-
555
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
556
- materialCB.setToolTipText("Copy material when dropped");
557
- materialCB.addItemListener(this);
558
-
559
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
560
- textureCB.setToolTipText("Copy texture when dropped");
561
- textureCB.addItemListener(this);
562
-
563
- copyOptionsPanel.preferredHeight = 1;
564821 oe.treePanel.add(copyOptionsPanel);
565822 oe.treePanel.Return();
566823
....@@ -591,13 +848,43 @@
591848
592849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
593850 {
594
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
595
- supportCB.setToolTipText("Enabled rigging");
596
- supportCB.addItemListener(this);
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
865
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
866
+ boxCB.setToolTipText("Display bounding boxes");
867
+ boxCB.addItemListener(this);
868
+
869
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
871
+ zoomBoxCB.addItemListener(this);
872
+
873
+ if (true) // Globals.ADVANCED)
874
+ {
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
597882
598883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
599884 // localCB.addItemListener(this);
600885
886
+ panel.Return();
887
+
601888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
602889 crowdCB.setToolTipText("Used for crowds");
603890 crowdCB.addItemListener(this);
....@@ -610,18 +897,12 @@
610897 slowCB.setToolTipText("Smooth interpolation");
611898 slowCB.addItemListener(this);
612899
613
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
614
- boxCB.setToolTipText("Display bounding boxes");
615
- boxCB.addItemListener(this);
616
-
617
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
618
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
619
- zoomBoxCB.addItemListener(this);
620
-
621900 // constraints.gridy += 1;
622901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
623902 // speakerMocapCB.addItemListener(this);
624903
904
+ panel.Return();
905
+
625906 if (false)
626907 {
627908 // handled in scripts
....@@ -636,30 +917,72 @@
636917 //constraints.gridy += 1;
637918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
638919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
639921 }
640922
641923 //constraints.gridx += 1;
642924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
643925 // debugCB.addItemListener(this);
644926
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
645931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
646933 oeilCB.addItemListener(this);
647934
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
648955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
649956 lookAtCB.setToolTipText("Look-at target");
650957 lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
651961
652962 cGridBag fill = new cGridBag();
653
-
654963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
655968
656969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
657972
658973 }
659974
660975 void EditObject(Object3D obj)
661976 {
662977 cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
663986 radioButton.SetObject(obj);
664987 radioButton.layout = sevenButton;
665988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -668,8 +991,11 @@
668991 buttonGroup.add(radioButton);
669992 radioButton.doClick();
670993 }
994
+
671995 void SetupViews(ObjEditor oe)
672996 {
997
+ theFrame = this;
998
+
673999 oe.SetupViews();
6741000
6751001 System.out.println("SetupViews");
....@@ -678,23 +1004,28 @@
6781004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6791005 }
6801006
681
- JCheckBox liveCB;
682
- JCheckBox supportCB;
683
- JCheckBox localCB;
684
- JCheckBox crowdCB;
685
- JCheckBox smoothCB;
686
- JCheckBox fastCB;
687
- JCheckBox slowCB;
688
- JCheckBox boxCB;
689
- JCheckBox zoomBoxCB;
690
- JCheckBox trackCB;
691
- JCheckBox smoothfocusCB;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
6921020 // JCheckBox speakerMocapCB;
693
- JCheckBox speakerCameraCB;
694
- JCheckBox speakerFocusCB;
695
- JCheckBox debugCB;
696
- JCheckBox oeilCB;
697
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
6981029
6991030 // static int COLOR = 1;
7001031 // static int MATERIAL = 2;
....@@ -702,9 +1033,9 @@
7021033
7031034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7041035
705
- JCheckBox colorCB;
706
- JCheckBox materialCB;
707
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7081039
7091040 public void itemStateChanged(ItemEvent e)
7101041 {
....@@ -732,6 +1063,7 @@
7321063 } else if(e.getSource() == liveCB)
7331064 {
7341065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7351067 }
7361068 else if(e.getSource() == supportCB)
7371069 {
....@@ -796,6 +1128,18 @@
7961128 {
7971129 cameraView.ToggleOeil();
7981130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
7991143 else if(e.getSource() == lookAtCB)
8001144 {
8011145 cameraView.ToggleLookAt();
....@@ -812,7 +1156,8 @@
8121156
8131157 /**/
8141158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
815
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8161161 if ((path == null) || (path.getPathCount() <= 1)) {
8171162 // We can't move the root node or an empty selection
8181163 return;
....@@ -875,8 +1220,6 @@
8751220 }
8761221 }
8771222
878
- String string = (String) object;
879
-
8801223 System.out.println("Transfer = " + object + "; drop : " + target);
8811224 // if( object instanceof java.io.File[])
8821225 // {
....@@ -884,7 +1227,11 @@
8841227 // objEditor.DropFile((java.io.File[]) object, true);
8851228 // return;
8861229 // }
887
- if (string.charAt(0) == '/')
1230
+
1231
+ String string = object.toString();
1232
+
1233
+ // File path for Mac and Windows
1234
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8881235 {
8891236 // file(s)
8901237 String[] names = string.split("\n");
....@@ -911,7 +1258,7 @@
9111258
9121259 flashIt = false;
9131260 CameraPane pane = (CameraPane) target;
914
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9151262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9161263
9171264 if (group.selection.size() == 1)
....@@ -927,23 +1274,33 @@
9271274
9281275 assert target == objEditor.jTree;
9291276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9301278 try {
931
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9321280 } catch (Exception e) {
9331281 System.out.println("destinationPath : " + destinationPath);
9341282 return;
9351283 }
9361284
937
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9381286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
9391296 loadClipboard(true);
9401297 objEditor.jTree.setSelectionPath(destinationPath);
941
- pasteInto(false);
942
- } else {
943
- loadClipboard(false);
944
- objEditor.jTree.setSelectionPath(destinationPath);
945
- pasteInto(false); // true); // ???
946
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9471304 }
9481305 public void dropActionChanged(DropTargetDragEvent dtde)
9491306 // Called if the user has modified the current drop gesture
....@@ -1048,54 +1405,71 @@
10481405 {
10491406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10501407 //heightFieldItem.addActionListener(this);
1051
- gridItem = menu.add(new MenuItem("Grid"));
1052
- gridItem.addActionListener(this);
1053
- rectoidItem = menu.add(new MenuItem("Box"));
1054
- rectoidItem.addActionListener(this);
1055
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1056
- ellipsoidItem.addActionListener(this);
1057
- coneItem = menu.add(new MenuItem("Cone"));
1058
- coneItem.addActionListener(this);
1059
- torusItem = menu.add(new MenuItem("Torus"));
1060
- torusItem.addActionListener(this);
1061
- superItem = menu.add(new MenuItem("Superellipsoid"));
1062
- superItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
10631426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10641427 kleinItem.addActionListener(this);
1065
- particleItem = menu.add(new MenuItem("Particle system"));
1066
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10671434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10681435 ragdollItem.addActionListener(this);
10691436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10701437 ragdoll2Item.addActionListener(this);
1438
+ }
10711439 menu.add("-");
1072
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10731441 meshItem.addActionListener(this);
10741442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10751443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10761446 springItem = menu.add(new MenuItem("Spring"));
10771447 springItem.addActionListener(this);
10781448 flagItem = menu.add(new MenuItem("Flag"));
10791449 flagItem.addActionListener(this);
1080
- bezierItem = menu.add(new MenuItem("Patch"));
1081
- bezierItem.addActionListener(this);
1082
- checkerItem = menu.add(new MenuItem("Checker"));
1083
- checkerItem.addActionListener(this);
10841450 blobItem = menu.add(new MenuItem("Blob"));
10851451 blobItem.addActionListener(this);
10861452 latheItem = menu.add(new MenuItem("Lathe"));
10871453 latheItem.addActionListener(this);
1088
- lightItem = menu.add(new MenuItem("Light"));
1089
- lightItem.addActionListener(this);
1454
+ }
1455
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1456
+ bezierItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
10901461 menu.add("-");
10911462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10921463 //superLoopItem.addActionListener(this);
1093
- loopItem = menu.add(new MenuItem("Loop"));
1094
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
10951466 doubleItem = menu.add(new MenuItem("Fork"));
10961467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
10971470 tripleItem = menu.add(new MenuItem("Trident"));
10981471 tripleItem.addActionListener(this);
1472
+ }
10991473 }
11001474
11011475 void buildToolsMenu(Menu menu)
....@@ -1104,29 +1478,34 @@
11041478 animationItem.addItemListener(this);
11051479 animationItem.setState(Globals.ANIMATION);
11061480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
11071484 menu.add("-");
11081485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11091486 parseverticesItem.addActionListener(this);
11101487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11111488 textureFieldItem.addActionListener(this);
1112
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
11131490 alignItem.addActionListener(this);
1114
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1115
- mirrorItem.addActionListener(this);
11161491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11171492 reduceMorphItem.addActionListener(this);
11181493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11191494 reduce34MorphItem.addActionListener(this);
1120
-
1121
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1122
- computeAOItem.addActionListener(this);
11231495 menu.add("-");
1124
-
11251496 menu.add(memoryItem = new MenuItem("Memory Usage"));
11261497 memoryItem.addActionListener(this);
1498
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1499
+ computeAOItem.addActionListener(this);
1500
+
1501
+ if (Globals.ADVANCED)
1502
+ {
1503
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1504
+ mirrorItem.addActionListener(this);
1505
+ menu.add("-");
11271506 menu.add(analyzeItem = new MenuItem("Analyze"));
11281507 analyzeItem.addActionListener(this);
1129
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11301509 dumpItem.addActionListener(this);
11311510 // menu.add(pathItem = new MenuItem("From-to path"));
11321511 // pathItem.addActionListener(this);
....@@ -1144,6 +1523,7 @@
11441523 menu.add("-");
11451524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11461525 editScriptItem.addActionListener(this);
1526
+ }
11471527 }
11481528
11491529 void ScreenFit()
....@@ -1266,9 +1646,24 @@
12661646 shadow.material = new cMaterial(obj.material);
12671647 shadow.material.diffuse = 0.0001f;
12681648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12691650
12701651 makeSomething(shadow);
12711652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
12721667
12731668 /**
12741669 * applyExample
....@@ -1472,9 +1867,9 @@
14721867
14731868 void Overwrite(int mask)
14741869 {
1475
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14761871 {
1477
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14781873
14791874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14801875 content = ((cGroup)content).get(0);
....@@ -1513,7 +1908,7 @@
15131908 {
15141909 ScreenFit();
15151910 } else
1516
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15171912 {
15181913 cVector v1 = new cVector();
15191914 cVector v2 = new cVector();
....@@ -1522,11 +1917,11 @@
15221917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15231918 objEditor.cameraView.repaint();
15241919 } else
1525
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
15261921 {
15271922 makeSomething(new Box());
15281923 } else
1529
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15301925 {
15311926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15321927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1605,27 +2000,27 @@
16052000
16062001 makeSomething(obj);
16072002 } else
1608
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16092004 {
16102005 makeSomething(new Grid());
16112006 } else
1612
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16132008 {
16142009 makeSomething(new Sphere());
16152010 } else
1616
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16172012 {
16182013 makeSomething(new Cone());
16192014 } else
1620
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16212016 {
16222017 makeSomething(new Torus());
16232018 } else
1624
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
16252020 {
16262021 makeSomething(new Superellipsoid());
16272022 } else
1628
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
16292024 {
16302025 makeSomething(new Klein());
16312026 } else
....@@ -1645,7 +2040,7 @@
16452040 {
16462041 makeSomething(new BezierSurface());
16472042 } else
1648
- if (source == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16492044 {
16502045 /*
16512046 Object3D obj = new BezierSurface(5,8);
....@@ -1693,7 +2088,7 @@
16932088 s.setup();
16942089 makeSomething(s);
16952090 } else
1696
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
16972092 {
16982093 makeSomething(new Light());
16992094 } else
....@@ -1743,30 +2138,30 @@
17432138
17442139 group(g);
17452140 } else
1746
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17472142 {
17482143 Composite csg = new GroupLeaf();
17492144 csg.count = 5;
17502145 group(csg);
1751
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17522147 csg.addChild(child);
17532148 child.addChild(csg);
17542149 } else
17552150 if (source == doubleItem)
17562151 {
1757
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17582153 csg.count = 5;
17592154 group(csg);
1760
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17612156 csg.addChild(child);
17622157 child.addChild(csg);
1763
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17642159 csg.addChild(child);
17652160 child.addChild(csg);
17662161 } else
17672162 if (source == tripleItem)
17682163 {
1769
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17702165 csg.count = 4;
17712166 group(csg);
17722167 Composite child = new cGroup();
....@@ -1778,23 +2173,6 @@
17782173 child = new cGroup();
17792174 csg.addChild(child);
17802175 child.addChild(csg);
1781
- } else
1782
-
1783
- if (source == importGFDItem)
1784
- {
1785
- ImportGFD();
1786
- } else
1787
- if (source == importVRMLX3DItem)
1788
- {
1789
- ImportVRMLX3D();
1790
- } else
1791
- if (source == import3DSItem)
1792
- {
1793
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1794
- } else
1795
- if (source == importOBJItem)
1796
- {
1797
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
17982176 } else
17992177 if (source == computeAOItem)
18002178 {
....@@ -1814,7 +2192,7 @@
18142192 if (source == invariantsItem)
18152193 {
18162194 System.out.println("Invariants:");
1817
- GrafreeD.grafreeD.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
18182196 } else
18192197 if (source == memoryItem)
18202198 {
....@@ -1833,19 +2211,47 @@
18332211 {
18342212 DumpObject();
18352213 } else
2214
+ if (source == minButton)
2215
+ {
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
2240
+ if (source == oneStepButton)
2241
+ {
2242
+ Globals.ONESTEP = true;
2243
+ cameraView.repaint();
2244
+ } else
18362245 if (source == screenfitButton)
18372246 {
1838
- //Reload(lastConverter, lastFilename, true);
18392247 ScreenFit();
18402248 } else
18412249 if (source == screenfitpointButton)
18422250 {
1843
- //Reload(lastConverter, lastFilename, true);
18442251 ScreenFitPoint();
18452252 } else
18462253 if (source == snapobjectButton)
18472254 {
1848
- //Reload(lastConverter, lastFilename, true);
18492255 SnapObject();
18502256 } else
18512257 // if (event.getSource() == recompileButton)
....@@ -1882,12 +2288,20 @@
18822288 {
18832289 loadClipboard(true);
18842290 } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
18852299 if (source == duplicateItem)
18862300 {
1887
- Object3D keep = GrafreeD.clipboard;
2301
+ Object3D keep = Grafreed.clipboard;
18882302 loadClipboard(false);
18892303 paste(false);
1890
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
18912305 } else
18922306 if (source == cloneItem)
18932307 {
....@@ -1905,13 +2319,17 @@
19052319 {
19062320 paste(false);
19072321 } else
2322
+ if (source == pasteIntoItem)
2323
+ {
2324
+ pasteInto(true, false);
2325
+ } else
19082326 if (source == pasteLinkItem)
19092327 {
1910
- pasteInto(false);
2328
+ pasteInto(false, false);
19112329 } else
19122330 if (source == pasteCloneItem)
19132331 {
1914
- pasteInto(true);
2332
+ pasteInto(true, true);
19152333 } else
19162334 if (source == pasteExpandItem)
19172335 {
....@@ -2103,9 +2521,9 @@
21032521 // group.selection.get(0).setMasterThis(content); // should be identity
21042522 // refreshContents();
21052523 // }
2106
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21072525 {
2108
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
21092527
21102528 if (content instanceof cGroup && ((cGroup)content).transientlink )
21112529 content = ((cGroup)content).get(0);
....@@ -2113,11 +2531,11 @@
21132531 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21142532 for (int i=0; i<group.selection.size(); i++)
21152533 {
2116
- boolean random = CameraPane.RANDOM;
2117
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
21182536 group.selection.get(i).linkVerticesThis(content);
21192537 // group.selection.get(i).setMasterThis(content); // should be identity
2120
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
21212539 }
21222540 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21232541 refreshContents();
....@@ -2127,20 +2545,20 @@
21272545 {
21282546 for (int i=0; i<group.selection.size(); i++)
21292547 {
2130
- boolean random = CameraPane.RANDOM;
2131
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
21322550 group.selection.get(i).linkVerticesThis(null);
2133
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
21342552 }
21352553
21362554 refreshContents();
21372555 } else
21382556 if (source == relinkverticesItem)
21392557 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
21422560 group.selection.RelinkToSupport();
2143
- CameraPane.RANDOM = random;
2561
+ CameraPane.SWITCH = random;
21442562
21452563 refreshContents();
21462564 } else
....@@ -2155,9 +2573,9 @@
21552573 } else
21562574 if (source == setMasterItem)
21572575 {
2158
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21592577 {
2160
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21612579
21622580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21632581 content = ((cGroup)content).get(0);
....@@ -2170,9 +2588,9 @@
21702588 {
21712589 if (group.selection.size() == 1)
21722590 {
2173
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21742592 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21762594
21772595 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782596 content = ((cGroup)content).get(0);
....@@ -2189,7 +2607,7 @@
21892607 {
21902608 RevertMeshes();
21912609 } else
2192
- if (source == resetMeshItem)
2610
+ if (source == resetAllItem)
21932611 {
21942612 ResetAll();
21952613 } else
....@@ -2209,9 +2627,9 @@
22092627 {
22102628 ClearSelection(true);
22112629 } else
2212
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
22132631 {
2214
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
22152633 } else
22162634 if (source == hideItem)
22172635 {
....@@ -2229,16 +2647,16 @@
22292647 {
22302648 makeSomething(new Camera());
22312649 } else
2232
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
22332651 {
22342652 group(new Composite());
22352653 } else
2236
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
22372655 {
22382656 RandomNode random = new RandomNode();
22392657 group(random);
22402658 if (random.size() > 0)
2241
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
22422660 } else
22432661 if (source == physicsItem)
22442662 {
....@@ -2335,7 +2753,7 @@
23352753 {
23362754 group(new cLinker());
23372755 } else
2338
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
23392757 {
23402758 group(new TextureNode());
23412759 } else
....@@ -2355,17 +2773,30 @@
23552773 {
23562774 CastShadow(2);
23572775 } else
2358
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23592777 {
2360
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
23612780 for (int i=0; i<group.selection.size(); i++)
23622781 {
2363
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
23642787 }
23652788
2366
- ClearSelection(false);
2367
-
2368
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
23692800 } else
23702801 if (source == genUVItem)
23712802 {
....@@ -2377,7 +2808,7 @@
23772808 } else
23782809 if (source == genNormalsMESHItem)
23792810 {
2380
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
23812812 } else
23822813 if (source == genNormalsORGANItem)
23832814 {
....@@ -2442,6 +2873,22 @@
24422873 if (source == unmarkleavesItem)
24432874 {
24442875 MarkLeaves(false);
2876
+ } else
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
24452892 } else
24462893 if (source == flipVItem)
24472894 {
....@@ -2527,9 +2974,13 @@
25272974 {
25282975 SmoothMesh();
25292976 } else
2530
- if (source == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
25312978 {
25322979 TransformGeometry();
2980
+ } else
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
25332984 } else
25342985 if (source == resetTransformItem)
25352986 {
....@@ -2537,7 +2988,11 @@
25372988 } else
25382989 if (source == resetCentroidItem)
25392990 {
2540
- ResetCentroid();
2991
+ ResetCentroid(true);
2992
+ } else
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
25412996 } else
25422997 if (source == resetParentItem)
25432998 {
....@@ -2669,6 +3124,10 @@
26693124 if (source == twoButton)
26703125 {
26713126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
26723131 // bug
26733132 //gridPanel.setDividerLocation(1.0);
26743133 //bigPanel.setDividerLocation(0.0);
....@@ -2701,10 +3160,31 @@
27013160 bigThree.ClearUI();
27023161 bigThree.add(centralPanel);
27033162 bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
27043181 } else
27053182 if (source == threeButton)
27063183 {
27073184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
27083188
27093189 // bigThree.remove(scenePanel);
27103190 // bigThree.remove(centralPanel);
....@@ -2737,10 +3217,15 @@
27373217 bigThree.add(centralPanel);
27383218 bigThree.add(XYZPanel);
27393219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
27403222 } else
27413223 if (source == fourButton)
27423224 {
27433225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
27443229
27453230 // bigThree.remove(scenePanel);
27463231 // bigThree.remove(centralPanel);
....@@ -2772,10 +3257,15 @@
27723257 bigThree.ClearUI();
27733258 bigThree.add(scenePanel);
27743259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
27753262 } else
27763263 if (source == sixButton)
27773264 {
27783265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
27793269
27803270 // bigThree.remove(scenePanel);
27813271 // bigThree.remove(centralPanel);
....@@ -2808,10 +3298,15 @@
28083298 bigThree.add(scenePanel);
28093299 bigThree.add(centralPanel);
28103300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
28113303 } else
28123304 if (source == sevenButton)
28133305 {
28143306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
28153310
28163311 // bigThree.remove(scenePanel);
28173312 // bigThree.remove(centralPanel);
....@@ -2845,6 +3340,8 @@
28453340 bigThree.add(centralPanel);
28463341 bigThree.add(XYZPanel);
28473342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
28483345 } else
28493346 if (source == rootButton)
28503347 {
....@@ -2856,6 +3353,7 @@
28563353 EditObject(obj);
28573354 }
28583355
3356
+ cameraView.requestFocusInWindow();
28593357 refreshContents(true);
28603358 } else
28613359 if (source == closeButton)
....@@ -2865,22 +3363,37 @@
28653363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28663364 {
28673365 ab = (cRadio)e.nextElement();
2868
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28693367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
28703374 buttonGroup.remove(ab);
28713375 radioPanel.remove(ab);
28723376
2873
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
28743379 // ab.GetObject().objectUI = null; // ?????????
28753380
28763381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28773382 break;
28783383 }
28793384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
28803387 refreshContents(true);
28813388 } else
28823389 if (source == editItem || source == editButton)
28833390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
28843397 EditSelection(false);
28853398 } else
28863399 if (source == uneditButton)
....@@ -2890,12 +3403,13 @@
28903403 Object3D child = (Object3D)e.nextElement();
28913404 if(child.editWindow != null)
28923405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
28933407 child.CloseUI();
28943408 listUI.remove(child);
28953409
2896
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
28973411 }
2898
- objEditor.ctrlPanel.validate();
3412
+ objEditor.ctrlPanel.FlushUI();
28993413 //objEditor.jTree.clearSelection();
29003414 //objEditor.ResetSliders();
29013415 refreshContents(true);
....@@ -2906,6 +3420,7 @@
29063420 //copy.ClearUI();
29073421 for (Object3D obj : listUI)
29083422 {
3423
+ obj.pinned = false;
29093424 obj.CloseUI();
29103425 }
29113426 listUI.clear();
....@@ -2915,7 +3430,7 @@
29153430 {
29163431 assert(copy == group);
29173432
2918
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29193434
29203435 for (Object3D obj : listUI)
29213436 {
....@@ -2979,20 +3494,44 @@
29793494 frontView.object = group;
29803495 sideView.object = group;
29813496 }
2982
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
29833502 /*
29843503 currentLayout = radio.layout;
29853504 if (currentLayout == null)
29863505 currentLayout = sevenButton;
29873506 */
29883507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
29893513 keepparent = group.parent;
29903514 // PARENT = NULL or not???
29913515 //group.parent = null; // ROOT
29923516 //group.attributes = -1;
29933517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
29943520 refreshContents(true);
2995
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
29963535 else
29973536 {
29983537 //return super.action(event, arg);
....@@ -3001,7 +3540,6 @@
30013540 }
30023541
30033542 boolean useclient = false;
3004
- cRadio radio;
30053543
30063544 void ToggleRoot()
30073545 {
....@@ -3053,6 +3591,28 @@
30533591 refreshContents();
30543592 }
30553593
3594
+ void TransformChildren()
3595
+ {
3596
+ Object3D obj;
3597
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3598
+ {
3599
+ obj = (Object3D)e.nextElement();
3600
+ obj.KeepTextureMatrices();
3601
+ obj.TransformChildren();
3602
+ obj.RestoreTextureMatrices();
3603
+
3604
+// if (obj.parent == null)
3605
+// {
3606
+// System.out.println("NULL PARENT!");
3607
+// new Exception().printStackTrace();
3608
+// }
3609
+// else
3610
+// TouchTransform(obj);
3611
+// //obj.parent.Touch();
3612
+ }
3613
+
3614
+ refreshContents();
3615
+ }
30563616
30573617 void ResetTransform()
30583618 {
....@@ -3165,7 +3725,7 @@
31653725 refreshContents();
31663726 }
31673727
3168
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
31693729 {
31703730 Object3D obj;
31713731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3180,12 +3740,16 @@
31803740 LA.matIdentity(Object3D.mat);
31813741 obj.getBounds(minima, maxima, false);
31823742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3183
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31843745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31853746 obj.TransformMesh(Object3D.mat);
3747
+
31863748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3187
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31883751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
31893753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31903754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31913755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3214,7 +3778,8 @@
32143778
32153779 int size = obj.MemorySize();
32163780
3217
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32183783 }
32193784 }
32203785 catch (Exception e)
....@@ -3251,9 +3816,9 @@
32513816 obj = (Object3D)e.nextElement();
32523817
32533818 System.out.println("Object is: " + obj);
3254
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
32553820 System.out.println("Boundary rep: " + obj.bRep);
3256
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
32573822
32583823 // System.err.println((size/1024) + " KB is the size of " + obj);
32593824 }
....@@ -3295,6 +3860,13 @@
32953860 void GenNormals(boolean crease)
32963861 {
32973862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
32983870
32993871 refreshContents();
33003872 }
....@@ -3467,8 +4039,8 @@
34674039
34684040 void ParseVertices()
34694041 {
3470
- boolean epsequal = GrafreeD.epsequal;
3471
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
34724044
34734045 for (int i=0; i<group.selection.size(); i++)
34744046 {
....@@ -3493,7 +4065,7 @@
34934065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34944066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34954067
3496
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
34974069
34984070 buffer.add(g);
34994071 }
....@@ -3508,7 +4080,7 @@
35084080 makeSomething(buffer, i==group.selection.size()-1);
35094081 }
35104082
3511
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
35124084
35134085 refreshContents();
35144086 }
....@@ -3526,7 +4098,16 @@
35264098 String pigment = Object3D.GetPigment(tex);
35274099 //String bump = Object3D.GetBump(tex);
35284100
3529
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4102
+
4103
+ try
4104
+ {
4105
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4106
+ }
4107
+ catch (Exception e)
4108
+ {
4109
+ System.err.println("FAIL: " + node);
4110
+ }
35304111
35314112 double s = v.s;
35324113
....@@ -3614,11 +4195,11 @@
36144195
36154196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36164197
3617
- boolean random = CameraPane.RANDOM;
3618
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
36194200 lowres.linkVerticesThis(null);
36204201 lowres.linkVerticesThis(sn);
3621
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
36224203
36234204 System.err.flush();
36244205
....@@ -3658,7 +4239,7 @@
36584239 return;
36594240
36604241 Object3D poses = group.selection.get(0);
3661
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
36624243
36634244 Object3D newgroup = new Object3D("Po:" + poses.name);
36644245
....@@ -3852,9 +4433,9 @@
38524433
38534434 void ClipMesh()
38544435 {
3855
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38564437 {
3857
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
38584439
38594440 if (content instanceof cGroup && ((cGroup)content).transientlink )
38604441 content = ((cGroup)content).get(0);
....@@ -3863,7 +4444,7 @@
38634444 // {
38644445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38654446 // }
3866
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
38674448 }
38684449 // group.selection.ClipMesh(GrafreeD.clipboard);
38694450 System.out.println("DONE.");
....@@ -3910,6 +4491,18 @@
39104491 void MarkLeaves(boolean hide)
39114492 {
39124493 group.selection.MarkLeaves(hide);
4494
+ refreshContents();
4495
+ }
4496
+
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
39134506 refreshContents();
39144507 }
39154508
....@@ -3984,10 +4577,6 @@
39844577 // }
39854578 // }
39864579
3987
- static boolean allparams = true;
3988
-
3989
- static Vector<Object3D> listUI = new Vector<Object3D>();
3990
-
39914580 void EditSelection(boolean newWindow)
39924581 {
39934582 // aConstraints.gridy = 0;
....@@ -3995,10 +4584,10 @@
39954584 {
39964585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39974586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3998
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39994588
40004589 Object3D elem = (Object3D)group.selection.elementAt(i);
4001
- if(elem != group)
4590
+ if(elem != group || !newWindow)
40024591 {
40034592 // if (!(elem instanceof Composite))
40044593 // newWindow = false;
....@@ -4080,7 +4669,8 @@
40804669 //new Exception().printStackTrace();
40814670
40824671 freezemodel = true;
4083
-
4672
+ ClearUnpinned();
4673
+
40844674 /**/
40854675 //switch (event.id)
40864676 {
....@@ -4088,7 +4678,6 @@
40884678 //case 702: // Event.LIST_DESELECT
40894679 group.deselectAll();
40904680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4091
- objEditor.ClearInfo(); // .GetMaterial());
40924681 if (tps != null)
40934682 {
40944683 for (int i=0; i < tps.length; i++)
....@@ -4097,10 +4686,8 @@
40974686
40984687 //if (child.parent != null)
40994688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
41004690 group.addSelectee(child);
4101
- objEditor.SetMaterial(child); // .GetMaterial());
4102
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4103
- System.err.println("info : " + child.GetPath());
41044691 }
41054692 }
41064693 // else
....@@ -4110,20 +4697,28 @@
41104697 // System.err.println("info : " + group.GetPath());
41114698 // }
41124699
4113
- objEditor.SetText(); // jan 2014
4114
-
4115
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41164701 CameraPane.flash = true;
41174702
4118
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41194704 // a camera
41204705 {
4121
- CameraPane.camerachangeframe = 0; // don't refuse it
4122
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
41234711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41244712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41254713 }
41264714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
41274722 refreshContents();
41284723 //return true;
41294724 }
....@@ -4132,6 +4727,35 @@
41324727
41334728 freezemodel = false;
41344729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
41354759
41364760 void linkSomething(Object3D thing)
41374761 {
....@@ -4203,16 +4827,19 @@
42034827 {
42044828 if (group.selection.isEmpty())
42054829 return;
4206
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
42074832 Composite tGroup = null;
42084833 if (group.selection.size() > 0) // 1)
42094834 {
42104835 tGroup = new cGroup();
4211
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
42124837 }
42134838
42144839 if (cut)
42154840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
42164843 //int indices[] = jList.getSelectedIndices();
42174844 //for (int i = indices.length - 1; i >= 0; i--)
42184845 //jList.remove(indices[i]);
....@@ -4248,16 +4875,16 @@
42484875 //System.out.println("cut " + child);
42494876 //System.out.println("parent = " + child.parent);
42504877 // tmp.addChild(child);
4251
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
42524879 tGroup.add/*Child*/(tmp);
42534880 else
4254
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
42554882 }
42564883 else
4257
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
42584885 tGroup.add/*Child*/(child);
42594886 else
4260
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
42614888 }
42624889
42634890 //ResetModel();
....@@ -4289,21 +4916,23 @@
42894916 //System.out.println("cut " + elem);
42904917 //System.out.println("parent = " + elem.parent);
42914918 // tmp.addChild(elem);
4292
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
42934920 tGroup.add/*Child*/(tmp);
42944921 else
4295
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
42964923 }
42974924 else
4298
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
42994926 tGroup.add/*Child*/(child);
43004927 else
4301
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
43024929 }
43034930
43044931 }
4305
- if (GrafreeD.clipboardIsTempGroup)
4306
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
43074936 if (cut)
43084937 {
43094938 ResetModel();
....@@ -4313,11 +4942,15 @@
43134942
43144943 void paste(boolean expand)
43154944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
43164949 // if (GrafreeD.clipboard == null)
43174950 // return;
43184951 boolean first = true;
43194952
4320
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43214954 {
43224955 Composite temp;
43234956
....@@ -4328,7 +4961,7 @@
43284961 temp = (Composite)Applet3D.clipboard.deepCopy();
43294962 */
43304963 Object3D elem;
4331
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4964
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43324965 {
43334966 Object3D child = (Object3D)e.nextElement();
43344967
....@@ -4362,21 +4995,22 @@
43624995 //Object3D cb = Applet3D.clipboard;
43634996 //temp.addChild(cb);
43644997 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4365
- assert(GrafreeD.clipboard.parent == null);
4366
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4367
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4368
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4369
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4998
+ assert(Grafreed.clipboard.parent == null);
4999
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5000
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5001
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5002
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43705003 else
4371
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4372
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
43735006 }
43745007
5008
+ Globals.SAVEONMAKE = keep;
43755009 ResetModel();
43765010 refreshContents();
43775011 }
43785012
4379
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
43805014 {
43815015 // if (GrafreeD.clipboard == null)
43825016 // return;
....@@ -4405,15 +5039,22 @@
44055039 if (copyit)
44065040 {
44075041 // paste(false);
4408
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
44095050 }
44105051 else
44115052 {
44125053 boolean first = true;
44135054
4414
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
44155056 {
4416
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
44175058 Object3D copy;
44185059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44195060 {
....@@ -4423,7 +5064,7 @@
44235064 }
44245065 } else
44255066 {
4426
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
44275068 }
44285069 }
44295070 }
....@@ -4500,6 +5141,10 @@
45005141
45015142 void group(Object3D csg, boolean grab)
45025143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
45035148 if (//false) // why??
45045149 !group.selection.isEmpty())
45055150 {
....@@ -4613,10 +5258,15 @@
46135258 //node.add(csg);
46145259 //makeSomething(node);
46155260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
46165262 }
46175263
46185264 void Ungroup(Object3D g)
46195265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
46205270 if (g instanceof HiddenObject)
46215271 {
46225272 HiddenObject h = (HiddenObject) g;
....@@ -4633,6 +5283,7 @@
46335283 objEditor.makeSomething(g.get(i), false);
46345284 }
46355285 }
5286
+ Globals.SAVEONMAKE = keep;
46365287 }
46375288
46385289 void ungroup()
....@@ -4828,21 +5479,6 @@
48285479 }
48295480 */
48305481
4831
- void ImportGFD()
4832
- {
4833
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4834
- browser.show();
4835
- String filename = browser.getFile();
4836
- if (filename != null && filename.length() > 0)
4837
- {
4838
- String fullname = browser.getDirectory() + filename;
4839
-
4840
- //Object3D readobj =
4841
- objEditor.ReadGFD(fullname, objEditor);
4842
- //makeSomething(readobj);
4843
- }
4844
- }
4845
-
48465482 /*
48475483 public void Callback(Object obj)
48485484 {
....@@ -4866,26 +5502,9 @@
48665502 }
48675503 */
48685504
4869
- void ImportVRMLX3D()
4870
- {
4871
- if (GrafreeD.standAlone)
4872
- {
4873
- /**/
4874
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4875
- browser.show();
4876
- String filename = browser.getFile();
4877
- if (filename != null && filename.length() > 0)
4878
- {
4879
- String fullname = browser.getDirectory() + filename;
4880
- LoadVRMLX3D(fullname);
4881
- }
4882
- /**/
4883
- }
4884
- }
4885
-
48865505 String GetFile(String dialogName)
48875506 {
4888
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
48895508 {
48905509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48915510 browser.show();
....@@ -4949,10 +5568,33 @@
49495568 cButton flashSelectionButton;
49505569 cButton editButton;
49515570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
49525572 cButton clearpanelButton;
4953
- cButton allParamsButton;
49545573 cButton unselectButton;
49555574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
5578
+ cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
5597
+
49565598 cButton screenfitButton;
49575599 cButton screenfitpointButton;
49585600 cButton snapobjectButton;
....@@ -4964,14 +5606,6 @@
49645606
49655607 cButton setsupportButton;
49665608
4967
- cButton twoButton;
4968
- cButton sixButton;
4969
- cButton threeButton;
4970
- cButton sevenButton;
4971
- cButton fourButton; // full panel
4972
- cButton oneButton; // full XYZ
4973
- //cButton currentLayout;
4974
-
49755609 //
49765610 //Composite
49775611 Object3D // to do !!
....@@ -4981,9 +5615,11 @@
49815615 //JTree jTree;
49825616 private MenuItem lookAtItem;
49835617 private MenuItem lookFromItem;
4984
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
49855619 private MenuItem cutItem;
4986
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
49875623 private MenuItem cloneItem;
49885624 private MenuItem cloneSupportItem;
49895625 private MenuItem overwriteGeoItem;
....@@ -4996,7 +5632,7 @@
49965632 private MenuItem linkverticesItem;
49975633 private MenuItem relinkverticesItem;
49985634 private MenuItem setMasterItem;
4999
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
50005636 private MenuItem stepAllItem;
50015637 private MenuItem revertMeshItem;
50025638 private MenuItem poseMeshItem;
....@@ -5007,6 +5643,7 @@
50075643 private MenuItem mergeGeometriesItem;
50085644 private MenuItem copyItem;
50095645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
50105647 private MenuItem pasteLinkItem;
50115648 private MenuItem pasteCloneItem;
50125649 private MenuItem pasteExpandItem;
....@@ -5045,6 +5682,10 @@
50455682 private MenuItem showleavesItem;
50465683 private MenuItem markleavesItem;
50475684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
50485689
50495690 private MenuItem flipVItem;
50505691 private MenuItem unflipVItem;
....@@ -5056,15 +5697,17 @@
50565697 private MenuItem panoTexturesItem;
50575698
50585699 private MenuItem resetCentroidItem;
5059
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
50605701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
50615704 private MenuItem hideItem;
50625705 private MenuItem grabItem;
50635706 private MenuItem backItem;
50645707 private MenuItem frontItem;
50655708 private MenuItem cameraItem;
50665709 private MenuItem compositeItem;
5067
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
50685711 private MenuItem physicsItem;
50695712 private MenuItem frameselectorItem;
50705713 private MenuItem scriptNodeItem;
....@@ -5104,7 +5747,7 @@
51045747 private MenuItem blobItem;
51055748 private MenuItem latheItem;
51065749 private MenuItem bezierItem;
5107
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
51085751 private MenuItem meshItem;
51095752 // private MenuItem meshGroupItem;
51105753 private MenuItem springItem;
....@@ -5126,11 +5769,6 @@
51265769 private MenuItem doubleItem;
51275770 private MenuItem tripleItem;
51285771
5129
- private MenuItem importGFDItem;
5130
- private MenuItem importVRMLX3DItem;
5131
- private MenuItem import3DSItem;
5132
- private MenuItem importOBJItem;
5133
-
51345772 private MenuItem computeAOItem;
51355773 private MenuItem recompileItem;
51365774 private MenuItem editScriptItem;
....@@ -5140,4 +5778,8 @@
51405778 private MenuItem analyzeItem;
51415779 private MenuItem dumpItem;
51425780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
51435785 }