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,92 +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(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
444
- trackCB.setToolTipText("Enable tracking");
445
- trackCB.addItemListener(this);
446
-
447
- 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);
448611 screenfitButton.setToolTipText("Screen fit");
449612 screenfitButton.addActionListener(this);
450613
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
+
451650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
452651 // screenfitpointButton.addActionListener(this);
453
-// oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
455
- snapobjectButton.addActionListener(this);
456
- snapobjectButton.setToolTipText("Snap Object");
457
- oe.aConstraints.gridx += 1;
458652
459
- //aConstraints.gridx = 0;
460
- //aConstraints.gridy += 1;
461
- oe.aConstraints.weighty = 0;
462
- oe.aConstraints.gridwidth = 1;
463
-
464
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
465
- flashSelectionButton.setToolTipText("Show selection");
466
- 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));
467661
468
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469
-
470
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
471663 twoButton.setToolTipText("Show center view only");
472664 twoButton.addActionListener(this);
473
- 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);
474668 fourButton.addActionListener(this);
475669 fourButton.setToolTipText("Show left panel only");
476
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
477671 sixButton.setToolTipText("2-column layout left");
478672 sixButton.addActionListener(this);
479
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
480674 threeButton.setToolTipText("2-column layout right");
481675 threeButton.addActionListener(this);
482
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483677 sevenButton.setToolTipText("3-column layout");
484678 sevenButton.addActionListener(this);
485679 //
486680
487
- 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);
488682 rootButton.setToolTipText("Edit selection in new tab");
489683 rootButton.addActionListener(this);
490684
491
- 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);
492686 closeButton.setToolTipText("Close tab");
493687 closeButton.addActionListener(this);
494688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
495689 //clearButton.addActionListener(this);
496
-
497
- 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
+ }
498722
499
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
500
- 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");
501772 editButton.addActionListener(this);
502773
503
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
505776 uneditButton.addActionListener(this);
506777
507
- 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);
508783 clearPanelButton.setToolTipText("Clear edit panel");
509784 clearPanelButton.addActionListener(this);
510785
511
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
512
- allParamsButton.setToolTipText("All params??");
513
- allParamsButton.addActionListener(this);
514
-
515
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516787 unselectButton.setToolTipText("Unselect");
517788 unselectButton.addActionListener(this);
518789
519
- 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);
520793
521
- oe.treePanel.add(commandsPanel);
522
- oe.treePanel.Return();
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
523799
524800 // oe.aConstraints.gridx += 1;
525801 // oe.aConstraints.weighty = 0;
....@@ -536,27 +812,12 @@
536812
537813 JScrollPane jSP;
538814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
539
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
540816 ResetModel();
541817
542818 oe.treePanel.add(jSPPanel);
543819 oe.treePanel.Return();
544820
545
- cGridBag copyOptionsPanel = new cGridBag();
546
-
547
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
548
- colorCB.setToolTipText("Copy color when dropped");
549
- colorCB.addItemListener(this);
550
-
551
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
552
- materialCB.setToolTipText("Copy material when dropped");
553
- materialCB.addItemListener(this);
554
-
555
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
556
- textureCB.setToolTipText("Copy texture when dropped");
557
- textureCB.addItemListener(this);
558
-
559
- copyOptionsPanel.preferredHeight = 1;
560821 oe.treePanel.add(copyOptionsPanel);
561822 oe.treePanel.Return();
562823
....@@ -587,47 +848,61 @@
587848
588849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
589850 {
590
- //constraints.gridx = 0;
591
- //constraints.gridy = 0;
592
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
593
- fastCB.setToolTipText("Fast mode");
594
- fastCB.addItemListener(this);
595
- //constraints.gridy += 1;
596
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
597
- supportCB.setToolTipText("Enabled rigging");
598
- 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);
599854
600
- // constraints.gridy += 1;
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);
882
+
601883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
602884 // localCB.addItemListener(this);
603885
604
- //constraints.gridy += 1;
886
+ panel.Return();
887
+
605888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
606889 crowdCB.setToolTipText("Used for crowds");
607890 crowdCB.addItemListener(this);
608891
609
- //constraints.gridy += 1;
610892 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
611893 smoothCB.setToolTipText("Snapping delay");
612894 smoothCB.addItemListener(this);
613895
614
- //constraints.gridy += 1;
615896 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
616897 slowCB.setToolTipText("Smooth interpolation");
617898 slowCB.addItemListener(this);
618
- //constraints.gridy += 1;
619
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
620
- boxCB.setToolTipText("Display bounding boxes");
621
- boxCB.addItemListener(this);
622
- //constraints.gridy += 1;
623
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
624
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
625
- zoomBoxCB.addItemListener(this);
626
-
899
+
627900 // constraints.gridy += 1;
628901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
629902 // speakerMocapCB.addItemListener(this);
630903
904
+ panel.Return();
905
+
631906 if (false)
632907 {
633908 // handled in scripts
....@@ -642,32 +917,72 @@
642917 //constraints.gridy += 1;
643918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
644919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
645921 }
646922
647923 //constraints.gridx += 1;
648924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
649925 // debugCB.addItemListener(this);
650926
651
- //constraints.gridy += 1;
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
652931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
653933 oeilCB.addItemListener(this);
654934
655
- //constraints.gridy += 1;
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
+ {
656955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
657956 lookAtCB.setToolTipText("Look-at target");
658957 lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
659961
660962 cGridBag fill = new cGridBag();
661
-
662963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
663968
664969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
665972
666973 }
667974
668975 void EditObject(Object3D obj)
669976 {
670977 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
+
671986 radioButton.SetObject(obj);
672987 radioButton.layout = sevenButton;
673988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -676,8 +991,11 @@
676991 buttonGroup.add(radioButton);
677992 radioButton.doClick();
678993 }
994
+
679995 void SetupViews(ObjEditor oe)
680996 {
997
+ theFrame = this;
998
+
681999 oe.SetupViews();
6821000
6831001 System.out.println("SetupViews");
....@@ -686,23 +1004,28 @@
6861004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6871005 }
6881006
689
- JCheckBox liveCB;
690
- JCheckBox supportCB;
691
- JCheckBox localCB;
692
- JCheckBox crowdCB;
693
- JCheckBox smoothCB;
694
- JCheckBox fastCB;
695
- JCheckBox slowCB;
696
- JCheckBox boxCB;
697
- JCheckBox zoomBoxCB;
698
- JCheckBox trackCB;
699
- 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;
7001020 // JCheckBox speakerMocapCB;
701
- JCheckBox speakerCameraCB;
702
- JCheckBox speakerFocusCB;
703
- JCheckBox debugCB;
704
- JCheckBox oeilCB;
705
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
7061029
7071030 // static int COLOR = 1;
7081031 // static int MATERIAL = 2;
....@@ -710,9 +1033,9 @@
7101033
7111034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7121035
713
- JCheckBox colorCB;
714
- JCheckBox materialCB;
715
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7161039
7171040 public void itemStateChanged(ItemEvent e)
7181041 {
....@@ -740,6 +1063,7 @@
7401063 } else if(e.getSource() == liveCB)
7411064 {
7421065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7431067 }
7441068 else if(e.getSource() == supportCB)
7451069 {
....@@ -804,6 +1128,18 @@
8041128 {
8051129 cameraView.ToggleOeil();
8061130 }
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
+ }
8071143 else if(e.getSource() == lookAtCB)
8081144 {
8091145 cameraView.ToggleLookAt();
....@@ -820,7 +1156,8 @@
8201156
8211157 /**/
8221158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
823
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8241161 if ((path == null) || (path.getPathCount() <= 1)) {
8251162 // We can't move the root node or an empty selection
8261163 return;
....@@ -883,8 +1220,6 @@
8831220 }
8841221 }
8851222
886
- String string = (String) object;
887
-
8881223 System.out.println("Transfer = " + object + "; drop : " + target);
8891224 // if( object instanceof java.io.File[])
8901225 // {
....@@ -892,7 +1227,11 @@
8921227 // objEditor.DropFile((java.io.File[]) object, true);
8931228 // return;
8941229 // }
895
- 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) == ':')
8961235 {
8971236 // file(s)
8981237 String[] names = string.split("\n");
....@@ -919,7 +1258,7 @@
9191258
9201259 flashIt = false;
9211260 CameraPane pane = (CameraPane) target;
922
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9231262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9241263
9251264 if (group.selection.size() == 1)
....@@ -935,23 +1274,33 @@
9351274
9361275 assert target == objEditor.jTree;
9371276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9381278 try {
939
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9401280 } catch (Exception e) {
9411281 System.out.println("destinationPath : " + destinationPath);
9421282 return;
9431283 }
9441284
945
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9461286 {
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
+// {
9471296 loadClipboard(true);
9481297 objEditor.jTree.setSelectionPath(destinationPath);
949
- pasteInto(false);
950
- } else {
951
- loadClipboard(false);
952
- objEditor.jTree.setSelectionPath(destinationPath);
953
- pasteInto(false); // true); // ???
954
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9551304 }
9561305 public void dropActionChanged(DropTargetDragEvent dtde)
9571306 // Called if the user has modified the current drop gesture
....@@ -1056,85 +1405,107 @@
10561405 {
10571406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10581407 //heightFieldItem.addActionListener(this);
1059
- gridItem = menu.add(new MenuItem("Grid"));
1060
- gridItem.addActionListener(this);
1061
- rectoidItem = menu.add(new MenuItem("Box"));
1062
- rectoidItem.addActionListener(this);
1063
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1064
- ellipsoidItem.addActionListener(this);
1065
- coneItem = menu.add(new MenuItem("Cone"));
1066
- coneItem.addActionListener(this);
1067
- torusItem = menu.add(new MenuItem("Torus"));
1068
- torusItem.addActionListener(this);
1069
- superItem = menu.add(new MenuItem("Superellipsoid"));
1070
- 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
+ {
10711426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10721427 kleinItem.addActionListener(this);
1073
- particleItem = menu.add(new MenuItem("Particle system"));
1074
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10751434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10761435 ragdollItem.addActionListener(this);
10771436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10781437 ragdoll2Item.addActionListener(this);
1438
+ }
10791439 menu.add("-");
1080
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10811441 meshItem.addActionListener(this);
10821442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10831443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10841446 springItem = menu.add(new MenuItem("Spring"));
10851447 springItem.addActionListener(this);
10861448 flagItem = menu.add(new MenuItem("Flag"));
10871449 flagItem.addActionListener(this);
1088
- bezierItem = menu.add(new MenuItem("Patch"));
1089
- bezierItem.addActionListener(this);
1090
- checkerItem = menu.add(new MenuItem("Checker"));
1091
- checkerItem.addActionListener(this);
10921450 blobItem = menu.add(new MenuItem("Blob"));
10931451 blobItem.addActionListener(this);
10941452 latheItem = menu.add(new MenuItem("Lathe"));
10951453 latheItem.addActionListener(this);
1096
- lightItem = menu.add(new MenuItem("Light"));
1097
- 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);
10981461 menu.add("-");
10991462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11001463 //superLoopItem.addActionListener(this);
1101
- loopItem = menu.add(new MenuItem("Loop"));
1102
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
11031466 doubleItem = menu.add(new MenuItem("Fork"));
11041467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
11051470 tripleItem = menu.add(new MenuItem("Trident"));
11061471 tripleItem.addActionListener(this);
1472
+ }
11071473 }
11081474
11091475 void buildToolsMenu(Menu menu)
11101476 {
11111477 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11121478 animationItem.addItemListener(this);
1113
- animationItem.setState(CameraPane.ANIMATION);
1479
+ animationItem.setState(Globals.ANIMATION);
1480
+
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
11141483
11151484 menu.add("-");
11161485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11171486 parseverticesItem.addActionListener(this);
11181487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11191488 textureFieldItem.addActionListener(this);
1120
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
11211490 alignItem.addActionListener(this);
1122
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1123
- mirrorItem.addActionListener(this);
11241491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11251492 reduceMorphItem.addActionListener(this);
11261493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11271494 reduce34MorphItem.addActionListener(this);
1128
-
1129
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1130
- computeAOItem.addActionListener(this);
11311495 menu.add("-");
1132
-
11331496 menu.add(memoryItem = new MenuItem("Memory Usage"));
11341497 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("-");
11351506 menu.add(analyzeItem = new MenuItem("Analyze"));
11361507 analyzeItem.addActionListener(this);
1137
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11381509 dumpItem.addActionListener(this);
11391510 // menu.add(pathItem = new MenuItem("From-to path"));
11401511 // pathItem.addActionListener(this);
....@@ -1152,6 +1523,7 @@
11521523 menu.add("-");
11531524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11541525 editScriptItem.addActionListener(this);
1526
+ }
11551527 }
11561528
11571529 void ScreenFit()
....@@ -1274,9 +1646,24 @@
12741646 shadow.material = new cMaterial(obj.material);
12751647 shadow.material.diffuse = 0.0001f;
12761648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12771650
12781651 makeSomething(shadow);
12791652 }
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
+ }
12801667
12811668 /**
12821669 * applyExample
....@@ -1480,9 +1867,9 @@
14801867
14811868 void Overwrite(int mask)
14821869 {
1483
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14841871 {
1485
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14861873
14871874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14881875 content = ((cGroup)content).get(0);
....@@ -1521,7 +1908,7 @@
15211908 {
15221909 ScreenFit();
15231910 } else
1524
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15251912 {
15261913 cVector v1 = new cVector();
15271914 cVector v2 = new cVector();
....@@ -1530,11 +1917,11 @@
15301917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15311918 objEditor.cameraView.repaint();
15321919 } else
1533
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
15341921 {
15351922 makeSomething(new Box());
15361923 } else
1537
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15381925 {
15391926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15401927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1613,27 +2000,27 @@
16132000
16142001 makeSomething(obj);
16152002 } else
1616
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16172004 {
16182005 makeSomething(new Grid());
16192006 } else
1620
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16212008 {
16222009 makeSomething(new Sphere());
16232010 } else
1624
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16252012 {
16262013 makeSomething(new Cone());
16272014 } else
1628
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16292016 {
16302017 makeSomething(new Torus());
16312018 } else
1632
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
16332020 {
16342021 makeSomething(new Superellipsoid());
16352022 } else
1636
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
16372024 {
16382025 makeSomething(new Klein());
16392026 } else
....@@ -1653,7 +2040,7 @@
16532040 {
16542041 makeSomething(new BezierSurface());
16552042 } else
1656
- if (source == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16572044 {
16582045 /*
16592046 Object3D obj = new BezierSurface(5,8);
....@@ -1701,7 +2088,7 @@
17012088 s.setup();
17022089 makeSomething(s);
17032090 } else
1704
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
17052092 {
17062093 makeSomething(new Light());
17072094 } else
....@@ -1751,30 +2138,30 @@
17512138
17522139 group(g);
17532140 } else
1754
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17552142 {
17562143 Composite csg = new GroupLeaf();
17572144 csg.count = 5;
17582145 group(csg);
1759
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17602147 csg.addChild(child);
17612148 child.addChild(csg);
17622149 } else
17632150 if (source == doubleItem)
17642151 {
1765
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17662153 csg.count = 5;
17672154 group(csg);
1768
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17692156 csg.addChild(child);
17702157 child.addChild(csg);
1771
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17722159 csg.addChild(child);
17732160 child.addChild(csg);
17742161 } else
17752162 if (source == tripleItem)
17762163 {
1777
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17782165 csg.count = 4;
17792166 group(csg);
17802167 Composite child = new cGroup();
....@@ -1786,23 +2173,6 @@
17862173 child = new cGroup();
17872174 csg.addChild(child);
17882175 child.addChild(csg);
1789
- } else
1790
-
1791
- if (source == importGFDItem)
1792
- {
1793
- ImportGFD();
1794
- } else
1795
- if (source == importVRMLX3DItem)
1796
- {
1797
- ImportVRMLX3D();
1798
- } else
1799
- if (source == import3DSItem)
1800
- {
1801
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1802
- } else
1803
- if (source == importOBJItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18062176 } else
18072177 if (source == computeAOItem)
18082178 {
....@@ -1822,7 +2192,7 @@
18222192 if (source == invariantsItem)
18232193 {
18242194 System.out.println("Invariants:");
1825
- GrafreeD.grafreeD.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
18262196 } else
18272197 if (source == memoryItem)
18282198 {
....@@ -1841,19 +2211,47 @@
18412211 {
18422212 DumpObject();
18432213 } 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
18442245 if (source == screenfitButton)
18452246 {
1846
- //Reload(lastConverter, lastFilename, true);
18472247 ScreenFit();
18482248 } else
18492249 if (source == screenfitpointButton)
18502250 {
1851
- //Reload(lastConverter, lastFilename, true);
18522251 ScreenFitPoint();
18532252 } else
18542253 if (source == snapobjectButton)
18552254 {
1856
- //Reload(lastConverter, lastFilename, true);
18572255 SnapObject();
18582256 } else
18592257 // if (event.getSource() == recompileButton)
....@@ -1890,12 +2288,20 @@
18902288 {
18912289 loadClipboard(true);
18922290 } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
18932299 if (source == duplicateItem)
18942300 {
1895
- Object3D keep = GrafreeD.clipboard;
2301
+ Object3D keep = Grafreed.clipboard;
18962302 loadClipboard(false);
18972303 paste(false);
1898
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
18992305 } else
19002306 if (source == cloneItem)
19012307 {
....@@ -1913,13 +2319,17 @@
19132319 {
19142320 paste(false);
19152321 } else
2322
+ if (source == pasteIntoItem)
2323
+ {
2324
+ pasteInto(true, false);
2325
+ } else
19162326 if (source == pasteLinkItem)
19172327 {
1918
- pasteInto(false);
2328
+ pasteInto(false, false);
19192329 } else
19202330 if (source == pasteCloneItem)
19212331 {
1922
- pasteInto(true);
2332
+ pasteInto(true, true);
19232333 } else
19242334 if (source == pasteExpandItem)
19252335 {
....@@ -2111,9 +2521,9 @@
21112521 // group.selection.get(0).setMasterThis(content); // should be identity
21122522 // refreshContents();
21132523 // }
2114
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21152525 {
2116
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
21172527
21182528 if (content instanceof cGroup && ((cGroup)content).transientlink )
21192529 content = ((cGroup)content).get(0);
....@@ -2121,11 +2531,11 @@
21212531 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21222532 for (int i=0; i<group.selection.size(); i++)
21232533 {
2124
- boolean random = CameraPane.RANDOM;
2125
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
21262536 group.selection.get(i).linkVerticesThis(content);
21272537 // group.selection.get(i).setMasterThis(content); // should be identity
2128
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
21292539 }
21302540 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21312541 refreshContents();
....@@ -2135,20 +2545,20 @@
21352545 {
21362546 for (int i=0; i<group.selection.size(); i++)
21372547 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
21402550 group.selection.get(i).linkVerticesThis(null);
2141
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
21422552 }
21432553
21442554 refreshContents();
21452555 } else
21462556 if (source == relinkverticesItem)
21472557 {
2148
- boolean random = CameraPane.RANDOM;
2149
- CameraPane.RANDOM = false; // parse all random nodes
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
21502560 group.selection.RelinkToSupport();
2151
- CameraPane.RANDOM = random;
2561
+ CameraPane.SWITCH = random;
21522562
21532563 refreshContents();
21542564 } else
....@@ -2163,9 +2573,9 @@
21632573 } else
21642574 if (source == setMasterItem)
21652575 {
2166
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21672577 {
2168
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21692579
21702580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21712581 content = ((cGroup)content).get(0);
....@@ -2178,9 +2588,9 @@
21782588 {
21792589 if (group.selection.size() == 1)
21802590 {
2181
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21822592 {
2183
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21842594
21852595 if (content instanceof cGroup && ((cGroup)content).transientlink )
21862596 content = ((cGroup)content).get(0);
....@@ -2197,7 +2607,7 @@
21972607 {
21982608 RevertMeshes();
21992609 } else
2200
- if (source == resetMeshItem)
2610
+ if (source == resetAllItem)
22012611 {
22022612 ResetAll();
22032613 } else
....@@ -2217,9 +2627,9 @@
22172627 {
22182628 ClearSelection(true);
22192629 } else
2220
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
22212631 {
2222
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
22232633 } else
22242634 if (source == hideItem)
22252635 {
....@@ -2237,16 +2647,16 @@
22372647 {
22382648 makeSomething(new Camera());
22392649 } else
2240
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
22412651 {
22422652 group(new Composite());
22432653 } else
2244
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
22452655 {
22462656 RandomNode random = new RandomNode();
22472657 group(random);
22482658 if (random.size() > 0)
2249
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
22502660 } else
22512661 if (source == physicsItem)
22522662 {
....@@ -2343,7 +2753,7 @@
23432753 {
23442754 group(new cLinker());
23452755 } else
2346
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
23472757 {
23482758 group(new TextureNode());
23492759 } else
....@@ -2363,17 +2773,30 @@
23632773 {
23642774 CastShadow(2);
23652775 } else
2366
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23672777 {
2368
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
23692780 for (int i=0; i<group.selection.size(); i++)
23702781 {
2371
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
23722787 }
23732788
2374
- ClearSelection(false);
2375
-
2376
- 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
+ }
23772800 } else
23782801 if (source == genUVItem)
23792802 {
....@@ -2385,7 +2808,7 @@
23852808 } else
23862809 if (source == genNormalsMESHItem)
23872810 {
2388
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
23892812 } else
23902813 if (source == genNormalsORGANItem)
23912814 {
....@@ -2450,6 +2873,22 @@
24502873 if (source == unmarkleavesItem)
24512874 {
24522875 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);
24532892 } else
24542893 if (source == flipVItem)
24552894 {
....@@ -2535,9 +2974,13 @@
25352974 {
25362975 SmoothMesh();
25372976 } else
2538
- if (source == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
25392978 {
25402979 TransformGeometry();
2980
+ } else
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
25412984 } else
25422985 if (source == resetTransformItem)
25432986 {
....@@ -2545,7 +2988,11 @@
25452988 } else
25462989 if (source == resetCentroidItem)
25472990 {
2548
- ResetCentroid();
2991
+ ResetCentroid(true);
2992
+ } else
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
25492996 } else
25502997 if (source == resetParentItem)
25512998 {
....@@ -2677,6 +3124,10 @@
26773124 if (source == twoButton)
26783125 {
26793126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
26803131 // bug
26813132 //gridPanel.setDividerLocation(1.0);
26823133 //bigPanel.setDividerLocation(0.0);
....@@ -2709,10 +3160,31 @@
27093160 bigThree.ClearUI();
27103161 bigThree.add(centralPanel);
27113162 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
+
27123181 } else
27133182 if (source == threeButton)
27143183 {
27153184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
27163188
27173189 // bigThree.remove(scenePanel);
27183190 // bigThree.remove(centralPanel);
....@@ -2745,10 +3217,15 @@
27453217 bigThree.add(centralPanel);
27463218 bigThree.add(XYZPanel);
27473219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
27483222 } else
27493223 if (source == fourButton)
27503224 {
27513225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
27523229
27533230 // bigThree.remove(scenePanel);
27543231 // bigThree.remove(centralPanel);
....@@ -2780,10 +3257,15 @@
27803257 bigThree.ClearUI();
27813258 bigThree.add(scenePanel);
27823259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
27833262 } else
27843263 if (source == sixButton)
27853264 {
27863265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
27873269
27883270 // bigThree.remove(scenePanel);
27893271 // bigThree.remove(centralPanel);
....@@ -2816,10 +3298,15 @@
28163298 bigThree.add(scenePanel);
28173299 bigThree.add(centralPanel);
28183300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
28193303 } else
28203304 if (source == sevenButton)
28213305 {
28223306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
28233310
28243311 // bigThree.remove(scenePanel);
28253312 // bigThree.remove(centralPanel);
....@@ -2853,6 +3340,8 @@
28533340 bigThree.add(centralPanel);
28543341 bigThree.add(XYZPanel);
28553342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
28563345 } else
28573346 if (source == rootButton)
28583347 {
....@@ -2864,6 +3353,7 @@
28643353 EditObject(obj);
28653354 }
28663355
3356
+ cameraView.requestFocusInWindow();
28673357 refreshContents(true);
28683358 } else
28693359 if (source == closeButton)
....@@ -2873,22 +3363,37 @@
28733363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28743364 {
28753365 ab = (cRadio)e.nextElement();
2876
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28773367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
28783374 buttonGroup.remove(ab);
28793375 radioPanel.remove(ab);
28803376
2881
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
28823379 // ab.GetObject().objectUI = null; // ?????????
28833380
28843381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28853382 break;
28863383 }
28873384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
28883387 refreshContents(true);
28893388 } else
28903389 if (source == editItem || source == editButton)
28913390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
28923397 EditSelection(false);
28933398 } else
28943399 if (source == uneditButton)
....@@ -2898,12 +3403,13 @@
28983403 Object3D child = (Object3D)e.nextElement();
28993404 if(child.editWindow != null)
29003405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
29013407 child.CloseUI();
29023408 listUI.remove(child);
29033409
2904
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
29053411 }
2906
- objEditor.ctrlPanel.validate();
3412
+ objEditor.ctrlPanel.FlushUI();
29073413 //objEditor.jTree.clearSelection();
29083414 //objEditor.ResetSliders();
29093415 refreshContents(true);
....@@ -2914,6 +3420,7 @@
29143420 //copy.ClearUI();
29153421 for (Object3D obj : listUI)
29163422 {
3423
+ obj.pinned = false;
29173424 obj.CloseUI();
29183425 }
29193426 listUI.clear();
....@@ -2923,7 +3430,7 @@
29233430 {
29243431 assert(copy == group);
29253432
2926
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29273434
29283435 for (Object3D obj : listUI)
29293436 {
....@@ -2987,20 +3494,44 @@
29873494 frontView.object = group;
29883495 sideView.object = group;
29893496 }
2990
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
29913502 /*
29923503 currentLayout = radio.layout;
29933504 if (currentLayout == null)
29943505 currentLayout = sevenButton;
29953506 */
29963507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
29973513 keepparent = group.parent;
29983514 // PARENT = NULL or not???
29993515 //group.parent = null; // ROOT
30003516 //group.attributes = -1;
30013517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
30023520 refreshContents(true);
3003
- }
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
+ }
30043535 else
30053536 {
30063537 //return super.action(event, arg);
....@@ -3009,7 +3540,6 @@
30093540 }
30103541
30113542 boolean useclient = false;
3012
- cRadio radio;
30133543
30143544 void ToggleRoot()
30153545 {
....@@ -3061,6 +3591,28 @@
30613591 refreshContents();
30623592 }
30633593
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
+ }
30643616
30653617 void ResetTransform()
30663618 {
....@@ -3173,7 +3725,7 @@
31733725 refreshContents();
31743726 }
31753727
3176
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
31773729 {
31783730 Object3D obj;
31793731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3188,12 +3740,16 @@
31883740 LA.matIdentity(Object3D.mat);
31893741 obj.getBounds(minima, maxima, false);
31903742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3191
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31923745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31933746 obj.TransformMesh(Object3D.mat);
3747
+
31943748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3195
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31963751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
31973753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31983754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31993755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3222,7 +3778,8 @@
32223778
32233779 int size = obj.MemorySize();
32243780
3225
- 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)");
32263783 }
32273784 }
32283785 catch (Exception e)
....@@ -3259,9 +3816,9 @@
32593816 obj = (Object3D)e.nextElement();
32603817
32613818 System.out.println("Object is: " + obj);
3262
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
32633820 System.out.println("Boundary rep: " + obj.bRep);
3264
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
32653822
32663823 // System.err.println((size/1024) + " KB is the size of " + obj);
32673824 }
....@@ -3303,6 +3860,13 @@
33033860 void GenNormals(boolean crease)
33043861 {
33053862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
33063870
33073871 refreshContents();
33083872 }
....@@ -3475,8 +4039,8 @@
34754039
34764040 void ParseVertices()
34774041 {
3478
- boolean epsequal = GrafreeD.epsequal;
3479
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
34804044
34814045 for (int i=0; i<group.selection.size(); i++)
34824046 {
....@@ -3501,7 +4065,7 @@
35014065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35024066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35034067
3504
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
35054069
35064070 buffer.add(g);
35074071 }
....@@ -3516,7 +4080,7 @@
35164080 makeSomething(buffer, i==group.selection.size()-1);
35174081 }
35184082
3519
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
35204084
35214085 refreshContents();
35224086 }
....@@ -3534,7 +4098,16 @@
35344098 String pigment = Object3D.GetPigment(tex);
35354099 //String bump = Object3D.GetBump(tex);
35364100
3537
- 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
+ }
35384111
35394112 double s = v.s;
35404113
....@@ -3622,11 +4195,11 @@
36224195
36234196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36244197
3625
- boolean random = CameraPane.RANDOM;
3626
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
36274200 lowres.linkVerticesThis(null);
36284201 lowres.linkVerticesThis(sn);
3629
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
36304203
36314204 System.err.flush();
36324205
....@@ -3666,7 +4239,7 @@
36664239 return;
36674240
36684241 Object3D poses = group.selection.get(0);
3669
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
36704243
36714244 Object3D newgroup = new Object3D("Po:" + poses.name);
36724245
....@@ -3860,9 +4433,9 @@
38604433
38614434 void ClipMesh()
38624435 {
3863
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38644437 {
3865
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
38664439
38674440 if (content instanceof cGroup && ((cGroup)content).transientlink )
38684441 content = ((cGroup)content).get(0);
....@@ -3871,7 +4444,7 @@
38714444 // {
38724445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38734446 // }
3874
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
38754448 }
38764449 // group.selection.ClipMesh(GrafreeD.clipboard);
38774450 System.out.println("DONE.");
....@@ -3918,6 +4491,18 @@
39184491 void MarkLeaves(boolean hide)
39194492 {
39204493 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);
39214506 refreshContents();
39224507 }
39234508
....@@ -3992,10 +4577,6 @@
39924577 // }
39934578 // }
39944579
3995
- static boolean allparams = true;
3996
-
3997
- static Vector<Object3D> listUI = new Vector<Object3D>();
3998
-
39994580 void EditSelection(boolean newWindow)
40004581 {
40014582 // aConstraints.gridy = 0;
....@@ -4003,10 +4584,10 @@
40034584 {
40044585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40054586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4006
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40074588
40084589 Object3D elem = (Object3D)group.selection.elementAt(i);
4009
- if(elem != group)
4590
+ if(elem != group || !newWindow)
40104591 {
40114592 // if (!(elem instanceof Composite))
40124593 // newWindow = false;
....@@ -4088,7 +4669,8 @@
40884669 //new Exception().printStackTrace();
40894670
40904671 freezemodel = true;
4091
-
4672
+ ClearUnpinned();
4673
+
40924674 /**/
40934675 //switch (event.id)
40944676 {
....@@ -4096,7 +4678,6 @@
40964678 //case 702: // Event.LIST_DESELECT
40974679 group.deselectAll();
40984680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4099
- objEditor.ClearInfo(); // .GetMaterial());
41004681 if (tps != null)
41014682 {
41024683 for (int i=0; i < tps.length; i++)
....@@ -4105,10 +4686,8 @@
41054686
41064687 //if (child.parent != null)
41074688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
41084690 group.addSelectee(child);
4109
- objEditor.SetMaterial(child); // .GetMaterial());
4110
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4111
- System.err.println("info : " + child.GetPath());
41124691 }
41134692 }
41144693 // else
....@@ -4118,20 +4697,28 @@
41184697 // System.err.println("info : " + group.GetPath());
41194698 // }
41204699
4121
- objEditor.SetText(); // jan 2014
4122
-
4123
- 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))
41244701 CameraPane.flash = true;
41254702
4126
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41274704 // a camera
41284705 {
4129
- CameraPane.camerachangeframe = 0; // don't refuse it
4130
- 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
+ }
41314711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41324712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41334713 }
41344714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
41354722 refreshContents();
41364723 //return true;
41374724 }
....@@ -4140,6 +4727,35 @@
41404727
41414728 freezemodel = false;
41424729 }
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
+ }
41434759
41444760 void linkSomething(Object3D thing)
41454761 {
....@@ -4211,16 +4827,19 @@
42114827 {
42124828 if (group.selection.isEmpty())
42134829 return;
4214
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
42154832 Composite tGroup = null;
42164833 if (group.selection.size() > 0) // 1)
42174834 {
42184835 tGroup = new cGroup();
4219
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
42204837 }
42214838
42224839 if (cut)
42234840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
42244843 //int indices[] = jList.getSelectedIndices();
42254844 //for (int i = indices.length - 1; i >= 0; i--)
42264845 //jList.remove(indices[i]);
....@@ -4256,16 +4875,16 @@
42564875 //System.out.println("cut " + child);
42574876 //System.out.println("parent = " + child.parent);
42584877 // tmp.addChild(child);
4259
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
42604879 tGroup.add/*Child*/(tmp);
42614880 else
4262
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
42634882 }
42644883 else
4265
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
42664885 tGroup.add/*Child*/(child);
42674886 else
4268
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
42694888 }
42704889
42714890 //ResetModel();
....@@ -4297,21 +4916,23 @@
42974916 //System.out.println("cut " + elem);
42984917 //System.out.println("parent = " + elem.parent);
42994918 // tmp.addChild(elem);
4300
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
43014920 tGroup.add/*Child*/(tmp);
43024921 else
4303
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
43044923 }
43054924 else
4306
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
43074926 tGroup.add/*Child*/(child);
43084927 else
4309
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
43104929 }
43114930
43124931 }
4313
- if (GrafreeD.clipboardIsTempGroup)
4314
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
43154936 if (cut)
43164937 {
43174938 ResetModel();
....@@ -4321,11 +4942,15 @@
43214942
43224943 void paste(boolean expand)
43234944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
43244949 // if (GrafreeD.clipboard == null)
43254950 // return;
43264951 boolean first = true;
43274952
4328
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43294954 {
43304955 Composite temp;
43314956
....@@ -4336,7 +4961,7 @@
43364961 temp = (Composite)Applet3D.clipboard.deepCopy();
43374962 */
43384963 Object3D elem;
4339
- 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))
43404965 {
43414966 Object3D child = (Object3D)e.nextElement();
43424967
....@@ -4370,21 +4995,22 @@
43704995 //Object3D cb = Applet3D.clipboard;
43714996 //temp.addChild(cb);
43724997 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4373
- assert(GrafreeD.clipboard.parent == null);
4374
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4375
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4376
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4377
- 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());
43785003 else
4379
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4380
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
43815006 }
43825007
5008
+ Globals.SAVEONMAKE = keep;
43835009 ResetModel();
43845010 refreshContents();
43855011 }
43865012
4387
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
43885014 {
43895015 // if (GrafreeD.clipboard == null)
43905016 // return;
....@@ -4413,15 +5039,22 @@
44135039 if (copyit)
44145040 {
44155041 // paste(false);
4416
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
44175050 }
44185051 else
44195052 {
44205053 boolean first = true;
44215054
4422
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
44235056 {
4424
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
44255058 Object3D copy;
44265059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44275060 {
....@@ -4431,7 +5064,7 @@
44315064 }
44325065 } else
44335066 {
4434
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
44355068 }
44365069 }
44375070 }
....@@ -4508,6 +5141,10 @@
45085141
45095142 void group(Object3D csg, boolean grab)
45105143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
45115148 if (//false) // why??
45125149 !group.selection.isEmpty())
45135150 {
....@@ -4621,10 +5258,15 @@
46215258 //node.add(csg);
46225259 //makeSomething(node);
46235260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
46245262 }
46255263
46265264 void Ungroup(Object3D g)
46275265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
46285270 if (g instanceof HiddenObject)
46295271 {
46305272 HiddenObject h = (HiddenObject) g;
....@@ -4641,6 +5283,7 @@
46415283 objEditor.makeSomething(g.get(i), false);
46425284 }
46435285 }
5286
+ Globals.SAVEONMAKE = keep;
46445287 }
46455288
46465289 void ungroup()
....@@ -4836,21 +5479,6 @@
48365479 }
48375480 */
48385481
4839
- void ImportGFD()
4840
- {
4841
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4842
- browser.show();
4843
- String filename = browser.getFile();
4844
- if (filename != null && filename.length() > 0)
4845
- {
4846
- String fullname = browser.getDirectory() + filename;
4847
-
4848
- //Object3D readobj =
4849
- objEditor.ReadGFD(fullname, objEditor);
4850
- //makeSomething(readobj);
4851
- }
4852
- }
4853
-
48545482 /*
48555483 public void Callback(Object obj)
48565484 {
....@@ -4874,26 +5502,9 @@
48745502 }
48755503 */
48765504
4877
- void ImportVRMLX3D()
4878
- {
4879
- if (GrafreeD.standAlone)
4880
- {
4881
- /**/
4882
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4883
- browser.show();
4884
- String filename = browser.getFile();
4885
- if (filename != null && filename.length() > 0)
4886
- {
4887
- String fullname = browser.getDirectory() + filename;
4888
- LoadVRMLX3D(fullname);
4889
- }
4890
- /**/
4891
- }
4892
- }
4893
-
48945505 String GetFile(String dialogName)
48955506 {
4896
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
48975508 {
48985509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48995510 browser.show();
....@@ -4957,10 +5568,33 @@
49575568 cButton flashSelectionButton;
49585569 cButton editButton;
49595570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
49605572 cButton clearpanelButton;
4961
- cButton allParamsButton;
49625573 cButton unselectButton;
49635574
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
+
49645598 cButton screenfitButton;
49655599 cButton screenfitpointButton;
49665600 cButton snapobjectButton;
....@@ -4972,14 +5606,6 @@
49725606
49735607 cButton setsupportButton;
49745608
4975
- cButton twoButton;
4976
- cButton sixButton;
4977
- cButton threeButton;
4978
- cButton sevenButton;
4979
- cButton fourButton; // full panel
4980
- cButton oneButton; // full XYZ
4981
- //cButton currentLayout;
4982
-
49835609 //
49845610 //Composite
49855611 Object3D // to do !!
....@@ -4989,9 +5615,11 @@
49895615 //JTree jTree;
49905616 private MenuItem lookAtItem;
49915617 private MenuItem lookFromItem;
4992
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
49935619 private MenuItem cutItem;
4994
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
49955623 private MenuItem cloneItem;
49965624 private MenuItem cloneSupportItem;
49975625 private MenuItem overwriteGeoItem;
....@@ -5004,7 +5632,7 @@
50045632 private MenuItem linkverticesItem;
50055633 private MenuItem relinkverticesItem;
50065634 private MenuItem setMasterItem;
5007
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
50085636 private MenuItem stepAllItem;
50095637 private MenuItem revertMeshItem;
50105638 private MenuItem poseMeshItem;
....@@ -5015,6 +5643,7 @@
50155643 private MenuItem mergeGeometriesItem;
50165644 private MenuItem copyItem;
50175645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
50185647 private MenuItem pasteLinkItem;
50195648 private MenuItem pasteCloneItem;
50205649 private MenuItem pasteExpandItem;
....@@ -5053,6 +5682,10 @@
50535682 private MenuItem showleavesItem;
50545683 private MenuItem markleavesItem;
50555684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
50565689
50575690 private MenuItem flipVItem;
50585691 private MenuItem unflipVItem;
....@@ -5064,15 +5697,17 @@
50645697 private MenuItem panoTexturesItem;
50655698
50665699 private MenuItem resetCentroidItem;
5067
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
50685701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
50695704 private MenuItem hideItem;
50705705 private MenuItem grabItem;
50715706 private MenuItem backItem;
50725707 private MenuItem frontItem;
50735708 private MenuItem cameraItem;
50745709 private MenuItem compositeItem;
5075
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
50765711 private MenuItem physicsItem;
50775712 private MenuItem frameselectorItem;
50785713 private MenuItem scriptNodeItem;
....@@ -5112,7 +5747,7 @@
51125747 private MenuItem blobItem;
51135748 private MenuItem latheItem;
51145749 private MenuItem bezierItem;
5115
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
51165751 private MenuItem meshItem;
51175752 // private MenuItem meshGroupItem;
51185753 private MenuItem springItem;
....@@ -5134,11 +5769,6 @@
51345769 private MenuItem doubleItem;
51355770 private MenuItem tripleItem;
51365771
5137
- private MenuItem importGFDItem;
5138
- private MenuItem importVRMLX3DItem;
5139
- private MenuItem import3DSItem;
5140
- private MenuItem importOBJItem;
5141
-
51425772 private MenuItem computeAOItem;
51435773 private MenuItem recompileItem;
51445774 private MenuItem editScriptItem;
....@@ -5148,4 +5778,8 @@
51485778 private MenuItem analyzeItem;
51495779 private MenuItem dumpItem;
51505780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
51515785 }