Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
GroupEditor.java
....@@ -12,9 +12,10 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1819 ObjectUI,
1920 Runnable,
2021 ActionListener,
....@@ -59,6 +60,12 @@
5960 this.copy = this.group = group;
6061 //selectees = this.group.selectees;
6162
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6269 if(ui)
6370 SetupUI(objEditor);
6471 }
....@@ -73,17 +80,29 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7784 SetupUI2(objEditor);
7885 objEditor.SetupUI(true);
7986 SetupViews(objEditor);
8087
8188 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8297 }
8398
8499 void CloneSelection(boolean supports)
85100 {
86
- // Object3D keep = GraphreeD.clipboard;
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
105
+ // Object3D keep = GrafreeD.clipboard;
87106 //Object3D obj;
88107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89108 {
....@@ -93,18 +112,19 @@
93112
94113 makeSomething(clone, i==group.selection.size()-1);
95114 }
115
+ Globals.REPLACEONMAKE = keep;
96116 }
97117
98118 void CloneClipboard(boolean supports)
99119 {
100
- assert(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.clipboard.get(0), false));
120
+ assert(Grafreed.clipboard.parent == null);
121
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
122
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
123
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
124
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105125 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
126
+ makeSomething(CloneObject(Grafreed.clipboard, false));
127
+ Grafreed.clipboard.get(0).parent = keepparent;
108128 }
109129
110130 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +138,7 @@
118138 // obj.support = null;
119139 if (!supports)
120140 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
141
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122142 obj.parent = parent;
123143 // obj.support = support;
124144 // clone.support = support; // aout 2013
....@@ -147,30 +167,29 @@
147167
148168 //JTextField nameField;
149169
150
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
151171 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
172
+ oe.jTree = new cTree();
173
+
163174 Menu menu;
164175 oe.menuBar.add(menu = new Menu("Edit"));
165176 //editItem = menu.add(new MenuItem("Edit"));
166177 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168185 duplicateItem.addActionListener(this);
169
- menu.add("-");
170186 cloneItem = menu.add(new MenuItem("Clone"));
171187 cloneItem.addActionListener(this);
188
+ if (Globals.ADVANCED)
189
+ {
172190 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173191 cloneSupportItem.addActionListener(this);
192
+ }
174193 menu.add("-");
175194 cutItem = menu.add(new MenuItem("Cut"));
176195 cutItem.addActionListener(this);
....@@ -178,26 +197,123 @@
178197 copyItem.addActionListener(this);
179198 pasteItem = menu.add(new MenuItem("Paste"));
180199 pasteItem.addActionListener(this);
200
+
201
+ menu.add("-");
202
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
203
+ pasteIntoItem.addActionListener(this);
181204 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182205 pasteLinkItem.addActionListener(this);
183206 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184207 pasteCloneItem.addActionListener(this);
185208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186209 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
210
+ menu.add("-");
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
213
+
214
+ if (Globals.ADVANCED)
215
+ {
216
+ // Deletes the cameras...
189217 clearAllItem = menu.add(new MenuItem("Clear All"));
190218 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
193
- resetMeshItem.addActionListener(this);
194
- stepAllItem = menu.add(new MenuItem("Step All"));
195
- stepAllItem.addActionListener(this);
219
+ }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
256
+
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
308
+ oe.menuBar.add(menu = new Menu("Setting"));
309
+ if (Globals.ADVANCED)
310
+ {
196311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197312 revertMeshItem.addActionListener(this);
198313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199314 resetreferencesItem.addActionListener(this);
200315 menu.add("-");
316
+ }
201317 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202318 overwriteGeoItem.addActionListener(this);
203319 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +325,104 @@
209325 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210326 overwriteUVItem.addActionListener(this);
211327 menu.add("-");
328
+ if (Globals.ADVANCED)
329
+ {
212330 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213331 generateMeshItem.addActionListener(this);
214332 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215333 poseMeshItem.addActionListener(this);
216334 menu.add("-");
335
+ }
217336 resetsupportItem = menu.add(new MenuItem("Reset support"));
218337 resetsupportItem.addActionListener(this);
219338 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220339 linkverticesItem.addActionListener(this);
340
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
341
+ relinkverticesItem.addActionListener(this);
342
+
343
+ if (Globals.ADVANCED)
344
+ {
221345 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222346 setMasterItem.addActionListener(this);
347
+ }
223348
224
- oe.menuBar.add(menu = new Menu("Object"));
225
- grabItem = menu.add(new MenuItem("Grab"));
226
- grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
349
+ oe.menuBar.add(menu = new Menu("Group"));
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
229352 backItem = menu.add(new MenuItem("Back"));
230353 backItem.addActionListener(this);
231
- compositeItem = menu.add(new MenuItem("Composite"));
232
- compositeItem.addActionListener(this);
233
- menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
235
- randomItem.addActionListener(this);
236
- physicsItem = menu.add(new MenuItem("Physics"));
237
- physicsItem.addActionListener(this);
238
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
239
- frameselectorItem.addActionListener(this);
354
+ frontItem = menu.add(new MenuItem("Front"));
355
+ frontItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
361
+ hideItem = menu.add(new MenuItem("Hidden Group"));
362
+ hideItem.addActionListener(this);
363
+ }
364
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
365
+ ungroupItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
240373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241374 switchGeoItem.addActionListener(this);
242375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243376 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
377
+ morphItem = menu.add(new MenuItem("Morph Group"));
245378 morphItem.addActionListener(this);
379
+
380
+ menu.add("-");
381
+ physicsItem = menu.add(new MenuItem("Physics"));
382
+ physicsItem.addActionListener(this);
383
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
384
+ frameselectorItem.addActionListener(this);
246385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247386 scriptNodeItem.addActionListener(this);
248
- cameraItem = menu.add(new MenuItem("Camera"));
249
- cameraItem.addActionListener(this);
250
- menu.add("-");
251
- textureItem = menu.add(new MenuItem("Texture"));
252
- textureItem.addActionListener(this);
387
+ }
388
+
389
+ oe.menuBar.add(menu = new Menu("Object"));
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
392
+ billboardItem = menu.add(new MenuItem("Billboard"));
393
+ billboardItem.addActionListener(this);
253394 csgItem = menu.add(new MenuItem("CSG"));
254395 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256397 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258399 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
405
+ if (Globals.ADVANCED)
406
+ {
407
+ menu.add("-");
261408 linkerItem = menu.add(new MenuItem("Linker"));
262409 linkerItem.addActionListener(this);
263410 templateItem = menu.add(new MenuItem("Template"));
264411 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267412 pointflowItem = menu.add(new MenuItem("Point Flow"));
268413 pointflowItem.addActionListener(this);
414
+ }
269415 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272416 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273417 resetTransformItem.addActionListener(this);
274418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275419 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
420
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
421
+ resetCentroidXZItem.addActionListener(this);
422
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
423
+ transformGeometryItem.addActionListener(this);
424
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
425
+ transformChildrenItem.addActionListener(this);
278426
279427 oe.menuBar.add(menu = new Menu("Geometry"));
280428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +431,13 @@
283431 genNormalsORGANItem.addActionListener(this);
284432 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285433 genNormalsCADItem.addActionListener(this);
434
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
435
+ genNormalsMESHItem.addActionListener(this);
436
+ if (Globals.ADVANCED)
437
+ {
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
439
+ genNormalsMINEItem.addActionListener(this);
440
+ }
286441 stripifyItem = menu.add(new MenuItem("Stripify"));
287442 stripifyItem.addActionListener(this);
288443 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +447,6 @@
292447 untrimItem = menu.add(new MenuItem("Untrim"));
293448 untrimItem.addActionListener(this);
294449 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297450 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298451 clearColorsItem.addActionListener(this);
299452 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +459,34 @@
306459 reduce34MeshItem.addActionListener(this);
307460 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308461 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311462 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312463 clipMeshItem.addActionListener(this);
464
+
465
+ if (Globals.ADVANCED)
466
+ {
467
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
468
+ smoothMeshItem.addActionListener(this);
469
+ }
470
+
471
+ oe.menuBar.add(menu = new Menu("Attributes"));
472
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
473
+ clearMaterialsItem.addActionListener(this);
474
+ resetAllItem = menu.add(new MenuItem("Reset All"));
475
+ resetAllItem.addActionListener(this);
476
+ stepAllItem = menu.add(new MenuItem("Step All"));
477
+ stepAllItem.addActionListener(this);
313478 menu.add("-");
314479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315480 liveleavesItem.addActionListener(this);
316481 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317482 unliveleavesItem.addActionListener(this);
483
+ if (Globals.ADVANCED)
484
+ {
318485 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319486 supportleavesItem.addActionListener(this);
320487 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321488 unsupportleavesItem.addActionListener(this);
489
+ }
322490 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323491 hideleavesItem.addActionListener(this);
324492 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +495,31 @@
327495 markleavesItem.addActionListener(this);
328496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
330506 menu.add("-");
331507 flipVItem = menu.add(new MenuItem("Flip V"));
332508 flipVItem.addActionListener(this);
333509 unflipVItem = menu.add(new MenuItem("Unflip V"));
334510 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
511
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336512 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
513
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338514 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
515
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340516 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
517
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342518 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
519
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344520 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
521
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346522 panoTexturesItem.addActionListener(this);
347
- menu.add("-");
348
- extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
349
- extractGeometriesItem.addActionListener(this);
350
- cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
351
- cloneGeometriesItem.addActionListener(this);
352
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
353
- shareGeometriesItem.addActionListener(this);
354
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
355
- mergeGeometriesItem.addActionListener(this);
356523
357524 oe.menuBar.add(menu = new Menu("Selection"));
358525 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -361,23 +528,56 @@
361528 attachBumpItem.addActionListener(this);
362529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
363530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
364532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
365533 detachPigmentItem.addActionListener(this);
366534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
367535 detachBumpItem.addActionListener(this);
536
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
537
+ embedTexturesItem.addActionListener(this);
538
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
539
+ deEmbedTexturesItem.addActionListener(this);
368540 menu.add("-");
369541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
370542 sortbysizeItem.addActionListener(this);
371543 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372544 sortbynameItem.addActionListener(this);
545
+ menu.add("-");
546
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
547
+ shareGeometriesItem.addActionListener(this);
548
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
549
+ mergeGeometriesItem.addActionListener(this);
550
+ if (Globals.ADVANCED)
551
+ {
552
+ // Pretty much the same as duplicate and clone.
553
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
554
+ extractGeometriesItem.addActionListener(this);
555
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
556
+ cloneGeometriesItem.addActionListener(this);
557
+ }
558
+
373559 oe.menuBar.add(menu = new Menu("Insert"));
374560 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
561
+
562
+ oe.menuBar.add(menu = new Menu("Tools"));
376563 buildToolsMenu(menu);
377564 }
378565
566
+
379567 void SetupUI2(ObjEditor oe)
380568 {
569
+ // June 2019
570
+ if (oe == null)
571
+ {
572
+ //super.SetupUI2(this);
573
+ //return;
574
+ }
575
+
576
+ if (copy != group)
577
+ {
578
+ //super.SetupUI2(this);
579
+ }
580
+
381581 //new Exception().printStackTrace();
382582
383583 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +606,231 @@
406606 oe.radioPanel.add(dummyButton);
407607 oe.buttonGroup.add(dummyButton);
408608 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
412612
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
613
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
614
+
615
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ //minButton.setToolTipText("Minimize window");
617
+ //minButton.addActionListener(this);
618
+
619
+ if (Globals.ADVANCED)
620
+ {
621
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ maxButton.setToolTipText("Maximize window");
623
+ maxButton.addActionListener(this);
624
+ }
625
+
626
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
627
+ fullButton.setToolTipText("Full-screen window");
628
+ fullButton.addActionListener(this);
629
+
630
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ screenfitButton.setToolTipText("Screen fit");
632
+ screenfitButton.addActionListener(this);
633
+
634
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ restoreCameraButton.setToolTipText("Restore viewpoint");
636
+ restoreCameraButton.addActionListener(this);
637
+
638
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ saveButton.setToolTipText("New version");
640
+ saveButton.addActionListener(this);
641
+
642
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643
+ undoButton.setToolTipText("Previous version");
644
+ undoButton.addActionListener(this);
645
+ undoButton.setEnabled(false);
646
+
647
+ cGridBag updown = new cGridBag().setVertical(true);
648
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ restoreButton.setToolTipText("Restore current");
650
+ restoreButton.addActionListener(this);
651
+ restoreButton.setEnabled(false);
652
+
653
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ replaceButton.setToolTipText("Replace current");
655
+ replaceButton.addActionListener(this);
656
+ replaceButton.setEnabled(false);
657
+
658
+ copyOptionsPanel.add(updown);
659
+
660
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ redoButton.setToolTipText("Next version");
662
+ redoButton.addActionListener(this);
663
+ redoButton.setEnabled(false);
664
+
665
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
666
+ liveCB.setToolTipText("Enable animation");
414667 liveCB.addItemListener(this);
415668
416
- oe.aConstraints.gridx += 1;
417
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
418
- supportCB.addItemListener(this);
419
-
420
- // oe.aConstraints.gridx += 1;
421
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
422
- // localCB.addItemListener(this);
423
-
424
- oe.aConstraints.gridx += 1;
425
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
426
- crowdCB.addItemListener(this);
427
-
428
- oe.aConstraints.gridx += 1;
429
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
430
- smoothCB.addItemListener(this);
431
-
432
- oe.aConstraints.gridx += 1;
433
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ oneStepButton.setToolTipText("Animate one step forward");
671
+ oneStepButton.addActionListener(this);
672
+
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
674
+ fastCB.setToolTipText("Fast mode");
434675 fastCB.addItemListener(this);
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
437
- slowCB.addItemListener(this);
438
- oe.aConstraints.gridx += 1;
439
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
440
- boxCB.addItemListener(this);
676
+
677
+ //oe.toolboxPanel.Return();
678
+
679
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
680
+// trackCB.setToolTipText("Enable tracking");
681
+// trackCB.addItemListener(this);
441682
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
476
- trackCB.addItemListener(this);
477
-
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
480
- screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
482683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483684 // screenfitpointButton.addActionListener(this);
484
-// oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486
- snapobjectButton.addActionListener(this);
487
- oe.aConstraints.gridx += 1;
488685
489
- //aConstraints.gridx = 0;
490
- //aConstraints.gridy += 1;
491
- oe.aConstraints.weighty = 0;
492
- oe.aConstraints.gridwidth = 1;
493
-
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
495
- flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499
-
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
502
- twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
686
+ if (Globals.ADVANCED)
687
+ {
688
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
+ snapobjectButton.addActionListener(this);
690
+ snapobjectButton.setToolTipText("Snap Object");
691
+
692
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504693 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
506
- sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
694
+ fourButton.setToolTipText("Show control panel only");
695
+ }
696
+
697
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
698
+
699
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ twoButton.setToolTipText("Show 3D view only");
701
+ twoButton.addActionListener(this);
702
+ this.fullscreenLayout = twoButton;
703
+
704
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ threeButton.setToolTipText("Show controls and 3D view");
508706 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
707
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ sixButton.setToolTipText("Show 3D view and controls");
709
+ sixButton.addActionListener(this);
710
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+// sevenButton.setToolTipText("3-column layout");
712
+// sevenButton.addActionListener(this);
511713 //
512714
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
715
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
716
+ rootButton.setToolTipText("Open selection in new tab");
514717 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
718
+
719
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ closeButton.setToolTipText("Close tab");
517721 closeButton.addActionListener(this);
518722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519723 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521
-
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
524
- editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
528724
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
725
+ // INSERT
726
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ gridButton.setToolTipText("Create grid");
728
+ gridButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ boxButton.setToolTipText("Create box");
732
+ boxButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ sphereButton.setToolTipText("Create sphere");
736
+ sphereButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ coneButton.setToolTipText("Create cone");
740
+ coneButton.addActionListener(this);
741
+
742
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
743
+ torusButton.setToolTipText("Create torus");
744
+ torusButton.addActionListener(this);
745
+
746
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
747
+ superButton.setToolTipText("Create superellipsoid");
748
+ superButton.addActionListener(this);
749
+
750
+ if (Globals.ADVANCED)
751
+ {
752
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ kleinButton.setToolTipText("Create Klein bottle");
754
+ kleinButton.addActionListener(this);
755
+ }
756
+
757
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ particlesButton.setToolTipText("Create particle system");
759
+ particlesButton.addActionListener(this);
760
+
761
+ oe.toolboxPanel.Return();
762
+
763
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ groupButton.setToolTipText("Create group");
765
+ groupButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ compositeButton.setToolTipText("Create composite");
769
+ compositeButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ switchButton.setToolTipText("Create item switcher");
773
+ switchButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ loopButton.setToolTipText("Create loop");
777
+ loopButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ textureButton.setToolTipText("Create texture");
781
+ textureButton.addActionListener(this);
782
+
783
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ overlayButton.setToolTipText("Create overlay");
785
+ overlayButton.addActionListener(this);
786
+
787
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
788
+ lightButton.setToolTipText("Create light");
789
+ lightButton.addActionListener(this);
790
+
791
+ for (int i=6; --i>=0;)
792
+ {
793
+ oe.toolboxPanel.Return();
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ oe.toolboxPanel.add(new cGridBag());
797
+ oe.toolboxPanel.add(new cGridBag());
798
+ oe.toolboxPanel.add(new cGridBag());
799
+ oe.toolboxPanel.add(new cGridBag());
800
+ oe.toolboxPanel.add(new cGridBag());
801
+ }
802
+
803
+ // EDIT panel
804
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ editButton.setToolTipText("Pin selection controls");
806
+ editButton.addActionListener(this);
807
+
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
530810 uneditButton.addActionListener(this);
531811
532
- oe.aConstraints.gridx += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
537
- clearPanelButton.addActionListener(this);
538
-
539
- oe.aConstraints.gridx += 1;
540
- oe.aConstraints.weighty = 0;
541
- oe.aConstraints.gridwidth = 1;
542
-
543
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
812
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
813
+ allParamsButton.setToolTipText("Show all controle");
544814 allParamsButton.addActionListener(this);
545815
546
- oe.aConstraints.gridx += 1;
547
- oe.aConstraints.weighty = 0;
548
- oe.aConstraints.gridwidth = 1;
549
-
550
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
816
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ clearPanelButton.setToolTipText("Clear edit panel");
818
+ clearPanelButton.addActionListener(this);
819
+
820
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
821
+ unselectButton.setToolTipText("Unselect");
551822 unselectButton.addActionListener(this);
552823
824
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
825
+ flashSelectionButton.setToolTipText("Highlight selection");
826
+ flashSelectionButton.addActionListener(this);
827
+
828
+ editCommandsPanel.preferredHeight = 1;
829
+
830
+ SetPinStates(false);
831
+// oe.treePanel.add(commandsPanel);
832
+// oe.treePanel.Return();
833
+
553834 // oe.aConstraints.gridx += 1;
554835 // oe.aConstraints.weighty = 0;
555836 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +842,25 @@
561842 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562843 // gcButton.addActionListener(this);
563844
564
- oe.aConstraints.gridx = 0;
565
- oe.aConstraints.gridy += 1;
566
-
567
- //ctrlPanel.add(objList = new List(5, true));
568
- oe.aConstraints.gridwidth = 100;
569
- // oe.aConstraints.gridheight = 100;
570
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
571
- oe.aConstraints.gridheight = 1;
572
- oe.aConstraints.weighty = 0.5;
573
- oe.aConstraints.gridx = 0;
574
- JScrollPane jSP;
845
+ cGridBag jSPPanel = new cGridBag();
846
+
847
+ JScrollPane jSP;
575848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
576
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
577850 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
582
-
583
- oe.aConstraints.weighty = 0;
584
- oe.aConstraints.gridwidth = 2;
585
-
586
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
587
- colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
590
- materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
593
- textureCB.addItemListener(this);
594
-
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
597851
852
+ oe.treePanel.add(jSPPanel);
853
+ oe.treePanel.Return();
854
+
855
+ oe.treePanel.add(copyOptionsPanel);
856
+ oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
860
+
861
+// mainPanel.setDividerLocation(0.5); //1.0);
862
+// mainPanel.setResizeWeight(0.5);
863
+
598864 //jList.addListSelectionListener(this);
599865 oe.jTree.addTreeSelectionListener(this);
600866 //jTree.setRootVisible(false);
....@@ -613,23 +879,160 @@
613879 dgr.addDragGestureListener(this);
614880 }catch(Exception e) {}
615881 */
616
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
617883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618884 }
885
+
886
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
887
+ {
888
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
889
+ colorCB.setToolTipText("Copy color when dropped");
890
+ colorCB.addItemListener(this);
891
+
892
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
893
+ materialCB.setToolTipText("Copy material when dropped");
894
+ materialCB.addItemListener(this);
895
+
896
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
897
+ textureCB.setToolTipText("Copy texture when dropped");
898
+ textureCB.addItemListener(this);
899
+
900
+ panel.Return();
901
+
902
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
903
+ boxCB.setToolTipText("Display bounding boxes");
904
+ boxCB.addItemListener(this);
905
+
906
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
908
+ zoomBoxCB.addItemListener(this);
909
+
910
+ if (true) // Globals.ADVANCED)
911
+ {
912
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
913
+// supportCB.setToolTipText("Enable rigging");
914
+// supportCB.addItemListener(this);
915
+
916
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
917
+ freezeCB.setToolTipText("Fast moving camera");
918
+ freezeCB.addItemListener(this);
919
+
920
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
921
+ // localCB.addItemListener(this);
922
+
923
+ panel.Return();
924
+
925
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
926
+ crowdCB.setToolTipText("Used for crowds");
927
+ crowdCB.addItemListener(this);
928
+
929
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
930
+ smoothCB.setToolTipText("Snapping delay");
931
+ smoothCB.addItemListener(this);
932
+
933
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
934
+ slowCB.setToolTipText("Smooth interpolation");
935
+ slowCB.addItemListener(this);
936
+
937
+// constraints.gridy += 1;
938
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
939
+// speakerMocapCB.addItemListener(this);
940
+
941
+ panel.Return();
942
+
943
+ if (false)
944
+ {
945
+ // handled in scripts
946
+ //constraints.gridy += 1;
947
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
948
+ speakerCameraCB.addItemListener(this);
949
+
950
+ //constraints.gridy += 1;
951
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
952
+ speakerFocusCB.addItemListener(this);
953
+
954
+ //constraints.gridy += 1;
955
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
956
+ smoothfocusCB.addItemListener(this);
957
+ panel.Return();
958
+ }
959
+
960
+//constraints.gridx += 1;
961
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
962
+// debugCB.addItemListener(this);
963
+
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
968
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
969
+ oeilCB.setToolTipText("Move camera when tracking");
970
+ oeilCB.addItemListener(this);
971
+
972
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
973
+ shadowCB.setToolTipText("When live compute shadows");
974
+ shadowCB.addItemListener(this);
975
+
976
+ panel.Return();
977
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
978
+ toggleTextureCB.setToolTipText("Load textures");
979
+ toggleTextureCB.addItemListener(this);
980
+
981
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
982
+ toggleSwitchCB.setToolTipText("Choose a single item");
983
+ toggleSwitchCB.addItemListener(this);
984
+
985
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
986
+ autokeepCB.setToolTipText("On structure change");
987
+ autokeepCB.addItemListener(this);
988
+
989
+ panel.Return();
990
+ if (Globals.ADVANCED)
991
+ {
992
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
993
+ lookAtCB.setToolTipText("Look-at target");
994
+ lookAtCB.addItemListener(this);
995
+ }
996
+
997
+ }
998
+
999
+ cGridBag fill = new cGridBag();
1000
+ fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
1005
+
1006
+ panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
1009
+
1010
+ }
6191011
6201012 void EditObject(Object3D obj)
6211013 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
1014
+ cRadio radioButton = new cRadio(obj.name);
1015
+
1016
+ // June 2019. Patch to avoid bug with transparency.
1017
+ radioButton.hadMaterial = obj.material != null;
1018
+ if (!radioButton.hadMaterial)
1019
+ {
1020
+ obj.material = new cMaterial();
1021
+ }
1022
+
1023
+ radioButton.SetObject(obj);
1024
+ radioButton.layout = sixButton; // sevenButton;
1025
+ radioButton.SetCamera(cameraView.renderCamera, false);
1026
+ radioButton.addActionListener(this);
1027
+ radioPanel.add(radioButton);
1028
+ buttonGroup.add(radioButton);
1029
+ radioButton.doClick();
6301030 }
1031
+
6311032 void SetupViews(ObjEditor oe)
6321033 {
1034
+ theFrame = this;
1035
+
6331036 oe.SetupViews();
6341037
6351038 System.out.println("SetupViews");
....@@ -638,22 +1041,28 @@
6381041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391042 }
6401043
641
- JCheckBox liveCB;
642
- JCheckBox supportCB;
643
- JCheckBox localCB;
644
- JCheckBox crowdCB;
645
- JCheckBox smoothCB;
646
- JCheckBox fastCB;
647
- JCheckBox slowCB;
648
- JCheckBox boxCB;
649
- JCheckBox trackCB;
650
- JCheckBox smoothfocusCB;
1044
+ cToggleButton liveCB;
1045
+ cCheckBox supportCB;
1046
+ cCheckBox localCB;
1047
+ cCheckBox crowdCB;
1048
+ cCheckBox smoothCB;
1049
+ cToggleButton fastCB;
1050
+ cCheckBox slowCB;
1051
+ cCheckBox boxCB;
1052
+ cCheckBox zoomBoxCB;
1053
+ cCheckBox freezeCB;
1054
+ //cToggleButton trackCB;
1055
+ cCheckBox trackCB;
1056
+ cCheckBox smoothfocusCB;
6511057 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1058
+ cCheckBox speakerCameraCB;
1059
+ cCheckBox speakerFocusCB;
1060
+ cCheckBox debugCB;
1061
+
1062
+ cCheckBox oeilCB;
1063
+ cCheckBox shadowCB;
1064
+ cCheckBox autokeepCB;
1065
+ cCheckBox lookAtCB;
6571066
6581067 // static int COLOR = 1;
6591068 // static int MATERIAL = 2;
....@@ -661,9 +1070,9 @@
6611070
6621071 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631072
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1073
+ cCheckBox colorCB;
1074
+ cCheckBox materialCB;
1075
+ cCheckBox textureCB;
6671076
6681077 public void itemStateChanged(ItemEvent e)
6691078 {
....@@ -688,10 +1097,10 @@
6881097 dropAttributes |= Object3D.TEXTURE;
6891098 else
6901099 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1100
+ } else if(e.getSource() == liveCB)
6931101 {
6941102 cameraView.ToggleLive();
1103
+ refreshContents(false);
6951104 }
6961105 else if(e.getSource() == supportCB)
6971106 {
....@@ -727,6 +1136,10 @@
7271136 cameraView.repaint();
7281137 // refreshContents();
7291138 }
1139
+ else if(e.getSource() == zoomBoxCB)
1140
+ {
1141
+ cameraView.ToggleZoomBoxMode();
1142
+ }
7301143 else if(e.getSource() == smoothfocusCB)
7311144 {
7321145 cameraView.ToggleSmoothFocus();
....@@ -752,6 +1165,18 @@
7521165 {
7531166 cameraView.ToggleOeil();
7541167 }
1168
+ else if(e.getSource() == shadowCB)
1169
+ {
1170
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1171
+ }
1172
+ else if(e.getSource() == freezeCB)
1173
+ {
1174
+ Globals.FREEZEONMOVE ^= true;
1175
+ }
1176
+ else if(e.getSource() == autokeepCB)
1177
+ {
1178
+ Globals.REPLACEONMAKE ^= true;
1179
+ }
7551180 else if(e.getSource() == lookAtCB)
7561181 {
7571182 cameraView.ToggleLookAt();
....@@ -768,7 +1193,8 @@
7681193
7691194 /**/
7701195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
7721198 if ((path == null) || (path.getPathCount() <= 1)) {
7731199 // We can't move the root node or an empty selection
7741200 return;
....@@ -831,8 +1257,6 @@
8311257 }
8321258 }
8331259
834
- String string = (String) object;
835
-
8361260 System.out.println("Transfer = " + object + "; drop : " + target);
8371261 // if( object instanceof java.io.File[])
8381262 // {
....@@ -840,7 +1264,11 @@
8401264 // objEditor.DropFile((java.io.File[]) object, true);
8411265 // return;
8421266 // }
843
- if (string.charAt(0) == '/')
1267
+
1268
+ String string = object.toString();
1269
+
1270
+ // File path for Mac and Windows
1271
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441272 {
8451273 // file(s)
8461274 String[] names = string.split("\n");
....@@ -867,7 +1295,7 @@
8671295
8681296 flashIt = false;
8691297 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1298
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711299 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721300
8731301 if (group.selection.size() == 1)
....@@ -883,23 +1311,33 @@
8831311
8841312 assert target == objEditor.jTree;
8851313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
8861315 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881317 } catch (Exception e) {
8891318 System.out.println("destinationPath : " + destinationPath);
8901319 return;
8911320 }
8921321
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
8941323 {
1324
+ Object3D child = (Object3D)group.selection.elementAt(i);
1325
+
1326
+ // Cannot move into itself
1327
+ if (child == destinationLeaf)
1328
+ return;
1329
+ }
1330
+
1331
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1332
+// {
8951333 loadClipboard(true);
8961334 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1335
+ pasteInto(false, false);
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
9031341 }
9041342 public void dropActionChanged(DropTargetDragEvent dtde)
9051343 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1440,109 @@
10021440
10031441 void buildCreateMenu(Menu menu)
10041442 {
1005
- gridItem = menu.add(new MenuItem("Grid"));
1006
- gridItem.addActionListener(this);
1007
- rectoidItem = menu.add(new MenuItem("Box"));
1008
- rectoidItem.addActionListener(this);
1009
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1010
- ellipsoidItem.addActionListener(this);
1011
- coneItem = menu.add(new MenuItem("Cone"));
1012
- coneItem.addActionListener(this);
1013
- torusItem = menu.add(new MenuItem("Torus"));
1014
- torusItem.addActionListener(this);
1015
- superItem = menu.add(new MenuItem("Superellipsoid"));
1016
- superItem.addActionListener(this);
1017
- particleItem = menu.add(new MenuItem("Particle system"));
1018
- particleItem.addActionListener(this);
1443
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1444
+ //heightFieldItem.addActionListener(this);
1445
+// gridItem = menu.add(new MenuItem("Grid"));
1446
+// gridItem.addActionListener(this);
1447
+// rectoidItem = menu.add(new MenuItem("Box"));
1448
+// rectoidItem.addActionListener(this);
1449
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1450
+// ellipsoidItem.addActionListener(this);
1451
+// coneItem = menu.add(new MenuItem("Cone"));
1452
+// coneItem.addActionListener(this);
1453
+// torusItem = menu.add(new MenuItem("Torus"));
1454
+// torusItem.addActionListener(this);
1455
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1456
+// superItem.addActionListener(this);
1457
+
1458
+ cameraItem = menu.add(new MenuItem("Camera"));
1459
+ cameraItem.addActionListener(this);
1460
+
1461
+ if (!Globals.ADVANCED)
1462
+ {
1463
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1464
+ kleinItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
1469
+ if (Globals.ADVANCED)
1470
+ {
10191471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201472 ragdollItem.addActionListener(this);
10211473 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221474 ragdoll2Item.addActionListener(this);
1475
+ }
10231476 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1477
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251478 meshItem.addActionListener(this);
10261479 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271480 // meshGroupItem.addActionListener(this);
1481
+ if (Globals.ADVANCED)
1482
+ {
10281483 springItem = menu.add(new MenuItem("Spring"));
10291484 springItem.addActionListener(this);
10301485 flagItem = menu.add(new MenuItem("Flag"));
10311486 flagItem.addActionListener(this);
1032
- bezierItem = menu.add(new MenuItem("Patch"));
1033
- bezierItem.addActionListener(this);
1034
- checkerItem = menu.add(new MenuItem("Checker"));
1035
- checkerItem.addActionListener(this);
10361487 blobItem = menu.add(new MenuItem("Blob"));
10371488 blobItem.addActionListener(this);
10381489 latheItem = menu.add(new MenuItem("Lathe"));
10391490 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1491
+ }
1492
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1493
+ bezierItem.addActionListener(this);
1494
+// overlayItem = menu.add(new MenuItem("Overlay"));
1495
+// overlayItem.addActionListener(this);
1496
+// lightItem = menu.add(new MenuItem("Light"));
1497
+// lightItem.addActionListener(this);
10421498 menu.add("-");
10431499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441500 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
10471503 doubleItem = menu.add(new MenuItem("Fork"));
10481504 doubleItem.addActionListener(this);
1505
+ if (Globals.ADVANCED)
1506
+ {
10491507 tripleItem = menu.add(new MenuItem("Trident"));
10501508 tripleItem.addActionListener(this);
1051
- menu.add("-");
1052
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
1053
- importGFDItem.addActionListener(this);
1054
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
1055
- importVRMLX3DItem.addActionListener(this);
1056
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
1057
- importOBJItem.addActionListener(this);
1058
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
1059
- import3DSItem.addActionListener(this);
1509
+ }
10601510 }
10611511
10621512 void buildToolsMenu(Menu menu)
10631513 {
10641514 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651515 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1516
+ animationItem.setState(Globals.ANIMATION);
1517
+
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
10671520
10681521 menu.add("-");
10691522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701523 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1524
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1525
+ textureFieldItem.addActionListener(this);
1526
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721527 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751528 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761529 reduceMorphItem.addActionListener(this);
10771530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781531 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821532 menu.add("-");
1083
-
10841533 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851534 memoryItem.addActionListener(this);
1535
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1536
+ computeAOItem.addActionListener(this);
1537
+
1538
+ if (Globals.ADVANCED)
1539
+ {
1540
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1541
+ mirrorItem.addActionListener(this);
1542
+ menu.add("-");
10861543 menu.add(analyzeItem = new MenuItem("Analyze"));
10871544 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1545
+ menu.add(dumpItem = new MenuItem("Print"));
10891546 dumpItem.addActionListener(this);
10901547 // menu.add(pathItem = new MenuItem("From-to path"));
10911548 // pathItem.addActionListener(this);
....@@ -1094,6 +1551,8 @@
10941551 resetParentItem.addActionListener(this);
10951552 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961553 repairParentItem.addActionListener(this);
1554
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1555
+ repairShadowItem.addActionListener(this);
10971556 menu.add(invariantsItem = new MenuItem("Invariants"));
10981557 invariantsItem.addActionListener(this);
10991558 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1560,7 @@
11011560 menu.add("-");
11021561 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031562 editScriptItem.addActionListener(this);
1563
+ }
11041564 }
11051565
11061566 void ScreenFit()
....@@ -1223,9 +1683,34 @@
12231683 shadow.material = new cMaterial(obj.material);
12241684 shadow.material.diffuse = 0.0001f;
12251685 shadow.material.specular = 0.0001f;
1686
+ //shadow.projectedVertices[1].x = 300;
12261687
12271688 makeSomething(shadow);
12281689 }
1690
+
1691
+ private void ClearUnpinned()
1692
+ {
1693
+ //for (Object3D obj : listUI)
1694
+ for (int i=listUI.size(); --i>=0;)
1695
+ {
1696
+ Object3D obj = listUI.elementAt(i);
1697
+ if (!obj.pinned)
1698
+ {
1699
+ obj.CloseUI();
1700
+ listUI.remove(i);
1701
+ }
1702
+ }
1703
+ }
1704
+
1705
+ private void EditElement(Object3D elem, boolean newWindow)
1706
+ {
1707
+ // if (!(elem instanceof Composite))
1708
+ // newWindow = false;
1709
+ listUI.add(elem);
1710
+ elem.openEditWindow(this, newWindow); //, false);
1711
+ System.out.println("edit : " + elem);
1712
+ elem.editWindow.refreshContents(true); // ? new
1713
+ }
12291714
12301715 /**
12311716 * applyExample
....@@ -1429,9 +1914,9 @@
14291914
14301915 void Overwrite(int mask)
14311916 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1917
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331918 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1919
+ Object3D content = Grafreed.clipboard.get(0);
14351920
14361921 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371922 content = ((cGroup)content).get(0);
....@@ -1454,6 +1939,7 @@
14541939 //
14551940 public void actionPerformed(ActionEvent event) // , Object arg)
14561941 {
1942
+ Object source = event.getSource();
14571943 /*
14581944 if (event.getSource() == nameField)
14591945 {
....@@ -1465,11 +1951,11 @@
14651951 }
14661952 else
14671953 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1954
+ if (source == lookAtItem || source == lookFromItem)
14691955 {
14701956 ScreenFit();
14711957 } else
1472
- if (event.getSource() == switchItem)
1958
+ if (source == switchViewItem)
14731959 {
14741960 cVector v1 = new cVector();
14751961 cVector v2 = new cVector();
....@@ -1478,11 +1964,11 @@
14781964 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791965 objEditor.cameraView.repaint();
14801966 } else
1481
- if (event.getSource() == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
14821968 {
14831969 makeSomething(new Box());
14841970 } else
1485
- if (event.getSource() == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
14861972 {
14871973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1989,9 @@
15031989 applyExample(particleGeom, "SMOKE");
15041990 makeSomething(particleGeom);
15051991 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1992
+ if (source == ragdollItem || source == ragdoll2Item)
15071993 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1994
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091995
15101996 ragdoll.toParent = LA.newMatrix();
15111997 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2007,71 @@
15212007 makeSomething(ragdoll);
15222008 //makeSomething(new VehicleDemo());
15232009 } else
1524
- if (event.getSource() == gridItem)
2010
+ /*
2011
+ */
2012
+ if (source == heightFieldItem)
2013
+ {
2014
+ Object3D obj = new Object3D();
2015
+
2016
+ obj.CreateMaterial();
2017
+ obj.bRep = new BoundaryRep();
2018
+
2019
+ obj.bRep.CreateMesh(new iHeightField()
2020
+ {
2021
+ public double f(double x, double y)
2022
+ {
2023
+ // The Mandelbrot set is represented by coloring
2024
+ // each point (x,y) according to the number of
2025
+ // iterations it takes before the while loop in
2026
+ // this method ends. For points that are actually
2027
+ // in the Mandelbrot set, or very close to it, the
2028
+ // count will reach the maximum value, 80. These
2029
+ // points will be colored purple. All other colors
2030
+ // represent points that are definitely NOT in the set.
2031
+ x -= 600;
2032
+ y -= 500;
2033
+ x /= 200;
2034
+ y /= 200;
2035
+ int count = 0;
2036
+ double zx = x;
2037
+ double zy = y;
2038
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2039
+ double new_zx = zx*zx - zy*zy + x;
2040
+ zy = 2*zx*zy + y;
2041
+ zx = new_zx;
2042
+ count++;
2043
+ }
2044
+ return count; // Math.sqrt(count);
2045
+ }
2046
+ }, 1000,1000);
2047
+
2048
+ makeSomething(obj);
2049
+ } else
2050
+ if (source == gridItem || source == gridButton)
15252051 {
15262052 makeSomething(new Grid());
15272053 } else
1528
- if (event.getSource() == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
15292055 {
15302056 makeSomething(new Sphere());
15312057 } else
1532
- if (event.getSource() == coneItem)
2058
+ if (source == coneItem || source == coneButton)
15332059 {
15342060 makeSomething(new Cone());
15352061 } else
1536
- if (event.getSource() == torusItem)
2062
+ if (source == torusItem || source == torusButton)
15372063 {
15382064 makeSomething(new Torus());
15392065 } else
1540
- if (event.getSource() == superItem)
2066
+ if (source == superItem || source == superButton)
15412067 {
15422068 makeSomething(new Superellipsoid());
15432069 } else
1544
- if (event.getSource() == blobItem)
2070
+ if (source == kleinItem || source == kleinButton)
2071
+ {
2072
+ makeSomething(new Klein());
2073
+ } else
2074
+ if (source == blobItem)
15452075 {
15462076 Blob blob = new Blob();
15472077 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2079,15 @@
15492079 //blob.retile();
15502080 makeSomething(blob);
15512081 } else
1552
- if (event.getSource() == latheItem)
2082
+ if (source == latheItem)
15532083 {
15542084 makeSomething(new Lathe());
15552085 } else
1556
- if (event.getSource() == bezierItem)
2086
+ if (source == bezierItem)
15572087 {
15582088 makeSomething(new BezierSurface());
15592089 } else
1560
- if (event.getSource() == checkerItem)
2090
+ if (source == overlayItem || source == overlayButton)
15612091 {
15622092 /*
15632093 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2100,9 @@
15702100 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712101 LA.matInvert(obj.toParent, obj.fromParent);
15722102 */
1573
- makeSomething(new CheckerIG());
2103
+ makeSomething(new Checker());
15742104 } else
1575
- if (event.getSource() == meshItem)
2105
+ if (source == meshItem)
15762106 {
15772107 Object3D itemtomake = new Object3D();
15782108 Object3D child;
....@@ -1593,35 +2123,35 @@
15932123 makeSomething(child);
15942124 }
15952125 } else
1596
- if (event.getSource() == springItem)
2126
+ if (source == springItem)
15972127 {
15982128 cSpring s = new cSpring();
15992129 s.setup();
16002130 makeSomething(s);
16012131 } else
1602
- if (event.getSource() == flagItem)
2132
+ if (source == flagItem)
16032133 {
16042134 cSpring s = new cFlag();
16052135 s.setup();
16062136 makeSomething(s);
16072137 } else
1608
- if (event.getSource() == lightItem)
2138
+ if (source == lightItem || source == lightButton)
16092139 {
16102140 makeSomething(new Light());
16112141 } else
1612
- if (event.getSource() == csgItem)
2142
+ if (source == csgItem)
16132143 {
16142144 group(new CSG());
16152145 } else
1616
- if (event.getSource() == templateItem)
2146
+ if (source == templateItem)
16172147 {
16182148 group(new cTemplate());
16192149 } else
1620
- if (event.getSource() == attributeItem)
2150
+ if (source == attributeItem)
16212151 {
16222152 makeSomething(new Attribute());
16232153 } else
1624
- if (event.getSource() == pointflowItem)
2154
+ if (source == pointflowItem)
16252155 {
16262156 makeSomething(new PointFlow());
16272157 } else
....@@ -1633,7 +2163,7 @@
16332163 } else
16342164 */
16352165
1636
- if (event.getSource() == superLoopItem)
2166
+ if (source == superLoopItem)
16372167 {
16382168 Composite g = new cGroup();
16392169 for (int i=0; i<15; i++)
....@@ -1655,30 +2185,30 @@
16552185
16562186 group(g);
16572187 } else
1658
- if (event.getSource() == loopItem)
2188
+ if (source == loopItem || source == loopButton)
16592189 {
16602190 Composite csg = new GroupLeaf();
16612191 csg.count = 5;
16622192 group(csg);
1663
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
16642194 csg.addChild(child);
16652195 child.addChild(csg);
16662196 } else
1667
- if (event.getSource() == doubleItem)
2197
+ if (source == doubleItem)
16682198 {
1669
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
16702200 csg.count = 5;
16712201 group(csg);
1672
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
16732203 csg.addChild(child);
16742204 child.addChild(csg);
1675
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
16762206 csg.addChild(child);
16772207 child.addChild(csg);
16782208 } else
1679
- if (event.getSource() == tripleItem)
2209
+ if (source == tripleItem)
16802210 {
1681
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
16822212 csg.count = 4;
16832213 group(csg);
16842214 Composite child = new cGroup();
....@@ -1691,73 +2221,98 @@
16912221 csg.addChild(child);
16922222 child.addChild(csg);
16932223 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2224
+ if (source == computeAOItem)
16962225 {
1697
- ImportGFD();
2226
+ Globals.drawMode = CameraPane.OCCLUSION;
2227
+ Globals.theRenderer.repaint();
16982228 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1700
- {
1701
- ImportVRMLX3D();
1702
- } else
1703
- if (event.getSource() == import3DSItem)
1704
- {
1705
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1706
- } else
1707
- if (event.getSource() == importOBJItem)
1708
- {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1710
- } else
1711
- if (event.getSource() == computeAOItem)
1712
- {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1715
- } else
1716
- if (event.getSource() == recompileItem)
2229
+ if (source == recompileItem)
17172230 {
17182231 Recompile();
17192232 refreshContents();
17202233 } else
1721
- if (event.getSource() == editScriptItem)
2234
+ if (source == editScriptItem)
17222235 {
17232236 OpenDialog();
17242237 refreshContents();
17252238 } else
1726
- if (event.getSource() == invariantsItem)
2239
+ if (source == invariantsItem)
17272240 {
17282241 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2242
+ Grafreed.grafreeD.universe.invariants();
17302243 } else
1731
- if (event.getSource() == memoryItem)
2244
+ if (source == memoryItem)
17322245 {
17332246 //System.out.println("Invariants:");
17342247 PrintMemory();
17352248 } else
1736
- if (event.getSource() == pathItem)
2249
+ if (source == pathItem)
17372250 {
17382251 PrintPath();
17392252 } else
1740
- if (event.getSource() == analyzeItem)
2253
+ if (source == analyzeItem)
17412254 {
17422255 AnalyzeObject();
17432256 } else
1744
- if (event.getSource() == dumpItem)
2257
+ if (source == dumpItem)
17452258 {
17462259 DumpObject();
17472260 } else
1748
- if (event.getSource() == screenfitButton)
2261
+ if (source == minButton)
17492262 {
1750
- //Reload(lastConverter, lastFilename, true);
2263
+ Minimize();
2264
+ } else
2265
+ if (source == maxButton)
2266
+ {
2267
+ Maximize();
2268
+ } else
2269
+ if (source == fullButton)
2270
+ {
2271
+ ToggleFullScreen();
2272
+ } else
2273
+ if (source == undoButton)
2274
+ {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2278
+ Undo();
2279
+ } else
2280
+ if (source == restoreButton)
2281
+ {
2282
+ // Restore current version
2283
+ Restore();
2284
+ } else
2285
+ if (source == replaceButton)
2286
+ {
2287
+ // Overwrite current version
2288
+ Replace();
2289
+ } else
2290
+ if (source == redoButton)
2291
+ {
2292
+ // Go to next version
2293
+ Redo();
2294
+ } else
2295
+ if (source == saveButton)
2296
+ {
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
2300
+ } else
2301
+ if (source == oneStepButton)
2302
+ {
2303
+ Globals.ONESTEP = true;
2304
+ cameraView.repaint();
2305
+ } else
2306
+ if (source == screenfitButton)
2307
+ {
17512308 ScreenFit();
17522309 } else
1753
- if (event.getSource() == screenfitpointButton)
2310
+ if (source == screenfitpointButton)
17542311 {
1755
- //Reload(lastConverter, lastFilename, true);
17562312 ScreenFitPoint();
17572313 } else
1758
- if (event.getSource() == snapobjectButton)
2314
+ if (source == snapobjectButton)
17592315 {
1760
- //Reload(lastConverter, lastFilename, true);
17612316 SnapObject();
17622317 } else
17632318 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2321,13 @@
17662321 // Recompile();
17672322 // refreshContents();
17682323 // } else
1769
- if (event.getSource() == gcButton)
2324
+ if (source == gcButton)
17702325 {
17712326 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722327 System.gc();
17732328 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742329 } else
1775
- if (event.getSource() == editLeafItem)
2330
+ if (source == editLeafItem)
17762331 {
17772332 Object3D obj;
17782333 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2341,78 @@
17862341 }
17872342 refreshContents(true);
17882343 } else
1789
- if (event.getSource() == openWindowItem)
2344
+ if (source == openWindowItem)
17902345 {
17912346 EditSelection(true);
17922347 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2348
+ if (source == cutItem || source == clearButton)
17942349 {
17952350 loadClipboard(true);
17962351 } else
1797
- if (event.getSource() == duplicateItem)
2352
+ if (source == undoItem)
17982353 {
1799
- Object3D keep = GraphreeD.clipboard;
2354
+ Undo();
2355
+ } else
2356
+ if (source == redoItem)
2357
+ {
2358
+ Redo();
2359
+ } else
2360
+ if (source == duplicateItem)
2361
+ {
2362
+ Object3D keep = Grafreed.clipboard;
18002363 loadClipboard(false);
18012364 paste(false);
1802
- GraphreeD.clipboard = keep;
2365
+ Grafreed.clipboard = keep;
18032366 } else
1804
- if (event.getSource() == cloneItem)
2367
+ if (source == cloneItem)
18052368 {
18062369 CloneSelection(false);
18072370 } else
1808
- if (event.getSource() == cloneSupportItem)
2371
+ if (source == cloneSupportItem)
18092372 {
18102373 CloneSelection(true);
18112374 } else
1812
- if (event.getSource() == copyItem)
2375
+ if (source == copyItem)
18132376 {
18142377 loadClipboard(false);
18152378 } else
1816
- if (event.getSource() == pasteItem)
2379
+ if (source == pasteItem)
18172380 {
18182381 paste(false);
18192382 } else
1820
- if (event.getSource() == pasteLinkItem)
2383
+ if (source == pasteIntoItem)
18212384 {
1822
- pasteInto(false);
2385
+ pasteInto(true, false);
18232386 } else
1824
- if (event.getSource() == pasteCloneItem)
2387
+ if (source == pasteLinkItem)
18252388 {
1826
- pasteInto(true);
2389
+ pasteInto(false, false);
18272390 } else
1828
- if (event.getSource() == pasteExpandItem)
2391
+ if (source == pasteCloneItem)
2392
+ {
2393
+ pasteInto(true, true);
2394
+ } else
2395
+ if (source == pasteExpandItem)
18292396 {
18302397 paste(true);
18312398 } else
1832
- if (event.getSource() == synchronizeItem)
2399
+ if (source == synchronizeItem)
18332400 {
18342401 Overwrite(Object3D.TRANSFORM);
18352402 } else
1836
- if (event.getSource() == overwriteNameItem)
2403
+ if (source == overwriteNameItem)
18372404 {
18382405 Overwrite(Object3D.NAME);
18392406 } else
1840
- if (event.getSource() == overwriteUVItem)
2407
+ if (source == overwriteUVItem)
18412408 {
18422409 Overwrite(Object3D.UV);
18432410 } else
1844
- if (event.getSource() == overwriteMatItem)
2411
+ if (source == overwriteMatItem)
18452412 {
2413
+ /* july 2015
18462414 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2415
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482416 else
18492417 {
18502418 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2424,16 @@
18562424 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572425 }
18582426 }
2427
+ */
2428
+
2429
+ Overwrite(dropAttributes);
18592430 }
1860
- if (event.getSource() == overwriteGeoItem)
2431
+ if (source == overwriteGeoItem)
18612432 {
18622433 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2434
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642435 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2436
+// Object3D content = GrafreeD.clipboard.get(0);
18662437 //
18672438 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682439 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2445,7 @@
18742445 // refreshContents();
18752446 // }
18762447 } else
1877
- if (event.getSource() == generateMeshItem)
2448
+ if (source == generateMeshItem)
18782449 {
18792450 //if (group.selection.size() == 1)
18802451 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2456,7 @@
18852456 ResetModel();
18862457 refreshContents();
18872458 } else
1888
- if (event.getSource() == extractGeometriesItem)
2459
+ if (source == extractGeometriesItem)
18892460 {
18902461 boolean one = false;
18912462
....@@ -1912,7 +2483,7 @@
19122483 ResetModel();
19132484 refreshContents();
19142485 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2486
+ if (source == cloneGeometriesItem)
19162487 {
19172488 boolean one = false;
19182489
....@@ -1938,32 +2509,37 @@
19382509 ResetModel();
19392510 refreshContents();
19402511 } else
1941
- if (event.getSource() == shareGeometriesItem)
2512
+ if (source == shareGeometriesItem)
19422513 {
19432514 boolean one = false;
19442515
19452516 if (group.selection.size() == 1)
19462517 one = true;
19472518
2519
+ Object3D merge = null;
2520
+
19482521 Object3D content = new cGroup();
19492522
19502523 for (int i=0; i<group.selection.size(); i++)
19512524 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2525
+ merge = new Merge(group.selection.get(i));
19532526
19542527 if (one)
1955
- makeSomething(sel, false);
2528
+ makeSomething(merge, false);
19562529 else
1957
- content.addChild(sel);
2530
+ content.addChild(merge);
19582531 }
19592532
19602533 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2534
+ makeSomething(content, true);
2535
+ else
2536
+ {
2537
+ ResetModel();
2538
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2539
+ refreshContents();
2540
+ }
19652541 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2542
+ if (source == mergeGeometriesItem)
19672543 {
19682544 boolean one = false;
19692545
....@@ -1993,11 +2569,11 @@
19932569 ResetModel();
19942570 refreshContents();
19952571 } else
1996
- if (event.getSource() == linkverticesItem)
2572
+ if (source == linkverticesItem)
19972573 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2574
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992575 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2576
+// Object3D content = GrafreeD.clipboard.get(0);
20012577 //
20022578 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032579 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2582,48 @@
20062582 // group.selection.get(0).setMasterThis(content); // should be identity
20072583 // refreshContents();
20082584 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2585
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102586 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2587
+ Object3D content = Grafreed.clipboard.get(0);
20122588
20132589 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142590 content = ((cGroup)content).get(0);
20152591
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2592
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172593 for (int i=0; i<group.selection.size(); i++)
20182594 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2595
+ boolean random = CameraPane.SWITCH;
2596
+ CameraPane.SWITCH = false; // parse all random nodes
20212597 group.selection.get(i).linkVerticesThis(content);
20222598 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2599
+ CameraPane.SWITCH = random;
20242600 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2601
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262602 refreshContents();
20272603 }
20282604 } else
2029
- if (event.getSource() == resetsupportItem)
2605
+ if (source == resetsupportItem)
20302606 {
20312607 for (int i=0; i<group.selection.size(); i++)
20322608 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2609
+ boolean random = CameraPane.SWITCH;
2610
+ CameraPane.SWITCH = false; // parse all random nodes
20352611 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2612
+ CameraPane.SWITCH = random;
20372613 }
20382614
20392615 refreshContents();
20402616 } else
2041
- if (event.getSource() == resetreferencesItem)
2617
+ if (source == relinkverticesItem)
2618
+ {
2619
+ boolean random = CameraPane.SWITCH;
2620
+ CameraPane.SWITCH = false; // parse all random nodes
2621
+ group.selection.RelinkToSupport();
2622
+ CameraPane.SWITCH = random;
2623
+
2624
+ refreshContents();
2625
+ } else
2626
+ if (source == resetreferencesItem)
20422627 {
20432628 for (int i=0; i<group.selection.size(); i++)
20442629 {
....@@ -2047,11 +2632,11 @@
20472632
20482633 refreshContents();
20492634 } else
2050
- if (event.getSource() == setMasterItem)
2635
+ if (source == setMasterItem)
20512636 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2637
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532638 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2639
+ Object3D content = Grafreed.clipboard.get(0);
20552640
20562641 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572642 content = ((cGroup)content).get(0);
....@@ -2060,13 +2645,13 @@
20602645 refreshContents();
20612646 }
20622647 } else
2063
- if (event.getSource() == poseMeshItem)
2648
+ if (source == poseMeshItem)
20642649 {
20652650 if (group.selection.size() == 1)
20662651 {
2067
- if (GraphreeD.clipboard.size() == 1)
2652
+ if (Grafreed.clipboard.size() == 1)
20682653 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2654
+ Object3D content = Grafreed.clipboard.get(0);
20702655
20712656 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722657 content = ((cGroup)content).get(0);
....@@ -2079,19 +2664,19 @@
20792664 }
20802665
20812666 } else
2082
- if (event.getSource() == revertMeshItem)
2667
+ if (source == revertMeshItem)
20832668 {
20842669 RevertMeshes();
20852670 } else
2086
- if (event.getSource() == resetMeshItem)
2671
+ if (source == resetAllItem)
20872672 {
20882673 ResetAll();
20892674 } else
2090
- if (event.getSource() == stepAllItem)
2675
+ if (source == stepAllItem)
20912676 {
20922677 StepAll();
20932678 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
20952680 {
20962681 //int indices[] = jList.getSelectedIndices();
20972682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2684,46 @@
20992684
21002685 ClearSelection(false);
21012686 } else
2102
- if (event.getSource() == clearAllItem)
2687
+ if (source == clearAllItem)
21032688 {
21042689 ClearSelection(true);
21052690 } else
2106
- if (event.getSource() == grabItem)
2691
+ if (source == grabItem || source == groupButton)
21072692 {
2108
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
21092694 } else
2110
- if (event.getSource() == frontItem)
2695
+ if (source == hideItem)
2696
+ {
2697
+ group(new HiddenObject());
2698
+ } else
2699
+ if (source == frontItem)
21112700 {
21122701 front();
21132702 } else
2114
- if (event.getSource() == backItem)
2703
+ if (source == backItem)
21152704 {
21162705 back();
21172706 } else
2118
- if (event.getSource() == cameraItem)
2707
+ if (source == cameraItem)
21192708 {
21202709 makeSomething(new Camera());
21212710 } else
2122
- if (event.getSource() == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
21232712 {
21242713 group(new Composite());
21252714 } else
2126
- if (event.getSource() == randomItem)
2715
+ if (source == switchItem || source == switchButton)
21272716 {
21282717 RandomNode random = new RandomNode();
21292718 group(random);
21302719 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2720
+ random.name = random.get(0).name + "Switch";
21322721 } else
2133
- if (event.getSource() == physicsItem)
2722
+ if (source == physicsItem)
21342723 {
21352724 group(new PhysicsNode());
21362725 } else
2137
- if (event.getSource() == frameselectorItem)
2726
+ if (source == frameselectorItem)
21382727 {
21392728 for (int i=0; i<group.selection.size(); i++)
21402729 {
....@@ -2146,7 +2735,7 @@
21462735 ResetModel();
21472736 refreshContents();
21482737 } else
2149
- if (event.getSource() == switchGeoItem)
2738
+ if (source == switchGeoItem)
21502739 {
21512740 for (int i=0; i<group.selection.size(); i++)
21522741 {
....@@ -2158,7 +2747,7 @@
21582747 ResetModel();
21592748 refreshContents();
21602749 } else
2161
- if (event.getSource() == switchTransfoItem)
2750
+ if (source == switchTransfoItem)
21622751 {
21632752 for (int i=0; i<group.selection.size(); i++)
21642753 {
....@@ -2170,7 +2759,7 @@
21702759 ResetModel();
21712760 refreshContents();
21722761 } else
2173
- if (event.getSource() == morphItem)
2762
+ if (source == morphItem)
21742763 {
21752764 for (int i=0; i<group.selection.size(); i++)
21762765 {
....@@ -2182,7 +2771,7 @@
21822771 ResetModel();
21832772 refreshContents();
21842773 } else
2185
- if (event.getSource() == scriptNodeItem)
2774
+ if (source == scriptNodeItem)
21862775 {
21872776 boolean atleastone = false;
21882777
....@@ -2221,191 +2810,252 @@
22212810 }
22222811 }
22232812 } else
2224
- if (event.getSource() == linkerItem)
2813
+ if (source == linkerItem)
22252814 {
22262815 group(new cLinker());
22272816 } else
2228
- if (event.getSource() == textureItem)
2817
+ if (source == textureItem || source == textureButton)
22292818 {
22302819 group(new TextureNode());
22312820 } else
2232
- if (event.getSource() == shadowXItem)
2821
+ if (source == billboardItem)
2822
+ {
2823
+ group(new BillboardNode());
2824
+ } else
2825
+ if (source == shadowXItem)
22332826 {
22342827 CastShadow(0);
22352828 } else
2236
- if (event.getSource() == shadowYItem)
2829
+ if (source == shadowYItem)
22372830 {
22382831 CastShadow(1);
22392832 } else
2240
- if (event.getSource() == shadowZItem)
2833
+ if (source == shadowZItem)
22412834 {
22422835 CastShadow(2);
22432836 } else
2244
- if (event.getSource() == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
22452838 {
2246
- ungroup();
2839
+ boolean hasRoot = false;
2840
+
2841
+ for (int i=0; i<group.selection.size(); i++)
2842
+ {
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
2848
+ }
2849
+
2850
+ if (!hasRoot)
2851
+ {
2852
+ for (int i=0; i<group.selection.size(); i++)
2853
+ {
2854
+ Ungroup(group.selection.get(i));
2855
+ }
2856
+
2857
+ ClearSelection(false);
2858
+
2859
+ refreshContents();
2860
+ }
22472861 } else
2248
- if (event.getSource() == genUVItem)
2862
+ if (source == genUVItem)
22492863 {
22502864 GenUV();
22512865 } else
2252
- if (event.getSource() == genNormalsCADItem)
2866
+ if (source == genNormalsCADItem)
22532867 {
22542868 GenNormals(true);
22552869 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2870
+ if (source == genNormalsMESHItem)
2871
+ {
2872
+ GenNormalsMESH();
2873
+ } else
2874
+ if (source == genNormalsORGANItem)
22572875 {
22582876 GenNormals(false);
22592877 } else
2260
- if (event.getSource() == stripifyItem)
2878
+ if (source == genNormalsMINEItem)
2879
+ {
2880
+ GenNormalsMINE();
2881
+ } else
2882
+ if (source == stripifyItem)
22612883 {
22622884 Stripify();
22632885 } else
2264
- if (event.getSource() == unstripifyItem)
2886
+ if (source == unstripifyItem)
22652887 {
22662888 Unstripify();
22672889 } else
2268
- if (event.getSource() == trimItem)
2890
+ if (source == trimItem)
22692891 {
22702892 Trim();
22712893 } else
2272
- if (event.getSource() == untrimItem)
2894
+ if (source == untrimItem)
22732895 {
22742896 Untrim();
22752897 } else
2276
- if (event.getSource() == clearColorsItem)
2898
+ if (source == clearColorsItem)
22772899 {
22782900 ClearColors();
22792901 } else
2280
- if (event.getSource() == clearMaterialsItem)
2902
+ if (source == clearMaterialsItem)
22812903 {
22822904 ClearMaterials();
22832905 } else
2284
- if (event.getSource() == liveleavesItem)
2906
+ if (source == liveleavesItem)
22852907 {
22862908 LiveLeaves(true);
22872909 } else
2288
- if (event.getSource() == unliveleavesItem)
2910
+ if (source == unliveleavesItem)
22892911 {
22902912 LiveLeaves(false);
22912913 } else
2292
- if (event.getSource() == supportleavesItem)
2914
+ if (source == supportleavesItem)
22932915 {
22942916 SupportLeaves(true);
22952917 } else
2296
- if (event.getSource() == unsupportleavesItem)
2918
+ if (source == unsupportleavesItem)
22972919 {
22982920 SupportLeaves(false);
22992921 } else
2300
- if (event.getSource() == hideleavesItem)
2922
+ if (source == hideleavesItem)
23012923 {
23022924 HideLeaves(true);
23032925 } else
2304
- if (event.getSource() == showleavesItem)
2926
+ if (source == showleavesItem)
23052927 {
23062928 HideLeaves(false);
23072929 } else
2308
- if (event.getSource() == markleavesItem)
2930
+ if (source == markleavesItem)
23092931 {
23102932 MarkLeaves(true);
23112933 } else
2312
- if (event.getSource() == unmarkleavesItem)
2934
+ if (source == unmarkleavesItem)
23132935 {
23142936 MarkLeaves(false);
23152937 } else
2316
- if (event.getSource() == flipVItem)
2938
+ if (source == rewindleavesItem)
2939
+ {
2940
+ RewindLeaves(true);
2941
+ } else
2942
+ if (source == unrewindleavesItem)
2943
+ {
2944
+ RewindLeaves(false);
2945
+ } else
2946
+ if (source == randomleavesItem)
2947
+ {
2948
+ RandomLeaves(true);
2949
+ } else
2950
+ if (source == unrandomleavesItem)
2951
+ {
2952
+ RandomLeaves(false);
2953
+ } else
2954
+ if (source == flipVItem)
23172955 {
23182956 FlipV(true);
23192957 } else
2320
- if (event.getSource() == unflipVItem)
2958
+ if (source == unflipVItem)
23212959 {
23222960 FlipV(false);
23232961 } else
2324
- if (event.getSource() == lowTexturesItem)
2962
+ if (source == lowTexturesItem)
23252963 {
23262964 SetTexRes(0);
23272965 } else
2328
- if (event.getSource() == normalTexturesItem)
2966
+ if (source == normalTexturesItem)
23292967 {
23302968 SetTexRes(1);
23312969 } else
2332
- if (event.getSource() == highTexturesItem)
2970
+ if (source == highTexturesItem)
23332971 {
23342972 SetTexRes(2);
23352973 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2974
+ if (source == veryhighTexturesItem)
23372975 {
23382976 SetTexRes(3);
23392977 } else
2340
- if (event.getSource() == maxTexturesItem)
2978
+ if (source == maxTexturesItem)
23412979 {
23422980 SetTexRes(4);
23432981 } else
2344
- if (event.getSource() == panoTexturesItem)
2982
+ if (source == panoTexturesItem)
23452983 {
23462984 SetTexRes(5);
23472985 } else
2348
- if (event.getSource() == reverseNormalsItem)
2986
+ if (source == reverseNormalsItem)
23492987 {
23502988 ReverseNormals();
23512989 } else
2352
- if (event.getSource() == parseverticesItem)
2990
+ if (source == parseverticesItem)
23532991 {
23542992 ParseVertices();
23552993 } else
2356
- if (event.getSource() == alignItem)
2994
+ if (source == textureFieldItem)
2995
+ {
2996
+ TextureVertices();
2997
+ } else
2998
+ if (source == alignItem)
23572999 {
23583000 Align();
23593001 } else
2360
- if (event.getSource() == mirrorItem)
3002
+ if (source == mirrorItem)
23613003 {
23623004 MirrorPoses();
23633005 } else
2364
- if (event.getSource() == reduceMorphItem)
3006
+ if (source == reduceMorphItem)
23653007 {
23663008 MeshReduction(false);
23673009 } else
2368
- if (event.getSource() == reduce34MorphItem)
3010
+ if (source == reduce34MorphItem)
23693011 {
23703012 MeshReduction(true);
23713013 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3014
+ if (source == reverseTrianglesItem)
23733015 {
23743016 ReverseTriangles();
23753017 } else
2376
- if (event.getSource() == reduceMeshItem)
3018
+ if (source == reduceMeshItem)
23773019 {
23783020 ReduceMesh(false);
23793021 } else
2380
- if (event.getSource() == reduce34MeshItem)
3022
+ if (source == reduce34MeshItem)
23813023 {
23823024 ReduceMesh(true);
23833025 } else
2384
- if (event.getSource() == increaseMeshItem)
3026
+ if (source == increaseMeshItem)
23853027 {
23863028 IncreaseMesh();
23873029 } else
2388
- if (event.getSource() == clipMeshItem)
3030
+ if (source == clipMeshItem)
23893031 {
23903032 ClipMesh();
23913033 } else
2392
- if (event.getSource() == smoothMeshItem)
3034
+ if (source == smoothMeshItem)
23933035 {
23943036 SmoothMesh();
23953037 } else
2396
- if (event.getSource() == transformgeometryItem)
3038
+ if (source == transformGeometryItem)
23973039 {
23983040 TransformGeometry();
23993041 } else
2400
- if (event.getSource() == resetTransformItem)
3042
+ if (source == transformChildrenItem)
3043
+ {
3044
+ TransformChildren();
3045
+ } else
3046
+ if (source == resetTransformItem)
24013047 {
24023048 ResetTransform();
24033049 } else
2404
- if (event.getSource() == resetCentroidItem)
3050
+ if (source == resetCentroidItem)
24053051 {
2406
- ResetCentroid();
3052
+ ResetCentroid(true);
24073053 } else
2408
- if (event.getSource() == resetParentItem)
3054
+ if (source == resetCentroidXZItem)
3055
+ {
3056
+ ResetCentroid(false);
3057
+ } else
3058
+ if (source == resetParentItem)
24093059 {
24103060 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113061 {
....@@ -2415,7 +3065,7 @@
24153065
24163066 refreshContents();
24173067 } else
2418
- if (event.getSource() == repairParentItem)
3068
+ if (source == repairParentItem)
24193069 {
24203070 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213071 {
....@@ -2429,7 +3079,21 @@
24293079
24303080 refreshContents();
24313081 } else
2432
- if (event.getSource() == sortbysizeItem)
3082
+ if (source == repairShadowItem)
3083
+ {
3084
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3085
+ {
3086
+ Object3D obj = (Object3D)e.nextElement();
3087
+ obj.RepairShadow();
3088
+// for (int i=0; i<obj.size(); i++)
3089
+// {
3090
+// obj.get(i).parent = obj;
3091
+// }
3092
+ }
3093
+
3094
+ refreshContents();
3095
+ } else
3096
+ if (source == sortbysizeItem)
24333097 {
24343098 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353099 {
....@@ -2441,7 +3105,7 @@
24413105 ResetModel();
24423106 refreshContents();
24433107 } else
2444
- if (event.getSource() == sortbynameItem)
3108
+ if (source == sortbynameItem)
24453109 {
24463110 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473111 {
....@@ -2453,7 +3117,7 @@
24533117 ResetModel();
24543118 refreshContents();
24553119 } else
2456
- if (event.getSource() == attachPigmentItem)
3120
+ if (source == attachPigmentItem)
24573121 {
24583122 String texture = GetFile("Attach pigment");
24593123 Object3D obj;
....@@ -2465,7 +3129,7 @@
24653129
24663130 refreshContents();
24673131 } else
2468
- if (event.getSource() == detachPigmentItem)
3132
+ if (source == detachPigmentItem)
24693133 {
24703134 Object3D obj;
24713135 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3140,7 @@
24763140
24773141 refreshContents();
24783142 } else
2479
- if (event.getSource() == attachBumpItem)
3143
+ if (source == attachBumpItem)
24803144 {
24813145 String texture = GetFile("Attach bump");
24823146 Object3D obj;
....@@ -2488,18 +3152,18 @@
24883152
24893153 refreshContents();
24903154 } else
2491
- if (event.getSource() == detachBumpItem)
3155
+ if (source == detachBumpItem)
24923156 {
24933157 Object3D obj;
24943158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953159 {
24963160 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
24983162 }
24993163
25003164 refreshContents();
25013165 } else
2502
- if (event.getSource() == pigmentBumpItem)
3166
+ if (source == pigmentBumpItem)
25033167 {
25043168 Object3D obj;
25053169 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3174,262 @@
25103174
25113175 refreshContents();
25123176 } else
2513
- if (event.getSource() == flashSelectionButton)
3177
+ if (source == embedTexturesItem)
3178
+ {
3179
+ Object3D obj;
3180
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3181
+ {
3182
+ obj = (Object3D)e.nextElement();
3183
+ obj.EmbedTextures(true);
3184
+ }
3185
+
3186
+ refreshContents();
3187
+ } else
3188
+ if (source == deEmbedTexturesItem)
3189
+ {
3190
+ Object3D obj;
3191
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3192
+ {
3193
+ obj = (Object3D)e.nextElement();
3194
+ obj.EmbedTextures(false);
3195
+ }
3196
+
3197
+ CameraPane.texturepigment.clear();
3198
+ CameraPane.texturebump.clear();
3199
+
3200
+ refreshContents();
3201
+ } else
3202
+ if (source == flashSelectionButton)
25143203 {
25153204 CameraPane.flash = true;
25163205 refreshContents();
25173206 } else
2518
- if (event.getSource() == oneButton)
3207
+ if (source == oneButton)
25193208 {
25203209 } else
2521
- if (event.getSource() == twoButton)
3210
+ if (source == twoButton)
25223211 {
25233212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
25243217 // bug
25253218 //gridPanel.setDividerLocation(1.0);
25263219 //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2529
- bigThree.remove(XYZPanel);
2530
- aWindowConstraints.gridx = 0;
2531
- aWindowConstraints.gridy = 0;
2532
- aWindowConstraints.gridwidth = 1;
2533
- // aConstraints.gridheight = 3;
2534
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2535
- aWindowConstraints.weightx = 0;
2536
- aWindowConstraints.weighty = 1;
2537
- //bigThree.add(jtp, aWindowConstraints);
2538
- aWindowConstraints.weightx = 1;
2539
- aWindowConstraints.gridwidth = 3;
2540
- // aConstraints.gridheight = 3;
2541
- aWindowConstraints.gridx = 1;
2542
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2544
- aWindowConstraints.weightx = 0;
2545
- aWindowConstraints.gridx = 4;
2546
- aWindowConstraints.gridwidth = 1;
2547
- // aConstraints.gridheight = 3;
2548
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2549
- //bigThree.add(XYZPanel, aWindowConstraints);
2550
- bigThree.revalidate();
3220
+// bigThree.remove(scenePanel);
3221
+// bigThree.remove(centralPanel);
3222
+// bigThree.remove(XYZPanel);
3223
+// aWindowConstraints.gridx = 0;
3224
+// aWindowConstraints.gridy = 0;
3225
+// aWindowConstraints.gridwidth = 1;
3226
+// // aConstraints.gridheight = 3;
3227
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3228
+// aWindowConstraints.weightx = 0;
3229
+// aWindowConstraints.weighty = 1;
3230
+// //bigThree.add(jtp, aWindowConstraints);
3231
+// aWindowConstraints.weightx = 1;
3232
+// aWindowConstraints.gridwidth = 3;
3233
+// // aConstraints.gridheight = 3;
3234
+// aWindowConstraints.gridx = 1;
3235
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3236
+// bigThree.add(centralPanel, aWindowConstraints);
3237
+// aWindowConstraints.weightx = 0;
3238
+// aWindowConstraints.gridx = 4;
3239
+// aWindowConstraints.gridwidth = 1;
3240
+// // aConstraints.gridheight = 3;
3241
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3242
+// //bigThree.add(XYZPanel, aWindowConstraints);
3243
+// scenePanel.setVisible(false);
3244
+// centralPanel.setVisible(true);
3245
+// XYZPanel.setVisible(false);
3246
+ bigThree.ClearUI();
3247
+ bigThree.add(centralPanel);
3248
+ bigThree.FlushUI();
3249
+
3250
+ cameraView.requestFocusInWindow();
3251
+
3252
+// refreshContents(true);
3253
+//
3254
+// try
3255
+// {
3256
+// java.awt.Robot bot = new java.awt.Robot();
3257
+// int mask = InputEvent.BUTTON1_MASK;
3258
+// bot.mouseMove(100, 100);
3259
+// bot.mousePress(mask);
3260
+// bot.mouseRelease(mask);
3261
+// }
3262
+// catch (Exception e)
3263
+// {
3264
+//
3265
+// }
3266
+
25513267 } else
2552
- if (event.getSource() == threeButton)
3268
+ if (source == threeButton)
25533269 {
25543270 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2557
- bigThree.remove(XYZPanel);
2558
- aWindowConstraints.gridx = 0;
2559
- aWindowConstraints.gridy = 0;
2560
- aWindowConstraints.gridwidth = 1;
2561
- // aConstraints.gridheight = 3;
2562
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2563
- aWindowConstraints.weightx = 0;
2564
- aWindowConstraints.weighty = 1;
2565
- //bigThree.add(jtp, aWindowConstraints);
2566
- aWindowConstraints.weightx = 1;
2567
- aWindowConstraints.gridwidth = 3;
2568
- // aConstraints.gridheight = 3;
2569
- aWindowConstraints.gridx = 1;
2570
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2572
- aWindowConstraints.weightx = 0;
2573
- aWindowConstraints.gridx = 4;
2574
- aWindowConstraints.gridwidth = 1;
2575
- // aConstraints.gridheight = 3;
2576
- aConstraints.fill = GridBagConstraints.VERTICAL;
2577
- bigThree.add(XYZPanel, aWindowConstraints);
2578
- bigThree.revalidate();
3271
+
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
3274
+
3275
+// bigThree.remove(scenePanel);
3276
+// bigThree.remove(centralPanel);
3277
+// bigThree.remove(XYZPanel);
3278
+// aWindowConstraints.gridx = 0;
3279
+// aWindowConstraints.gridy = 0;
3280
+// aWindowConstraints.gridwidth = 1;
3281
+// // aConstraints.gridheight = 3;
3282
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3283
+// aWindowConstraints.weightx = 0;
3284
+// aWindowConstraints.weighty = 1;
3285
+// //bigThree.add(jtp, aWindowConstraints);
3286
+// aWindowConstraints.weightx = 1;
3287
+// aWindowConstraints.gridwidth = 3;
3288
+// // aConstraints.gridheight = 3;
3289
+// aWindowConstraints.gridx = 1;
3290
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3291
+// bigThree.add(centralPanel, aWindowConstraints);
3292
+// aWindowConstraints.weightx = 0;
3293
+// aWindowConstraints.gridx = 4;
3294
+// aWindowConstraints.gridwidth = 1;
3295
+// // aConstraints.gridheight = 3;
3296
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3297
+// bigThree.add(XYZPanel, aWindowConstraints);
3298
+// bigThree.validate();
3299
+// scenePanel.setVisible(false);
3300
+// centralPanel.setVisible(true);
3301
+// XYZPanel.setVisible(true);
3302
+ bigThree.ClearUI();
3303
+ bigThree.add(scenePanel);
3304
+ bigThree.add(centralPanel);
3305
+ bigThree.FlushUI();
3306
+
3307
+ cameraView.requestFocusInWindow();
25793308 } else
2580
- if (event.getSource() == fourButton)
3309
+ if (source == fourButton)
25813310 {
25823311 radio.layout = fourButton;
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aWindowConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2591
- aWindowConstraints.weightx = 1;
2592
- aWindowConstraints.weighty = 1;
2593
- bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- //bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aWindowConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
3315
+
3316
+// bigThree.remove(scenePanel);
3317
+// bigThree.remove(centralPanel);
3318
+// bigThree.remove(XYZPanel);
3319
+// aWindowConstraints.gridx = 0;
3320
+// aWindowConstraints.gridy = 0;
3321
+// aWindowConstraints.gridwidth = 1;
3322
+// // aWindowConstraints.gridheight = 3;
3323
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3324
+// aWindowConstraints.weightx = 1;
3325
+// aWindowConstraints.weighty = 1;
3326
+// bigThree.add(scenePanel, aWindowConstraints);
3327
+// aWindowConstraints.weightx = 1;
3328
+// aWindowConstraints.gridwidth = 3;
3329
+// // aConstraints.gridheight = 3;
3330
+// aWindowConstraints.gridx = 1;
3331
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3332
+// //bigThree.add(cameraPanel, aWindowConstraints);
3333
+// aWindowConstraints.weightx = 0;
3334
+// aWindowConstraints.gridx = 4;
3335
+// aWindowConstraints.gridwidth = 1;
3336
+// // aWindowConstraints.gridheight = 3;
3337
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3338
+// //bigThree.add(XYZPanel, aWindowConstraints);
3339
+// bigThree.validate();
3340
+// scenePanel.setVisible(true);
3341
+// centralPanel.setVisible(false);
3342
+// XYZPanel.setVisible(false);
3343
+ bigThree.ClearUI();
3344
+ bigThree.add(scenePanel);
3345
+ bigThree.FlushUI();
3346
+
3347
+ cameraView.requestFocusInWindow();
26073348 } else
2608
- if (event.getSource() == sixButton)
3349
+ if (source == sixButton)
26093350 {
26103351 radio.layout = sixButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aWindowConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aWindowConstraints.gridheight = 3;
2632
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2633
- //bigThree.add(XYZPanel, aConstraints);
2634
- bigThree.revalidate();
3352
+
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
3355
+
3356
+// bigThree.remove(scenePanel);
3357
+// bigThree.remove(centralPanel);
3358
+// bigThree.remove(XYZPanel);
3359
+// aWindowConstraints.gridx = 0;
3360
+// aWindowConstraints.gridy = 0;
3361
+// aWindowConstraints.gridwidth = 1;
3362
+// // aConstraints.gridheight = 3;
3363
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3364
+// aWindowConstraints.weightx = 0;
3365
+// aWindowConstraints.weighty = 1;
3366
+// bigThree.add(scenePanel, aWindowConstraints);
3367
+// aWindowConstraints.weightx = 1;
3368
+// aWindowConstraints.gridwidth = 3;
3369
+// // aWindowConstraints.gridheight = 3;
3370
+// aWindowConstraints.gridx = 1;
3371
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3372
+// bigThree.add(centralPanel, aWindowConstraints);
3373
+// aWindowConstraints.weightx = 0;
3374
+// aWindowConstraints.gridx = 4;
3375
+// aWindowConstraints.gridwidth = 1;
3376
+// // aWindowConstraints.gridheight = 3;
3377
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3378
+// //bigThree.add(XYZPanel, aConstraints);
3379
+// bigThree.validate();
3380
+// scenePanel.setVisible(true);
3381
+// centralPanel.setVisible(true);
3382
+// XYZPanel.setVisible(false);
3383
+ bigThree.ClearUI();
3384
+ bigThree.add(centralPanel);
3385
+ bigThree.add(scenePanel);
3386
+ bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
26353389 } else
2636
- if (event.getSource() == sevenButton)
3390
+ if (source == sevenButton)
26373391 {
26383392 radio.layout = sevenButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2647
- aWindowConstraints.weightx = 0;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aWindowConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
3396
+
3397
+// bigThree.remove(scenePanel);
3398
+// bigThree.remove(centralPanel);
3399
+// bigThree.remove(XYZPanel);
3400
+// aWindowConstraints.gridx = 0;
3401
+// aWindowConstraints.gridy = 0;
3402
+// aWindowConstraints.gridwidth = 1;
3403
+// // aWindowConstraints.gridheight = 3;
3404
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3405
+// aWindowConstraints.weightx = 0;
3406
+// aWindowConstraints.weighty = 1;
3407
+// bigThree.add(scenePanel, aWindowConstraints);
3408
+// aWindowConstraints.weightx = 1;
3409
+// aWindowConstraints.gridwidth = 3;
3410
+// // aWindowConstraints.gridheight = 3;
3411
+// aWindowConstraints.gridx = 1;
3412
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3413
+// bigThree.add(centralPanel, aWindowConstraints);
3414
+// aWindowConstraints.weightx = 0;
3415
+// aWindowConstraints.gridx = 4;
3416
+// aWindowConstraints.gridwidth = 1;
3417
+// // aConstraints.gridheight = 3;
3418
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3419
+// bigThree.add(XYZPanel, aWindowConstraints);
3420
+// bigThree.validate();
3421
+// scenePanel.setVisible(true);
3422
+// centralPanel.setVisible(true);
3423
+// XYZPanel.setVisible(true);
3424
+ bigThree.ClearUI();
3425
+ bigThree.add(scenePanel);
3426
+ bigThree.add(centralPanel);
3427
+ bigThree.add(XYZPanel);
3428
+ bigThree.FlushUI();
3429
+
3430
+ cameraView.requestFocusInWindow();
26633431 } else
2664
- if (event.getSource() == rootButton)
3432
+ if (source == rootButton)
26653433 {
26663434 Object3D obj;
26673435 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3439,84 @@
26713439 EditObject(obj);
26723440 }
26733441
3442
+ cameraView.requestFocusInWindow();
26743443 refreshContents(true);
26753444 } else
2676
- if (event.getSource() == closeButton)
3445
+ if (source == closeButton)
26773446 {
26783447 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793448 cRadio ab;
26803449 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813450 {
26823451 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3452
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843453 {
3454
+ // Patch to avoid bug with transparency.
3455
+ if (!ab.hadMaterial)
3456
+ {
3457
+ ab.object.material = null;
3458
+ }
3459
+
26853460 buttonGroup.remove(ab);
26863461 radioPanel.remove(ab);
26873462
2688
- ab.GetObject().editWindow = null;
3463
+ //ab.GetObject().editWindow = null;
3464
+ ab.GetObject().manipWindow = null;
26893465 // ab.GetObject().objectUI = null; // ?????????
26903466
26913467 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923468 break;
26933469 }
26943470 }
3471
+
3472
+ cameraView.requestFocusInWindow();
26953473 refreshContents(true);
26963474 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3475
+ if (source == editItem || source == editButton)
26983476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
26993483 EditSelection(false);
27003484 } else
2701
- if (event.getSource() == uneditButton)
3485
+ if (source == uneditButton)
27023486 {
27033487 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043488 {
27053489 Object3D child = (Object3D)e.nextElement();
27063490 if(child.editWindow != null)
27073491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
27083493 child.CloseUI();
27093494 listUI.remove(child);
27103495
2711
- child.editWindow = null; // ???????????
3496
+ //child.editWindow = null; // ???????????
27123497 }
2713
- objEditor.ctrlPanel.revalidate();
3498
+ objEditor.ctrlPanel.FlushUI();
27143499 //objEditor.jTree.clearSelection();
27153500 //objEditor.ResetSliders();
27163501 refreshContents(true);
27173502 } else
2718
- if (event.getSource() == clearPanelButton)
3503
+ if (source == clearPanelButton)
27193504 {
27203505 assert(copy == group);
27213506 //copy.ClearUI();
27223507 for (Object3D obj : listUI)
27233508 {
3509
+ obj.pinned = false;
27243510 obj.CloseUI();
27253511 }
27263512 listUI.clear();
27273513 refreshContents(true);
27283514 } else
2729
- if (event.getSource() == allParamsButton)
3515
+ if (source == allParamsButton)
27303516 {
27313517 assert(copy == group);
27323518
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343520
27353521 for (Object3D obj : listUI)
27363522 {
....@@ -2747,19 +3533,19 @@
27473533
27483534 refreshContents(true);
27493535 } else
2750
- if (event.getSource() == unselectButton)
3536
+ if (source == unselectButton)
27513537 {
27523538 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3539
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543540 objEditor.ResetSliders();
27553541 refreshContents(true);
27563542 } else
2757
- if(event.getSource() instanceof cRadio)
3543
+ if(source instanceof cRadio)
27583544 {
27593545 group.parent = keepparent;
27603546 group.attributes = 0;
27613547 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3548
+ /*cRadio*/ radio = (cRadio)source;
27633549 Object3D obj = radio.GetObject();
27643550 System.out.println("Edit " + obj);
27653551 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3565,10 @@
27793565 }
27803566
27813567 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3568
+
3569
+ SetUndoStates();
3570
+
3571
+ //Globals.theRenderer.object = group;
27833572 if(!useclient)
27843573 {
27853574 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3577,52 @@
27883577 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893578 cameraView.targetLookAt.set(radio.camera.lookAt);
27903579 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3580
+ //cameraView.lighttouched = true;
3581
+ Globals.lighttouched = true;
27923582 topView.object = group;
27933583 frontView.object = group;
27943584 sideView.object = group;
27953585 }
2796
- group.editWindow = this;
3586
+
3587
+// fix "+" issue
3588
+ //group.editWindow = this;
3589
+ group.manipWindow = this;
3590
+
27973591 /*
27983592 currentLayout = radio.layout;
27993593 if (currentLayout == null)
28003594 currentLayout = sevenButton;
28013595 */
28023596 radio.layout.doClick();
3597
+
3598
+ ClearUnpinned();
3599
+ //Grafreed.Assert(group != null);
3600
+ //Grafreed.Assert(group.selection != null);
3601
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3602
+ if (group.selection == null || group.selection.size() == 1)
3603
+ EditSelection(false);
28033604 keepparent = group.parent;
28043605 // PARENT = NULL or not???
28053606 //group.parent = null; // ROOT
28063607 //group.attributes = -1;
28073608 ResetModel();
3609
+
3610
+ cameraView.requestFocusInWindow();
28083611 refreshContents(true);
2809
- }
3612
+ } else if (event.getSource() == editCameraItem)
3613
+ {
3614
+ cameraView.ProtectCamera();
3615
+ cameraView.repaint();
3616
+ return;
3617
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3618
+ {
3619
+ cameraView.RevertCamera();
3620
+ cameraView.repaint();
3621
+ return;
3622
+ // } else if (event.getSource() == textureButton)
3623
+ // {
3624
+ // return; // true;
3625
+ }
28103626 else
28113627 {
28123628 //return super.action(event, arg);
....@@ -2815,7 +3631,6 @@
28153631 }
28163632
28173633 boolean useclient = false;
2818
- cRadio radio;
28193634
28203635 void ToggleRoot()
28213636 {
....@@ -2824,7 +3639,7 @@
28243639 if (useclient)
28253640 {
28263641 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3642
+ Globals.lighttouched = true;
28283643 //topView.object = client;
28293644 //frontView.object = client;
28303645 //sideView.object = client;
....@@ -2832,7 +3647,7 @@
28323647 else
28333648 {
28343649 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3650
+ Globals.lighttouched = true;
28363651 //topView.object = group;
28373652 //frontView.object = group;
28383653 //sideView.object = group;
....@@ -2867,6 +3682,28 @@
28673682 refreshContents();
28683683 }
28693684
3685
+ void TransformChildren()
3686
+ {
3687
+ Object3D obj;
3688
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3689
+ {
3690
+ obj = (Object3D)e.nextElement();
3691
+ obj.KeepTextureMatrices();
3692
+ obj.TransformChildren();
3693
+ obj.RestoreTextureMatrices();
3694
+
3695
+// if (obj.parent == null)
3696
+// {
3697
+// System.out.println("NULL PARENT!");
3698
+// new Exception().printStackTrace();
3699
+// }
3700
+// else
3701
+// TouchTransform(obj);
3702
+// //obj.parent.Touch();
3703
+ }
3704
+
3705
+ refreshContents();
3706
+ }
28703707
28713708 void ResetTransform()
28723709 {
....@@ -2979,7 +3816,7 @@
29793816 refreshContents();
29803817 }
29813818
2982
- void ResetCentroid()
3819
+ void ResetCentroid(boolean full)
29833820 {
29843821 Object3D obj;
29853822 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3831,16 @@
29943831 LA.matIdentity(Object3D.mat);
29953832 obj.getBounds(minima, maxima, false);
29963833 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3834
+ if (full)
3835
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983836 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993837 obj.TransformMesh(Object3D.mat);
3838
+
30003839 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3840
+ if (full)
3841
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023842 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3843
+
30033844 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043845 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053846 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3869,8 @@
30283869
30293870 int size = obj.MemorySize();
30303871
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3872
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3873
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323874 }
30333875 }
30343876 catch (Exception e)
....@@ -3065,9 +3907,9 @@
30653907 obj = (Object3D)e.nextElement();
30663908
30673909 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3910
+ Grafreed.AnalyzeObject(obj);
30693911 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3912
+ Grafreed.AnalyzeObject(obj.bRep);
30713913
30723914 // System.err.println((size/1024) + " KB is the size of " + obj);
30733915 }
....@@ -3109,6 +3951,20 @@
31093951 void GenNormals(boolean crease)
31103952 {
31113953 group.GenNormalsS(crease);
3954
+
3955
+ refreshContents();
3956
+ }
3957
+
3958
+ void GenNormalsMESH()
3959
+ {
3960
+ group.GenNormalsMeshS();
3961
+
3962
+ refreshContents();
3963
+ }
3964
+
3965
+ void GenNormalsMINE()
3966
+ {
3967
+ group.selection.GenNormalsMINE();
31123968
31133969 refreshContents();
31143970 }
....@@ -3157,104 +4013,259 @@
31574013
31584014 //Object3D buffer;
31594015 cVector temp = new cVector();
3160
- BoundaryRep temprep;
3161
- Object3D nodes;
3162
- Vector<Vertex> vertices;
3163
-
3164
- public void Vertex(Object3D node, Vertex v)
3165
- {
3166
- vertices.add(v);
3167
- nodes.addElement(node);
3168
-
3169
- if (temprep.GetCache(v) != null)
3170
- {
3171
- temprep.Remove(v);
3172
- }
3173
- else
3174
- {
3175
- temprep.Remember(v);
3176
- }
3177
- }
3178
-
3179
- public void Face(Object3D node, Face f)
3180
- {
3181
-
3182
- }
3183
-
4016
+// BoundaryRep temprep;
4017
+// Object3D nodes;
4018
+// Vector<Vertex> vertices;
4019
+//
4020
+// cGroup buffer;
4021
+//
4022
+// public void Vertex(Object3D node, Vertex v)
4023
+// {
4024
+//// vertices.add(v);
4025
+//// nodes.addElement(node);
4026
+////
4027
+//// if (temprep.GetCache(v) != null)
4028
+//// {
4029
+//// temprep.Remove(v);
4030
+//// } else
4031
+//// {
4032
+//// temprep.Remember(v);
4033
+//// }
4034
+//
4035
+// //Object3D node = nodes.get(index);
4036
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4037
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4038
+//
4039
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4040
+//
4041
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4042
+//
4043
+// cGroup g = new cGroup();
4044
+//
4045
+// if (g.toParent == null)
4046
+// {
4047
+// g.toParent = LA.newMatrix();
4048
+// g.fromParent = LA.newMatrix();
4049
+// }
4050
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4051
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4052
+//
4053
+// g.add(GrafreeD.clipboard);
4054
+//
4055
+// buffer.add(g);
4056
+// }
4057
+//
4058
+// public void Face(Object3D node, Face f)
4059
+// {
4060
+//
4061
+// }
4062
+//
4063
+// void ParseVerticesOld() // ??
4064
+// {
4065
+// //if (group.selection.size() != 1)
4066
+// // return;
4067
+//
4068
+// temprep = new BoundaryRep();
4069
+// nodes = new Object3D();
4070
+// vertices = new Vector<Vertex>();
4071
+//
4072
+// boolean epsequal = GrafreeD.epsequal;
4073
+// GrafreeD.epsequal = true;
4074
+//
4075
+// for (int i=0; i<group.selection.size(); i++)
4076
+// {
4077
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4078
+//
4079
+// group.selection.get(i).Parse(
4080
+//this );
4081
+//
4082
+// int repsize = temprep.VertexCount();
4083
+// int tablesize = temprep.vertextable.size();
4084
+// int nodesize = nodes.size();
4085
+//
4086
+// assert(vertices.size() == nodes.size());
4087
+//
4088
+// temprep.vertextable.elements();
4089
+//
4090
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4091
+//
4092
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4093
+// {
4094
+// cGroup g = new cGroup();
4095
+//
4096
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4097
+//
4098
+// Object3D node = nodes.get(index);
4099
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4100
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4101
+//
4102
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4103
+//
4104
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4105
+//
4106
+// if (g.toParent == null)
4107
+// {
4108
+// g.toParent = LA.newMatrix();
4109
+// g.fromParent = LA.newMatrix();
4110
+// }
4111
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4112
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4113
+//
4114
+// g.add(GrafreeD.clipboard);
4115
+//
4116
+// buffer.add(g);
4117
+// }
4118
+//
4119
+// makeSomething(buffer, i==group.selection.size()-1);
4120
+// }
4121
+//
4122
+// GrafreeD.epsequal = epsequal;
4123
+//
4124
+// //buffer = null;
4125
+// temprep = null;
4126
+// nodes = null;
4127
+//
4128
+// refreshContents();
4129
+// }
4130
+
31844131 void ParseVertices()
31854132 {
3186
- //if (group.selection.size() != 1)
3187
- // return;
3188
-
3189
- temprep = new BoundaryRep();
3190
- nodes = new Object3D();
3191
- vertices = new Vector<Vertex>();
3192
-
3193
- boolean epsequal = GraphreeD.epsequal;
3194
- GraphreeD.epsequal = true;
4133
+ boolean epsequal = Grafreed.epsequal;
4134
+ Grafreed.epsequal = true;
31954135
31964136 for (int i=0; i<group.selection.size(); i++)
31974137 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4138
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994139
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4140
+ group.selection.get(i).Parse(
4141
+
4142
+ new iParse()
4143
+ {
4144
+ public void Vertex(Object3D node, Vertex v)
4145
+ {
4146
+ temp.set(v);
4147
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054148
3206
- assert(vertices.size() == nodes.size());
3207
-
3208
- temprep.vertextable.elements();
3209
-
3210
- java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4149
+ cGroup g = new cGroup();
32114150
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4151
+ if (g.toParent == null)
4152
+ {
4153
+ g.toParent = LA.newMatrix();
4154
+ g.fromParent = LA.newMatrix();
4155
+ }
4156
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4157
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154158
3216
- int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3217
- Object3D node = nodes.get(index);
3218
- temp.set(vertices.get(index)); // temprep.GetVertex(k));
3219
- // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4159
+ g.add(Grafreed.clipboard);
32204160
3221
- LA.xformPos(temp, node.GlobalTransformInv(), temp);
3222
-
3223
- // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3224
-
3225
- if (g.toParent == null)
3226
- {
3227
- g.toParent = LA.newMatrix();
3228
- g.fromParent = LA.newMatrix();
3229
- }
3230
- LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3231
- LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4161
+ buffer.add(g);
4162
+ }
32324163
3233
- g.add(GraphreeD.clipboard);
4164
+ public void Face(Object3D node, Face f)
4165
+ {
32344166
3235
- buffer.add(g);
3236
- }
4167
+ }
4168
+ }
4169
+ );
32374170
32384171 makeSomething(buffer, i==group.selection.size()-1);
32394172 }
32404173
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4174
+ Grafreed.epsequal = epsequal;
32464175
32474176 refreshContents();
32484177 }
3249
-
4178
+
4179
+ void TextureVertices()
4180
+ {
4181
+ for (int i=0; i<group.selection.size(); i++)
4182
+ {
4183
+ group.selection.get(i).Parse(
4184
+ new iParse()
4185
+ {
4186
+ public void Vertex(Object3D node, Vertex v)
4187
+ {
4188
+ cTexture tex = node.GetTextures();
4189
+ String pigment = Object3D.GetPigment(tex);
4190
+ //String bump = Object3D.GetBump(tex);
4191
+
4192
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4193
+
4194
+ try
4195
+ {
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4197
+ }
4198
+ catch (Exception e)
4199
+ {
4200
+ System.err.println("FAIL: " + node);
4201
+ }
4202
+
4203
+ double s = v.s;
4204
+
4205
+ if (s == 1)
4206
+ s = 0;
4207
+
4208
+ double t = v.t;
4209
+
4210
+ if (t == 1)
4211
+ t = 0;
4212
+
4213
+ int indexs = (int) (texturedata.getWidth() * s);
4214
+ int indext = (int) (texturedata.getHeight() * t);
4215
+
4216
+ int index = indext * texturedata.getWidth() + indexs;
4217
+
4218
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4219
+
4220
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4221
+
4222
+ float scale = bytebuf.get(index*slide) & 0xFF;
4223
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4224
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4225
+ scale /= 3;
4226
+
4227
+ scale /= 0xFF;
4228
+ // c'est quoi ca? scale /= 4;
4229
+
4230
+ //v.AO = scale;
4231
+
4232
+ v.x += v.norm.x * scale;
4233
+ v.y += v.norm.y * scale;
4234
+ v.z += v.norm.z * scale;
4235
+ }
4236
+
4237
+ public void Face(Object3D node, Face f)
4238
+ {
4239
+ }
4240
+ }
4241
+ );
4242
+ }
4243
+
4244
+ refreshContents();
4245
+ }
4246
+
32504247 void Align()
32514248 {
4249
+ if (group.selection.size() == 0)
4250
+ return;
4251
+
4252
+ cVector bbmin = new cVector();
4253
+ cVector bbmax = new cVector();
4254
+
4255
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4256
+
4257
+ double dx = bbmax.x - bbmin.x;
4258
+ double dy = bbmax.y - bbmin.y;
4259
+ double dz = bbmax.z - bbmin.z;
4260
+
4261
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4262
+
32524263 for (int i=0; i<group.selection.size(); i++)
32534264 {
32544265 Object3D obj = group.selection.get(i);
32554266
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4267
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4268
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584269 }
32594270
32604271 refreshContents();
....@@ -3267,7 +4278,7 @@
32674278 // ref.SaveSupports();
32684279 // Object3D par = ref.parent;
32694280 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4281
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714282 // ref.parent = par;
32724283 // ref.RestoreSupports();
32734284
....@@ -3275,11 +4286,11 @@
32754286
32764287 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774288
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4289
+ boolean random = CameraPane.SWITCH;
4290
+ CameraPane.SWITCH = false; // parse all random nodes
32804291 lowres.linkVerticesThis(null);
32814292 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4293
+ CameraPane.SWITCH = random;
32834294
32844295 System.err.flush();
32854296
....@@ -3297,7 +4308,7 @@
32974308 // lowres.SaveSupports();
32984309 // par = lowres.parent;
32994310 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4311
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014312 Object3D newlow = CloneObject(lowres, false);
33024313 newlow.name = sn.switchobject.get(i).name;
33034314 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4330,7 @@
33194330 return;
33204331
33214332 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4333
+ Object3D ref = Grafreed.clipboard.get(0);
33234334
33244335 Object3D newgroup = new Object3D("Po:" + poses.name);
33254336
....@@ -3488,7 +4499,7 @@
34884499 group.selection.RelinkToSupport(); // july 2014
34894500 System.out.println("DONE.");
34904501 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4502
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924503 }
34934504
34944505 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4524,20 @@
35134524
35144525 void ClipMesh()
35154526 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4527
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174528 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4529
+ Object3D content = Grafreed.clipboard.get(0);
35194530
35204531 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214532 content = ((cGroup)content).get(0);
35224533
35234534 // for (int i=0; i<group.selection.size(); i++)
35244535 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4536
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264537 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4538
+ group.selection.ClipMesh(Grafreed.clipboard);
35284539 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4540
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304541 System.out.println("DONE.");
35314542 refreshContents();
35324543 }
....@@ -3571,6 +4582,18 @@
35714582 void MarkLeaves(boolean hide)
35724583 {
35734584 group.selection.MarkLeaves(hide);
4585
+ refreshContents();
4586
+ }
4587
+
4588
+ void RewindLeaves(boolean hide)
4589
+ {
4590
+ group.selection.RewindLeaves(hide);
4591
+ refreshContents();
4592
+ }
4593
+
4594
+ void RandomLeaves(boolean hide)
4595
+ {
4596
+ group.selection.RandomLeaves(hide);
35744597 refreshContents();
35754598 }
35764599
....@@ -3645,28 +4668,25 @@
36454668 // }
36464669 // }
36474670
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36524671 void EditSelection(boolean newWindow)
36534672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
36544679 // aConstraints.gridy = 0;
36554680 for (int i=0; i<group.selection.size(); i++)
36564681 {
36574682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36584683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604685
36614686 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4687
+ if(elem != group || !newWindow)
36634688 {
3664
- // if (!(elem instanceof Composite))
3665
- // newWindow = false;
3666
- listUI.add(elem);
3667
- elem.openEditWindow(this, newWindow); //, false);
3668
- System.out.println("edit : " + elem);
3669
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
36704690 }
36714691 }
36724692 }
....@@ -3741,7 +4761,8 @@
37414761 //new Exception().printStackTrace();
37424762
37434763 freezemodel = true;
3744
-
4764
+ ClearUnpinned();
4765
+
37454766 /**/
37464767 //switch (event.id)
37474768 {
....@@ -3749,7 +4770,6 @@
37494770 //case 702: // Event.LIST_DESELECT
37504771 group.deselectAll();
37514772 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534773 if (tps != null)
37544774 {
37554775 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +4778,39 @@
37584778
37594779 //if (child.parent != null)
37604780 //child.parent.addSelectee(child);
4781
+ objEditor.SetMaterial(child);
37614782 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654783 }
37664784 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4785
+// else
4786
+// {
4787
+// objEditor.SetMaterial(group); // .GetMaterial());
4788
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4789
+// System.err.println("info : " + group.GetPath());
4790
+// }
37734791
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4792
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774793 CameraPane.flash = true;
37784794
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4795
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804796 // a camera
37814797 {
3782
- CameraPane.camerachangeframe = 0; // don't refuse it
3783
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3784
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3785
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4798
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4799
+ {
4800
+ CameraPane.camerachangeframe = 0; // don't refuse it
4801
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4802
+ }
4803
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4804
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864805 }
37874806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
37884814 refreshContents();
37894815 //return true;
37904816 }
....@@ -3793,6 +4819,35 @@
37934819
37944820 freezemodel = false;
37954821 }
4822
+
4823
+ void SetPinStates(boolean enabled)
4824
+ {
4825
+ editButton.setEnabled(enabled);
4826
+ uneditButton.setEnabled(enabled);
4827
+ unselectButton.setEnabled(enabled);
4828
+ flashSelectionButton.setEnabled(enabled);
4829
+ }
4830
+
4831
+ void refreshContents(boolean cp)
4832
+ {
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4834
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4835
+ {
4836
+ objEditor.ClearInfo(); // .GetMaterial());
4837
+
4838
+ for (int i=0; i < group.selection.Size(); i++)
4839
+ {
4840
+ Object3D child = (Object3D) group.selection.get(i);
4841
+
4842
+ objEditor.AddInfo(child, this, true);
4843
+ System.err.println("info : " + child.GetPath());
4844
+ }
4845
+
4846
+ objEditor.SetText(); // jan 2014
4847
+ }
4848
+
4849
+ super.refreshContents(cp);
4850
+ }
37964851
37974852 void linkSomething(Object3D thing)
37984853 {
....@@ -3864,16 +4919,19 @@
38644919 {
38654920 if (group.selection.isEmpty())
38664921 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4922
+
4923
+ Grafreed.clipboardIsTempGroup = false;
38684924 Composite tGroup = null;
38694925 if (group.selection.size() > 0) // 1)
38704926 {
38714927 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4928
+ Grafreed.clipboardIsTempGroup = true;
38734929 }
38744930
38754931 if (cut)
38764932 {
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
38774935 //int indices[] = jList.getSelectedIndices();
38784936 //for (int i = indices.length - 1; i >= 0; i--)
38794937 //jList.remove(indices[i]);
....@@ -3909,16 +4967,16 @@
39094967 //System.out.println("cut " + child);
39104968 //System.out.println("parent = " + child.parent);
39114969 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4970
+ if (Grafreed.clipboardIsTempGroup)
39134971 tGroup.add/*Child*/(tmp);
39144972 else
3915
- GraphreeD.clipboard = tmp;
4973
+ Grafreed.clipboard = tmp;
39164974 }
39174975 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4976
+ if (Grafreed.clipboardIsTempGroup)
39194977 tGroup.add/*Child*/(child);
39204978 else
3921
- GraphreeD.clipboard = child;
4979
+ Grafreed.clipboard = child;
39224980 }
39234981
39244982 //ResetModel();
....@@ -3950,21 +5008,23 @@
39505008 //System.out.println("cut " + elem);
39515009 //System.out.println("parent = " + elem.parent);
39525010 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5011
+ if (Grafreed.clipboardIsTempGroup)
39545012 tGroup.add/*Child*/(tmp);
39555013 else
3956
- GraphreeD.clipboard = tmp;
5014
+ Grafreed.clipboard = tmp;
39575015 }
39585016 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5017
+ if (Grafreed.clipboardIsTempGroup)
39605018 tGroup.add/*Child*/(child);
39615019 else
3962
- GraphreeD.clipboard = child;
5020
+ Grafreed.clipboard = child;
39635021 }
39645022
39655023 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5024
+
5025
+ if (Grafreed.clipboardIsTempGroup)
5026
+ Grafreed.clipboard = tGroup;
5027
+
39685028 if (cut)
39695029 {
39705030 ResetModel();
....@@ -3974,11 +5034,15 @@
39745034
39755035 void paste(boolean expand)
39765036 {
3977
- // if (GraphreeD.clipboard == null)
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
5041
+ // if (GrafreeD.clipboard == null)
39785042 // return;
39795043 boolean first = true;
39805044
3981
- if (GraphreeD.clipboardIsTempGroup)
5045
+ if (Grafreed.clipboardIsTempGroup)
39825046 {
39835047 Composite temp;
39845048
....@@ -3989,7 +5053,7 @@
39895053 temp = (Composite)Applet3D.clipboard.deepCopy();
39905054 */
39915055 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5056
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935057 {
39945058 Object3D child = (Object3D)e.nextElement();
39955059
....@@ -4003,7 +5067,7 @@
40035067 else
40045068 elem = child.deepCopy(); // ?
40055069 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5070
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075071 // elem = elem.get(0);
40085072 makeSomething(elem, true); // ?? first);
40095073 //group.addChild(elem);
....@@ -4023,23 +5087,24 @@
40235087 //Object3D cb = Applet3D.clipboard;
40245088 //temp.addChild(cb);
40255089 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4026
- assert(GraphreeD.clipboard.parent == null);
4027
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4028
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4029
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4030
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
5090
+ assert(Grafreed.clipboard.parent == null);
5091
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5092
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5093
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5094
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315095 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5096
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5097
+ Grafreed.clipboard.get(0).parent = keepparent;
40345098 }
40355099
5100
+ Globals.REPLACEONMAKE = keep;
40365101 ResetModel();
40375102 refreshContents();
40385103 }
40395104
4040
- void pasteInto(boolean copyit)
5105
+ void pasteInto(boolean copyit, boolean clone)
40415106 {
4042
-// if (GraphreeD.clipboard == null)
5107
+// if (GrafreeD.clipboard == null)
40435108 // return;
40445109
40455110 if (group.selection.size() != 1)
....@@ -4066,15 +5131,22 @@
40665131 if (copyit)
40675132 {
40685133 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5134
+ if (clone)
5135
+ {
5136
+ CloneClipboard(false); // sept 2014
5137
+ }
5138
+ else
5139
+ {
5140
+ paste(false);
5141
+ }
40705142 }
40715143 else
40725144 {
40735145 boolean first = true;
40745146
4075
- if (GraphreeD.clipboardIsTempGroup)
5147
+ if (Grafreed.clipboardIsTempGroup)
40765148 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5149
+ Composite temp = (Composite)Grafreed.clipboard;
40785150 Object3D copy;
40795151 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805152 {
....@@ -4084,7 +5156,7 @@
40845156 }
40855157 } else
40865158 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5159
+ linkSomething(Grafreed.clipboard); //.get(0));
40885160 }
40895161 }
40905162 }
....@@ -4161,6 +5233,10 @@
41615233
41625234 void group(Object3D csg, boolean grab)
41635235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
41645240 if (//false) // why??
41655241 !group.selection.isEmpty())
41665242 {
....@@ -4274,8 +5350,34 @@
42745350 //node.add(csg);
42755351 //makeSomething(node);
42765352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
42775354 }
42785355
5356
+ void Ungroup(Object3D g)
5357
+ {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
5362
+ if (g instanceof HiddenObject)
5363
+ {
5364
+ HiddenObject h = (HiddenObject) g;
5365
+
5366
+ for (int i=0; i<h.ActualSize(); i++)
5367
+ {
5368
+ objEditor.makeSomething(h.get(i), false);
5369
+ }
5370
+ }
5371
+ else
5372
+ {
5373
+ for (int i=0; i<g.Size(); i++)
5374
+ {
5375
+ objEditor.makeSomething(g.get(i), false);
5376
+ }
5377
+ }
5378
+ Globals.REPLACEONMAKE = keep;
5379
+ }
5380
+
42795381 void ungroup()
42805382 {
42815383 /*
....@@ -4469,21 +5571,6 @@
44695571 }
44705572 */
44715573
4472
- void ImportGFD()
4473
- {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4475
- browser.show();
4476
- String filename = browser.getFile();
4477
- if (filename != null && filename.length() > 0)
4478
- {
4479
- String fullname = browser.getDirectory() + filename;
4480
-
4481
- //Object3D readobj =
4482
- objEditor.ReadGFD(fullname, objEditor);
4483
- //makeSomething(readobj);
4484
- }
4485
- }
4486
-
44875574 /*
44885575 public void Callback(Object obj)
44895576 {
....@@ -4507,26 +5594,9 @@
45075594 }
45085595 */
45095596
4510
- void ImportVRMLX3D()
4511
- {
4512
- if (GraphreeD.standAlone)
4513
- {
4514
- /**/
4515
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4516
- browser.show();
4517
- String filename = browser.getFile();
4518
- if (filename != null && filename.length() > 0)
4519
- {
4520
- String fullname = browser.getDirectory() + filename;
4521
- LoadVRMLX3D(fullname);
4522
- }
4523
- /**/
4524
- }
4525
- }
4526
-
45275597 String GetFile(String dialogName)
45285598 {
4529
- if (GraphreeD.standAlone)
5599
+ if (Grafreed.standAlone)
45305600 {
45315601 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325602 browser.show();
....@@ -4590,10 +5660,33 @@
45905660 cButton flashSelectionButton;
45915661 cButton editButton;
45925662 cButton uneditButton;
5663
+ JCheckBox allParamsButton;
45935664 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955665 cButton unselectButton;
45965666
5667
+ cButton restoreCameraButton;
5668
+
5669
+ cButton saveButton;
5670
+ cButton oneStepButton;
5671
+
5672
+ cButton groupButton;
5673
+ cButton ungroupButton;
5674
+ cButton compositeButton;
5675
+ cButton switchButton;
5676
+ cButton loopButton;
5677
+ cButton textureButton;
5678
+
5679
+ cButton gridButton;
5680
+ cButton boxButton;
5681
+ cButton sphereButton;
5682
+ cButton coneButton;
5683
+ cButton torusButton;
5684
+ cButton superButton;
5685
+ cButton kleinButton;
5686
+ cButton particlesButton;
5687
+ cButton overlayButton;
5688
+ cButton lightButton;
5689
+
45975690 cButton screenfitButton;
45985691 cButton screenfitpointButton;
45995692 cButton snapobjectButton;
....@@ -4605,14 +5698,6 @@
46055698
46065699 cButton setsupportButton;
46075700
4608
- cButton twoButton;
4609
- cButton sixButton;
4610
- cButton threeButton;
4611
- cButton sevenButton;
4612
- cButton fourButton; // full panel
4613
- cButton oneButton; // full XYZ
4614
- //cButton currentLayout;
4615
-
46165701 //
46175702 //Composite
46185703 Object3D // to do !!
....@@ -4622,9 +5707,11 @@
46225707 //JTree jTree;
46235708 private MenuItem lookAtItem;
46245709 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
46265711 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
5712
+ private MenuItem undoItem;
5713
+ private MenuItem redoItem;
5714
+ private JMenuItem duplicateItem;
46285715 private MenuItem cloneItem;
46295716 private MenuItem cloneSupportItem;
46305717 private MenuItem overwriteGeoItem;
....@@ -4635,8 +5722,9 @@
46355722 private MenuItem resetsupportItem;
46365723 private MenuItem resetreferencesItem;
46375724 private MenuItem linkverticesItem;
5725
+ private MenuItem relinkverticesItem;
46385726 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5727
+ private MenuItem resetAllItem;
46405728 private MenuItem stepAllItem;
46415729 private MenuItem revertMeshItem;
46425730 private MenuItem poseMeshItem;
....@@ -4647,14 +5735,17 @@
46475735 private MenuItem mergeGeometriesItem;
46485736 private MenuItem copyItem;
46495737 private MenuItem pasteItem;
5738
+ private MenuItem pasteIntoItem;
46505739 private MenuItem pasteLinkItem;
46515740 private MenuItem pasteCloneItem;
46525741 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
46545743 private MenuItem clearAllItem;
46555744 private MenuItem genUVItem;
5745
+ private MenuItem genNormalsMESHItem;
46565746 private MenuItem genNormalsCADItem;
46575747 private MenuItem genNormalsORGANItem;
5748
+ private MenuItem genNormalsMINEItem;
46585749 private MenuItem stripifyItem;
46595750 private MenuItem unstripifyItem;
46605751 private MenuItem trimItem;
....@@ -4683,6 +5774,10 @@
46835774 private MenuItem showleavesItem;
46845775 private MenuItem markleavesItem;
46855776 private MenuItem unmarkleavesItem;
5777
+ private MenuItem rewindleavesItem;
5778
+ private MenuItem unrewindleavesItem;
5779
+ private MenuItem randomleavesItem;
5780
+ private MenuItem unrandomleavesItem;
46865781
46875782 private MenuItem flipVItem;
46885783 private MenuItem unflipVItem;
....@@ -4694,14 +5789,17 @@
46945789 private MenuItem panoTexturesItem;
46955790
46965791 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5792
+ private MenuItem resetCentroidXZItem;
46985793 private MenuItem resetTransformItem;
5794
+ private MenuItem transformGeometryItem;
5795
+ private MenuItem transformChildrenItem;
5796
+ private MenuItem hideItem;
46995797 private MenuItem grabItem;
47005798 private MenuItem backItem;
47015799 private MenuItem frontItem;
47025800 private MenuItem cameraItem;
47035801 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
47055803 private MenuItem physicsItem;
47065804 private MenuItem frameselectorItem;
47075805 private MenuItem scriptNodeItem;
....@@ -4716,6 +5814,7 @@
47165814
47175815 private MenuItem resetParentItem;
47185816 private MenuItem repairParentItem;
5817
+ private MenuItem repairShadowItem;
47195818 private MenuItem sortbysizeItem;
47205819 private MenuItem sortbynameItem;
47215820
....@@ -4724,20 +5823,25 @@
47245823 private MenuItem attachBumpItem;
47255824 private MenuItem detachBumpItem;
47265825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
47275828
47285829 private MenuItem particleItem;
47295830 private MenuItem ragdollItem;
47305831 private MenuItem ragdoll2Item;
5832
+ private MenuItem heightFieldItem;
5833
+ private MenuItem textureFieldItem;
47315834 private MenuItem gridItem;
47325835 private MenuItem rectoidItem;
47335836 private MenuItem ellipsoidItem;
47345837 private MenuItem coneItem;
47355838 private MenuItem torusItem;
47365839 private MenuItem superItem;
5840
+ private MenuItem kleinItem;
47375841 private MenuItem blobItem;
47385842 private MenuItem latheItem;
47395843 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5844
+ private MenuItem overlayItem;
47415845 private MenuItem meshItem;
47425846 // private MenuItem meshGroupItem;
47435847 private MenuItem springItem;
....@@ -4746,6 +5850,7 @@
47465850 private MenuItem csgItem;
47475851 private MenuItem templateItem;
47485852 private MenuItem textureItem;
5853
+ private MenuItem billboardItem;
47495854 private MenuItem shadowXItem;
47505855 private MenuItem shadowYItem;
47515856 private MenuItem shadowZItem;
....@@ -4758,11 +5863,6 @@
47585863 private MenuItem doubleItem;
47595864 private MenuItem tripleItem;
47605865
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665866 private MenuItem computeAOItem;
47675867 private MenuItem recompileItem;
47685868 private MenuItem editScriptItem;
....@@ -4772,4 +5872,8 @@
47725872 private MenuItem analyzeItem;
47735873 private MenuItem dumpItem;
47745874 //boolean freezemodel = false;
5875
+
5876
+ Menu cameraMenu;
5877
+ MenuItem editCameraItem;
5878
+ MenuItem restoreCameraItem;
47755879 }