Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
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 = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", 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(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oneStepButton.setToolTipText("Animate one step forward");
609
+ oneStepButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
612
+ fastCB.setToolTipText("Fast mode");
434613 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);
614
+
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", 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 = new cButton("@", !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 = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Show 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,111 @@
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
+ if (Globals.ADVANCED)
819
+ {
820
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
821
+ lookAtCB.setToolTipText("Look-at target");
822
+ lookAtCB.addItemListener(this);
823
+ }
824
+
825
+ }
826
+
827
+ cGridBag fill = new cGridBag();
828
+
829
+ fill.preferredHeight = 200;
830
+
831
+ panel.add(fill);
832
+
833
+ }
619834
620835 void EditObject(Object3D obj)
621836 {
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();
837
+ cRadio radioButton = new cRadio(obj.name);
838
+
839
+ // Patch to avoid bug with transparency.
840
+ radioButton.hadMaterial = obj.material != null;
841
+ if (!radioButton.hadMaterial)
842
+ {
843
+ obj.material = new cMaterial();
844
+ }
845
+
846
+ radioButton.SetObject(obj);
847
+ radioButton.layout = sevenButton;
848
+ radioButton.SetCamera(cameraView.renderCamera, false);
849
+ radioButton.addActionListener(this);
850
+ radioPanel.add(radioButton);
851
+ buttonGroup.add(radioButton);
852
+ radioButton.doClick();
630853 }
854
+
631855 void SetupViews(ObjEditor oe)
632856 {
857
+ theFrame = this;
858
+
633859 oe.SetupViews();
634860
635861 System.out.println("SetupViews");
....@@ -646,13 +872,16 @@
646872 JCheckBox fastCB;
647873 JCheckBox slowCB;
648874 JCheckBox boxCB;
875
+ JCheckBox zoomBoxCB;
649876 JCheckBox trackCB;
650877 JCheckBox smoothfocusCB;
651878 // JCheckBox speakerMocapCB;
652879 JCheckBox speakerCameraCB;
653880 JCheckBox speakerFocusCB;
654881 JCheckBox debugCB;
882
+
655883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
656885 JCheckBox lookAtCB;
657886
658887 // static int COLOR = 1;
....@@ -688,10 +917,10 @@
688917 dropAttributes |= Object3D.TEXTURE;
689918 else
690919 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
920
+ } else if(e.getSource() == liveCB)
693921 {
694922 cameraView.ToggleLive();
923
+ refreshContents(false);
695924 }
696925 else if(e.getSource() == supportCB)
697926 {
....@@ -727,6 +956,10 @@
727956 cameraView.repaint();
728957 // refreshContents();
729958 }
959
+ else if(e.getSource() == zoomBoxCB)
960
+ {
961
+ cameraView.ToggleZoomBoxMode();
962
+ }
730963 else if(e.getSource() == smoothfocusCB)
731964 {
732965 cameraView.ToggleSmoothFocus();
....@@ -751,6 +984,10 @@
751984 else if(e.getSource() == oeilCB)
752985 {
753986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
754991 }
755992 else if(e.getSource() == lookAtCB)
756993 {
....@@ -840,7 +1077,9 @@
8401077 // objEditor.DropFile((java.io.File[]) object, true);
8411078 // return;
8421079 // }
843
- if (string.charAt(0) == '/')
1080
+
1081
+ // File path for Mac and Windows
1082
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441083 {
8451084 // file(s)
8461085 String[] names = string.split("\n");
....@@ -867,7 +1106,7 @@
8671106
8681107 flashIt = false;
8691108 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1109
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711110 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721111
8731112 if (group.selection.size() == 1)
....@@ -894,11 +1133,11 @@
8941133 {
8951134 loadClipboard(true);
8961135 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
1136
+ pasteInto(false, false);
8981137 } else {
8991138 loadClipboard(false);
9001139 objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
1140
+ pasteInto(false, false); // true); // ???
9021141 }
9031142 }
9041143 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1002,6 +1241,8 @@
10021241
10031242 void buildCreateMenu(Menu menu)
10041243 {
1244
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1245
+ //heightFieldItem.addActionListener(this);
10051246 gridItem = menu.add(new MenuItem("Grid"));
10061247 gridItem.addActionListener(this);
10071248 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,29 +1255,37 @@
10141255 torusItem.addActionListener(this);
10151256 superItem = menu.add(new MenuItem("Superellipsoid"));
10161257 superItem.addActionListener(this);
1258
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1259
+ kleinItem.addActionListener(this);
10171260 particleItem = menu.add(new MenuItem("Particle system"));
10181261 particleItem.addActionListener(this);
1262
+ if (Globals.ADVANCED)
1263
+ {
10191264 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201265 ragdollItem.addActionListener(this);
10211266 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221267 ragdoll2Item.addActionListener(this);
1268
+ }
10231269 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1270
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251271 meshItem.addActionListener(this);
10261272 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271273 // meshGroupItem.addActionListener(this);
1274
+ if (Globals.ADVANCED)
1275
+ {
10281276 springItem = menu.add(new MenuItem("Spring"));
10291277 springItem.addActionListener(this);
10301278 flagItem = menu.add(new MenuItem("Flag"));
10311279 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);
10361280 blobItem = menu.add(new MenuItem("Blob"));
10371281 blobItem.addActionListener(this);
10381282 latheItem = menu.add(new MenuItem("Lathe"));
10391283 latheItem.addActionListener(this);
1284
+ }
1285
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1286
+ bezierItem.addActionListener(this);
1287
+ overlayItem = menu.add(new MenuItem("Overlay"));
1288
+ overlayItem.addActionListener(this);
10401289 lightItem = menu.add(new MenuItem("Light"));
10411290 lightItem.addActionListener(this);
10421291 menu.add("-");
....@@ -1046,46 +1295,44 @@
10461295 loopItem.addActionListener(this);
10471296 doubleItem = menu.add(new MenuItem("Fork"));
10481297 doubleItem.addActionListener(this);
1298
+ if (Globals.ADVANCED)
1299
+ {
10491300 tripleItem = menu.add(new MenuItem("Trident"));
10501301 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);
1302
+ }
10601303 }
10611304
10621305 void buildToolsMenu(Menu menu)
10631306 {
10641307 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651308 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1309
+ animationItem.setState(Globals.ANIMATION);
10671310
10681311 menu.add("-");
10691312 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701313 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1314
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1315
+ textureFieldItem.addActionListener(this);
1316
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721317 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751318 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761319 reduceMorphItem.addActionListener(this);
10771320 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781321 reduce34MorphItem.addActionListener(this);
1079
-
1322
+ menu.add("-");
10801323 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811324 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831325
1326
+ if (Globals.ADVANCED)
1327
+ {
1328
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1329
+ mirrorItem.addActionListener(this);
1330
+ menu.add("-");
10841331 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851332 memoryItem.addActionListener(this);
10861333 menu.add(analyzeItem = new MenuItem("Analyze"));
10871334 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
10891336 dumpItem.addActionListener(this);
10901337 // menu.add(pathItem = new MenuItem("From-to path"));
10911338 // pathItem.addActionListener(this);
....@@ -1094,6 +1341,8 @@
10941341 resetParentItem.addActionListener(this);
10951342 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961343 repairParentItem.addActionListener(this);
1344
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1345
+ repairShadowItem.addActionListener(this);
10971346 menu.add(invariantsItem = new MenuItem("Invariants"));
10981347 invariantsItem.addActionListener(this);
10991348 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1350,7 @@
11011350 menu.add("-");
11021351 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031352 editScriptItem.addActionListener(this);
1353
+ }
11041354 }
11051355
11061356 void ScreenFit()
....@@ -1223,6 +1473,7 @@
12231473 shadow.material = new cMaterial(obj.material);
12241474 shadow.material.diffuse = 0.0001f;
12251475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
12261477
12271478 makeSomething(shadow);
12281479 }
....@@ -1429,9 +1680,9 @@
14291680
14301681 void Overwrite(int mask)
14311682 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1683
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14331684 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1685
+ Object3D content = Grafreed.clipboard.get(0);
14351686
14361687 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371688 content = ((cGroup)content).get(0);
....@@ -1454,6 +1705,7 @@
14541705 //
14551706 public void actionPerformed(ActionEvent event) // , Object arg)
14561707 {
1708
+ Object source = event.getSource();
14571709 /*
14581710 if (event.getSource() == nameField)
14591711 {
....@@ -1465,11 +1717,11 @@
14651717 }
14661718 else
14671719 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1720
+ if (source == lookAtItem || source == lookFromItem)
14691721 {
14701722 ScreenFit();
14711723 } else
1472
- if (event.getSource() == switchItem)
1724
+ if (source == switchItem)
14731725 {
14741726 cVector v1 = new cVector();
14751727 cVector v2 = new cVector();
....@@ -1478,11 +1730,11 @@
14781730 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791731 objEditor.cameraView.repaint();
14801732 } else
1481
- if (event.getSource() == rectoidItem)
1733
+ if (source == rectoidItem)
14821734 {
14831735 makeSomething(new Box());
14841736 } else
1485
- if (event.getSource() == particleItem)
1737
+ if (source == particleItem)
14861738 {
14871739 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881740 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1755,9 @@
15031755 applyExample(particleGeom, "SMOKE");
15041756 makeSomething(particleGeom);
15051757 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1758
+ if (source == ragdollItem || source == ragdoll2Item)
15071759 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1760
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091761
15101762 ragdoll.toParent = LA.newMatrix();
15111763 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1773,71 @@
15211773 makeSomething(ragdoll);
15221774 //makeSomething(new VehicleDemo());
15231775 } else
1524
- if (event.getSource() == gridItem)
1776
+ /*
1777
+ */
1778
+ if (source == heightFieldItem)
1779
+ {
1780
+ Object3D obj = new Object3D();
1781
+
1782
+ obj.CreateMaterial();
1783
+ obj.bRep = new BoundaryRep();
1784
+
1785
+ obj.bRep.CreateMesh(new iHeightField()
1786
+ {
1787
+ public double f(double x, double y)
1788
+ {
1789
+ // The Mandelbrot set is represented by coloring
1790
+ // each point (x,y) according to the number of
1791
+ // iterations it takes before the while loop in
1792
+ // this method ends. For points that are actually
1793
+ // in the Mandelbrot set, or very close to it, the
1794
+ // count will reach the maximum value, 80. These
1795
+ // points will be colored purple. All other colors
1796
+ // represent points that are definitely NOT in the set.
1797
+ x -= 600;
1798
+ y -= 500;
1799
+ x /= 200;
1800
+ y /= 200;
1801
+ int count = 0;
1802
+ double zx = x;
1803
+ double zy = y;
1804
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1805
+ double new_zx = zx*zx - zy*zy + x;
1806
+ zy = 2*zx*zy + y;
1807
+ zx = new_zx;
1808
+ count++;
1809
+ }
1810
+ return count; // Math.sqrt(count);
1811
+ }
1812
+ }, 1000,1000);
1813
+
1814
+ makeSomething(obj);
1815
+ } else
1816
+ if (source == gridItem)
15251817 {
15261818 makeSomething(new Grid());
15271819 } else
1528
- if (event.getSource() == ellipsoidItem)
1820
+ if (source == ellipsoidItem)
15291821 {
15301822 makeSomething(new Sphere());
15311823 } else
1532
- if (event.getSource() == coneItem)
1824
+ if (source == coneItem)
15331825 {
15341826 makeSomething(new Cone());
15351827 } else
1536
- if (event.getSource() == torusItem)
1828
+ if (source == torusItem)
15371829 {
15381830 makeSomething(new Torus());
15391831 } else
1540
- if (event.getSource() == superItem)
1832
+ if (source == superItem)
15411833 {
15421834 makeSomething(new Superellipsoid());
15431835 } else
1544
- if (event.getSource() == blobItem)
1836
+ if (source == kleinItem)
1837
+ {
1838
+ makeSomething(new Klein());
1839
+ } else
1840
+ if (source == blobItem)
15451841 {
15461842 Blob blob = new Blob();
15471843 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1845,15 @@
15491845 //blob.retile();
15501846 makeSomething(blob);
15511847 } else
1552
- if (event.getSource() == latheItem)
1848
+ if (source == latheItem)
15531849 {
15541850 makeSomething(new Lathe());
15551851 } else
1556
- if (event.getSource() == bezierItem)
1852
+ if (source == bezierItem)
15571853 {
15581854 makeSomething(new BezierSurface());
15591855 } else
1560
- if (event.getSource() == checkerItem)
1856
+ if (source == overlayItem)
15611857 {
15621858 /*
15631859 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1866,9 @@
15701866 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711867 LA.matInvert(obj.toParent, obj.fromParent);
15721868 */
1573
- makeSomething(new CheckerIG());
1869
+ makeSomething(new Checker());
15741870 } else
1575
- if (event.getSource() == meshItem)
1871
+ if (source == meshItem)
15761872 {
15771873 Object3D itemtomake = new Object3D();
15781874 Object3D child;
....@@ -1593,35 +1889,35 @@
15931889 makeSomething(child);
15941890 }
15951891 } else
1596
- if (event.getSource() == springItem)
1892
+ if (source == springItem)
15971893 {
15981894 cSpring s = new cSpring();
15991895 s.setup();
16001896 makeSomething(s);
16011897 } else
1602
- if (event.getSource() == flagItem)
1898
+ if (source == flagItem)
16031899 {
16041900 cSpring s = new cFlag();
16051901 s.setup();
16061902 makeSomething(s);
16071903 } else
1608
- if (event.getSource() == lightItem)
1904
+ if (source == lightItem)
16091905 {
16101906 makeSomething(new Light());
16111907 } else
1612
- if (event.getSource() == csgItem)
1908
+ if (source == csgItem)
16131909 {
16141910 group(new CSG());
16151911 } else
1616
- if (event.getSource() == templateItem)
1912
+ if (source == templateItem)
16171913 {
16181914 group(new cTemplate());
16191915 } else
1620
- if (event.getSource() == attributeItem)
1916
+ if (source == attributeItem)
16211917 {
16221918 makeSomething(new Attribute());
16231919 } else
1624
- if (event.getSource() == pointflowItem)
1920
+ if (source == pointflowItem)
16251921 {
16261922 makeSomething(new PointFlow());
16271923 } else
....@@ -1633,7 +1929,7 @@
16331929 } else
16341930 */
16351931
1636
- if (event.getSource() == superLoopItem)
1932
+ if (source == superLoopItem)
16371933 {
16381934 Composite g = new cGroup();
16391935 for (int i=0; i<15; i++)
....@@ -1655,7 +1951,7 @@
16551951
16561952 group(g);
16571953 } else
1658
- if (event.getSource() == loopItem)
1954
+ if (source == loopItem)
16591955 {
16601956 Composite csg = new GroupLeaf();
16611957 csg.count = 5;
....@@ -1664,7 +1960,7 @@
16641960 csg.addChild(child);
16651961 child.addChild(csg);
16661962 } else
1667
- if (event.getSource() == doubleItem)
1963
+ if (source == doubleItem)
16681964 {
16691965 Composite csg = new GroupLeaf();
16701966 csg.count = 5;
....@@ -1676,7 +1972,7 @@
16761972 csg.addChild(child);
16771973 child.addChild(csg);
16781974 } else
1679
- if (event.getSource() == tripleItem)
1975
+ if (source == tripleItem)
16801976 {
16811977 Composite csg = new GroupLeaf();
16821978 csg.count = 4;
....@@ -1691,71 +1987,83 @@
16911987 csg.addChild(child);
16921988 child.addChild(csg);
16931989 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
1990
+ if (source == computeAOItem)
16961991 {
1697
- ImportGFD();
1992
+ Globals.drawMode = CameraPane.OCCLUSION;
1993
+ Globals.theRenderer.repaint();
16981994 } 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)
1995
+ if (source == recompileItem)
17171996 {
17181997 Recompile();
17191998 refreshContents();
17201999 } else
1721
- if (event.getSource() == editScriptItem)
2000
+ if (source == editScriptItem)
17222001 {
17232002 OpenDialog();
17242003 refreshContents();
17252004 } else
1726
- if (event.getSource() == invariantsItem)
2005
+ if (source == invariantsItem)
17272006 {
17282007 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2008
+ Grafreed.grafreeD.universe.invariants();
17302009 } else
1731
- if (event.getSource() == memoryItem)
2010
+ if (source == memoryItem)
17322011 {
17332012 //System.out.println("Invariants:");
17342013 PrintMemory();
17352014 } else
1736
- if (event.getSource() == pathItem)
2015
+ if (source == pathItem)
17372016 {
17382017 PrintPath();
17392018 } else
1740
- if (event.getSource() == analyzeItem)
2019
+ if (source == analyzeItem)
17412020 {
17422021 AnalyzeObject();
17432022 } else
1744
- if (event.getSource() == dumpItem)
2023
+ if (source == dumpItem)
17452024 {
17462025 DumpObject();
17472026 } else
1748
- if (event.getSource() == screenfitButton)
2027
+ if (source == minButton)
2028
+ {
2029
+ Minimize();
2030
+ } else
2031
+ if (source == maxButton)
2032
+ {
2033
+ Maximize();
2034
+ } else
2035
+ if (source == fullButton)
2036
+ {
2037
+ ToggleFullScreen();
2038
+ } else
2039
+ if (source == undoButton)
2040
+ {
2041
+ Undo();
2042
+ } else
2043
+ if (source == redoButton)
2044
+ {
2045
+ Redo();
2046
+ } else
2047
+ if (source == saveButton)
2048
+ {
2049
+ Save();
2050
+ } else
2051
+ if (source == oneStepButton)
2052
+ {
2053
+ Globals.ONESTEP = true;
2054
+ cameraView.repaint();
2055
+ } else
2056
+ if (source == screenfitButton)
17492057 {
17502058 //Reload(lastConverter, lastFilename, true);
17512059 ScreenFit();
17522060 } else
1753
- if (event.getSource() == screenfitpointButton)
2061
+ if (source == screenfitpointButton)
17542062 {
17552063 //Reload(lastConverter, lastFilename, true);
17562064 ScreenFitPoint();
17572065 } else
1758
- if (event.getSource() == snapobjectButton)
2066
+ if (source == snapobjectButton)
17592067 {
17602068 //Reload(lastConverter, lastFilename, true);
17612069 SnapObject();
....@@ -1766,13 +2074,13 @@
17662074 // Recompile();
17672075 // refreshContents();
17682076 // } else
1769
- if (event.getSource() == gcButton)
2077
+ if (source == gcButton)
17702078 {
17712079 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722080 System.gc();
17732081 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742082 } else
1775
- if (event.getSource() == editLeafItem)
2083
+ if (source == editLeafItem)
17762084 {
17772085 Object3D obj;
17782086 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2094,78 @@
17862094 }
17872095 refreshContents(true);
17882096 } else
1789
- if (event.getSource() == openWindowItem)
2097
+ if (source == openWindowItem)
17902098 {
17912099 EditSelection(true);
17922100 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2101
+ if (source == cutItem || source == clearButton)
17942102 {
17952103 loadClipboard(true);
17962104 } else
1797
- if (event.getSource() == duplicateItem)
2105
+ if (source == undoItem)
17982106 {
1799
- Object3D keep = GraphreeD.clipboard;
2107
+ Undo();
2108
+ } else
2109
+ if (source == redoItem)
2110
+ {
2111
+ Redo();
2112
+ } else
2113
+ if (source == duplicateItem)
2114
+ {
2115
+ Object3D keep = Grafreed.clipboard;
18002116 loadClipboard(false);
18012117 paste(false);
1802
- GraphreeD.clipboard = keep;
2118
+ Grafreed.clipboard = keep;
18032119 } else
1804
- if (event.getSource() == cloneItem)
2120
+ if (source == cloneItem)
18052121 {
18062122 CloneSelection(false);
18072123 } else
1808
- if (event.getSource() == cloneSupportItem)
2124
+ if (source == cloneSupportItem)
18092125 {
18102126 CloneSelection(true);
18112127 } else
1812
- if (event.getSource() == copyItem)
2128
+ if (source == copyItem)
18132129 {
18142130 loadClipboard(false);
18152131 } else
1816
- if (event.getSource() == pasteItem)
2132
+ if (source == pasteItem)
18172133 {
18182134 paste(false);
18192135 } else
1820
- if (event.getSource() == pasteLinkItem)
2136
+ if (source == pasteIntoItem)
18212137 {
1822
- pasteInto(false);
2138
+ pasteInto(true, false);
18232139 } else
1824
- if (event.getSource() == pasteCloneItem)
2140
+ if (source == pasteLinkItem)
18252141 {
1826
- pasteInto(true);
2142
+ pasteInto(false, false);
18272143 } else
1828
- if (event.getSource() == pasteExpandItem)
2144
+ if (source == pasteCloneItem)
2145
+ {
2146
+ pasteInto(true, true);
2147
+ } else
2148
+ if (source == pasteExpandItem)
18292149 {
18302150 paste(true);
18312151 } else
1832
- if (event.getSource() == synchronizeItem)
2152
+ if (source == synchronizeItem)
18332153 {
18342154 Overwrite(Object3D.TRANSFORM);
18352155 } else
1836
- if (event.getSource() == overwriteNameItem)
2156
+ if (source == overwriteNameItem)
18372157 {
18382158 Overwrite(Object3D.NAME);
18392159 } else
1840
- if (event.getSource() == overwriteUVItem)
2160
+ if (source == overwriteUVItem)
18412161 {
18422162 Overwrite(Object3D.UV);
18432163 } else
1844
- if (event.getSource() == overwriteMatItem)
2164
+ if (source == overwriteMatItem)
18452165 {
2166
+ /* july 2015
18462167 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2168
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482169 else
18492170 {
18502171 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2177,16 @@
18562177 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572178 }
18582179 }
2180
+ */
2181
+
2182
+ Overwrite(dropAttributes);
18592183 }
1860
- if (event.getSource() == overwriteGeoItem)
2184
+ if (source == overwriteGeoItem)
18612185 {
18622186 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2187
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642188 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2189
+// Object3D content = GrafreeD.clipboard.get(0);
18662190 //
18672191 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682192 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2198,7 @@
18742198 // refreshContents();
18752199 // }
18762200 } else
1877
- if (event.getSource() == generateMeshItem)
2201
+ if (source == generateMeshItem)
18782202 {
18792203 //if (group.selection.size() == 1)
18802204 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2209,7 @@
18852209 ResetModel();
18862210 refreshContents();
18872211 } else
1888
- if (event.getSource() == extractGeometriesItem)
2212
+ if (source == extractGeometriesItem)
18892213 {
18902214 boolean one = false;
18912215
....@@ -1912,7 +2236,7 @@
19122236 ResetModel();
19132237 refreshContents();
19142238 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2239
+ if (source == cloneGeometriesItem)
19162240 {
19172241 boolean one = false;
19182242
....@@ -1938,32 +2262,37 @@
19382262 ResetModel();
19392263 refreshContents();
19402264 } else
1941
- if (event.getSource() == shareGeometriesItem)
2265
+ if (source == shareGeometriesItem)
19422266 {
19432267 boolean one = false;
19442268
19452269 if (group.selection.size() == 1)
19462270 one = true;
19472271
2272
+ Object3D merge = null;
2273
+
19482274 Object3D content = new cGroup();
19492275
19502276 for (int i=0; i<group.selection.size(); i++)
19512277 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2278
+ merge = new Merge(group.selection.get(i));
19532279
19542280 if (one)
1955
- makeSomething(sel, false);
2281
+ makeSomething(merge, false);
19562282 else
1957
- content.addChild(sel);
2283
+ content.addChild(merge);
19582284 }
19592285
19602286 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2287
+ makeSomething(content, true);
2288
+ else
2289
+ {
2290
+ ResetModel();
2291
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2292
+ refreshContents();
2293
+ }
19652294 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2295
+ if (source == mergeGeometriesItem)
19672296 {
19682297 boolean one = false;
19692298
....@@ -1993,11 +2322,11 @@
19932322 ResetModel();
19942323 refreshContents();
19952324 } else
1996
- if (event.getSource() == linkverticesItem)
2325
+ if (source == linkverticesItem)
19972326 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2327
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992328 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2329
+// Object3D content = GrafreeD.clipboard.get(0);
20012330 //
20022331 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032332 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2335,48 @@
20062335 // group.selection.get(0).setMasterThis(content); // should be identity
20072336 // refreshContents();
20082337 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2338
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102339 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
20122341
20132342 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142343 content = ((cGroup)content).get(0);
20152344
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2345
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172346 for (int i=0; i<group.selection.size(); i++)
20182347 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2348
+ boolean random = CameraPane.SWITCH;
2349
+ CameraPane.SWITCH = false; // parse all random nodes
20212350 group.selection.get(i).linkVerticesThis(content);
20222351 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2352
+ CameraPane.SWITCH = random;
20242353 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2354
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262355 refreshContents();
20272356 }
20282357 } else
2029
- if (event.getSource() == resetsupportItem)
2358
+ if (source == resetsupportItem)
20302359 {
20312360 for (int i=0; i<group.selection.size(); i++)
20322361 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2362
+ boolean random = CameraPane.SWITCH;
2363
+ CameraPane.SWITCH = false; // parse all random nodes
20352364 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2365
+ CameraPane.SWITCH = random;
20372366 }
20382367
20392368 refreshContents();
20402369 } else
2041
- if (event.getSource() == resetreferencesItem)
2370
+ if (source == relinkverticesItem)
2371
+ {
2372
+ boolean random = CameraPane.SWITCH;
2373
+ CameraPane.SWITCH = false; // parse all random nodes
2374
+ group.selection.RelinkToSupport();
2375
+ CameraPane.SWITCH = random;
2376
+
2377
+ refreshContents();
2378
+ } else
2379
+ if (source == resetreferencesItem)
20422380 {
20432381 for (int i=0; i<group.selection.size(); i++)
20442382 {
....@@ -2047,11 +2385,11 @@
20472385
20482386 refreshContents();
20492387 } else
2050
- if (event.getSource() == setMasterItem)
2388
+ if (source == setMasterItem)
20512389 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2390
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532391 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2392
+ Object3D content = Grafreed.clipboard.get(0);
20552393
20562394 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572395 content = ((cGroup)content).get(0);
....@@ -2060,13 +2398,13 @@
20602398 refreshContents();
20612399 }
20622400 } else
2063
- if (event.getSource() == poseMeshItem)
2401
+ if (source == poseMeshItem)
20642402 {
20652403 if (group.selection.size() == 1)
20662404 {
2067
- if (GraphreeD.clipboard.size() == 1)
2405
+ if (Grafreed.clipboard.size() == 1)
20682406 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2407
+ Object3D content = Grafreed.clipboard.get(0);
20702408
20712409 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722410 content = ((cGroup)content).get(0);
....@@ -2079,19 +2417,19 @@
20792417 }
20802418
20812419 } else
2082
- if (event.getSource() == revertMeshItem)
2420
+ if (source == revertMeshItem)
20832421 {
20842422 RevertMeshes();
20852423 } else
2086
- if (event.getSource() == resetMeshItem)
2424
+ if (source == resetAllItem)
20872425 {
20882426 ResetAll();
20892427 } else
2090
- if (event.getSource() == stepAllItem)
2428
+ if (source == stepAllItem)
20912429 {
20922430 StepAll();
20932431 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2432
+ if (source == clearItem) // || event.getSource() == clearButton)
20952433 {
20962434 //int indices[] = jList.getSelectedIndices();
20972435 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2437,46 @@
20992437
21002438 ClearSelection(false);
21012439 } else
2102
- if (event.getSource() == clearAllItem)
2440
+ if (source == clearAllItem)
21032441 {
21042442 ClearSelection(true);
21052443 } else
2106
- if (event.getSource() == grabItem)
2444
+ if (source == grabItem)
21072445 {
21082446 group(new cGroup(), true);
21092447 } else
2110
- if (event.getSource() == frontItem)
2448
+ if (source == hideItem)
2449
+ {
2450
+ group(new HiddenObject());
2451
+ } else
2452
+ if (source == frontItem)
21112453 {
21122454 front();
21132455 } else
2114
- if (event.getSource() == backItem)
2456
+ if (source == backItem)
21152457 {
21162458 back();
21172459 } else
2118
- if (event.getSource() == cameraItem)
2460
+ if (source == cameraItem)
21192461 {
21202462 makeSomething(new Camera());
21212463 } else
2122
- if (event.getSource() == compositeItem)
2464
+ if (source == compositeItem)
21232465 {
21242466 group(new Composite());
21252467 } else
2126
- if (event.getSource() == randomItem)
2468
+ if (source == randomItem)
21272469 {
21282470 RandomNode random = new RandomNode();
21292471 group(random);
21302472 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2473
+ random.name = random.get(0).name + "Switch";
21322474 } else
2133
- if (event.getSource() == physicsItem)
2475
+ if (source == physicsItem)
21342476 {
21352477 group(new PhysicsNode());
21362478 } else
2137
- if (event.getSource() == frameselectorItem)
2479
+ if (source == frameselectorItem)
21382480 {
21392481 for (int i=0; i<group.selection.size(); i++)
21402482 {
....@@ -2146,7 +2488,7 @@
21462488 ResetModel();
21472489 refreshContents();
21482490 } else
2149
- if (event.getSource() == switchGeoItem)
2491
+ if (source == switchGeoItem)
21502492 {
21512493 for (int i=0; i<group.selection.size(); i++)
21522494 {
....@@ -2158,7 +2500,7 @@
21582500 ResetModel();
21592501 refreshContents();
21602502 } else
2161
- if (event.getSource() == switchTransfoItem)
2503
+ if (source == switchTransfoItem)
21622504 {
21632505 for (int i=0; i<group.selection.size(); i++)
21642506 {
....@@ -2170,7 +2512,7 @@
21702512 ResetModel();
21712513 refreshContents();
21722514 } else
2173
- if (event.getSource() == morphItem)
2515
+ if (source == morphItem)
21742516 {
21752517 for (int i=0; i<group.selection.size(); i++)
21762518 {
....@@ -2182,7 +2524,7 @@
21822524 ResetModel();
21832525 refreshContents();
21842526 } else
2185
- if (event.getSource() == scriptNodeItem)
2527
+ if (source == scriptNodeItem)
21862528 {
21872529 boolean atleastone = false;
21882530
....@@ -2221,191 +2563,239 @@
22212563 }
22222564 }
22232565 } else
2224
- if (event.getSource() == linkerItem)
2566
+ if (source == linkerItem)
22252567 {
22262568 group(new cLinker());
22272569 } else
2228
- if (event.getSource() == textureItem)
2570
+ if (source == textureItem)
22292571 {
22302572 group(new TextureNode());
22312573 } else
2232
- if (event.getSource() == shadowXItem)
2574
+ if (source == billboardItem)
2575
+ {
2576
+ group(new BillboardNode());
2577
+ } else
2578
+ if (source == shadowXItem)
22332579 {
22342580 CastShadow(0);
22352581 } else
2236
- if (event.getSource() == shadowYItem)
2582
+ if (source == shadowYItem)
22372583 {
22382584 CastShadow(1);
22392585 } else
2240
- if (event.getSource() == shadowZItem)
2586
+ if (source == shadowZItem)
22412587 {
22422588 CastShadow(2);
22432589 } else
2244
- if (event.getSource() == ungroupItem)
2590
+ if (source == ungroupItem)
22452591 {
2246
- ungroup();
2592
+ //ungroup();
2593
+ for (int i=0; i<group.selection.size(); i++)
2594
+ {
2595
+ Ungroup(group.selection.get(i));
2596
+ }
2597
+
2598
+ ClearSelection(false);
2599
+
2600
+ refreshContents();
22472601 } else
2248
- if (event.getSource() == genUVItem)
2602
+ if (source == genUVItem)
22492603 {
22502604 GenUV();
22512605 } else
2252
- if (event.getSource() == genNormalsCADItem)
2606
+ if (source == genNormalsCADItem)
22532607 {
22542608 GenNormals(true);
22552609 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2610
+ if (source == genNormalsMESHItem)
2611
+ {
2612
+ GenNormalsMESH();
2613
+ } else
2614
+ if (source == genNormalsORGANItem)
22572615 {
22582616 GenNormals(false);
22592617 } else
2260
- if (event.getSource() == stripifyItem)
2618
+ if (source == genNormalsMINEItem)
2619
+ {
2620
+ GenNormalsMINE();
2621
+ } else
2622
+ if (source == stripifyItem)
22612623 {
22622624 Stripify();
22632625 } else
2264
- if (event.getSource() == unstripifyItem)
2626
+ if (source == unstripifyItem)
22652627 {
22662628 Unstripify();
22672629 } else
2268
- if (event.getSource() == trimItem)
2630
+ if (source == trimItem)
22692631 {
22702632 Trim();
22712633 } else
2272
- if (event.getSource() == untrimItem)
2634
+ if (source == untrimItem)
22732635 {
22742636 Untrim();
22752637 } else
2276
- if (event.getSource() == clearColorsItem)
2638
+ if (source == clearColorsItem)
22772639 {
22782640 ClearColors();
22792641 } else
2280
- if (event.getSource() == clearMaterialsItem)
2642
+ if (source == clearMaterialsItem)
22812643 {
22822644 ClearMaterials();
22832645 } else
2284
- if (event.getSource() == liveleavesItem)
2646
+ if (source == liveleavesItem)
22852647 {
22862648 LiveLeaves(true);
22872649 } else
2288
- if (event.getSource() == unliveleavesItem)
2650
+ if (source == unliveleavesItem)
22892651 {
22902652 LiveLeaves(false);
22912653 } else
2292
- if (event.getSource() == supportleavesItem)
2654
+ if (source == supportleavesItem)
22932655 {
22942656 SupportLeaves(true);
22952657 } else
2296
- if (event.getSource() == unsupportleavesItem)
2658
+ if (source == unsupportleavesItem)
22972659 {
22982660 SupportLeaves(false);
22992661 } else
2300
- if (event.getSource() == hideleavesItem)
2662
+ if (source == hideleavesItem)
23012663 {
23022664 HideLeaves(true);
23032665 } else
2304
- if (event.getSource() == showleavesItem)
2666
+ if (source == showleavesItem)
23052667 {
23062668 HideLeaves(false);
23072669 } else
2308
- if (event.getSource() == markleavesItem)
2670
+ if (source == markleavesItem)
23092671 {
23102672 MarkLeaves(true);
23112673 } else
2312
- if (event.getSource() == unmarkleavesItem)
2674
+ if (source == unmarkleavesItem)
23132675 {
23142676 MarkLeaves(false);
23152677 } else
2316
- if (event.getSource() == flipVItem)
2678
+ if (source == rewindleavesItem)
2679
+ {
2680
+ RewindLeaves(true);
2681
+ } else
2682
+ if (source == unrewindleavesItem)
2683
+ {
2684
+ RewindLeaves(false);
2685
+ } else
2686
+ if (source == randomleavesItem)
2687
+ {
2688
+ RandomLeaves(true);
2689
+ } else
2690
+ if (source == unrandomleavesItem)
2691
+ {
2692
+ RandomLeaves(false);
2693
+ } else
2694
+ if (source == flipVItem)
23172695 {
23182696 FlipV(true);
23192697 } else
2320
- if (event.getSource() == unflipVItem)
2698
+ if (source == unflipVItem)
23212699 {
23222700 FlipV(false);
23232701 } else
2324
- if (event.getSource() == lowTexturesItem)
2702
+ if (source == lowTexturesItem)
23252703 {
23262704 SetTexRes(0);
23272705 } else
2328
- if (event.getSource() == normalTexturesItem)
2706
+ if (source == normalTexturesItem)
23292707 {
23302708 SetTexRes(1);
23312709 } else
2332
- if (event.getSource() == highTexturesItem)
2710
+ if (source == highTexturesItem)
23332711 {
23342712 SetTexRes(2);
23352713 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2714
+ if (source == veryhighTexturesItem)
23372715 {
23382716 SetTexRes(3);
23392717 } else
2340
- if (event.getSource() == maxTexturesItem)
2718
+ if (source == maxTexturesItem)
23412719 {
23422720 SetTexRes(4);
23432721 } else
2344
- if (event.getSource() == panoTexturesItem)
2722
+ if (source == panoTexturesItem)
23452723 {
23462724 SetTexRes(5);
23472725 } else
2348
- if (event.getSource() == reverseNormalsItem)
2726
+ if (source == reverseNormalsItem)
23492727 {
23502728 ReverseNormals();
23512729 } else
2352
- if (event.getSource() == parseverticesItem)
2730
+ if (source == parseverticesItem)
23532731 {
23542732 ParseVertices();
23552733 } else
2356
- if (event.getSource() == alignItem)
2734
+ if (source == textureFieldItem)
2735
+ {
2736
+ TextureVertices();
2737
+ } else
2738
+ if (source == alignItem)
23572739 {
23582740 Align();
23592741 } else
2360
- if (event.getSource() == mirrorItem)
2742
+ if (source == mirrorItem)
23612743 {
23622744 MirrorPoses();
23632745 } else
2364
- if (event.getSource() == reduceMorphItem)
2746
+ if (source == reduceMorphItem)
23652747 {
23662748 MeshReduction(false);
23672749 } else
2368
- if (event.getSource() == reduce34MorphItem)
2750
+ if (source == reduce34MorphItem)
23692751 {
23702752 MeshReduction(true);
23712753 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2754
+ if (source == reverseTrianglesItem)
23732755 {
23742756 ReverseTriangles();
23752757 } else
2376
- if (event.getSource() == reduceMeshItem)
2758
+ if (source == reduceMeshItem)
23772759 {
23782760 ReduceMesh(false);
23792761 } else
2380
- if (event.getSource() == reduce34MeshItem)
2762
+ if (source == reduce34MeshItem)
23812763 {
23822764 ReduceMesh(true);
23832765 } else
2384
- if (event.getSource() == increaseMeshItem)
2766
+ if (source == increaseMeshItem)
23852767 {
23862768 IncreaseMesh();
23872769 } else
2388
- if (event.getSource() == clipMeshItem)
2770
+ if (source == clipMeshItem)
23892771 {
23902772 ClipMesh();
23912773 } else
2392
- if (event.getSource() == smoothMeshItem)
2774
+ if (source == smoothMeshItem)
23932775 {
23942776 SmoothMesh();
23952777 } else
2396
- if (event.getSource() == transformgeometryItem)
2778
+ if (source == transformGeometryItem)
23972779 {
23982780 TransformGeometry();
23992781 } else
2400
- if (event.getSource() == resetTransformItem)
2782
+ if (source == transformChildrenItem)
2783
+ {
2784
+ TransformChildren();
2785
+ } else
2786
+ if (source == resetTransformItem)
24012787 {
24022788 ResetTransform();
24032789 } else
2404
- if (event.getSource() == resetCentroidItem)
2790
+ if (source == resetCentroidItem)
24052791 {
2406
- ResetCentroid();
2792
+ ResetCentroid(true);
24072793 } else
2408
- if (event.getSource() == resetParentItem)
2794
+ if (source == resetCentroidXZItem)
2795
+ {
2796
+ ResetCentroid(false);
2797
+ } else
2798
+ if (source == resetParentItem)
24092799 {
24102800 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112801 {
....@@ -2415,7 +2805,7 @@
24152805
24162806 refreshContents();
24172807 } else
2418
- if (event.getSource() == repairParentItem)
2808
+ if (source == repairParentItem)
24192809 {
24202810 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212811 {
....@@ -2429,7 +2819,21 @@
24292819
24302820 refreshContents();
24312821 } else
2432
- if (event.getSource() == sortbysizeItem)
2822
+ if (source == repairShadowItem)
2823
+ {
2824
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2825
+ {
2826
+ Object3D obj = (Object3D)e.nextElement();
2827
+ obj.RepairShadow();
2828
+// for (int i=0; i<obj.size(); i++)
2829
+// {
2830
+// obj.get(i).parent = obj;
2831
+// }
2832
+ }
2833
+
2834
+ refreshContents();
2835
+ } else
2836
+ if (source == sortbysizeItem)
24332837 {
24342838 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352839 {
....@@ -2441,7 +2845,7 @@
24412845 ResetModel();
24422846 refreshContents();
24432847 } else
2444
- if (event.getSource() == sortbynameItem)
2848
+ if (source == sortbynameItem)
24452849 {
24462850 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472851 {
....@@ -2453,7 +2857,7 @@
24532857 ResetModel();
24542858 refreshContents();
24552859 } else
2456
- if (event.getSource() == attachPigmentItem)
2860
+ if (source == attachPigmentItem)
24572861 {
24582862 String texture = GetFile("Attach pigment");
24592863 Object3D obj;
....@@ -2465,7 +2869,7 @@
24652869
24662870 refreshContents();
24672871 } else
2468
- if (event.getSource() == detachPigmentItem)
2872
+ if (source == detachPigmentItem)
24692873 {
24702874 Object3D obj;
24712875 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2880,7 @@
24762880
24772881 refreshContents();
24782882 } else
2479
- if (event.getSource() == attachBumpItem)
2883
+ if (source == attachBumpItem)
24802884 {
24812885 String texture = GetFile("Attach bump");
24822886 Object3D obj;
....@@ -2488,7 +2892,7 @@
24882892
24892893 refreshContents();
24902894 } else
2491
- if (event.getSource() == detachBumpItem)
2895
+ if (source == detachBumpItem)
24922896 {
24932897 Object3D obj;
24942898 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2903,7 @@
24992903
25002904 refreshContents();
25012905 } else
2502
- if (event.getSource() == pigmentBumpItem)
2906
+ if (source == pigmentBumpItem)
25032907 {
25042908 Object3D obj;
25052909 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2914,221 @@
25102914
25112915 refreshContents();
25122916 } else
2513
- if (event.getSource() == flashSelectionButton)
2917
+ if (source == flashSelectionButton)
25142918 {
25152919 CameraPane.flash = true;
25162920 refreshContents();
25172921 } else
2518
- if (event.getSource() == oneButton)
2922
+ if (source == oneButton)
25192923 {
25202924 } else
2521
- if (event.getSource() == twoButton)
2925
+ if (source == twoButton)
25222926 {
25232927 radio.layout = twoButton;
25242928 // bug
25252929 //gridPanel.setDividerLocation(1.0);
25262930 //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();
2931
+// bigThree.remove(scenePanel);
2932
+// bigThree.remove(centralPanel);
2933
+// bigThree.remove(XYZPanel);
2934
+// aWindowConstraints.gridx = 0;
2935
+// aWindowConstraints.gridy = 0;
2936
+// aWindowConstraints.gridwidth = 1;
2937
+// // aConstraints.gridheight = 3;
2938
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2939
+// aWindowConstraints.weightx = 0;
2940
+// aWindowConstraints.weighty = 1;
2941
+// //bigThree.add(jtp, aWindowConstraints);
2942
+// aWindowConstraints.weightx = 1;
2943
+// aWindowConstraints.gridwidth = 3;
2944
+// // aConstraints.gridheight = 3;
2945
+// aWindowConstraints.gridx = 1;
2946
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2947
+// bigThree.add(centralPanel, aWindowConstraints);
2948
+// aWindowConstraints.weightx = 0;
2949
+// aWindowConstraints.gridx = 4;
2950
+// aWindowConstraints.gridwidth = 1;
2951
+// // aConstraints.gridheight = 3;
2952
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2953
+// //bigThree.add(XYZPanel, aWindowConstraints);
2954
+// scenePanel.setVisible(false);
2955
+// centralPanel.setVisible(true);
2956
+// XYZPanel.setVisible(false);
2957
+ bigThree.ClearUI();
2958
+ bigThree.add(centralPanel);
2959
+ bigThree.FlushUI();
2960
+
2961
+ cameraView.requestFocusInWindow();
2962
+
2963
+// refreshContents(true);
2964
+//
2965
+// try
2966
+// {
2967
+// java.awt.Robot bot = new java.awt.Robot();
2968
+// int mask = InputEvent.BUTTON1_MASK;
2969
+// bot.mouseMove(100, 100);
2970
+// bot.mousePress(mask);
2971
+// bot.mouseRelease(mask);
2972
+// }
2973
+// catch (Exception e)
2974
+// {
2975
+//
2976
+// }
2977
+
25512978 } else
2552
- if (event.getSource() == threeButton)
2979
+ if (source == threeButton)
25532980 {
25542981 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();
2982
+
2983
+// bigThree.remove(scenePanel);
2984
+// bigThree.remove(centralPanel);
2985
+// bigThree.remove(XYZPanel);
2986
+// aWindowConstraints.gridx = 0;
2987
+// aWindowConstraints.gridy = 0;
2988
+// aWindowConstraints.gridwidth = 1;
2989
+// // aConstraints.gridheight = 3;
2990
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2991
+// aWindowConstraints.weightx = 0;
2992
+// aWindowConstraints.weighty = 1;
2993
+// //bigThree.add(jtp, aWindowConstraints);
2994
+// aWindowConstraints.weightx = 1;
2995
+// aWindowConstraints.gridwidth = 3;
2996
+// // aConstraints.gridheight = 3;
2997
+// aWindowConstraints.gridx = 1;
2998
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2999
+// bigThree.add(centralPanel, aWindowConstraints);
3000
+// aWindowConstraints.weightx = 0;
3001
+// aWindowConstraints.gridx = 4;
3002
+// aWindowConstraints.gridwidth = 1;
3003
+// // aConstraints.gridheight = 3;
3004
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3005
+// bigThree.add(XYZPanel, aWindowConstraints);
3006
+// bigThree.validate();
3007
+// scenePanel.setVisible(false);
3008
+// centralPanel.setVisible(true);
3009
+// XYZPanel.setVisible(true);
3010
+ bigThree.ClearUI();
3011
+ bigThree.add(centralPanel);
3012
+ bigThree.add(XYZPanel);
3013
+ bigThree.FlushUI();
3014
+
3015
+ cameraView.requestFocusInWindow();
25793016 } else
2580
- if (event.getSource() == fourButton)
3017
+ if (source == fourButton)
25813018 {
25823019 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();
3020
+
3021
+// bigThree.remove(scenePanel);
3022
+// bigThree.remove(centralPanel);
3023
+// bigThree.remove(XYZPanel);
3024
+// aWindowConstraints.gridx = 0;
3025
+// aWindowConstraints.gridy = 0;
3026
+// aWindowConstraints.gridwidth = 1;
3027
+// // aWindowConstraints.gridheight = 3;
3028
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3029
+// aWindowConstraints.weightx = 1;
3030
+// aWindowConstraints.weighty = 1;
3031
+// bigThree.add(scenePanel, aWindowConstraints);
3032
+// aWindowConstraints.weightx = 1;
3033
+// aWindowConstraints.gridwidth = 3;
3034
+// // aConstraints.gridheight = 3;
3035
+// aWindowConstraints.gridx = 1;
3036
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3037
+// //bigThree.add(cameraPanel, aWindowConstraints);
3038
+// aWindowConstraints.weightx = 0;
3039
+// aWindowConstraints.gridx = 4;
3040
+// aWindowConstraints.gridwidth = 1;
3041
+// // aWindowConstraints.gridheight = 3;
3042
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3043
+// //bigThree.add(XYZPanel, aWindowConstraints);
3044
+// bigThree.validate();
3045
+// scenePanel.setVisible(true);
3046
+// centralPanel.setVisible(false);
3047
+// XYZPanel.setVisible(false);
3048
+ bigThree.ClearUI();
3049
+ bigThree.add(scenePanel);
3050
+ bigThree.FlushUI();
3051
+
3052
+ cameraView.requestFocusInWindow();
26073053 } else
2608
- if (event.getSource() == sixButton)
3054
+ if (source == sixButton)
26093055 {
26103056 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();
3057
+
3058
+// bigThree.remove(scenePanel);
3059
+// bigThree.remove(centralPanel);
3060
+// bigThree.remove(XYZPanel);
3061
+// aWindowConstraints.gridx = 0;
3062
+// aWindowConstraints.gridy = 0;
3063
+// aWindowConstraints.gridwidth = 1;
3064
+// // aConstraints.gridheight = 3;
3065
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3066
+// aWindowConstraints.weightx = 0;
3067
+// aWindowConstraints.weighty = 1;
3068
+// bigThree.add(scenePanel, aWindowConstraints);
3069
+// aWindowConstraints.weightx = 1;
3070
+// aWindowConstraints.gridwidth = 3;
3071
+// // aWindowConstraints.gridheight = 3;
3072
+// aWindowConstraints.gridx = 1;
3073
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3074
+// bigThree.add(centralPanel, aWindowConstraints);
3075
+// aWindowConstraints.weightx = 0;
3076
+// aWindowConstraints.gridx = 4;
3077
+// aWindowConstraints.gridwidth = 1;
3078
+// // aWindowConstraints.gridheight = 3;
3079
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3080
+// //bigThree.add(XYZPanel, aConstraints);
3081
+// bigThree.validate();
3082
+// scenePanel.setVisible(true);
3083
+// centralPanel.setVisible(true);
3084
+// XYZPanel.setVisible(false);
3085
+ bigThree.ClearUI();
3086
+ bigThree.add(scenePanel);
3087
+ bigThree.add(centralPanel);
3088
+ bigThree.FlushUI();
3089
+
3090
+ cameraView.requestFocusInWindow();
26353091 } else
2636
- if (event.getSource() == sevenButton)
3092
+ if (source == sevenButton)
26373093 {
26383094 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();
3095
+
3096
+// bigThree.remove(scenePanel);
3097
+// bigThree.remove(centralPanel);
3098
+// bigThree.remove(XYZPanel);
3099
+// aWindowConstraints.gridx = 0;
3100
+// aWindowConstraints.gridy = 0;
3101
+// aWindowConstraints.gridwidth = 1;
3102
+// // aWindowConstraints.gridheight = 3;
3103
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3104
+// aWindowConstraints.weightx = 0;
3105
+// aWindowConstraints.weighty = 1;
3106
+// bigThree.add(scenePanel, aWindowConstraints);
3107
+// aWindowConstraints.weightx = 1;
3108
+// aWindowConstraints.gridwidth = 3;
3109
+// // aWindowConstraints.gridheight = 3;
3110
+// aWindowConstraints.gridx = 1;
3111
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3112
+// bigThree.add(centralPanel, aWindowConstraints);
3113
+// aWindowConstraints.weightx = 0;
3114
+// aWindowConstraints.gridx = 4;
3115
+// aWindowConstraints.gridwidth = 1;
3116
+// // aConstraints.gridheight = 3;
3117
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3118
+// bigThree.add(XYZPanel, aWindowConstraints);
3119
+// bigThree.validate();
3120
+// scenePanel.setVisible(true);
3121
+// centralPanel.setVisible(true);
3122
+// XYZPanel.setVisible(true);
3123
+ bigThree.ClearUI();
3124
+ bigThree.add(scenePanel);
3125
+ bigThree.add(centralPanel);
3126
+ bigThree.add(XYZPanel);
3127
+ bigThree.FlushUI();
3128
+
3129
+ cameraView.requestFocusInWindow();
26633130 } else
2664
- if (event.getSource() == rootButton)
3131
+ if (source == rootButton)
26653132 {
26663133 Object3D obj;
26673134 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,17 +3138,24 @@
26713138 EditObject(obj);
26723139 }
26733140
3141
+ cameraView.requestFocusInWindow();
26743142 refreshContents(true);
26753143 } else
2676
- if (event.getSource() == closeButton)
3144
+ if (source == closeButton)
26773145 {
26783146 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793147 cRadio ab;
26803148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813149 {
26823150 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
26853159 buttonGroup.remove(ab);
26863160 radioPanel.remove(ab);
26873161
....@@ -2692,13 +3166,15 @@
26923166 break;
26933167 }
26943168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
26953171 refreshContents(true);
26963172 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3173
+ if (source == editItem || source == editButton)
26983174 {
26993175 EditSelection(false);
27003176 } else
2701
- if (event.getSource() == uneditButton)
3177
+ if (source == uneditButton)
27023178 {
27033179 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043180 {
....@@ -2708,14 +3184,14 @@
27083184 child.CloseUI();
27093185 listUI.remove(child);
27103186
2711
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
27123188 }
2713
- objEditor.ctrlPanel.revalidate();
3189
+ objEditor.ctrlPanel.FlushUI();
27143190 //objEditor.jTree.clearSelection();
27153191 //objEditor.ResetSliders();
27163192 refreshContents(true);
27173193 } else
2718
- if (event.getSource() == clearPanelButton)
3194
+ if (source == clearPanelButton)
27193195 {
27203196 assert(copy == group);
27213197 //copy.ClearUI();
....@@ -2726,7 +3202,7 @@
27263202 listUI.clear();
27273203 refreshContents(true);
27283204 } else
2729
- if (event.getSource() == allParamsButton)
3205
+ if (source == allParamsButton)
27303206 {
27313207 assert(copy == group);
27323208
....@@ -2747,19 +3223,19 @@
27473223
27483224 refreshContents(true);
27493225 } else
2750
- if (event.getSource() == unselectButton)
3226
+ if (source == unselectButton)
27513227 {
27523228 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3229
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543230 objEditor.ResetSliders();
27553231 refreshContents(true);
27563232 } else
2757
- if(event.getSource() instanceof cRadio)
3233
+ if(source instanceof cRadio)
27583234 {
27593235 group.parent = keepparent;
27603236 group.attributes = 0;
27613237 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3238
+ /*cRadio*/ radio = (cRadio)source;
27633239 Object3D obj = radio.GetObject();
27643240 System.out.println("Edit " + obj);
27653241 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3255,7 @@
27793255 }
27803256
27813257 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3258
+ //Globals.theRenderer.object = group;
27833259 if(!useclient)
27843260 {
27853261 cameraView.renderCamera = radio.camera;
....@@ -2788,12 +3264,16 @@
27883264 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893265 cameraView.targetLookAt.set(radio.camera.lookAt);
27903266 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3267
+ //cameraView.lighttouched = true;
3268
+ Globals.lighttouched = true;
27923269 topView.object = group;
27933270 frontView.object = group;
27943271 sideView.object = group;
27953272 }
2796
- group.editWindow = this;
3273
+
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
3276
+
27973277 /*
27983278 currentLayout = radio.layout;
27993279 if (currentLayout == null)
....@@ -2805,8 +3285,23 @@
28053285 //group.parent = null; // ROOT
28063286 //group.attributes = -1;
28073287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
28083290 refreshContents(true);
2809
- }
3291
+ } else if (event.getSource() == editCameraItem)
3292
+ {
3293
+ cameraView.ProtectCamera();
3294
+ cameraView.repaint();
3295
+ return;
3296
+ } else if (event.getSource() == revertCameraItem)
3297
+ {
3298
+ cameraView.RevertCamera();
3299
+ cameraView.repaint();
3300
+ return;
3301
+ // } else if (event.getSource() == textureButton)
3302
+ // {
3303
+ // return; // true;
3304
+ }
28103305 else
28113306 {
28123307 //return super.action(event, arg);
....@@ -2815,7 +3310,6 @@
28153310 }
28163311
28173312 boolean useclient = false;
2818
- cRadio radio;
28193313
28203314 void ToggleRoot()
28213315 {
....@@ -2824,7 +3318,7 @@
28243318 if (useclient)
28253319 {
28263320 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3321
+ Globals.lighttouched = true;
28283322 //topView.object = client;
28293323 //frontView.object = client;
28303324 //sideView.object = client;
....@@ -2832,7 +3326,7 @@
28323326 else
28333327 {
28343328 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3329
+ Globals.lighttouched = true;
28363330 //topView.object = group;
28373331 //frontView.object = group;
28383332 //sideView.object = group;
....@@ -2867,6 +3361,28 @@
28673361 refreshContents();
28683362 }
28693363
3364
+ void TransformChildren()
3365
+ {
3366
+ Object3D obj;
3367
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3368
+ {
3369
+ obj = (Object3D)e.nextElement();
3370
+ obj.KeepTextureMatrices();
3371
+ obj.TransformChildren();
3372
+ obj.RestoreTextureMatrices();
3373
+
3374
+// if (obj.parent == null)
3375
+// {
3376
+// System.out.println("NULL PARENT!");
3377
+// new Exception().printStackTrace();
3378
+// }
3379
+// else
3380
+// TouchTransform(obj);
3381
+// //obj.parent.Touch();
3382
+ }
3383
+
3384
+ refreshContents();
3385
+ }
28703386
28713387 void ResetTransform()
28723388 {
....@@ -2979,7 +3495,7 @@
29793495 refreshContents();
29803496 }
29813497
2982
- void ResetCentroid()
3498
+ void ResetCentroid(boolean full)
29833499 {
29843500 Object3D obj;
29853501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +3510,16 @@
29943510 LA.matIdentity(Object3D.mat);
29953511 obj.getBounds(minima, maxima, false);
29963512 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3513
+ if (full)
3514
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29983515 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29993516 obj.TransformMesh(Object3D.mat);
3517
+
30003518 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3519
+ if (full)
3520
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30023521 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3522
+
30033523 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30043524 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30053525 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +3548,8 @@
30283548
30293549 int size = obj.MemorySize();
30303550
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
3551
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3552
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30323553 }
30333554 }
30343555 catch (Exception e)
....@@ -3065,9 +3586,9 @@
30653586 obj = (Object3D)e.nextElement();
30663587
30673588 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3589
+ Grafreed.AnalyzeObject(obj);
30693590 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3591
+ Grafreed.AnalyzeObject(obj.bRep);
30713592
30723593 // System.err.println((size/1024) + " KB is the size of " + obj);
30733594 }
....@@ -3109,6 +3630,20 @@
31093630 void GenNormals(boolean crease)
31103631 {
31113632 group.GenNormalsS(crease);
3633
+
3634
+ refreshContents();
3635
+ }
3636
+
3637
+ void GenNormalsMESH()
3638
+ {
3639
+ group.GenNormalsMeshS();
3640
+
3641
+ refreshContents();
3642
+ }
3643
+
3644
+ void GenNormalsMINE()
3645
+ {
3646
+ group.selection.GenNormalsMINE();
31123647
31133648 refreshContents();
31143649 }
....@@ -3157,104 +3692,259 @@
31573692
31583693 //Object3D buffer;
31593694 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
-
3695
+// BoundaryRep temprep;
3696
+// Object3D nodes;
3697
+// Vector<Vertex> vertices;
3698
+//
3699
+// cGroup buffer;
3700
+//
3701
+// public void Vertex(Object3D node, Vertex v)
3702
+// {
3703
+//// vertices.add(v);
3704
+//// nodes.addElement(node);
3705
+////
3706
+//// if (temprep.GetCache(v) != null)
3707
+//// {
3708
+//// temprep.Remove(v);
3709
+//// } else
3710
+//// {
3711
+//// temprep.Remember(v);
3712
+//// }
3713
+//
3714
+// //Object3D node = nodes.get(index);
3715
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3716
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3717
+//
3718
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3719
+//
3720
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3721
+//
3722
+// cGroup g = new cGroup();
3723
+//
3724
+// if (g.toParent == null)
3725
+// {
3726
+// g.toParent = LA.newMatrix();
3727
+// g.fromParent = LA.newMatrix();
3728
+// }
3729
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3730
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3731
+//
3732
+// g.add(GrafreeD.clipboard);
3733
+//
3734
+// buffer.add(g);
3735
+// }
3736
+//
3737
+// public void Face(Object3D node, Face f)
3738
+// {
3739
+//
3740
+// }
3741
+//
3742
+// void ParseVerticesOld() // ??
3743
+// {
3744
+// //if (group.selection.size() != 1)
3745
+// // return;
3746
+//
3747
+// temprep = new BoundaryRep();
3748
+// nodes = new Object3D();
3749
+// vertices = new Vector<Vertex>();
3750
+//
3751
+// boolean epsequal = GrafreeD.epsequal;
3752
+// GrafreeD.epsequal = true;
3753
+//
3754
+// for (int i=0; i<group.selection.size(); i++)
3755
+// {
3756
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3757
+//
3758
+// group.selection.get(i).Parse(
3759
+//this );
3760
+//
3761
+// int repsize = temprep.VertexCount();
3762
+// int tablesize = temprep.vertextable.size();
3763
+// int nodesize = nodes.size();
3764
+//
3765
+// assert(vertices.size() == nodes.size());
3766
+//
3767
+// temprep.vertextable.elements();
3768
+//
3769
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3770
+//
3771
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3772
+// {
3773
+// cGroup g = new cGroup();
3774
+//
3775
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3776
+//
3777
+// Object3D node = nodes.get(index);
3778
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3779
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3780
+//
3781
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3782
+//
3783
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3784
+//
3785
+// if (g.toParent == null)
3786
+// {
3787
+// g.toParent = LA.newMatrix();
3788
+// g.fromParent = LA.newMatrix();
3789
+// }
3790
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3791
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3792
+//
3793
+// g.add(GrafreeD.clipboard);
3794
+//
3795
+// buffer.add(g);
3796
+// }
3797
+//
3798
+// makeSomething(buffer, i==group.selection.size()-1);
3799
+// }
3800
+//
3801
+// GrafreeD.epsequal = epsequal;
3802
+//
3803
+// //buffer = null;
3804
+// temprep = null;
3805
+// nodes = null;
3806
+//
3807
+// refreshContents();
3808
+// }
3809
+
31843810 void ParseVertices()
31853811 {
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;
3812
+ boolean epsequal = Grafreed.epsequal;
3813
+ Grafreed.epsequal = true;
31953814
31963815 for (int i=0; i<group.selection.size(); i++)
31973816 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3817
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993818
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3819
+ group.selection.get(i).Parse(
3820
+
3821
+ new iParse()
3822
+ {
3823
+ public void Vertex(Object3D node, Vertex v)
3824
+ {
3825
+ temp.set(v);
3826
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053827
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();
3828
+ cGroup g = new cGroup();
32113829
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3830
+ if (g.toParent == null)
3831
+ {
3832
+ g.toParent = LA.newMatrix();
3833
+ g.fromParent = LA.newMatrix();
3834
+ }
3835
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3836
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153837
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);
3838
+ g.add(Grafreed.clipboard);
32203839
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);
3840
+ buffer.add(g);
3841
+ }
32323842
3233
- g.add(GraphreeD.clipboard);
3843
+ public void Face(Object3D node, Face f)
3844
+ {
32343845
3235
- buffer.add(g);
3236
- }
3846
+ }
3847
+ }
3848
+ );
32373849
32383850 makeSomething(buffer, i==group.selection.size()-1);
32393851 }
32403852
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3853
+ Grafreed.epsequal = epsequal;
32463854
32473855 refreshContents();
32483856 }
3249
-
3857
+
3858
+ void TextureVertices()
3859
+ {
3860
+ for (int i=0; i<group.selection.size(); i++)
3861
+ {
3862
+ group.selection.get(i).Parse(
3863
+ new iParse()
3864
+ {
3865
+ public void Vertex(Object3D node, Vertex v)
3866
+ {
3867
+ cTexture tex = node.GetTextures();
3868
+ String pigment = Object3D.GetPigment(tex);
3869
+ //String bump = Object3D.GetBump(tex);
3870
+
3871
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3872
+
3873
+ try
3874
+ {
3875
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3876
+ }
3877
+ catch (Exception e)
3878
+ {
3879
+ System.err.println("FAIL: " + node);
3880
+ }
3881
+
3882
+ double s = v.s;
3883
+
3884
+ if (s == 1)
3885
+ s = 0;
3886
+
3887
+ double t = v.t;
3888
+
3889
+ if (t == 1)
3890
+ t = 0;
3891
+
3892
+ int indexs = (int) (texturedata.getWidth() * s);
3893
+ int indext = (int) (texturedata.getHeight() * t);
3894
+
3895
+ int index = indext * texturedata.getWidth() + indexs;
3896
+
3897
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3898
+
3899
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3900
+
3901
+ float scale = bytebuf.get(index*slide) & 0xFF;
3902
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3903
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3904
+ scale /= 3;
3905
+
3906
+ scale /= 0xFF;
3907
+ // c'est quoi ca? scale /= 4;
3908
+
3909
+ //v.AO = scale;
3910
+
3911
+ v.x += v.norm.x * scale;
3912
+ v.y += v.norm.y * scale;
3913
+ v.z += v.norm.z * scale;
3914
+ }
3915
+
3916
+ public void Face(Object3D node, Face f)
3917
+ {
3918
+ }
3919
+ }
3920
+ );
3921
+ }
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
32503926 void Align()
32513927 {
3928
+ if (group.selection.size() == 0)
3929
+ return;
3930
+
3931
+ cVector bbmin = new cVector();
3932
+ cVector bbmax = new cVector();
3933
+
3934
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3935
+
3936
+ double dx = bbmax.x - bbmin.x;
3937
+ double dy = bbmax.y - bbmin.y;
3938
+ double dz = bbmax.z - bbmin.z;
3939
+
3940
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3941
+
32523942 for (int i=0; i<group.selection.size(); i++)
32533943 {
32543944 Object3D obj = group.selection.get(i);
32553945
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3946
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3947
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583948 }
32593949
32603950 refreshContents();
....@@ -3267,7 +3957,7 @@
32673957 // ref.SaveSupports();
32683958 // Object3D par = ref.parent;
32693959 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3960
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713961 // ref.parent = par;
32723962 // ref.RestoreSupports();
32733963
....@@ -3275,11 +3965,11 @@
32753965
32763966 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32773967
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
3968
+ boolean random = CameraPane.SWITCH;
3969
+ CameraPane.SWITCH = false; // parse all random nodes
32803970 lowres.linkVerticesThis(null);
32813971 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
3972
+ CameraPane.SWITCH = random;
32833973
32843974 System.err.flush();
32853975
....@@ -3297,7 +3987,7 @@
32973987 // lowres.SaveSupports();
32983988 // par = lowres.parent;
32993989 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3990
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013991 Object3D newlow = CloneObject(lowres, false);
33023992 newlow.name = sn.switchobject.get(i).name;
33033993 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4009,7 @@
33194009 return;
33204010
33214011 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4012
+ Object3D ref = Grafreed.clipboard.get(0);
33234013
33244014 Object3D newgroup = new Object3D("Po:" + poses.name);
33254015
....@@ -3488,7 +4178,7 @@
34884178 group.selection.RelinkToSupport(); // july 2014
34894179 System.out.println("DONE.");
34904180 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4181
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924182 }
34934183
34944184 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4203,20 @@
35134203
35144204 void ClipMesh()
35154205 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4206
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174207 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4208
+ Object3D content = Grafreed.clipboard.get(0);
35194209
35204210 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214211 content = ((cGroup)content).get(0);
35224212
35234213 // for (int i=0; i<group.selection.size(); i++)
35244214 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4215
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264216 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4217
+ group.selection.ClipMesh(Grafreed.clipboard);
35284218 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4219
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304220 System.out.println("DONE.");
35314221 refreshContents();
35324222 }
....@@ -3571,6 +4261,18 @@
35714261 void MarkLeaves(boolean hide)
35724262 {
35734263 group.selection.MarkLeaves(hide);
4264
+ refreshContents();
4265
+ }
4266
+
4267
+ void RewindLeaves(boolean hide)
4268
+ {
4269
+ group.selection.RewindLeaves(hide);
4270
+ refreshContents();
4271
+ }
4272
+
4273
+ void RandomLeaves(boolean hide)
4274
+ {
4275
+ group.selection.RandomLeaves(hide);
35744276 refreshContents();
35754277 }
35764278
....@@ -3659,7 +4361,7 @@
36594361 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36604362
36614363 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
4364
+ if(elem != group || !newWindow)
36634365 {
36644366 // if (!(elem instanceof Composite))
36654367 // newWindow = false;
....@@ -3749,7 +4451,6 @@
37494451 //case 702: // Event.LIST_DESELECT
37504452 group.deselectAll();
37514453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37534454 if (tps != null)
37544455 {
37554456 for (int i=0; i < tps.length; i++)
....@@ -3758,31 +4459,30 @@
37584459
37594460 //if (child.parent != null)
37604461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
37614463 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37654464 }
37664465 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4466
+// else
4467
+// {
4468
+// objEditor.SetMaterial(group); // .GetMaterial());
4469
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4470
+// System.err.println("info : " + group.GetPath());
4471
+// }
37734472
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4473
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37774474 CameraPane.flash = true;
37784475
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37804477 // a camera
37814478 {
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;
4479
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4480
+ {
4481
+ CameraPane.camerachangeframe = 0; // don't refuse it
4482
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4483
+ }
4484
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4485
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864486 }
37874487
37884488 refreshContents();
....@@ -3793,6 +4493,26 @@
37934493
37944494 freezemodel = false;
37954495 }
4496
+
4497
+ void refreshContents(boolean cp)
4498
+ {
4499
+ if (!Globals.MOUSEDRAGGED)
4500
+ {
4501
+ objEditor.ClearInfo(); // .GetMaterial());
4502
+
4503
+ for (int i=0; i < group.selection.Size(); i++)
4504
+ {
4505
+ Object3D child = (Object3D) group.selection.get(i);
4506
+
4507
+ objEditor.AddInfo(child, this, true);
4508
+ System.err.println("info : " + child.GetPath());
4509
+ }
4510
+
4511
+ objEditor.SetText(); // jan 2014
4512
+ }
4513
+
4514
+ super.refreshContents(cp);
4515
+ }
37964516
37974517 void linkSomething(Object3D thing)
37984518 {
....@@ -3864,16 +4584,18 @@
38644584 {
38654585 if (group.selection.isEmpty())
38664586 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4587
+
4588
+ Grafreed.clipboardIsTempGroup = false;
38684589 Composite tGroup = null;
38694590 if (group.selection.size() > 0) // 1)
38704591 {
38714592 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4593
+ Grafreed.clipboardIsTempGroup = true;
38734594 }
38744595
38754596 if (cut)
38764597 {
4598
+ Save();
38774599 //int indices[] = jList.getSelectedIndices();
38784600 //for (int i = indices.length - 1; i >= 0; i--)
38794601 //jList.remove(indices[i]);
....@@ -3909,16 +4631,16 @@
39094631 //System.out.println("cut " + child);
39104632 //System.out.println("parent = " + child.parent);
39114633 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4634
+ if (Grafreed.clipboardIsTempGroup)
39134635 tGroup.add/*Child*/(tmp);
39144636 else
3915
- GraphreeD.clipboard = tmp;
4637
+ Grafreed.clipboard = tmp;
39164638 }
39174639 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4640
+ if (Grafreed.clipboardIsTempGroup)
39194641 tGroup.add/*Child*/(child);
39204642 else
3921
- GraphreeD.clipboard = child;
4643
+ Grafreed.clipboard = child;
39224644 }
39234645
39244646 //ResetModel();
....@@ -3950,21 +4672,23 @@
39504672 //System.out.println("cut " + elem);
39514673 //System.out.println("parent = " + elem.parent);
39524674 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4675
+ if (Grafreed.clipboardIsTempGroup)
39544676 tGroup.add/*Child*/(tmp);
39554677 else
3956
- GraphreeD.clipboard = tmp;
4678
+ Grafreed.clipboard = tmp;
39574679 }
39584680 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4681
+ if (Grafreed.clipboardIsTempGroup)
39604682 tGroup.add/*Child*/(child);
39614683 else
3962
- GraphreeD.clipboard = child;
4684
+ Grafreed.clipboard = child;
39634685 }
39644686
39654687 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4688
+
4689
+ if (Grafreed.clipboardIsTempGroup)
4690
+ Grafreed.clipboard = tGroup;
4691
+
39684692 if (cut)
39694693 {
39704694 ResetModel();
....@@ -3974,11 +4698,11 @@
39744698
39754699 void paste(boolean expand)
39764700 {
3977
- // if (GraphreeD.clipboard == null)
4701
+ // if (GrafreeD.clipboard == null)
39784702 // return;
39794703 boolean first = true;
39804704
3981
- if (GraphreeD.clipboardIsTempGroup)
4705
+ if (Grafreed.clipboardIsTempGroup)
39824706 {
39834707 Composite temp;
39844708
....@@ -3989,7 +4713,7 @@
39894713 temp = (Composite)Applet3D.clipboard.deepCopy();
39904714 */
39914715 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4716
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934717 {
39944718 Object3D child = (Object3D)e.nextElement();
39954719
....@@ -4003,7 +4727,7 @@
40034727 else
40044728 elem = child.deepCopy(); // ?
40054729 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4730
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074731 // elem = elem.get(0);
40084732 makeSomething(elem, true); // ?? first);
40094733 //group.addChild(elem);
....@@ -4023,23 +4747,23 @@
40234747 //Object3D cb = Applet3D.clipboard;
40244748 //temp.addChild(cb);
40254749 //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());
4750
+ assert(Grafreed.clipboard.parent == null);
4751
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4752
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4753
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4754
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40314755 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4756
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4757
+ Grafreed.clipboard.get(0).parent = keepparent;
40344758 }
40354759
40364760 ResetModel();
40374761 refreshContents();
40384762 }
40394763
4040
- void pasteInto(boolean copyit)
4764
+ void pasteInto(boolean copyit, boolean clone)
40414765 {
4042
-// if (GraphreeD.clipboard == null)
4766
+// if (GrafreeD.clipboard == null)
40434767 // return;
40444768
40454769 if (group.selection.size() != 1)
....@@ -4066,15 +4790,22 @@
40664790 if (copyit)
40674791 {
40684792 // paste(false);
4069
- CloneClipboard(false); // sept 2014
4793
+ if (clone)
4794
+ {
4795
+ CloneClipboard(false); // sept 2014
4796
+ }
4797
+ else
4798
+ {
4799
+ paste(false);
4800
+ }
40704801 }
40714802 else
40724803 {
40734804 boolean first = true;
40744805
4075
- if (GraphreeD.clipboardIsTempGroup)
4806
+ if (Grafreed.clipboardIsTempGroup)
40764807 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4808
+ Composite temp = (Composite)Grafreed.clipboard;
40784809 Object3D copy;
40794810 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804811 {
....@@ -4084,7 +4815,7 @@
40844815 }
40854816 } else
40864817 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4818
+ linkSomething(Grafreed.clipboard); //.get(0));
40884819 }
40894820 }
40904821 }
....@@ -4276,6 +5007,26 @@
42765007 makeSomething(csg);
42775008 }
42785009
5010
+ void Ungroup(Object3D g)
5011
+ {
5012
+ if (g instanceof HiddenObject)
5013
+ {
5014
+ HiddenObject h = (HiddenObject) g;
5015
+
5016
+ for (int i=0; i<h.ActualSize(); i++)
5017
+ {
5018
+ objEditor.makeSomething(h.get(i), false);
5019
+ }
5020
+ }
5021
+ else
5022
+ {
5023
+ for (int i=0; i<g.Size(); i++)
5024
+ {
5025
+ objEditor.makeSomething(g.get(i), false);
5026
+ }
5027
+ }
5028
+ }
5029
+
42795030 void ungroup()
42805031 {
42815032 /*
....@@ -4469,21 +5220,6 @@
44695220 }
44705221 */
44715222
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
-
44875223 /*
44885224 public void Callback(Object obj)
44895225 {
....@@ -4507,26 +5243,9 @@
45075243 }
45085244 */
45095245
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
-
45275246 String GetFile(String dialogName)
45285247 {
4529
- if (GraphreeD.standAlone)
5248
+ if (Grafreed.standAlone)
45305249 {
45315250 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325251 browser.show();
....@@ -4590,10 +5309,18 @@
45905309 cButton flashSelectionButton;
45915310 cButton editButton;
45925311 cButton uneditButton;
5312
+ JCheckBox allParamsButton;
45935313 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955314 cButton unselectButton;
45965315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
5322
+ cButton oneStepButton;
5323
+
45975324 cButton screenfitButton;
45985325 cButton screenfitpointButton;
45995326 cButton snapobjectButton;
....@@ -4604,14 +5331,6 @@
46045331 cButton closeButton;
46055332
46065333 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;
46155334
46165335 //
46175336 //Composite
....@@ -4624,6 +5343,8 @@
46245343 private MenuItem lookFromItem;
46255344 private MenuItem switchItem;
46265345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
46275348 private MenuItem duplicateItem;
46285349 private MenuItem cloneItem;
46295350 private MenuItem cloneSupportItem;
....@@ -4635,8 +5356,9 @@
46355356 private MenuItem resetsupportItem;
46365357 private MenuItem resetreferencesItem;
46375358 private MenuItem linkverticesItem;
5359
+ private MenuItem relinkverticesItem;
46385360 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
5361
+ private MenuItem resetAllItem;
46405362 private MenuItem stepAllItem;
46415363 private MenuItem revertMeshItem;
46425364 private MenuItem poseMeshItem;
....@@ -4647,14 +5369,17 @@
46475369 private MenuItem mergeGeometriesItem;
46485370 private MenuItem copyItem;
46495371 private MenuItem pasteItem;
5372
+ private MenuItem pasteIntoItem;
46505373 private MenuItem pasteLinkItem;
46515374 private MenuItem pasteCloneItem;
46525375 private MenuItem pasteExpandItem;
46535376 private MenuItem clearItem;
46545377 private MenuItem clearAllItem;
46555378 private MenuItem genUVItem;
5379
+ private MenuItem genNormalsMESHItem;
46565380 private MenuItem genNormalsCADItem;
46575381 private MenuItem genNormalsORGANItem;
5382
+ private MenuItem genNormalsMINEItem;
46585383 private MenuItem stripifyItem;
46595384 private MenuItem unstripifyItem;
46605385 private MenuItem trimItem;
....@@ -4683,6 +5408,10 @@
46835408 private MenuItem showleavesItem;
46845409 private MenuItem markleavesItem;
46855410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
46865415
46875416 private MenuItem flipVItem;
46885417 private MenuItem unflipVItem;
....@@ -4694,8 +5423,11 @@
46945423 private MenuItem panoTexturesItem;
46955424
46965425 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
5426
+ private MenuItem resetCentroidXZItem;
46985427 private MenuItem resetTransformItem;
5428
+ private MenuItem transformGeometryItem;
5429
+ private MenuItem transformChildrenItem;
5430
+ private MenuItem hideItem;
46995431 private MenuItem grabItem;
47005432 private MenuItem backItem;
47015433 private MenuItem frontItem;
....@@ -4716,6 +5448,7 @@
47165448
47175449 private MenuItem resetParentItem;
47185450 private MenuItem repairParentItem;
5451
+ private MenuItem repairShadowItem;
47195452 private MenuItem sortbysizeItem;
47205453 private MenuItem sortbynameItem;
47215454
....@@ -4728,16 +5461,19 @@
47285461 private MenuItem particleItem;
47295462 private MenuItem ragdollItem;
47305463 private MenuItem ragdoll2Item;
5464
+ private MenuItem heightFieldItem;
5465
+ private MenuItem textureFieldItem;
47315466 private MenuItem gridItem;
47325467 private MenuItem rectoidItem;
47335468 private MenuItem ellipsoidItem;
47345469 private MenuItem coneItem;
47355470 private MenuItem torusItem;
47365471 private MenuItem superItem;
5472
+ private MenuItem kleinItem;
47375473 private MenuItem blobItem;
47385474 private MenuItem latheItem;
47395475 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5476
+ private MenuItem overlayItem;
47415477 private MenuItem meshItem;
47425478 // private MenuItem meshGroupItem;
47435479 private MenuItem springItem;
....@@ -4746,6 +5482,7 @@
47465482 private MenuItem csgItem;
47475483 private MenuItem templateItem;
47485484 private MenuItem textureItem;
5485
+ private MenuItem billboardItem;
47495486 private MenuItem shadowXItem;
47505487 private MenuItem shadowYItem;
47515488 private MenuItem shadowZItem;
....@@ -4758,11 +5495,6 @@
47585495 private MenuItem doubleItem;
47595496 private MenuItem tripleItem;
47605497
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47665498 private MenuItem computeAOItem;
47675499 private MenuItem recompileItem;
47685500 private MenuItem editScriptItem;
....@@ -4772,4 +5504,8 @@
47725504 private MenuItem analyzeItem;
47735505 private MenuItem dumpItem;
47745506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
47755511 }