Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
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,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -83,7 +84,7 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
86
- // Object3D keep = GraphreeD.clipboard;
87
+ // Object3D keep = GrafreeD.clipboard;
8788 //Object3D obj;
8889 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8990 {
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
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));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105106 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -147,8 +148,129 @@
147148
148149 //JTextField nameField;
149150
150
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
151152 {
153
+ Menu menu;
154
+ oe.menuBar.add(menu = new Menu("Edit"));
155
+ //editItem = menu.add(new MenuItem("Edit"));
156
+ //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
163
+ duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+ duplicateItem.addActionListener(this);
165
+ cloneItem = menu.add(new MenuItem("Clone"));
166
+ cloneItem.addActionListener(this);
167
+ if (Globals.ADVANCED)
168
+ {
169
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
170
+ cloneSupportItem.addActionListener(this);
171
+ }
172
+ menu.add("-");
173
+ cutItem = menu.add(new MenuItem("Cut"));
174
+ cutItem.addActionListener(this);
175
+ copyItem = menu.add(new MenuItem("Copy"));
176
+ copyItem.addActionListener(this);
177
+ pasteItem = menu.add(new MenuItem("Paste"));
178
+ pasteItem.addActionListener(this);
179
+
180
+ menu.add("-");
181
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
182
+ pasteIntoItem.addActionListener(this);
183
+ pasteLinkItem = menu.add(new MenuItem("Paste link"));
184
+ pasteLinkItem.addActionListener(this);
185
+ pasteCloneItem = menu.add(new MenuItem("Paste clone"));
186
+ pasteCloneItem.addActionListener(this);
187
+// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188
+// pasteExpandItem.addActionListener(this);
189
+ menu.add("-");
190
+ clearItem = menu.add(new MenuItem("Clear"));
191
+ clearItem.addActionListener(this);
192
+
193
+ if (Globals.ADVANCED)
194
+ {
195
+ // Deletes the cameras...
196
+ clearAllItem = menu.add(new MenuItem("Clear All"));
197
+ clearAllItem.addActionListener(this);
198
+ }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
213
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
+ toggleTextureItem.addItemListener(this);
215
+ toggleTextureItem.setState(CameraPane.textureon);
216
+
217
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
+ toggleSwitchItem.addItemListener(this);
219
+ toggleSwitchItem.setState(CameraPane.SWITCH);
220
+
221
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
235
+
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
152274 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153275 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154276 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,44 +282,17 @@
160282 lookAtItem.addActionListener(this);
161283 //lookFromItem.addActinoListener(this);
162284 //switchItem.addActionListener(this);
163
- Menu menu;
164
- oe.menuBar.add(menu = new Menu("Edit"));
165
- //editItem = menu.add(new MenuItem("Edit"));
166
- //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
168
- duplicateItem.addActionListener(this);
169
- menu.add("-");
170
- cloneItem = menu.add(new MenuItem("Clone"));
171
- cloneItem.addActionListener(this);
172
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173
- cloneSupportItem.addActionListener(this);
174
- menu.add("-");
175
- cutItem = menu.add(new MenuItem("Cut"));
176
- cutItem.addActionListener(this);
177
- copyItem = menu.add(new MenuItem("Copy"));
178
- copyItem.addActionListener(this);
179
- pasteItem = menu.add(new MenuItem("Paste"));
180
- pasteItem.addActionListener(this);
181
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
182
- pasteLinkItem.addActionListener(this);
183
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184
- pasteCloneItem.addActionListener(this);
185
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186
-// pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
189
- clearAllItem = menu.add(new MenuItem("Clear All"));
190
- 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);
285
+ }
286
+
287
+ oe.menuBar.add(menu = new Menu("Setting"));
288
+ if (Globals.ADVANCED)
289
+ {
196290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197291 revertMeshItem.addActionListener(this);
198292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199293 resetreferencesItem.addActionListener(this);
200294 menu.add("-");
295
+ }
201296 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202297 overwriteGeoItem.addActionListener(this);
203298 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +304,99 @@
209304 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210305 overwriteUVItem.addActionListener(this);
211306 menu.add("-");
307
+ if (Globals.ADVANCED)
308
+ {
212309 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213310 generateMeshItem.addActionListener(this);
214311 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215312 poseMeshItem.addActionListener(this);
216313 menu.add("-");
314
+ }
217315 resetsupportItem = menu.add(new MenuItem("Reset support"));
218316 resetsupportItem.addActionListener(this);
219317 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220318 linkverticesItem.addActionListener(this);
319
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
320
+ relinkverticesItem.addActionListener(this);
321
+
322
+ if (Globals.ADVANCED)
323
+ {
221324 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222325 setMasterItem.addActionListener(this);
326
+ }
223327
224
- oe.menuBar.add(menu = new Menu("Object"));
328
+ oe.menuBar.add(menu = new Menu("Group"));
225329 grabItem = menu.add(new MenuItem("Grab"));
226330 grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
229331 backItem = menu.add(new MenuItem("Back"));
230332 backItem.addActionListener(this);
333
+ frontItem = menu.add(new MenuItem("Front"));
334
+ frontItem.addActionListener(this);
231335 compositeItem = menu.add(new MenuItem("Composite"));
232336 compositeItem.addActionListener(this);
337
+ hideItem = menu.add(new MenuItem("Hidden Group"));
338
+ hideItem.addActionListener(this);
339
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
340
+ ungroupItem.addActionListener(this);
233341 menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
342
+ randomItem = menu.add(new MenuItem("Switch node"));
235343 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);
240344 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241345 switchGeoItem.addActionListener(this);
242346 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243347 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
348
+ morphItem = menu.add(new MenuItem("Morph Group"));
245349 morphItem.addActionListener(this);
350
+
351
+ if (Globals.ADVANCED)
352
+ {
353
+ menu.add("-");
354
+ physicsItem = menu.add(new MenuItem("Physics"));
355
+ physicsItem.addActionListener(this);
356
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
357
+ frameselectorItem.addActionListener(this);
246358 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247359 scriptNodeItem.addActionListener(this);
248360 cameraItem = menu.add(new MenuItem("Camera"));
249361 cameraItem.addActionListener(this);
250
- menu.add("-");
362
+ }
363
+
364
+ oe.menuBar.add(menu = new Menu("Object"));
251365 textureItem = menu.add(new MenuItem("Texture"));
252366 textureItem.addActionListener(this);
367
+ billboardItem = menu.add(new MenuItem("Billboard"));
368
+ billboardItem.addActionListener(this);
253369 csgItem = menu.add(new MenuItem("CSG"));
254370 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256372 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258374 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260376 shadowZItem.addActionListener(this);
377
+ if (Globals.ADVANCED)
378
+ {
379
+ menu.add("-");
261380 linkerItem = menu.add(new MenuItem("Linker"));
262381 linkerItem.addActionListener(this);
263
- templateItem = menu.add(new MenuItem("Template"));
264
- templateItem.addActionListener(this);
265382 attributeItem = menu.add(new MenuItem("Attribute"));
266383 attributeItem.addActionListener(this);
384
+ templateItem = menu.add(new MenuItem("Template"));
385
+ templateItem.addActionListener(this);
267386 pointflowItem = menu.add(new MenuItem("Point Flow"));
268387 pointflowItem.addActionListener(this);
388
+ }
269389 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272390 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273391 resetTransformItem.addActionListener(this);
274392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275393 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
394
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
395
+ resetCentroidXZItem.addActionListener(this);
396
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
397
+ transformGeometryItem.addActionListener(this);
398
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
399
+ transformChildrenItem.addActionListener(this);
278400
279401 oe.menuBar.add(menu = new Menu("Geometry"));
280402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +405,13 @@
283405 genNormalsORGANItem.addActionListener(this);
284406 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285407 genNormalsCADItem.addActionListener(this);
408
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
409
+ genNormalsMESHItem.addActionListener(this);
410
+ if (Globals.ADVANCED)
411
+ {
412
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
413
+ genNormalsMINEItem.addActionListener(this);
414
+ }
286415 stripifyItem = menu.add(new MenuItem("Stripify"));
287416 stripifyItem.addActionListener(this);
288417 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +421,6 @@
292421 untrimItem = menu.add(new MenuItem("Untrim"));
293422 untrimItem.addActionListener(this);
294423 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297424 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298425 clearColorsItem.addActionListener(this);
299426 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +433,34 @@
306433 reduce34MeshItem.addActionListener(this);
307434 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308435 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311436 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312437 clipMeshItem.addActionListener(this);
438
+
439
+ if (Globals.ADVANCED)
440
+ {
441
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
442
+ smoothMeshItem.addActionListener(this);
443
+ }
444
+
445
+ oe.menuBar.add(menu = new Menu("Attributes"));
446
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
447
+ clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
313452 menu.add("-");
314453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315454 liveleavesItem.addActionListener(this);
316455 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317456 unliveleavesItem.addActionListener(this);
457
+ if (Globals.ADVANCED)
458
+ {
318459 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319460 supportleavesItem.addActionListener(this);
320461 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321462 unsupportleavesItem.addActionListener(this);
463
+ }
322464 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323465 hideleavesItem.addActionListener(this);
324466 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +469,31 @@
327469 markleavesItem.addActionListener(this);
328470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
330480 menu.add("-");
331481 flipVItem = menu.add(new MenuItem("Flip V"));
332482 flipVItem.addActionListener(this);
333483 unflipVItem = menu.add(new MenuItem("Unflip V"));
334484 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
485
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336486 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
487
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338488 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
489
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340490 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
491
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342492 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
493
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344494 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
495
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346496 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);
356497
357498 oe.menuBar.add(menu = new Menu("Selection"));
358499 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,14 +511,41 @@
370511 sortbysizeItem.addActionListener(this);
371512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372513 sortbynameItem.addActionListener(this);
514
+ menu.add("-");
515
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
516
+ shareGeometriesItem.addActionListener(this);
517
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
518
+ mergeGeometriesItem.addActionListener(this);
519
+ if (Globals.ADVANCED)
520
+ {
521
+ // Pretty much the same as duplicate and clone.
522
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
523
+ extractGeometriesItem.addActionListener(this);
524
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
525
+ cloneGeometriesItem.addActionListener(this);
526
+ }
527
+
373528 oe.menuBar.add(menu = new Menu("Insert"));
374529 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
530
+
531
+ oe.menuBar.add(menu = new Menu("Tools"));
376532 buildToolsMenu(menu);
377533 }
378534
379535 void SetupUI2(ObjEditor oe)
380536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
381549 //new Exception().printStackTrace();
382550
383551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +574,120 @@
406574 oe.radioPanel.add(dummyButton);
407575 oe.buttonGroup.add(dummyButton);
408576 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
577
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
412578
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
414605 liveCB.addItemListener(this);
415606
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);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
+ fastCB.setToolTipText("Fast mode");
434609 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);
441
-
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);
610
+
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
+ trackCB.setToolTipText("Enable tracking");
476617 trackCB.addItemListener(this);
477618
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ screenfitButton.setToolTipText("Screen fit");
480621 screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
622
+
482623 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483624 // 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;
488625
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);
626
+ if (Globals.ADVANCED)
627
+ {
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ snapobjectButton.addActionListener(this);
630
+ snapobjectButton.setToolTipText("Snap Object");
631
+ }
632
+
633
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
495635 flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499636
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
637
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
+
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
+ twoButton.setToolTipText("Show center view only");
502641 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504643 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
644
+ fourButton.setToolTipText("Show left panel only");
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
+ sixButton.setToolTipText("2-column layout left");
506647 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ threeButton.setToolTipText("2-column layout right");
508650 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ sevenButton.setToolTipText("3-column layout");
510653 sevenButton.addActionListener(this);
511654 //
512655
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ rootButton.setToolTipText("Edit selection in new tab");
514658 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
659
+
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ closeButton.setToolTipText("Close tab");
517662 closeButton.addActionListener(this);
518663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519664 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521665
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ editButton.setToolTipText("Edit selection");
524668 editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
528669
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ uneditButton.setToolTipText("Unedit selection");
530672 uneditButton.addActionListener(this);
531673
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);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
+ allParamsButton.setToolTipText("Edit all params");
544676 allParamsButton.addActionListener(this);
545677
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);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ clearPanelButton.setToolTipText("Clear edit panel");
680
+ clearPanelButton.addActionListener(this);
681
+
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
683
+ unselectButton.setToolTipText("Unselect");
551684 unselectButton.addActionListener(this);
552685
686
+ editCommandsPanel.preferredHeight = 1;
687
+
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
690
+
553691 // oe.aConstraints.gridx += 1;
554692 // oe.aConstraints.weighty = 0;
555693 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +699,37 @@
561699 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562700 // gcButton.addActionListener(this);
563701
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;
702
+ cGridBag jSPPanel = new cGridBag();
703
+
704
+ JScrollPane jSP;
575705 //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);
706
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
577707 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
708
+
709
+ oe.treePanel.add(jSPPanel);
710
+ oe.treePanel.Return();
582711
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);
712
+ cGridBag copyOptionsPanel = new cGridBag();
713
+
714
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
+ colorCB.setToolTipText("Copy color when dropped");
587716 colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
717
+
718
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
+ materialCB.setToolTipText("Copy material when dropped");
590720 materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
721
+
722
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
+ textureCB.setToolTipText("Copy texture when dropped");
593724 textureCB.addItemListener(this);
594725
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
726
+ copyOptionsPanel.preferredHeight = 1;
727
+ oe.treePanel.add(copyOptionsPanel);
728
+ oe.treePanel.Return();
597729
730
+// mainPanel.setDividerLocation(0.5); //1.0);
731
+// mainPanel.setResizeWeight(0.5);
732
+
598733 //jList.addListSelectionListener(this);
599734 oe.jTree.addTreeSelectionListener(this);
600735 //jTree.setRootVisible(false);
....@@ -616,20 +751,115 @@
616751 radio.layout = sevenButton;
617752 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618753 }
754
+
755
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756
+ {
757
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758
+ boxCB.setToolTipText("Display bounding boxes");
759
+ boxCB.addItemListener(this);
760
+
761
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
763
+ zoomBoxCB.addItemListener(this);
764
+
765
+ if (true) // Globals.ADVANCED)
766
+ {
767
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
+ supportCB.setToolTipText("Enable rigging");
769
+ supportCB.addItemListener(this);
770
+
771
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772
+ // localCB.addItemListener(this);
773
+
774
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775
+ crowdCB.setToolTipText("Used for crowds");
776
+ crowdCB.addItemListener(this);
777
+
778
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
779
+ smoothCB.setToolTipText("Snapping delay");
780
+ smoothCB.addItemListener(this);
781
+
782
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
+ slowCB.setToolTipText("Smooth interpolation");
784
+ slowCB.addItemListener(this);
785
+
786
+// constraints.gridy += 1;
787
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788
+// speakerMocapCB.addItemListener(this);
789
+
790
+ if (false)
791
+ {
792
+ // handled in scripts
793
+ //constraints.gridy += 1;
794
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
795
+ speakerCameraCB.addItemListener(this);
796
+
797
+ //constraints.gridy += 1;
798
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
799
+ speakerFocusCB.addItemListener(this);
800
+
801
+ //constraints.gridy += 1;
802
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803
+ smoothfocusCB.addItemListener(this);
804
+ }
805
+
806
+//constraints.gridx += 1;
807
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808
+// debugCB.addItemListener(this);
809
+
810
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
812
+ oeilCB.addItemListener(this);
813
+
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
822
+ if (Globals.ADVANCED)
823
+ {
824
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
825
+ lookAtCB.setToolTipText("Look-at target");
826
+ lookAtCB.addItemListener(this);
827
+ }
828
+
829
+ }
830
+
831
+ cGridBag fill = new cGridBag();
832
+
833
+ fill.preferredHeight = 200;
834
+
835
+ panel.add(fill);
836
+
837
+ }
619838
620839 void EditObject(Object3D obj)
621840 {
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();
841
+ cRadio radioButton = new cRadio(obj.name);
842
+
843
+ // Patch to avoid bug with transparency.
844
+ radioButton.hadMaterial = obj.material != null;
845
+ if (!radioButton.hadMaterial)
846
+ {
847
+ obj.material = new cMaterial();
848
+ }
849
+
850
+ radioButton.SetObject(obj);
851
+ radioButton.layout = sevenButton;
852
+ radioButton.SetCamera(cameraView.renderCamera, false);
853
+ radioButton.addActionListener(this);
854
+ radioPanel.add(radioButton);
855
+ buttonGroup.add(radioButton);
856
+ radioButton.doClick();
630857 }
858
+
631859 void SetupViews(ObjEditor oe)
632860 {
861
+ theFrame = this;
862
+
633863 oe.SetupViews();
634864
635865 System.out.println("SetupViews");
....@@ -638,22 +868,26 @@
638868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
639869 }
640870
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;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
651882 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
886
+
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
657891
658892 // static int COLOR = 1;
659893 // static int MATERIAL = 2;
....@@ -661,9 +895,9 @@
661895
662896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
663897
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
667901
668902 public void itemStateChanged(ItemEvent e)
669903 {
....@@ -688,10 +922,10 @@
688922 dropAttributes |= Object3D.TEXTURE;
689923 else
690924 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
925
+ } else if(e.getSource() == liveCB)
693926 {
694927 cameraView.ToggleLive();
928
+ refreshContents(false);
695929 }
696930 else if(e.getSource() == supportCB)
697931 {
....@@ -727,6 +961,10 @@
727961 cameraView.repaint();
728962 // refreshContents();
729963 }
964
+ else if(e.getSource() == zoomBoxCB)
965
+ {
966
+ cameraView.ToggleZoomBoxMode();
967
+ }
730968 else if(e.getSource() == smoothfocusCB)
731969 {
732970 cameraView.ToggleSmoothFocus();
....@@ -751,6 +989,14 @@
751989 else if(e.getSource() == oeilCB)
752990 {
753991 cameraView.ToggleOeil();
992
+ }
993
+ else if(e.getSource() == shadowCB)
994
+ {
995
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
7541000 }
7551001 else if(e.getSource() == lookAtCB)
7561002 {
....@@ -840,7 +1086,9 @@
8401086 // objEditor.DropFile((java.io.File[]) object, true);
8411087 // return;
8421088 // }
843
- if (string.charAt(0) == '/')
1089
+
1090
+ // File path for Mac and Windows
1091
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441092 {
8451093 // file(s)
8461094 String[] names = string.split("\n");
....@@ -867,7 +1115,7 @@
8671115
8681116 flashIt = false;
8691117 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1118
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711119 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721120
8731121 if (group.selection.size() == 1)
....@@ -894,11 +1142,11 @@
8941142 {
8951143 loadClipboard(true);
8961144 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
1145
+ pasteInto(false, false);
8981146 } else {
8991147 loadClipboard(false);
9001148 objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
1149
+ pasteInto(false, false); // true); // ???
9021150 }
9031151 }
9041152 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1002,6 +1250,8 @@
10021250
10031251 void buildCreateMenu(Menu menu)
10041252 {
1253
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1254
+ //heightFieldItem.addActionListener(this);
10051255 gridItem = menu.add(new MenuItem("Grid"));
10061256 gridItem.addActionListener(this);
10071257 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,29 +1264,37 @@
10141264 torusItem.addActionListener(this);
10151265 superItem = menu.add(new MenuItem("Superellipsoid"));
10161266 superItem.addActionListener(this);
1267
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1268
+ kleinItem.addActionListener(this);
10171269 particleItem = menu.add(new MenuItem("Particle system"));
10181270 particleItem.addActionListener(this);
1271
+ if (Globals.ADVANCED)
1272
+ {
10191273 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201274 ragdollItem.addActionListener(this);
10211275 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221276 ragdoll2Item.addActionListener(this);
1277
+ }
10231278 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1279
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251280 meshItem.addActionListener(this);
10261281 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271282 // meshGroupItem.addActionListener(this);
1283
+ if (Globals.ADVANCED)
1284
+ {
10281285 springItem = menu.add(new MenuItem("Spring"));
10291286 springItem.addActionListener(this);
10301287 flagItem = menu.add(new MenuItem("Flag"));
10311288 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);
10361289 blobItem = menu.add(new MenuItem("Blob"));
10371290 blobItem.addActionListener(this);
10381291 latheItem = menu.add(new MenuItem("Lathe"));
10391292 latheItem.addActionListener(this);
1293
+ }
1294
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1295
+ bezierItem.addActionListener(this);
1296
+ overlayItem = menu.add(new MenuItem("Overlay"));
1297
+ overlayItem.addActionListener(this);
10401298 lightItem = menu.add(new MenuItem("Light"));
10411299 lightItem.addActionListener(this);
10421300 menu.add("-");
....@@ -1046,46 +1304,44 @@
10461304 loopItem.addActionListener(this);
10471305 doubleItem = menu.add(new MenuItem("Fork"));
10481306 doubleItem.addActionListener(this);
1307
+ if (Globals.ADVANCED)
1308
+ {
10491309 tripleItem = menu.add(new MenuItem("Trident"));
10501310 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);
1311
+ }
10601312 }
10611313
10621314 void buildToolsMenu(Menu menu)
10631315 {
10641316 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651317 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1318
+ animationItem.setState(Globals.ANIMATION);
10671319
10681320 menu.add("-");
10691321 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701322 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1323
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1324
+ textureFieldItem.addActionListener(this);
1325
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721326 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751327 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761328 reduceMorphItem.addActionListener(this);
10771329 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781330 reduce34MorphItem.addActionListener(this);
1079
-
1331
+ menu.add("-");
10801332 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811333 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831334
1335
+ if (Globals.ADVANCED)
1336
+ {
1337
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1338
+ mirrorItem.addActionListener(this);
1339
+ menu.add("-");
10841340 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851341 memoryItem.addActionListener(this);
10861342 menu.add(analyzeItem = new MenuItem("Analyze"));
10871343 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1344
+ menu.add(dumpItem = new MenuItem("Print"));
10891345 dumpItem.addActionListener(this);
10901346 // menu.add(pathItem = new MenuItem("From-to path"));
10911347 // pathItem.addActionListener(this);
....@@ -1094,6 +1350,8 @@
10941350 resetParentItem.addActionListener(this);
10951351 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961352 repairParentItem.addActionListener(this);
1353
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1354
+ repairShadowItem.addActionListener(this);
10971355 menu.add(invariantsItem = new MenuItem("Invariants"));
10981356 invariantsItem.addActionListener(this);
10991357 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1359,7 @@
11011359 menu.add("-");
11021360 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031361 editScriptItem.addActionListener(this);
1362
+ }
11041363 }
11051364
11061365 void ScreenFit()
....@@ -1223,6 +1482,7 @@
12231482 shadow.material = new cMaterial(obj.material);
12241483 shadow.material.diffuse = 0.0001f;
12251484 shadow.material.specular = 0.0001f;
1485
+ //shadow.projectedVertices[1].x = 300;
12261486
12271487 makeSomething(shadow);
12281488 }
....@@ -1429,9 +1689,9 @@
14291689
14301690 void Overwrite(int mask)
14311691 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1692
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331693 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1694
+ Object3D content = Grafreed.clipboard.get(0);
14351695
14361696 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371697 content = ((cGroup)content).get(0);
....@@ -1454,6 +1714,7 @@
14541714 //
14551715 public void actionPerformed(ActionEvent event) // , Object arg)
14561716 {
1717
+ Object source = event.getSource();
14571718 /*
14581719 if (event.getSource() == nameField)
14591720 {
....@@ -1465,11 +1726,11 @@
14651726 }
14661727 else
14671728 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1729
+ if (source == lookAtItem || source == lookFromItem)
14691730 {
14701731 ScreenFit();
14711732 } else
1472
- if (event.getSource() == switchItem)
1733
+ if (source == switchItem)
14731734 {
14741735 cVector v1 = new cVector();
14751736 cVector v2 = new cVector();
....@@ -1478,11 +1739,11 @@
14781739 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791740 objEditor.cameraView.repaint();
14801741 } else
1481
- if (event.getSource() == rectoidItem)
1742
+ if (source == rectoidItem)
14821743 {
14831744 makeSomething(new Box());
14841745 } else
1485
- if (event.getSource() == particleItem)
1746
+ if (source == particleItem)
14861747 {
14871748 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881749 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1764,9 @@
15031764 applyExample(particleGeom, "SMOKE");
15041765 makeSomething(particleGeom);
15051766 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1767
+ if (source == ragdollItem || source == ragdoll2Item)
15071768 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1769
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091770
15101771 ragdoll.toParent = LA.newMatrix();
15111772 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1782,71 @@
15211782 makeSomething(ragdoll);
15221783 //makeSomething(new VehicleDemo());
15231784 } else
1524
- if (event.getSource() == gridItem)
1785
+ /*
1786
+ */
1787
+ if (source == heightFieldItem)
1788
+ {
1789
+ Object3D obj = new Object3D();
1790
+
1791
+ obj.CreateMaterial();
1792
+ obj.bRep = new BoundaryRep();
1793
+
1794
+ obj.bRep.CreateMesh(new iHeightField()
1795
+ {
1796
+ public double f(double x, double y)
1797
+ {
1798
+ // The Mandelbrot set is represented by coloring
1799
+ // each point (x,y) according to the number of
1800
+ // iterations it takes before the while loop in
1801
+ // this method ends. For points that are actually
1802
+ // in the Mandelbrot set, or very close to it, the
1803
+ // count will reach the maximum value, 80. These
1804
+ // points will be colored purple. All other colors
1805
+ // represent points that are definitely NOT in the set.
1806
+ x -= 600;
1807
+ y -= 500;
1808
+ x /= 200;
1809
+ y /= 200;
1810
+ int count = 0;
1811
+ double zx = x;
1812
+ double zy = y;
1813
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1814
+ double new_zx = zx*zx - zy*zy + x;
1815
+ zy = 2*zx*zy + y;
1816
+ zx = new_zx;
1817
+ count++;
1818
+ }
1819
+ return count; // Math.sqrt(count);
1820
+ }
1821
+ }, 1000,1000);
1822
+
1823
+ makeSomething(obj);
1824
+ } else
1825
+ if (source == gridItem)
15251826 {
15261827 makeSomething(new Grid());
15271828 } else
1528
- if (event.getSource() == ellipsoidItem)
1829
+ if (source == ellipsoidItem)
15291830 {
15301831 makeSomething(new Sphere());
15311832 } else
1532
- if (event.getSource() == coneItem)
1833
+ if (source == coneItem)
15331834 {
15341835 makeSomething(new Cone());
15351836 } else
1536
- if (event.getSource() == torusItem)
1837
+ if (source == torusItem)
15371838 {
15381839 makeSomething(new Torus());
15391840 } else
1540
- if (event.getSource() == superItem)
1841
+ if (source == superItem)
15411842 {
15421843 makeSomething(new Superellipsoid());
15431844 } else
1544
- if (event.getSource() == blobItem)
1845
+ if (source == kleinItem)
1846
+ {
1847
+ makeSomething(new Klein());
1848
+ } else
1849
+ if (source == blobItem)
15451850 {
15461851 Blob blob = new Blob();
15471852 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1854,15 @@
15491854 //blob.retile();
15501855 makeSomething(blob);
15511856 } else
1552
- if (event.getSource() == latheItem)
1857
+ if (source == latheItem)
15531858 {
15541859 makeSomething(new Lathe());
15551860 } else
1556
- if (event.getSource() == bezierItem)
1861
+ if (source == bezierItem)
15571862 {
15581863 makeSomething(new BezierSurface());
15591864 } else
1560
- if (event.getSource() == checkerItem)
1865
+ if (source == overlayItem)
15611866 {
15621867 /*
15631868 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1875,9 @@
15701875 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711876 LA.matInvert(obj.toParent, obj.fromParent);
15721877 */
1573
- makeSomething(new CheckerIG());
1878
+ makeSomething(new Checker());
15741879 } else
1575
- if (event.getSource() == meshItem)
1880
+ if (source == meshItem)
15761881 {
15771882 Object3D itemtomake = new Object3D();
15781883 Object3D child;
....@@ -1593,35 +1898,35 @@
15931898 makeSomething(child);
15941899 }
15951900 } else
1596
- if (event.getSource() == springItem)
1901
+ if (source == springItem)
15971902 {
15981903 cSpring s = new cSpring();
15991904 s.setup();
16001905 makeSomething(s);
16011906 } else
1602
- if (event.getSource() == flagItem)
1907
+ if (source == flagItem)
16031908 {
16041909 cSpring s = new cFlag();
16051910 s.setup();
16061911 makeSomething(s);
16071912 } else
1608
- if (event.getSource() == lightItem)
1913
+ if (source == lightItem)
16091914 {
16101915 makeSomething(new Light());
16111916 } else
1612
- if (event.getSource() == csgItem)
1917
+ if (source == csgItem)
16131918 {
16141919 group(new CSG());
16151920 } else
1616
- if (event.getSource() == templateItem)
1921
+ if (source == templateItem)
16171922 {
16181923 group(new cTemplate());
16191924 } else
1620
- if (event.getSource() == attributeItem)
1925
+ if (source == attributeItem)
16211926 {
16221927 makeSomething(new Attribute());
16231928 } else
1624
- if (event.getSource() == pointflowItem)
1929
+ if (source == pointflowItem)
16251930 {
16261931 makeSomething(new PointFlow());
16271932 } else
....@@ -1633,7 +1938,7 @@
16331938 } else
16341939 */
16351940
1636
- if (event.getSource() == superLoopItem)
1941
+ if (source == superLoopItem)
16371942 {
16381943 Composite g = new cGroup();
16391944 for (int i=0; i<15; i++)
....@@ -1655,7 +1960,7 @@
16551960
16561961 group(g);
16571962 } else
1658
- if (event.getSource() == loopItem)
1963
+ if (source == loopItem)
16591964 {
16601965 Composite csg = new GroupLeaf();
16611966 csg.count = 5;
....@@ -1664,7 +1969,7 @@
16641969 csg.addChild(child);
16651970 child.addChild(csg);
16661971 } else
1667
- if (event.getSource() == doubleItem)
1972
+ if (source == doubleItem)
16681973 {
16691974 Composite csg = new GroupLeaf();
16701975 csg.count = 5;
....@@ -1676,7 +1981,7 @@
16761981 csg.addChild(child);
16771982 child.addChild(csg);
16781983 } else
1679
- if (event.getSource() == tripleItem)
1984
+ if (source == tripleItem)
16801985 {
16811986 Composite csg = new GroupLeaf();
16821987 csg.count = 4;
....@@ -1691,71 +1996,83 @@
16911996 csg.addChild(child);
16921997 child.addChild(csg);
16931998 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
1999
+ if (source == computeAOItem)
16962000 {
1697
- ImportGFD();
2001
+ Globals.drawMode = CameraPane.OCCLUSION;
2002
+ Globals.theRenderer.repaint();
16982003 } 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)
2004
+ if (source == recompileItem)
17172005 {
17182006 Recompile();
17192007 refreshContents();
17202008 } else
1721
- if (event.getSource() == editScriptItem)
2009
+ if (source == editScriptItem)
17222010 {
17232011 OpenDialog();
17242012 refreshContents();
17252013 } else
1726
- if (event.getSource() == invariantsItem)
2014
+ if (source == invariantsItem)
17272015 {
17282016 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2017
+ Grafreed.grafreeD.universe.invariants();
17302018 } else
1731
- if (event.getSource() == memoryItem)
2019
+ if (source == memoryItem)
17322020 {
17332021 //System.out.println("Invariants:");
17342022 PrintMemory();
17352023 } else
1736
- if (event.getSource() == pathItem)
2024
+ if (source == pathItem)
17372025 {
17382026 PrintPath();
17392027 } else
1740
- if (event.getSource() == analyzeItem)
2028
+ if (source == analyzeItem)
17412029 {
17422030 AnalyzeObject();
17432031 } else
1744
- if (event.getSource() == dumpItem)
2032
+ if (source == dumpItem)
17452033 {
17462034 DumpObject();
17472035 } else
1748
- if (event.getSource() == screenfitButton)
2036
+ if (source == minButton)
2037
+ {
2038
+ Minimize();
2039
+ } else
2040
+ if (source == maxButton)
2041
+ {
2042
+ Maximize();
2043
+ } else
2044
+ if (source == fullButton)
2045
+ {
2046
+ ToggleFullScreen();
2047
+ } else
2048
+ if (source == undoButton)
2049
+ {
2050
+ Undo();
2051
+ } else
2052
+ if (source == redoButton)
2053
+ {
2054
+ Redo();
2055
+ } else
2056
+ if (source == saveButton)
2057
+ {
2058
+ Save();
2059
+ } else
2060
+ if (source == oneStepButton)
2061
+ {
2062
+ Globals.ONESTEP = true;
2063
+ cameraView.repaint();
2064
+ } else
2065
+ if (source == screenfitButton)
17492066 {
17502067 //Reload(lastConverter, lastFilename, true);
17512068 ScreenFit();
17522069 } else
1753
- if (event.getSource() == screenfitpointButton)
2070
+ if (source == screenfitpointButton)
17542071 {
17552072 //Reload(lastConverter, lastFilename, true);
17562073 ScreenFitPoint();
17572074 } else
1758
- if (event.getSource() == snapobjectButton)
2075
+ if (source == snapobjectButton)
17592076 {
17602077 //Reload(lastConverter, lastFilename, true);
17612078 SnapObject();
....@@ -1766,13 +2083,13 @@
17662083 // Recompile();
17672084 // refreshContents();
17682085 // } else
1769
- if (event.getSource() == gcButton)
2086
+ if (source == gcButton)
17702087 {
17712088 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722089 System.gc();
17732090 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742091 } else
1775
- if (event.getSource() == editLeafItem)
2092
+ if (source == editLeafItem)
17762093 {
17772094 Object3D obj;
17782095 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2103,78 @@
17862103 }
17872104 refreshContents(true);
17882105 } else
1789
- if (event.getSource() == openWindowItem)
2106
+ if (source == openWindowItem)
17902107 {
17912108 EditSelection(true);
17922109 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2110
+ if (source == cutItem || source == clearButton)
17942111 {
17952112 loadClipboard(true);
17962113 } else
1797
- if (event.getSource() == duplicateItem)
2114
+ if (source == undoItem)
17982115 {
1799
- Object3D keep = GraphreeD.clipboard;
2116
+ Undo();
2117
+ } else
2118
+ if (source == redoItem)
2119
+ {
2120
+ Redo();
2121
+ } else
2122
+ if (source == duplicateItem)
2123
+ {
2124
+ Object3D keep = Grafreed.clipboard;
18002125 loadClipboard(false);
18012126 paste(false);
1802
- GraphreeD.clipboard = keep;
2127
+ Grafreed.clipboard = keep;
18032128 } else
1804
- if (event.getSource() == cloneItem)
2129
+ if (source == cloneItem)
18052130 {
18062131 CloneSelection(false);
18072132 } else
1808
- if (event.getSource() == cloneSupportItem)
2133
+ if (source == cloneSupportItem)
18092134 {
18102135 CloneSelection(true);
18112136 } else
1812
- if (event.getSource() == copyItem)
2137
+ if (source == copyItem)
18132138 {
18142139 loadClipboard(false);
18152140 } else
1816
- if (event.getSource() == pasteItem)
2141
+ if (source == pasteItem)
18172142 {
18182143 paste(false);
18192144 } else
1820
- if (event.getSource() == pasteLinkItem)
2145
+ if (source == pasteIntoItem)
18212146 {
1822
- pasteInto(false);
2147
+ pasteInto(true, false);
18232148 } else
1824
- if (event.getSource() == pasteCloneItem)
2149
+ if (source == pasteLinkItem)
18252150 {
1826
- pasteInto(true);
2151
+ pasteInto(false, false);
18272152 } else
1828
- if (event.getSource() == pasteExpandItem)
2153
+ if (source == pasteCloneItem)
2154
+ {
2155
+ pasteInto(true, true);
2156
+ } else
2157
+ if (source == pasteExpandItem)
18292158 {
18302159 paste(true);
18312160 } else
1832
- if (event.getSource() == synchronizeItem)
2161
+ if (source == synchronizeItem)
18332162 {
18342163 Overwrite(Object3D.TRANSFORM);
18352164 } else
1836
- if (event.getSource() == overwriteNameItem)
2165
+ if (source == overwriteNameItem)
18372166 {
18382167 Overwrite(Object3D.NAME);
18392168 } else
1840
- if (event.getSource() == overwriteUVItem)
2169
+ if (source == overwriteUVItem)
18412170 {
18422171 Overwrite(Object3D.UV);
18432172 } else
1844
- if (event.getSource() == overwriteMatItem)
2173
+ if (source == overwriteMatItem)
18452174 {
2175
+ /* july 2015
18462176 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2177
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482178 else
18492179 {
18502180 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2186,16 @@
18562186 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572187 }
18582188 }
2189
+ */
2190
+
2191
+ Overwrite(dropAttributes);
18592192 }
1860
- if (event.getSource() == overwriteGeoItem)
2193
+ if (source == overwriteGeoItem)
18612194 {
18622195 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2196
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642197 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2198
+// Object3D content = GrafreeD.clipboard.get(0);
18662199 //
18672200 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682201 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2207,7 @@
18742207 // refreshContents();
18752208 // }
18762209 } else
1877
- if (event.getSource() == generateMeshItem)
2210
+ if (source == generateMeshItem)
18782211 {
18792212 //if (group.selection.size() == 1)
18802213 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2218,7 @@
18852218 ResetModel();
18862219 refreshContents();
18872220 } else
1888
- if (event.getSource() == extractGeometriesItem)
2221
+ if (source == extractGeometriesItem)
18892222 {
18902223 boolean one = false;
18912224
....@@ -1912,7 +2245,7 @@
19122245 ResetModel();
19132246 refreshContents();
19142247 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2248
+ if (source == cloneGeometriesItem)
19162249 {
19172250 boolean one = false;
19182251
....@@ -1938,32 +2271,37 @@
19382271 ResetModel();
19392272 refreshContents();
19402273 } else
1941
- if (event.getSource() == shareGeometriesItem)
2274
+ if (source == shareGeometriesItem)
19422275 {
19432276 boolean one = false;
19442277
19452278 if (group.selection.size() == 1)
19462279 one = true;
19472280
2281
+ Object3D merge = null;
2282
+
19482283 Object3D content = new cGroup();
19492284
19502285 for (int i=0; i<group.selection.size(); i++)
19512286 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2287
+ merge = new Merge(group.selection.get(i));
19532288
19542289 if (one)
1955
- makeSomething(sel, false);
2290
+ makeSomething(merge, false);
19562291 else
1957
- content.addChild(sel);
2292
+ content.addChild(merge);
19582293 }
19592294
19602295 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2296
+ makeSomething(content, true);
2297
+ else
2298
+ {
2299
+ ResetModel();
2300
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2301
+ refreshContents();
2302
+ }
19652303 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2304
+ if (source == mergeGeometriesItem)
19672305 {
19682306 boolean one = false;
19692307
....@@ -1993,11 +2331,11 @@
19932331 ResetModel();
19942332 refreshContents();
19952333 } else
1996
- if (event.getSource() == linkverticesItem)
2334
+ if (source == linkverticesItem)
19972335 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2336
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992337 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2338
+// Object3D content = GrafreeD.clipboard.get(0);
20012339 //
20022340 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032341 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2344,48 @@
20062344 // group.selection.get(0).setMasterThis(content); // should be identity
20072345 // refreshContents();
20082346 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2347
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102348 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2349
+ Object3D content = Grafreed.clipboard.get(0);
20122350
20132351 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142352 content = ((cGroup)content).get(0);
20152353
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2354
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172355 for (int i=0; i<group.selection.size(); i++)
20182356 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2357
+ boolean random = CameraPane.SWITCH;
2358
+ CameraPane.SWITCH = false; // parse all random nodes
20212359 group.selection.get(i).linkVerticesThis(content);
20222360 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2361
+ CameraPane.SWITCH = random;
20242362 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2363
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262364 refreshContents();
20272365 }
20282366 } else
2029
- if (event.getSource() == resetsupportItem)
2367
+ if (source == resetsupportItem)
20302368 {
20312369 for (int i=0; i<group.selection.size(); i++)
20322370 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2371
+ boolean random = CameraPane.SWITCH;
2372
+ CameraPane.SWITCH = false; // parse all random nodes
20352373 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2374
+ CameraPane.SWITCH = random;
20372375 }
20382376
20392377 refreshContents();
20402378 } else
2041
- if (event.getSource() == resetreferencesItem)
2379
+ if (source == relinkverticesItem)
2380
+ {
2381
+ boolean random = CameraPane.SWITCH;
2382
+ CameraPane.SWITCH = false; // parse all random nodes
2383
+ group.selection.RelinkToSupport();
2384
+ CameraPane.SWITCH = random;
2385
+
2386
+ refreshContents();
2387
+ } else
2388
+ if (source == resetreferencesItem)
20422389 {
20432390 for (int i=0; i<group.selection.size(); i++)
20442391 {
....@@ -2047,11 +2394,11 @@
20472394
20482395 refreshContents();
20492396 } else
2050
- if (event.getSource() == setMasterItem)
2397
+ if (source == setMasterItem)
20512398 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2399
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532400 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2401
+ Object3D content = Grafreed.clipboard.get(0);
20552402
20562403 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572404 content = ((cGroup)content).get(0);
....@@ -2060,13 +2407,13 @@
20602407 refreshContents();
20612408 }
20622409 } else
2063
- if (event.getSource() == poseMeshItem)
2410
+ if (source == poseMeshItem)
20642411 {
20652412 if (group.selection.size() == 1)
20662413 {
2067
- if (GraphreeD.clipboard.size() == 1)
2414
+ if (Grafreed.clipboard.size() == 1)
20682415 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2416
+ Object3D content = Grafreed.clipboard.get(0);
20702417
20712418 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722419 content = ((cGroup)content).get(0);
....@@ -2079,19 +2426,19 @@
20792426 }
20802427
20812428 } else
2082
- if (event.getSource() == revertMeshItem)
2429
+ if (source == revertMeshItem)
20832430 {
20842431 RevertMeshes();
20852432 } else
2086
- if (event.getSource() == resetMeshItem)
2433
+ if (source == resetAllItem)
20872434 {
20882435 ResetAll();
20892436 } else
2090
- if (event.getSource() == stepAllItem)
2437
+ if (source == stepAllItem)
20912438 {
20922439 StepAll();
20932440 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2441
+ if (source == clearItem) // || event.getSource() == clearButton)
20952442 {
20962443 //int indices[] = jList.getSelectedIndices();
20972444 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2446,46 @@
20992446
21002447 ClearSelection(false);
21012448 } else
2102
- if (event.getSource() == clearAllItem)
2449
+ if (source == clearAllItem)
21032450 {
21042451 ClearSelection(true);
21052452 } else
2106
- if (event.getSource() == grabItem)
2453
+ if (source == grabItem)
21072454 {
21082455 group(new cGroup(), true);
21092456 } else
2110
- if (event.getSource() == frontItem)
2457
+ if (source == hideItem)
2458
+ {
2459
+ group(new HiddenObject());
2460
+ } else
2461
+ if (source == frontItem)
21112462 {
21122463 front();
21132464 } else
2114
- if (event.getSource() == backItem)
2465
+ if (source == backItem)
21152466 {
21162467 back();
21172468 } else
2118
- if (event.getSource() == cameraItem)
2469
+ if (source == cameraItem)
21192470 {
21202471 makeSomething(new Camera());
21212472 } else
2122
- if (event.getSource() == compositeItem)
2473
+ if (source == compositeItem)
21232474 {
21242475 group(new Composite());
21252476 } else
2126
- if (event.getSource() == randomItem)
2477
+ if (source == randomItem)
21272478 {
21282479 RandomNode random = new RandomNode();
21292480 group(random);
21302481 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2482
+ random.name = random.get(0).name + "Switch";
21322483 } else
2133
- if (event.getSource() == physicsItem)
2484
+ if (source == physicsItem)
21342485 {
21352486 group(new PhysicsNode());
21362487 } else
2137
- if (event.getSource() == frameselectorItem)
2488
+ if (source == frameselectorItem)
21382489 {
21392490 for (int i=0; i<group.selection.size(); i++)
21402491 {
....@@ -2146,7 +2497,7 @@
21462497 ResetModel();
21472498 refreshContents();
21482499 } else
2149
- if (event.getSource() == switchGeoItem)
2500
+ if (source == switchGeoItem)
21502501 {
21512502 for (int i=0; i<group.selection.size(); i++)
21522503 {
....@@ -2158,7 +2509,7 @@
21582509 ResetModel();
21592510 refreshContents();
21602511 } else
2161
- if (event.getSource() == switchTransfoItem)
2512
+ if (source == switchTransfoItem)
21622513 {
21632514 for (int i=0; i<group.selection.size(); i++)
21642515 {
....@@ -2170,7 +2521,7 @@
21702521 ResetModel();
21712522 refreshContents();
21722523 } else
2173
- if (event.getSource() == morphItem)
2524
+ if (source == morphItem)
21742525 {
21752526 for (int i=0; i<group.selection.size(); i++)
21762527 {
....@@ -2182,7 +2533,7 @@
21822533 ResetModel();
21832534 refreshContents();
21842535 } else
2185
- if (event.getSource() == scriptNodeItem)
2536
+ if (source == scriptNodeItem)
21862537 {
21872538 boolean atleastone = false;
21882539
....@@ -2221,191 +2572,239 @@
22212572 }
22222573 }
22232574 } else
2224
- if (event.getSource() == linkerItem)
2575
+ if (source == linkerItem)
22252576 {
22262577 group(new cLinker());
22272578 } else
2228
- if (event.getSource() == textureItem)
2579
+ if (source == textureItem)
22292580 {
22302581 group(new TextureNode());
22312582 } else
2232
- if (event.getSource() == shadowXItem)
2583
+ if (source == billboardItem)
2584
+ {
2585
+ group(new BillboardNode());
2586
+ } else
2587
+ if (source == shadowXItem)
22332588 {
22342589 CastShadow(0);
22352590 } else
2236
- if (event.getSource() == shadowYItem)
2591
+ if (source == shadowYItem)
22372592 {
22382593 CastShadow(1);
22392594 } else
2240
- if (event.getSource() == shadowZItem)
2595
+ if (source == shadowZItem)
22412596 {
22422597 CastShadow(2);
22432598 } else
2244
- if (event.getSource() == ungroupItem)
2599
+ if (source == ungroupItem)
22452600 {
2246
- ungroup();
2601
+ //ungroup();
2602
+ for (int i=0; i<group.selection.size(); i++)
2603
+ {
2604
+ Ungroup(group.selection.get(i));
2605
+ }
2606
+
2607
+ ClearSelection(false);
2608
+
2609
+ refreshContents();
22472610 } else
2248
- if (event.getSource() == genUVItem)
2611
+ if (source == genUVItem)
22492612 {
22502613 GenUV();
22512614 } else
2252
- if (event.getSource() == genNormalsCADItem)
2615
+ if (source == genNormalsCADItem)
22532616 {
22542617 GenNormals(true);
22552618 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2619
+ if (source == genNormalsMESHItem)
2620
+ {
2621
+ GenNormalsMESH();
2622
+ } else
2623
+ if (source == genNormalsORGANItem)
22572624 {
22582625 GenNormals(false);
22592626 } else
2260
- if (event.getSource() == stripifyItem)
2627
+ if (source == genNormalsMINEItem)
2628
+ {
2629
+ GenNormalsMINE();
2630
+ } else
2631
+ if (source == stripifyItem)
22612632 {
22622633 Stripify();
22632634 } else
2264
- if (event.getSource() == unstripifyItem)
2635
+ if (source == unstripifyItem)
22652636 {
22662637 Unstripify();
22672638 } else
2268
- if (event.getSource() == trimItem)
2639
+ if (source == trimItem)
22692640 {
22702641 Trim();
22712642 } else
2272
- if (event.getSource() == untrimItem)
2643
+ if (source == untrimItem)
22732644 {
22742645 Untrim();
22752646 } else
2276
- if (event.getSource() == clearColorsItem)
2647
+ if (source == clearColorsItem)
22772648 {
22782649 ClearColors();
22792650 } else
2280
- if (event.getSource() == clearMaterialsItem)
2651
+ if (source == clearMaterialsItem)
22812652 {
22822653 ClearMaterials();
22832654 } else
2284
- if (event.getSource() == liveleavesItem)
2655
+ if (source == liveleavesItem)
22852656 {
22862657 LiveLeaves(true);
22872658 } else
2288
- if (event.getSource() == unliveleavesItem)
2659
+ if (source == unliveleavesItem)
22892660 {
22902661 LiveLeaves(false);
22912662 } else
2292
- if (event.getSource() == supportleavesItem)
2663
+ if (source == supportleavesItem)
22932664 {
22942665 SupportLeaves(true);
22952666 } else
2296
- if (event.getSource() == unsupportleavesItem)
2667
+ if (source == unsupportleavesItem)
22972668 {
22982669 SupportLeaves(false);
22992670 } else
2300
- if (event.getSource() == hideleavesItem)
2671
+ if (source == hideleavesItem)
23012672 {
23022673 HideLeaves(true);
23032674 } else
2304
- if (event.getSource() == showleavesItem)
2675
+ if (source == showleavesItem)
23052676 {
23062677 HideLeaves(false);
23072678 } else
2308
- if (event.getSource() == markleavesItem)
2679
+ if (source == markleavesItem)
23092680 {
23102681 MarkLeaves(true);
23112682 } else
2312
- if (event.getSource() == unmarkleavesItem)
2683
+ if (source == unmarkleavesItem)
23132684 {
23142685 MarkLeaves(false);
23152686 } else
2316
- if (event.getSource() == flipVItem)
2687
+ if (source == rewindleavesItem)
2688
+ {
2689
+ RewindLeaves(true);
2690
+ } else
2691
+ if (source == unrewindleavesItem)
2692
+ {
2693
+ RewindLeaves(false);
2694
+ } else
2695
+ if (source == randomleavesItem)
2696
+ {
2697
+ RandomLeaves(true);
2698
+ } else
2699
+ if (source == unrandomleavesItem)
2700
+ {
2701
+ RandomLeaves(false);
2702
+ } else
2703
+ if (source == flipVItem)
23172704 {
23182705 FlipV(true);
23192706 } else
2320
- if (event.getSource() == unflipVItem)
2707
+ if (source == unflipVItem)
23212708 {
23222709 FlipV(false);
23232710 } else
2324
- if (event.getSource() == lowTexturesItem)
2711
+ if (source == lowTexturesItem)
23252712 {
23262713 SetTexRes(0);
23272714 } else
2328
- if (event.getSource() == normalTexturesItem)
2715
+ if (source == normalTexturesItem)
23292716 {
23302717 SetTexRes(1);
23312718 } else
2332
- if (event.getSource() == highTexturesItem)
2719
+ if (source == highTexturesItem)
23332720 {
23342721 SetTexRes(2);
23352722 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2723
+ if (source == veryhighTexturesItem)
23372724 {
23382725 SetTexRes(3);
23392726 } else
2340
- if (event.getSource() == maxTexturesItem)
2727
+ if (source == maxTexturesItem)
23412728 {
23422729 SetTexRes(4);
23432730 } else
2344
- if (event.getSource() == panoTexturesItem)
2731
+ if (source == panoTexturesItem)
23452732 {
23462733 SetTexRes(5);
23472734 } else
2348
- if (event.getSource() == reverseNormalsItem)
2735
+ if (source == reverseNormalsItem)
23492736 {
23502737 ReverseNormals();
23512738 } else
2352
- if (event.getSource() == parseverticesItem)
2739
+ if (source == parseverticesItem)
23532740 {
23542741 ParseVertices();
23552742 } else
2356
- if (event.getSource() == alignItem)
2743
+ if (source == textureFieldItem)
2744
+ {
2745
+ TextureVertices();
2746
+ } else
2747
+ if (source == alignItem)
23572748 {
23582749 Align();
23592750 } else
2360
- if (event.getSource() == mirrorItem)
2751
+ if (source == mirrorItem)
23612752 {
23622753 MirrorPoses();
23632754 } else
2364
- if (event.getSource() == reduceMorphItem)
2755
+ if (source == reduceMorphItem)
23652756 {
23662757 MeshReduction(false);
23672758 } else
2368
- if (event.getSource() == reduce34MorphItem)
2759
+ if (source == reduce34MorphItem)
23692760 {
23702761 MeshReduction(true);
23712762 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2763
+ if (source == reverseTrianglesItem)
23732764 {
23742765 ReverseTriangles();
23752766 } else
2376
- if (event.getSource() == reduceMeshItem)
2767
+ if (source == reduceMeshItem)
23772768 {
23782769 ReduceMesh(false);
23792770 } else
2380
- if (event.getSource() == reduce34MeshItem)
2771
+ if (source == reduce34MeshItem)
23812772 {
23822773 ReduceMesh(true);
23832774 } else
2384
- if (event.getSource() == increaseMeshItem)
2775
+ if (source == increaseMeshItem)
23852776 {
23862777 IncreaseMesh();
23872778 } else
2388
- if (event.getSource() == clipMeshItem)
2779
+ if (source == clipMeshItem)
23892780 {
23902781 ClipMesh();
23912782 } else
2392
- if (event.getSource() == smoothMeshItem)
2783
+ if (source == smoothMeshItem)
23932784 {
23942785 SmoothMesh();
23952786 } else
2396
- if (event.getSource() == transformgeometryItem)
2787
+ if (source == transformGeometryItem)
23972788 {
23982789 TransformGeometry();
23992790 } else
2400
- if (event.getSource() == resetTransformItem)
2791
+ if (source == transformChildrenItem)
2792
+ {
2793
+ TransformChildren();
2794
+ } else
2795
+ if (source == resetTransformItem)
24012796 {
24022797 ResetTransform();
24032798 } else
2404
- if (event.getSource() == resetCentroidItem)
2799
+ if (source == resetCentroidItem)
24052800 {
2406
- ResetCentroid();
2801
+ ResetCentroid(true);
24072802 } else
2408
- if (event.getSource() == resetParentItem)
2803
+ if (source == resetCentroidXZItem)
2804
+ {
2805
+ ResetCentroid(false);
2806
+ } else
2807
+ if (source == resetParentItem)
24092808 {
24102809 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112810 {
....@@ -2415,7 +2814,7 @@
24152814
24162815 refreshContents();
24172816 } else
2418
- if (event.getSource() == repairParentItem)
2817
+ if (source == repairParentItem)
24192818 {
24202819 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212820 {
....@@ -2429,7 +2828,21 @@
24292828
24302829 refreshContents();
24312830 } else
2432
- if (event.getSource() == sortbysizeItem)
2831
+ if (source == repairShadowItem)
2832
+ {
2833
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2834
+ {
2835
+ Object3D obj = (Object3D)e.nextElement();
2836
+ obj.RepairShadow();
2837
+// for (int i=0; i<obj.size(); i++)
2838
+// {
2839
+// obj.get(i).parent = obj;
2840
+// }
2841
+ }
2842
+
2843
+ refreshContents();
2844
+ } else
2845
+ if (source == sortbysizeItem)
24332846 {
24342847 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352848 {
....@@ -2441,7 +2854,7 @@
24412854 ResetModel();
24422855 refreshContents();
24432856 } else
2444
- if (event.getSource() == sortbynameItem)
2857
+ if (source == sortbynameItem)
24452858 {
24462859 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472860 {
....@@ -2453,7 +2866,7 @@
24532866 ResetModel();
24542867 refreshContents();
24552868 } else
2456
- if (event.getSource() == attachPigmentItem)
2869
+ if (source == attachPigmentItem)
24572870 {
24582871 String texture = GetFile("Attach pigment");
24592872 Object3D obj;
....@@ -2465,7 +2878,7 @@
24652878
24662879 refreshContents();
24672880 } else
2468
- if (event.getSource() == detachPigmentItem)
2881
+ if (source == detachPigmentItem)
24692882 {
24702883 Object3D obj;
24712884 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2889,7 @@
24762889
24772890 refreshContents();
24782891 } else
2479
- if (event.getSource() == attachBumpItem)
2892
+ if (source == attachBumpItem)
24802893 {
24812894 String texture = GetFile("Attach bump");
24822895 Object3D obj;
....@@ -2488,7 +2901,7 @@
24882901
24892902 refreshContents();
24902903 } else
2491
- if (event.getSource() == detachBumpItem)
2904
+ if (source == detachBumpItem)
24922905 {
24932906 Object3D obj;
24942907 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2912,7 @@
24992912
25002913 refreshContents();
25012914 } else
2502
- if (event.getSource() == pigmentBumpItem)
2915
+ if (source == pigmentBumpItem)
25032916 {
25042917 Object3D obj;
25052918 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2923,221 @@
25102923
25112924 refreshContents();
25122925 } else
2513
- if (event.getSource() == flashSelectionButton)
2926
+ if (source == flashSelectionButton)
25142927 {
25152928 CameraPane.flash = true;
25162929 refreshContents();
25172930 } else
2518
- if (event.getSource() == oneButton)
2931
+ if (source == oneButton)
25192932 {
25202933 } else
2521
- if (event.getSource() == twoButton)
2934
+ if (source == twoButton)
25222935 {
25232936 radio.layout = twoButton;
25242937 // bug
25252938 //gridPanel.setDividerLocation(1.0);
25262939 //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();
2940
+// bigThree.remove(scenePanel);
2941
+// bigThree.remove(centralPanel);
2942
+// bigThree.remove(XYZPanel);
2943
+// aWindowConstraints.gridx = 0;
2944
+// aWindowConstraints.gridy = 0;
2945
+// aWindowConstraints.gridwidth = 1;
2946
+// // aConstraints.gridheight = 3;
2947
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2948
+// aWindowConstraints.weightx = 0;
2949
+// aWindowConstraints.weighty = 1;
2950
+// //bigThree.add(jtp, aWindowConstraints);
2951
+// aWindowConstraints.weightx = 1;
2952
+// aWindowConstraints.gridwidth = 3;
2953
+// // aConstraints.gridheight = 3;
2954
+// aWindowConstraints.gridx = 1;
2955
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2956
+// bigThree.add(centralPanel, aWindowConstraints);
2957
+// aWindowConstraints.weightx = 0;
2958
+// aWindowConstraints.gridx = 4;
2959
+// aWindowConstraints.gridwidth = 1;
2960
+// // aConstraints.gridheight = 3;
2961
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2962
+// //bigThree.add(XYZPanel, aWindowConstraints);
2963
+// scenePanel.setVisible(false);
2964
+// centralPanel.setVisible(true);
2965
+// XYZPanel.setVisible(false);
2966
+ bigThree.ClearUI();
2967
+ bigThree.add(centralPanel);
2968
+ bigThree.FlushUI();
2969
+
2970
+ cameraView.requestFocusInWindow();
2971
+
2972
+// refreshContents(true);
2973
+//
2974
+// try
2975
+// {
2976
+// java.awt.Robot bot = new java.awt.Robot();
2977
+// int mask = InputEvent.BUTTON1_MASK;
2978
+// bot.mouseMove(100, 100);
2979
+// bot.mousePress(mask);
2980
+// bot.mouseRelease(mask);
2981
+// }
2982
+// catch (Exception e)
2983
+// {
2984
+//
2985
+// }
2986
+
25512987 } else
2552
- if (event.getSource() == threeButton)
2988
+ if (source == threeButton)
25532989 {
25542990 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();
2991
+
2992
+// bigThree.remove(scenePanel);
2993
+// bigThree.remove(centralPanel);
2994
+// bigThree.remove(XYZPanel);
2995
+// aWindowConstraints.gridx = 0;
2996
+// aWindowConstraints.gridy = 0;
2997
+// aWindowConstraints.gridwidth = 1;
2998
+// // aConstraints.gridheight = 3;
2999
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3000
+// aWindowConstraints.weightx = 0;
3001
+// aWindowConstraints.weighty = 1;
3002
+// //bigThree.add(jtp, aWindowConstraints);
3003
+// aWindowConstraints.weightx = 1;
3004
+// aWindowConstraints.gridwidth = 3;
3005
+// // aConstraints.gridheight = 3;
3006
+// aWindowConstraints.gridx = 1;
3007
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3008
+// bigThree.add(centralPanel, aWindowConstraints);
3009
+// aWindowConstraints.weightx = 0;
3010
+// aWindowConstraints.gridx = 4;
3011
+// aWindowConstraints.gridwidth = 1;
3012
+// // aConstraints.gridheight = 3;
3013
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3014
+// bigThree.add(XYZPanel, aWindowConstraints);
3015
+// bigThree.validate();
3016
+// scenePanel.setVisible(false);
3017
+// centralPanel.setVisible(true);
3018
+// XYZPanel.setVisible(true);
3019
+ bigThree.ClearUI();
3020
+ bigThree.add(centralPanel);
3021
+ bigThree.add(XYZPanel);
3022
+ bigThree.FlushUI();
3023
+
3024
+ cameraView.requestFocusInWindow();
25793025 } else
2580
- if (event.getSource() == fourButton)
3026
+ if (source == fourButton)
25813027 {
25823028 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();
3029
+
3030
+// bigThree.remove(scenePanel);
3031
+// bigThree.remove(centralPanel);
3032
+// bigThree.remove(XYZPanel);
3033
+// aWindowConstraints.gridx = 0;
3034
+// aWindowConstraints.gridy = 0;
3035
+// aWindowConstraints.gridwidth = 1;
3036
+// // aWindowConstraints.gridheight = 3;
3037
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3038
+// aWindowConstraints.weightx = 1;
3039
+// aWindowConstraints.weighty = 1;
3040
+// bigThree.add(scenePanel, aWindowConstraints);
3041
+// aWindowConstraints.weightx = 1;
3042
+// aWindowConstraints.gridwidth = 3;
3043
+// // aConstraints.gridheight = 3;
3044
+// aWindowConstraints.gridx = 1;
3045
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3046
+// //bigThree.add(cameraPanel, aWindowConstraints);
3047
+// aWindowConstraints.weightx = 0;
3048
+// aWindowConstraints.gridx = 4;
3049
+// aWindowConstraints.gridwidth = 1;
3050
+// // aWindowConstraints.gridheight = 3;
3051
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3052
+// //bigThree.add(XYZPanel, aWindowConstraints);
3053
+// bigThree.validate();
3054
+// scenePanel.setVisible(true);
3055
+// centralPanel.setVisible(false);
3056
+// XYZPanel.setVisible(false);
3057
+ bigThree.ClearUI();
3058
+ bigThree.add(scenePanel);
3059
+ bigThree.FlushUI();
3060
+
3061
+ cameraView.requestFocusInWindow();
26073062 } else
2608
- if (event.getSource() == sixButton)
3063
+ if (source == sixButton)
26093064 {
26103065 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();
3066
+
3067
+// bigThree.remove(scenePanel);
3068
+// bigThree.remove(centralPanel);
3069
+// bigThree.remove(XYZPanel);
3070
+// aWindowConstraints.gridx = 0;
3071
+// aWindowConstraints.gridy = 0;
3072
+// aWindowConstraints.gridwidth = 1;
3073
+// // aConstraints.gridheight = 3;
3074
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3075
+// aWindowConstraints.weightx = 0;
3076
+// aWindowConstraints.weighty = 1;
3077
+// bigThree.add(scenePanel, aWindowConstraints);
3078
+// aWindowConstraints.weightx = 1;
3079
+// aWindowConstraints.gridwidth = 3;
3080
+// // aWindowConstraints.gridheight = 3;
3081
+// aWindowConstraints.gridx = 1;
3082
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3083
+// bigThree.add(centralPanel, aWindowConstraints);
3084
+// aWindowConstraints.weightx = 0;
3085
+// aWindowConstraints.gridx = 4;
3086
+// aWindowConstraints.gridwidth = 1;
3087
+// // aWindowConstraints.gridheight = 3;
3088
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3089
+// //bigThree.add(XYZPanel, aConstraints);
3090
+// bigThree.validate();
3091
+// scenePanel.setVisible(true);
3092
+// centralPanel.setVisible(true);
3093
+// XYZPanel.setVisible(false);
3094
+ bigThree.ClearUI();
3095
+ bigThree.add(scenePanel);
3096
+ bigThree.add(centralPanel);
3097
+ bigThree.FlushUI();
3098
+
3099
+ cameraView.requestFocusInWindow();
26353100 } else
2636
- if (event.getSource() == sevenButton)
3101
+ if (source == sevenButton)
26373102 {
26383103 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();
3104
+
3105
+// bigThree.remove(scenePanel);
3106
+// bigThree.remove(centralPanel);
3107
+// bigThree.remove(XYZPanel);
3108
+// aWindowConstraints.gridx = 0;
3109
+// aWindowConstraints.gridy = 0;
3110
+// aWindowConstraints.gridwidth = 1;
3111
+// // aWindowConstraints.gridheight = 3;
3112
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3113
+// aWindowConstraints.weightx = 0;
3114
+// aWindowConstraints.weighty = 1;
3115
+// bigThree.add(scenePanel, aWindowConstraints);
3116
+// aWindowConstraints.weightx = 1;
3117
+// aWindowConstraints.gridwidth = 3;
3118
+// // aWindowConstraints.gridheight = 3;
3119
+// aWindowConstraints.gridx = 1;
3120
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3121
+// bigThree.add(centralPanel, aWindowConstraints);
3122
+// aWindowConstraints.weightx = 0;
3123
+// aWindowConstraints.gridx = 4;
3124
+// aWindowConstraints.gridwidth = 1;
3125
+// // aConstraints.gridheight = 3;
3126
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3127
+// bigThree.add(XYZPanel, aWindowConstraints);
3128
+// bigThree.validate();
3129
+// scenePanel.setVisible(true);
3130
+// centralPanel.setVisible(true);
3131
+// XYZPanel.setVisible(true);
3132
+ bigThree.ClearUI();
3133
+ bigThree.add(scenePanel);
3134
+ bigThree.add(centralPanel);
3135
+ bigThree.add(XYZPanel);
3136
+ bigThree.FlushUI();
3137
+
3138
+ cameraView.requestFocusInWindow();
26633139 } else
2664
- if (event.getSource() == rootButton)
3140
+ if (source == rootButton)
26653141 {
26663142 Object3D obj;
26673143 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,34 +3147,44 @@
26713147 EditObject(obj);
26723148 }
26733149
3150
+ cameraView.requestFocusInWindow();
26743151 refreshContents(true);
26753152 } else
2676
- if (event.getSource() == closeButton)
3153
+ if (source == closeButton)
26773154 {
26783155 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793156 cRadio ab;
26803157 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813158 {
26823159 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3160
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843161 {
3162
+ // Patch to avoid bug with transparency.
3163
+ if (!ab.hadMaterial)
3164
+ {
3165
+ ab.object.material = null;
3166
+ }
3167
+
26853168 buttonGroup.remove(ab);
26863169 radioPanel.remove(ab);
26873170
2688
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
26893173 // ab.GetObject().objectUI = null; // ?????????
26903174
26913175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923176 break;
26933177 }
26943178 }
3179
+
3180
+ cameraView.requestFocusInWindow();
26953181 refreshContents(true);
26963182 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3183
+ if (source == editItem || source == editButton)
26983184 {
26993185 EditSelection(false);
27003186 } else
2701
- if (event.getSource() == uneditButton)
3187
+ if (source == uneditButton)
27023188 {
27033189 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043190 {
....@@ -2708,14 +3194,14 @@
27083194 child.CloseUI();
27093195 listUI.remove(child);
27103196
2711
- child.editWindow = null; // ???????????
3197
+ //child.editWindow = null; // ???????????
27123198 }
2713
- objEditor.ctrlPanel.revalidate();
3199
+ objEditor.ctrlPanel.FlushUI();
27143200 //objEditor.jTree.clearSelection();
27153201 //objEditor.ResetSliders();
27163202 refreshContents(true);
27173203 } else
2718
- if (event.getSource() == clearPanelButton)
3204
+ if (source == clearPanelButton)
27193205 {
27203206 assert(copy == group);
27213207 //copy.ClearUI();
....@@ -2726,7 +3212,7 @@
27263212 listUI.clear();
27273213 refreshContents(true);
27283214 } else
2729
- if (event.getSource() == allParamsButton)
3215
+ if (source == allParamsButton)
27303216 {
27313217 assert(copy == group);
27323218
....@@ -2747,19 +3233,19 @@
27473233
27483234 refreshContents(true);
27493235 } else
2750
- if (event.getSource() == unselectButton)
3236
+ if (source == unselectButton)
27513237 {
27523238 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3239
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543240 objEditor.ResetSliders();
27553241 refreshContents(true);
27563242 } else
2757
- if(event.getSource() instanceof cRadio)
3243
+ if(source instanceof cRadio)
27583244 {
27593245 group.parent = keepparent;
27603246 group.attributes = 0;
27613247 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3248
+ /*cRadio*/ radio = (cRadio)source;
27633249 Object3D obj = radio.GetObject();
27643250 System.out.println("Edit " + obj);
27653251 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3265,7 @@
27793265 }
27803266
27813267 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3268
+ //Globals.theRenderer.object = group;
27833269 if(!useclient)
27843270 {
27853271 cameraView.renderCamera = radio.camera;
....@@ -2788,12 +3274,17 @@
27883274 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893275 cameraView.targetLookAt.set(radio.camera.lookAt);
27903276 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3277
+ //cameraView.lighttouched = true;
3278
+ Globals.lighttouched = true;
27923279 topView.object = group;
27933280 frontView.object = group;
27943281 sideView.object = group;
27953282 }
2796
- group.editWindow = this;
3283
+
3284
+// fix "+" issue
3285
+ //group.editWindow = this;
3286
+ group.manipWindow = this;
3287
+
27973288 /*
27983289 currentLayout = radio.layout;
27993290 if (currentLayout == null)
....@@ -2805,8 +3296,23 @@
28053296 //group.parent = null; // ROOT
28063297 //group.attributes = -1;
28073298 ResetModel();
3299
+
3300
+ cameraView.requestFocusInWindow();
28083301 refreshContents(true);
2809
- }
3302
+ } else if (event.getSource() == editCameraItem)
3303
+ {
3304
+ cameraView.ProtectCamera();
3305
+ cameraView.repaint();
3306
+ return;
3307
+ } else if (event.getSource() == revertCameraItem)
3308
+ {
3309
+ cameraView.RevertCamera();
3310
+ cameraView.repaint();
3311
+ return;
3312
+ // } else if (event.getSource() == textureButton)
3313
+ // {
3314
+ // return; // true;
3315
+ }
28103316 else
28113317 {
28123318 //return super.action(event, arg);
....@@ -2815,7 +3321,6 @@
28153321 }
28163322
28173323 boolean useclient = false;
2818
- cRadio radio;
28193324
28203325 void ToggleRoot()
28213326 {
....@@ -2824,7 +3329,7 @@
28243329 if (useclient)
28253330 {
28263331 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3332
+ Globals.lighttouched = true;
28283333 //topView.object = client;
28293334 //frontView.object = client;
28303335 //sideView.object = client;
....@@ -2832,7 +3337,7 @@
28323337 else
28333338 {
28343339 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3340
+ Globals.lighttouched = true;
28363341 //topView.object = group;
28373342 //frontView.object = group;
28383343 //sideView.object = group;
....@@ -2867,6 +3372,28 @@
28673372 refreshContents();
28683373 }
28693374
3375
+ void TransformChildren()
3376
+ {
3377
+ Object3D obj;
3378
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3379
+ {
3380
+ obj = (Object3D)e.nextElement();
3381
+ obj.KeepTextureMatrices();
3382
+ obj.TransformChildren();
3383
+ obj.RestoreTextureMatrices();
3384
+
3385
+// if (obj.parent == null)
3386
+// {
3387
+// System.out.println("NULL PARENT!");
3388
+// new Exception().printStackTrace();
3389
+// }
3390
+// else
3391
+// TouchTransform(obj);
3392
+// //obj.parent.Touch();
3393
+ }
3394
+
3395
+ refreshContents();
3396
+ }
28703397
28713398 void ResetTransform()
28723399 {
....@@ -2979,7 +3506,7 @@
29793506 refreshContents();
29803507 }
29813508
2982
- void ResetCentroid()
3509
+ void ResetCentroid(boolean full)
29833510 {
29843511 Object3D obj;
29853512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3521,16 @@
29943521 LA.matIdentity(Object3D.mat);
29953522 obj.getBounds(minima, maxima, false);
29963523 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3524
+ if (full)
3525
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983526 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993527 obj.TransformMesh(Object3D.mat);
3528
+
30003529 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3530
+ if (full)
3531
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023532 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3533
+
30033534 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043535 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053536 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3559,8 @@
30283559
30293560 int size = obj.MemorySize();
30303561
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3562
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3563
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323564 }
30333565 }
30343566 catch (Exception e)
....@@ -3065,9 +3597,9 @@
30653597 obj = (Object3D)e.nextElement();
30663598
30673599 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3600
+ Grafreed.AnalyzeObject(obj);
30693601 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3602
+ Grafreed.AnalyzeObject(obj.bRep);
30713603
30723604 // System.err.println((size/1024) + " KB is the size of " + obj);
30733605 }
....@@ -3109,6 +3641,20 @@
31093641 void GenNormals(boolean crease)
31103642 {
31113643 group.GenNormalsS(crease);
3644
+
3645
+ refreshContents();
3646
+ }
3647
+
3648
+ void GenNormalsMESH()
3649
+ {
3650
+ group.GenNormalsMeshS();
3651
+
3652
+ refreshContents();
3653
+ }
3654
+
3655
+ void GenNormalsMINE()
3656
+ {
3657
+ group.selection.GenNormalsMINE();
31123658
31133659 refreshContents();
31143660 }
....@@ -3157,104 +3703,259 @@
31573703
31583704 //Object3D buffer;
31593705 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
-
3706
+// BoundaryRep temprep;
3707
+// Object3D nodes;
3708
+// Vector<Vertex> vertices;
3709
+//
3710
+// cGroup buffer;
3711
+//
3712
+// public void Vertex(Object3D node, Vertex v)
3713
+// {
3714
+//// vertices.add(v);
3715
+//// nodes.addElement(node);
3716
+////
3717
+//// if (temprep.GetCache(v) != null)
3718
+//// {
3719
+//// temprep.Remove(v);
3720
+//// } else
3721
+//// {
3722
+//// temprep.Remember(v);
3723
+//// }
3724
+//
3725
+// //Object3D node = nodes.get(index);
3726
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3727
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3728
+//
3729
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3730
+//
3731
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3732
+//
3733
+// cGroup g = new cGroup();
3734
+//
3735
+// if (g.toParent == null)
3736
+// {
3737
+// g.toParent = LA.newMatrix();
3738
+// g.fromParent = LA.newMatrix();
3739
+// }
3740
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3741
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3742
+//
3743
+// g.add(GrafreeD.clipboard);
3744
+//
3745
+// buffer.add(g);
3746
+// }
3747
+//
3748
+// public void Face(Object3D node, Face f)
3749
+// {
3750
+//
3751
+// }
3752
+//
3753
+// void ParseVerticesOld() // ??
3754
+// {
3755
+// //if (group.selection.size() != 1)
3756
+// // return;
3757
+//
3758
+// temprep = new BoundaryRep();
3759
+// nodes = new Object3D();
3760
+// vertices = new Vector<Vertex>();
3761
+//
3762
+// boolean epsequal = GrafreeD.epsequal;
3763
+// GrafreeD.epsequal = true;
3764
+//
3765
+// for (int i=0; i<group.selection.size(); i++)
3766
+// {
3767
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3768
+//
3769
+// group.selection.get(i).Parse(
3770
+//this );
3771
+//
3772
+// int repsize = temprep.VertexCount();
3773
+// int tablesize = temprep.vertextable.size();
3774
+// int nodesize = nodes.size();
3775
+//
3776
+// assert(vertices.size() == nodes.size());
3777
+//
3778
+// temprep.vertextable.elements();
3779
+//
3780
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3781
+//
3782
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3783
+// {
3784
+// cGroup g = new cGroup();
3785
+//
3786
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3787
+//
3788
+// Object3D node = nodes.get(index);
3789
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3790
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3791
+//
3792
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3793
+//
3794
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3795
+//
3796
+// if (g.toParent == null)
3797
+// {
3798
+// g.toParent = LA.newMatrix();
3799
+// g.fromParent = LA.newMatrix();
3800
+// }
3801
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3802
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3803
+//
3804
+// g.add(GrafreeD.clipboard);
3805
+//
3806
+// buffer.add(g);
3807
+// }
3808
+//
3809
+// makeSomething(buffer, i==group.selection.size()-1);
3810
+// }
3811
+//
3812
+// GrafreeD.epsequal = epsequal;
3813
+//
3814
+// //buffer = null;
3815
+// temprep = null;
3816
+// nodes = null;
3817
+//
3818
+// refreshContents();
3819
+// }
3820
+
31843821 void ParseVertices()
31853822 {
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;
3823
+ boolean epsequal = Grafreed.epsequal;
3824
+ Grafreed.epsequal = true;
31953825
31963826 for (int i=0; i<group.selection.size(); i++)
31973827 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3828
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993829
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3830
+ group.selection.get(i).Parse(
3831
+
3832
+ new iParse()
3833
+ {
3834
+ public void Vertex(Object3D node, Vertex v)
3835
+ {
3836
+ temp.set(v);
3837
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053838
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();
3839
+ cGroup g = new cGroup();
32113840
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3841
+ if (g.toParent == null)
3842
+ {
3843
+ g.toParent = LA.newMatrix();
3844
+ g.fromParent = LA.newMatrix();
3845
+ }
3846
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3847
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153848
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);
3849
+ g.add(Grafreed.clipboard);
32203850
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);
3851
+ buffer.add(g);
3852
+ }
32323853
3233
- g.add(GraphreeD.clipboard);
3854
+ public void Face(Object3D node, Face f)
3855
+ {
32343856
3235
- buffer.add(g);
3236
- }
3857
+ }
3858
+ }
3859
+ );
32373860
32383861 makeSomething(buffer, i==group.selection.size()-1);
32393862 }
32403863
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3864
+ Grafreed.epsequal = epsequal;
32463865
32473866 refreshContents();
32483867 }
3249
-
3868
+
3869
+ void TextureVertices()
3870
+ {
3871
+ for (int i=0; i<group.selection.size(); i++)
3872
+ {
3873
+ group.selection.get(i).Parse(
3874
+ new iParse()
3875
+ {
3876
+ public void Vertex(Object3D node, Vertex v)
3877
+ {
3878
+ cTexture tex = node.GetTextures();
3879
+ String pigment = Object3D.GetPigment(tex);
3880
+ //String bump = Object3D.GetBump(tex);
3881
+
3882
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3883
+
3884
+ try
3885
+ {
3886
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3887
+ }
3888
+ catch (Exception e)
3889
+ {
3890
+ System.err.println("FAIL: " + node);
3891
+ }
3892
+
3893
+ double s = v.s;
3894
+
3895
+ if (s == 1)
3896
+ s = 0;
3897
+
3898
+ double t = v.t;
3899
+
3900
+ if (t == 1)
3901
+ t = 0;
3902
+
3903
+ int indexs = (int) (texturedata.getWidth() * s);
3904
+ int indext = (int) (texturedata.getHeight() * t);
3905
+
3906
+ int index = indext * texturedata.getWidth() + indexs;
3907
+
3908
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3909
+
3910
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3911
+
3912
+ float scale = bytebuf.get(index*slide) & 0xFF;
3913
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3914
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3915
+ scale /= 3;
3916
+
3917
+ scale /= 0xFF;
3918
+ // c'est quoi ca? scale /= 4;
3919
+
3920
+ //v.AO = scale;
3921
+
3922
+ v.x += v.norm.x * scale;
3923
+ v.y += v.norm.y * scale;
3924
+ v.z += v.norm.z * scale;
3925
+ }
3926
+
3927
+ public void Face(Object3D node, Face f)
3928
+ {
3929
+ }
3930
+ }
3931
+ );
3932
+ }
3933
+
3934
+ refreshContents();
3935
+ }
3936
+
32503937 void Align()
32513938 {
3939
+ if (group.selection.size() == 0)
3940
+ return;
3941
+
3942
+ cVector bbmin = new cVector();
3943
+ cVector bbmax = new cVector();
3944
+
3945
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3946
+
3947
+ double dx = bbmax.x - bbmin.x;
3948
+ double dy = bbmax.y - bbmin.y;
3949
+ double dz = bbmax.z - bbmin.z;
3950
+
3951
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3952
+
32523953 for (int i=0; i<group.selection.size(); i++)
32533954 {
32543955 Object3D obj = group.selection.get(i);
32553956
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3957
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3958
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583959 }
32593960
32603961 refreshContents();
....@@ -3267,7 +3968,7 @@
32673968 // ref.SaveSupports();
32683969 // Object3D par = ref.parent;
32693970 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3971
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713972 // ref.parent = par;
32723973 // ref.RestoreSupports();
32733974
....@@ -3275,11 +3976,11 @@
32753976
32763977 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32773978
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
3979
+ boolean random = CameraPane.SWITCH;
3980
+ CameraPane.SWITCH = false; // parse all random nodes
32803981 lowres.linkVerticesThis(null);
32813982 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
3983
+ CameraPane.SWITCH = random;
32833984
32843985 System.err.flush();
32853986
....@@ -3297,7 +3998,7 @@
32973998 // lowres.SaveSupports();
32983999 // par = lowres.parent;
32994000 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4001
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014002 Object3D newlow = CloneObject(lowres, false);
33024003 newlow.name = sn.switchobject.get(i).name;
33034004 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4020,7 @@
33194020 return;
33204021
33214022 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4023
+ Object3D ref = Grafreed.clipboard.get(0);
33234024
33244025 Object3D newgroup = new Object3D("Po:" + poses.name);
33254026
....@@ -3488,7 +4189,7 @@
34884189 group.selection.RelinkToSupport(); // july 2014
34894190 System.out.println("DONE.");
34904191 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4192
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924193 }
34934194
34944195 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4214,20 @@
35134214
35144215 void ClipMesh()
35154216 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4217
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174218 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4219
+ Object3D content = Grafreed.clipboard.get(0);
35194220
35204221 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214222 content = ((cGroup)content).get(0);
35224223
35234224 // for (int i=0; i<group.selection.size(); i++)
35244225 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4226
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264227 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4228
+ group.selection.ClipMesh(Grafreed.clipboard);
35284229 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4230
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304231 System.out.println("DONE.");
35314232 refreshContents();
35324233 }
....@@ -3571,6 +4272,18 @@
35714272 void MarkLeaves(boolean hide)
35724273 {
35734274 group.selection.MarkLeaves(hide);
4275
+ refreshContents();
4276
+ }
4277
+
4278
+ void RewindLeaves(boolean hide)
4279
+ {
4280
+ group.selection.RewindLeaves(hide);
4281
+ refreshContents();
4282
+ }
4283
+
4284
+ void RandomLeaves(boolean hide)
4285
+ {
4286
+ group.selection.RandomLeaves(hide);
35744287 refreshContents();
35754288 }
35764289
....@@ -3659,7 +4372,7 @@
36594372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604373
36614374 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4375
+ if(elem != group || !newWindow)
36634376 {
36644377 // if (!(elem instanceof Composite))
36654378 // newWindow = false;
....@@ -3749,7 +4462,6 @@
37494462 //case 702: // Event.LIST_DESELECT
37504463 group.deselectAll();
37514464 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534465 if (tps != null)
37544466 {
37554467 for (int i=0; i < tps.length; i++)
....@@ -3758,31 +4470,30 @@
37584470
37594471 //if (child.parent != null)
37604472 //child.parent.addSelectee(child);
4473
+ objEditor.SetMaterial(child);
37614474 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654475 }
37664476 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4477
+// else
4478
+// {
4479
+// objEditor.SetMaterial(group); // .GetMaterial());
4480
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4481
+// System.err.println("info : " + group.GetPath());
4482
+// }
37734483
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4484
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774485 CameraPane.flash = true;
37784486
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4487
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804488 // a camera
37814489 {
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;
4490
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4491
+ {
4492
+ CameraPane.camerachangeframe = 0; // don't refuse it
4493
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4494
+ }
4495
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4496
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864497 }
37874498
37884499 refreshContents();
....@@ -3793,6 +4504,26 @@
37934504
37944505 freezemodel = false;
37954506 }
4507
+
4508
+ void refreshContents(boolean cp)
4509
+ {
4510
+ if (!Globals.MOUSEDRAGGED)
4511
+ {
4512
+ objEditor.ClearInfo(); // .GetMaterial());
4513
+
4514
+ for (int i=0; i < group.selection.Size(); i++)
4515
+ {
4516
+ Object3D child = (Object3D) group.selection.get(i);
4517
+
4518
+ objEditor.AddInfo(child, this, true);
4519
+ System.err.println("info : " + child.GetPath());
4520
+ }
4521
+
4522
+ objEditor.SetText(); // jan 2014
4523
+ }
4524
+
4525
+ super.refreshContents(cp);
4526
+ }
37964527
37974528 void linkSomething(Object3D thing)
37984529 {
....@@ -3864,16 +4595,19 @@
38644595 {
38654596 if (group.selection.isEmpty())
38664597 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4598
+
4599
+ Grafreed.clipboardIsTempGroup = false;
38684600 Composite tGroup = null;
38694601 if (group.selection.size() > 0) // 1)
38704602 {
38714603 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4604
+ Grafreed.clipboardIsTempGroup = true;
38734605 }
38744606
38754607 if (cut)
38764608 {
4609
+ if (Globals.SAVEONMAKE)
4610
+ Save();
38774611 //int indices[] = jList.getSelectedIndices();
38784612 //for (int i = indices.length - 1; i >= 0; i--)
38794613 //jList.remove(indices[i]);
....@@ -3909,16 +4643,16 @@
39094643 //System.out.println("cut " + child);
39104644 //System.out.println("parent = " + child.parent);
39114645 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4646
+ if (Grafreed.clipboardIsTempGroup)
39134647 tGroup.add/*Child*/(tmp);
39144648 else
3915
- GraphreeD.clipboard = tmp;
4649
+ Grafreed.clipboard = tmp;
39164650 }
39174651 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4652
+ if (Grafreed.clipboardIsTempGroup)
39194653 tGroup.add/*Child*/(child);
39204654 else
3921
- GraphreeD.clipboard = child;
4655
+ Grafreed.clipboard = child;
39224656 }
39234657
39244658 //ResetModel();
....@@ -3950,21 +4684,23 @@
39504684 //System.out.println("cut " + elem);
39514685 //System.out.println("parent = " + elem.parent);
39524686 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4687
+ if (Grafreed.clipboardIsTempGroup)
39544688 tGroup.add/*Child*/(tmp);
39554689 else
3956
- GraphreeD.clipboard = tmp;
4690
+ Grafreed.clipboard = tmp;
39574691 }
39584692 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4693
+ if (Grafreed.clipboardIsTempGroup)
39604694 tGroup.add/*Child*/(child);
39614695 else
3962
- GraphreeD.clipboard = child;
4696
+ Grafreed.clipboard = child;
39634697 }
39644698
39654699 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4700
+
4701
+ if (Grafreed.clipboardIsTempGroup)
4702
+ Grafreed.clipboard = tGroup;
4703
+
39684704 if (cut)
39694705 {
39704706 ResetModel();
....@@ -3974,11 +4710,11 @@
39744710
39754711 void paste(boolean expand)
39764712 {
3977
- // if (GraphreeD.clipboard == null)
4713
+ // if (GrafreeD.clipboard == null)
39784714 // return;
39794715 boolean first = true;
39804716
3981
- if (GraphreeD.clipboardIsTempGroup)
4717
+ if (Grafreed.clipboardIsTempGroup)
39824718 {
39834719 Composite temp;
39844720
....@@ -3989,7 +4725,7 @@
39894725 temp = (Composite)Applet3D.clipboard.deepCopy();
39904726 */
39914727 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4728
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934729 {
39944730 Object3D child = (Object3D)e.nextElement();
39954731
....@@ -4003,7 +4739,7 @@
40034739 else
40044740 elem = child.deepCopy(); // ?
40054741 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4742
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074743 // elem = elem.get(0);
40084744 makeSomething(elem, true); // ?? first);
40094745 //group.addChild(elem);
....@@ -4023,23 +4759,23 @@
40234759 //Object3D cb = Applet3D.clipboard;
40244760 //temp.addChild(cb);
40254761 //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());
4762
+ assert(Grafreed.clipboard.parent == null);
4763
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4764
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4765
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4766
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40314767 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4768
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4769
+ Grafreed.clipboard.get(0).parent = keepparent;
40344770 }
40354771
40364772 ResetModel();
40374773 refreshContents();
40384774 }
40394775
4040
- void pasteInto(boolean copyit)
4776
+ void pasteInto(boolean copyit, boolean clone)
40414777 {
4042
-// if (GraphreeD.clipboard == null)
4778
+// if (GrafreeD.clipboard == null)
40434779 // return;
40444780
40454781 if (group.selection.size() != 1)
....@@ -4066,15 +4802,22 @@
40664802 if (copyit)
40674803 {
40684804 // paste(false);
4069
- CloneClipboard(false); // sept 2014
4805
+ if (clone)
4806
+ {
4807
+ CloneClipboard(false); // sept 2014
4808
+ }
4809
+ else
4810
+ {
4811
+ paste(false);
4812
+ }
40704813 }
40714814 else
40724815 {
40734816 boolean first = true;
40744817
4075
- if (GraphreeD.clipboardIsTempGroup)
4818
+ if (Grafreed.clipboardIsTempGroup)
40764819 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4820
+ Composite temp = (Composite)Grafreed.clipboard;
40784821 Object3D copy;
40794822 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804823 {
....@@ -4084,7 +4827,7 @@
40844827 }
40854828 } else
40864829 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4830
+ linkSomething(Grafreed.clipboard); //.get(0));
40884831 }
40894832 }
40904833 }
....@@ -4276,6 +5019,26 @@
42765019 makeSomething(csg);
42775020 }
42785021
5022
+ void Ungroup(Object3D g)
5023
+ {
5024
+ if (g instanceof HiddenObject)
5025
+ {
5026
+ HiddenObject h = (HiddenObject) g;
5027
+
5028
+ for (int i=0; i<h.ActualSize(); i++)
5029
+ {
5030
+ objEditor.makeSomething(h.get(i), false);
5031
+ }
5032
+ }
5033
+ else
5034
+ {
5035
+ for (int i=0; i<g.Size(); i++)
5036
+ {
5037
+ objEditor.makeSomething(g.get(i), false);
5038
+ }
5039
+ }
5040
+ }
5041
+
42795042 void ungroup()
42805043 {
42815044 /*
....@@ -4469,21 +5232,6 @@
44695232 }
44705233 */
44715234
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
-
44875235 /*
44885236 public void Callback(Object obj)
44895237 {
....@@ -4507,26 +5255,9 @@
45075255 }
45085256 */
45095257
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
-
45275258 String GetFile(String dialogName)
45285259 {
4529
- if (GraphreeD.standAlone)
5260
+ if (Grafreed.standAlone)
45305261 {
45315262 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325263 browser.show();
....@@ -4590,10 +5321,18 @@
45905321 cButton flashSelectionButton;
45915322 cButton editButton;
45925323 cButton uneditButton;
5324
+ JCheckBox allParamsButton;
45935325 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955326 cButton unselectButton;
45965327
5328
+ cButton minButton;
5329
+ cButton maxButton;
5330
+ cButton fullButton;
5331
+ cButton undoButton;
5332
+ cButton redoButton;
5333
+ cButton saveButton;
5334
+ cButton oneStepButton;
5335
+
45975336 cButton screenfitButton;
45985337 cButton screenfitpointButton;
45995338 cButton snapobjectButton;
....@@ -4604,14 +5343,6 @@
46045343 cButton closeButton;
46055344
46065345 cButton setsupportButton;
4607
-
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;
46155346
46165347 //
46175348 //Composite
....@@ -4624,6 +5355,8 @@
46245355 private MenuItem lookFromItem;
46255356 private MenuItem switchItem;
46265357 private MenuItem cutItem;
5358
+ private MenuItem undoItem;
5359
+ private MenuItem redoItem;
46275360 private MenuItem duplicateItem;
46285361 private MenuItem cloneItem;
46295362 private MenuItem cloneSupportItem;
....@@ -4635,8 +5368,9 @@
46355368 private MenuItem resetsupportItem;
46365369 private MenuItem resetreferencesItem;
46375370 private MenuItem linkverticesItem;
5371
+ private MenuItem relinkverticesItem;
46385372 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5373
+ private MenuItem resetAllItem;
46405374 private MenuItem stepAllItem;
46415375 private MenuItem revertMeshItem;
46425376 private MenuItem poseMeshItem;
....@@ -4647,14 +5381,17 @@
46475381 private MenuItem mergeGeometriesItem;
46485382 private MenuItem copyItem;
46495383 private MenuItem pasteItem;
5384
+ private MenuItem pasteIntoItem;
46505385 private MenuItem pasteLinkItem;
46515386 private MenuItem pasteCloneItem;
46525387 private MenuItem pasteExpandItem;
46535388 private MenuItem clearItem;
46545389 private MenuItem clearAllItem;
46555390 private MenuItem genUVItem;
5391
+ private MenuItem genNormalsMESHItem;
46565392 private MenuItem genNormalsCADItem;
46575393 private MenuItem genNormalsORGANItem;
5394
+ private MenuItem genNormalsMINEItem;
46585395 private MenuItem stripifyItem;
46595396 private MenuItem unstripifyItem;
46605397 private MenuItem trimItem;
....@@ -4683,6 +5420,10 @@
46835420 private MenuItem showleavesItem;
46845421 private MenuItem markleavesItem;
46855422 private MenuItem unmarkleavesItem;
5423
+ private MenuItem rewindleavesItem;
5424
+ private MenuItem unrewindleavesItem;
5425
+ private MenuItem randomleavesItem;
5426
+ private MenuItem unrandomleavesItem;
46865427
46875428 private MenuItem flipVItem;
46885429 private MenuItem unflipVItem;
....@@ -4694,8 +5435,11 @@
46945435 private MenuItem panoTexturesItem;
46955436
46965437 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5438
+ private MenuItem resetCentroidXZItem;
46985439 private MenuItem resetTransformItem;
5440
+ private MenuItem transformGeometryItem;
5441
+ private MenuItem transformChildrenItem;
5442
+ private MenuItem hideItem;
46995443 private MenuItem grabItem;
47005444 private MenuItem backItem;
47015445 private MenuItem frontItem;
....@@ -4716,6 +5460,7 @@
47165460
47175461 private MenuItem resetParentItem;
47185462 private MenuItem repairParentItem;
5463
+ private MenuItem repairShadowItem;
47195464 private MenuItem sortbysizeItem;
47205465 private MenuItem sortbynameItem;
47215466
....@@ -4728,16 +5473,19 @@
47285473 private MenuItem particleItem;
47295474 private MenuItem ragdollItem;
47305475 private MenuItem ragdoll2Item;
5476
+ private MenuItem heightFieldItem;
5477
+ private MenuItem textureFieldItem;
47315478 private MenuItem gridItem;
47325479 private MenuItem rectoidItem;
47335480 private MenuItem ellipsoidItem;
47345481 private MenuItem coneItem;
47355482 private MenuItem torusItem;
47365483 private MenuItem superItem;
5484
+ private MenuItem kleinItem;
47375485 private MenuItem blobItem;
47385486 private MenuItem latheItem;
47395487 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5488
+ private MenuItem overlayItem;
47415489 private MenuItem meshItem;
47425490 // private MenuItem meshGroupItem;
47435491 private MenuItem springItem;
....@@ -4746,6 +5494,7 @@
47465494 private MenuItem csgItem;
47475495 private MenuItem templateItem;
47485496 private MenuItem textureItem;
5497
+ private MenuItem billboardItem;
47495498 private MenuItem shadowXItem;
47505499 private MenuItem shadowYItem;
47515500 private MenuItem shadowZItem;
....@@ -4758,11 +5507,6 @@
47585507 private MenuItem doubleItem;
47595508 private MenuItem tripleItem;
47605509
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665510 private MenuItem computeAOItem;
47675511 private MenuItem recompileItem;
47685512 private MenuItem editScriptItem;
....@@ -4772,4 +5516,8 @@
47725516 private MenuItem analyzeItem;
47735517 private MenuItem dumpItem;
47745518 //boolean freezemodel = false;
5519
+
5520
+ Menu cameraMenu;
5521
+ MenuItem editCameraItem;
5522
+ MenuItem revertCameraItem;
47755523 }