Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
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));
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));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -148,8 +148,129 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
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
+ {
153274 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154275 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155276 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -161,45 +282,17 @@
161282 lookAtItem.addActionListener(this);
162283 //lookFromItem.addActinoListener(this);
163284 //switchItem.addActionListener(this);
164
- Menu menu;
165
- oe.menuBar.add(menu = new Menu("Edit"));
166
- //editItem = menu.add(new MenuItem("Edit"));
167
- //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
169
- duplicateItem.addActionListener(this);
170
- menu.add("-");
171
- cloneItem = menu.add(new MenuItem("Clone"));
172
- cloneItem.addActionListener(this);
173
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174
- cloneSupportItem.addActionListener(this);
175
- menu.add("-");
176
- cutItem = menu.add(new MenuItem("Cut"));
177
- cutItem.addActionListener(this);
178
- copyItem = menu.add(new MenuItem("Copy"));
179
- copyItem.addActionListener(this);
180
- pasteItem = menu.add(new MenuItem("Paste"));
181
- pasteItem.addActionListener(this);
182
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
183
- pasteLinkItem.addActionListener(this);
184
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185
- pasteCloneItem.addActionListener(this);
186
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187
-// pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- clearItem.addActionListener(this);
190
- clearAllItem = menu.add(new MenuItem("Clear All"));
191
- clearAllItem.addActionListener(this);
192
-
285
+ }
286
+
193287 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
288
+ if (Globals.ADVANCED)
289
+ {
198290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199291 revertMeshItem.addActionListener(this);
200292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201293 resetreferencesItem.addActionListener(this);
202294 menu.add("-");
295
+ }
203296 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204297 overwriteGeoItem.addActionListener(this);
205298 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,19 +304,26 @@
211304 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212305 overwriteUVItem.addActionListener(this);
213306 menu.add("-");
307
+ if (Globals.ADVANCED)
308
+ {
214309 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215310 generateMeshItem.addActionListener(this);
216311 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217312 poseMeshItem.addActionListener(this);
218313 menu.add("-");
314
+ }
219315 resetsupportItem = menu.add(new MenuItem("Reset support"));
220316 resetsupportItem.addActionListener(this);
221317 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222318 linkverticesItem.addActionListener(this);
223319 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224320 relinkverticesItem.addActionListener(this);
321
+
322
+ if (Globals.ADVANCED)
323
+ {
225324 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226325 setMasterItem.addActionListener(this);
326
+ }
227327
228328 oe.menuBar.add(menu = new Menu("Group"));
229329 grabItem = menu.add(new MenuItem("Grab"));
....@@ -234,27 +334,32 @@
234334 frontItem.addActionListener(this);
235335 compositeItem = menu.add(new MenuItem("Composite"));
236336 compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
337
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238338 hideItem.addActionListener(this);
239339 ungroupItem = menu.add(new MenuItem("Ungroup"));
240340 ungroupItem.addActionListener(this);
241341 menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
342
+ randomItem = menu.add(new MenuItem("Switch node"));
243343 randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
248344 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249345 switchGeoItem.addActionListener(this);
250346 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251347 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
348
+ morphItem = menu.add(new MenuItem("Morph Group"));
253349 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);
254358 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255359 scriptNodeItem.addActionListener(this);
256360 cameraItem = menu.add(new MenuItem("Camera"));
257361 cameraItem.addActionListener(this);
362
+ }
258363
259364 oe.menuBar.add(menu = new Menu("Object"));
260365 textureItem = menu.add(new MenuItem("Texture"));
....@@ -263,27 +368,35 @@
263368 billboardItem.addActionListener(this);
264369 csgItem = menu.add(new MenuItem("CSG"));
265370 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267372 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269374 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271376 shadowZItem.addActionListener(this);
377
+ if (Globals.ADVANCED)
378
+ {
379
+ menu.add("-");
272380 linkerItem = menu.add(new MenuItem("Linker"));
273381 linkerItem.addActionListener(this);
274
- templateItem = menu.add(new MenuItem("Template"));
275
- templateItem.addActionListener(this);
276382 attributeItem = menu.add(new MenuItem("Attribute"));
277383 attributeItem.addActionListener(this);
384
+ templateItem = menu.add(new MenuItem("Template"));
385
+ templateItem.addActionListener(this);
278386 pointflowItem = menu.add(new MenuItem("Point Flow"));
279387 pointflowItem.addActionListener(this);
388
+ }
280389 menu.add("-");
281390 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282391 resetTransformItem.addActionListener(this);
283392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284393 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.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);
287400
288401 oe.menuBar.add(menu = new Menu("Geometry"));
289402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +407,11 @@
294407 genNormalsCADItem.addActionListener(this);
295408 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296409 genNormalsMESHItem.addActionListener(this);
410
+ if (Globals.ADVANCED)
411
+ {
297412 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298413 genNormalsMINEItem.addActionListener(this);
414
+ }
299415 stripifyItem = menu.add(new MenuItem("Stripify"));
300416 stripifyItem.addActionListener(this);
301417 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +433,34 @@
317433 reduce34MeshItem.addActionListener(this);
318434 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319435 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322436 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323437 clipMeshItem.addActionListener(this);
438
+
439
+ if (Globals.ADVANCED)
440
+ {
441
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
442
+ smoothMeshItem.addActionListener(this);
443
+ }
324444
325445 oe.menuBar.add(menu = new Menu("Attributes"));
326446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327447 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);
328452 menu.add("-");
329453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330454 liveleavesItem.addActionListener(this);
331455 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332456 unliveleavesItem.addActionListener(this);
457
+ if (Globals.ADVANCED)
458
+ {
333459 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334460 supportleavesItem.addActionListener(this);
335461 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336462 unsupportleavesItem.addActionListener(this);
463
+ }
337464 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338465 hideleavesItem.addActionListener(this);
339466 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +469,14 @@
342469 markleavesItem.addActionListener(this);
343470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344471 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);
345480 menu.add("-");
346481 flipVItem = menu.add(new MenuItem("Flip V"));
347482 flipVItem.addActionListener(this);
....@@ -377,35 +512,40 @@
377512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378513 sortbynameItem.addActionListener(this);
379514 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.
380522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381523 extractGeometriesItem.addActionListener(this);
382524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383525 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
526
+ }
388527
389528 oe.menuBar.add(menu = new Menu("Insert"));
390529 buildCreateMenu(menu);
391530
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403531 oe.menuBar.add(menu = new Menu("Tools"));
404532 buildToolsMenu(menu);
405533 }
406534
407535 void SetupUI2(ObjEditor oe)
408536 {
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
+
409549 //new Exception().printStackTrace();
410550
411551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,110 +574,120 @@
434574 oe.radioPanel.add(dummyButton);
435575 oe.buttonGroup.add(dummyButton);
436576 */
437
- aConstraints.gridy += 1;
438
-
439577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440578
441
- oe.aConstraints.gridwidth = 1;
442
- oe.aConstraints.gridx = 0;
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
443582
444
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
- liveCB.setToolTipText("Enabled animation");
583
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
446605 liveCB.addItemListener(this);
447606
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
+ fastCB.setToolTipText("Fast mode");
609
+ fastCB.addItemListener(this);
610
+
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
450616 trackCB.setToolTipText("Enable tracking");
451617 trackCB.addItemListener(this);
452618
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
455620 screenfitButton.setToolTipText("Screen fit");
456621 screenfitButton.addActionListener(this);
457
- oe.aConstraints.gridx += 1;
622
+
458623 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459624 // screenfitpointButton.addActionListener(this);
460
-// oe.aConstraints.gridx += 1;
461
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
462
- snapobjectButton.addActionListener(this);
463
- snapobjectButton.setToolTipText("Snap Object");
464
- oe.aConstraints.gridx += 1;
465625
466
- //aConstraints.gridx = 0;
467
- //aConstraints.gridy += 1;
468
- oe.aConstraints.weighty = 0;
469
- oe.aConstraints.gridwidth = 1;
470
-
471
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
- flashSelectionButton.setToolTipText("Show selection");
626
+ if (Globals.ADVANCED)
627
+ {
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ snapobjectButton.addActionListener(this);
630
+ snapobjectButton.setToolTipText("Snap Object");
631
+ }
632
+
633
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
473635 flashSelectionButton.addActionListener(this);
474636
475
- oe.toolbarPanel.add(new cButton(" ", false));
637
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
476638
477
- oe.aConstraints.gridx += 1;
478
- oe.aConstraints.weighty = 0;
479
- oe.aConstraints.gridwidth = 1;
480
-
481
- //
482
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483640 twoButton.setToolTipText("Show center view only");
484641 twoButton.addActionListener(this);
485
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
486643 fourButton.addActionListener(this);
487644 fourButton.setToolTipText("Show left panel only");
488
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
489646 sixButton.setToolTipText("2-column layout left");
490647 sixButton.addActionListener(this);
491
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492649 threeButton.setToolTipText("2-column layout right");
493650 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495652 sevenButton.setToolTipText("3-column layout");
496653 sevenButton.addActionListener(this);
497654 //
498655
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- rootButton.setToolTipText("Edit object in new tab");
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ rootButton.setToolTipText("Edit selection in new tab");
501658 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
659
+
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504661 closeButton.setToolTipText("Close tab");
505662 closeButton.addActionListener(this);
506663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
507664 //clearButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509665
510
- oe.aConstraints.gridx = 1; //
511
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
+ editButton.setToolTipText("Edit selection");
512668 editButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516669
517
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ uneditButton.setToolTipText("Unedit selection");
518672 uneditButton.addActionListener(this);
519673
520
- oe.aConstraints.gridx += 1;
521
- oe.aConstraints.weighty = 0;
522
- oe.aConstraints.gridwidth = 1;
523
-
524
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
525
- clearPanelButton.addActionListener(this);
526
-
527
- oe.aConstraints.gridx += 1;
528
- oe.aConstraints.weighty = 0;
529
- oe.aConstraints.gridwidth = 1;
530
-
531
- 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");
532676 allParamsButton.addActionListener(this);
533677
534
- oe.aConstraints.gridx += 1;
535
- oe.aConstraints.weighty = 0;
536
- oe.aConstraints.gridwidth = 1;
537
-
538
- 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");
539684 unselectButton.addActionListener(this);
540685
686
+ editCommandsPanel.preferredHeight = 1;
687
+
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
690
+
541691 // oe.aConstraints.gridx += 1;
542692 // oe.aConstraints.weighty = 0;
543693 // oe.aConstraints.gridwidth = 1;
....@@ -549,40 +699,37 @@
549699 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
550700 // gcButton.addActionListener(this);
551701
552
- oe.aConstraints.gridx = 0;
553
- oe.aConstraints.gridy += 1;
554
-
555
- //ctrlPanel.add(objList = new List(5, true));
556
- oe.aConstraints.gridwidth = 100;
557
- // oe.aConstraints.gridheight = 100;
558
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
559
- oe.aConstraints.gridheight = 1;
560
- oe.aConstraints.weighty = 0.5;
561
- oe.aConstraints.gridx = 0;
562
- JScrollPane jSP;
702
+ cGridBag jSPPanel = new cGridBag();
703
+
704
+ JScrollPane jSP;
563705 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
564
- 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);
565707 ResetModel();
566
- oe.aConstraints.weighty = 0.5;
567
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
568
- oe.aConstraints.gridy += 1;
569
- oe.aConstraints.gridwidth = 1;
708
+
709
+ oe.treePanel.add(jSPPanel);
710
+ oe.treePanel.Return();
570711
571
- oe.aConstraints.weighty = 0;
572
- oe.aConstraints.gridwidth = 2;
573
-
574
- 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");
575716 colorCB.addItemListener(this);
576
- oe.aConstraints.gridx += 2;
577
- 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");
578720 materialCB.addItemListener(this);
579
- oe.aConstraints.gridx += 2;
580
- 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");
581724 textureCB.addItemListener(this);
582725
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
726
+ copyOptionsPanel.preferredHeight = 1;
727
+ oe.treePanel.add(copyOptionsPanel);
728
+ oe.treePanel.Return();
585729
730
+// mainPanel.setDividerLocation(0.5); //1.0);
731
+// mainPanel.setResizeWeight(0.5);
732
+
586733 //jList.addListSelectionListener(this);
587734 oe.jTree.addTreeSelectionListener(this);
588735 //jTree.setRootVisible(false);
....@@ -607,43 +754,35 @@
607754
608755 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
609756 {
610
- //constraints.gridx = 0;
611
- //constraints.gridy = 0;
612
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
- fastCB.setToolTipText("Fast mode");
614
- fastCB.addItemListener(this);
615
- //constraints.gridy += 1;
616
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
- supportCB.setToolTipText("Enabled rigging");
618
- supportCB.addItemListener(this);
619
-
620
- // constraints.gridy += 1;
621
- // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
622
- // localCB.addItemListener(this);
623
-
624
- //constraints.gridy += 1;
625
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
626
- crowdCB.setToolTipText("Used for crowds");
627
- crowdCB.addItemListener(this);
628
-
629
- //constraints.gridy += 1;
630
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
631
- smoothCB.setToolTipText("Snapping delay");
632
- smoothCB.addItemListener(this);
633
-
634
- //constraints.gridy += 1;
635
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
636
- slowCB.setToolTipText("Smooth interpolation");
637
- slowCB.addItemListener(this);
638
- //constraints.gridy += 1;
639757 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640758 boxCB.setToolTipText("Display bounding boxes");
641759 boxCB.addItemListener(this);
642
- //constraints.gridy += 1;
760
+
643761 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644762 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645763 zoomBoxCB.addItemListener(this);
646764
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
+
647786 // constraints.gridy += 1;
648787 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
649788 // speakerMocapCB.addItemListener(this);
....@@ -668,20 +807,46 @@
668807 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
669808 // debugCB.addItemListener(this);
670809
671
- //constraints.gridy += 1;
672810 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
673812 oeilCB.addItemListener(this);
674813
675
- //constraints.gridy += 1;
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
822
+ if (Globals.ADVANCED)
823
+ {
676824 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
677825 lookAtCB.setToolTipText("Look-at target");
678826 lookAtCB.addItemListener(this);
827
+ }
828
+
829
+ }
830
+
831
+ cGridBag fill = new cGridBag();
832
+
833
+ fill.preferredHeight = 200;
834
+
835
+ panel.add(fill);
679836
680837 }
681838
682839 void EditObject(Object3D obj)
683840 {
684841 cRadio radioButton = new cRadio(obj.name);
842
+
843
+ // Patch to avoid bug with transparency.
844
+ radioButton.hadMaterial = obj.material != null;
845
+ if (!radioButton.hadMaterial)
846
+ {
847
+ obj.material = new cMaterial();
848
+ }
849
+
685850 radioButton.SetObject(obj);
686851 radioButton.layout = sevenButton;
687852 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -690,8 +855,11 @@
690855 buttonGroup.add(radioButton);
691856 radioButton.doClick();
692857 }
858
+
693859 void SetupViews(ObjEditor oe)
694860 {
861
+ theFrame = this;
862
+
695863 oe.SetupViews();
696864
697865 System.out.println("SetupViews");
....@@ -700,23 +868,26 @@
700868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
701869 }
702870
703
- JCheckBox liveCB;
704
- JCheckBox supportCB;
705
- JCheckBox localCB;
706
- JCheckBox crowdCB;
707
- JCheckBox smoothCB;
708
- JCheckBox fastCB;
709
- JCheckBox slowCB;
710
- JCheckBox boxCB;
711
- JCheckBox zoomBoxCB;
712
- JCheckBox trackCB;
713
- JCheckBox smoothfocusCB;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
714882 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
886
+
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
720891
721892 // static int COLOR = 1;
722893 // static int MATERIAL = 2;
....@@ -724,9 +895,9 @@
724895
725896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
726897
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
730901
731902 public void itemStateChanged(ItemEvent e)
732903 {
....@@ -754,6 +925,7 @@
754925 } else if(e.getSource() == liveCB)
755926 {
756927 cameraView.ToggleLive();
928
+ refreshContents(false);
757929 }
758930 else if(e.getSource() == supportCB)
759931 {
....@@ -817,6 +989,14 @@
817989 else if(e.getSource() == oeilCB)
818990 {
819991 cameraView.ToggleOeil();
992
+ }
993
+ else if(e.getSource() == shadowCB)
994
+ {
995
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
8201000 }
8211001 else if(e.getSource() == lookAtCB)
8221002 {
....@@ -906,7 +1086,9 @@
9061086 // objEditor.DropFile((java.io.File[]) object, true);
9071087 // return;
9081088 // }
909
- if (string.charAt(0) == '/')
1089
+
1090
+ // File path for Mac and Windows
1091
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9101092 {
9111093 // file(s)
9121094 String[] names = string.split("\n");
....@@ -933,7 +1115,7 @@
9331115
9341116 flashIt = false;
9351117 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1118
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371119 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381120
9391121 if (group.selection.size() == 1)
....@@ -960,11 +1142,11 @@
9601142 {
9611143 loadClipboard(true);
9621144 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
1145
+ pasteInto(false, false);
9641146 } else {
9651147 loadClipboard(false);
9661148 objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
1149
+ pasteInto(false, false); // true); // ???
9681150 }
9691151 }
9701152 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1086,27 +1268,33 @@
10861268 kleinItem.addActionListener(this);
10871269 particleItem = menu.add(new MenuItem("Particle system"));
10881270 particleItem.addActionListener(this);
1271
+ if (Globals.ADVANCED)
1272
+ {
10891273 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901274 ragdollItem.addActionListener(this);
10911275 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921276 ragdoll2Item.addActionListener(this);
1277
+ }
10931278 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1279
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951280 meshItem.addActionListener(this);
10961281 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971282 // meshGroupItem.addActionListener(this);
1283
+ if (Globals.ADVANCED)
1284
+ {
10981285 springItem = menu.add(new MenuItem("Spring"));
10991286 springItem.addActionListener(this);
11001287 flagItem = menu.add(new MenuItem("Flag"));
11011288 flagItem.addActionListener(this);
1102
- bezierItem = menu.add(new MenuItem("Patch"));
1103
- bezierItem.addActionListener(this);
1104
- checkerItem = menu.add(new MenuItem("Checker"));
1105
- checkerItem.addActionListener(this);
11061289 blobItem = menu.add(new MenuItem("Blob"));
11071290 blobItem.addActionListener(this);
11081291 latheItem = menu.add(new MenuItem("Lathe"));
11091292 latheItem.addActionListener(this);
1293
+ }
1294
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1295
+ bezierItem.addActionListener(this);
1296
+ overlayItem = menu.add(new MenuItem("Overlay"));
1297
+ overlayItem.addActionListener(this);
11101298 lightItem = menu.add(new MenuItem("Light"));
11111299 lightItem.addActionListener(this);
11121300 menu.add("-");
....@@ -1116,39 +1304,44 @@
11161304 loopItem.addActionListener(this);
11171305 doubleItem = menu.add(new MenuItem("Fork"));
11181306 doubleItem.addActionListener(this);
1307
+ if (Globals.ADVANCED)
1308
+ {
11191309 tripleItem = menu.add(new MenuItem("Trident"));
11201310 tripleItem.addActionListener(this);
1311
+ }
11211312 }
11221313
11231314 void buildToolsMenu(Menu menu)
11241315 {
11251316 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261317 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1318
+ animationItem.setState(Globals.ANIMATION);
11281319
11291320 menu.add("-");
11301321 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311322 parseverticesItem.addActionListener(this);
11321323 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331324 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1325
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351326 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381327 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391328 reduceMorphItem.addActionListener(this);
11401329 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411330 reduce34MorphItem.addActionListener(this);
1142
-
1331
+ menu.add("-");
11431332 menu.add(computeAOItem = new MenuItem("Compute AO"));
11441333 computeAOItem.addActionListener(this);
1145
- menu.add("-");
11461334
1335
+ if (Globals.ADVANCED)
1336
+ {
1337
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1338
+ mirrorItem.addActionListener(this);
1339
+ menu.add("-");
11471340 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481341 memoryItem.addActionListener(this);
11491342 menu.add(analyzeItem = new MenuItem("Analyze"));
11501343 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1344
+ menu.add(dumpItem = new MenuItem("Print"));
11521345 dumpItem.addActionListener(this);
11531346 // menu.add(pathItem = new MenuItem("From-to path"));
11541347 // pathItem.addActionListener(this);
....@@ -1166,6 +1359,7 @@
11661359 menu.add("-");
11671360 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681361 editScriptItem.addActionListener(this);
1362
+ }
11691363 }
11701364
11711365 void ScreenFit()
....@@ -1288,6 +1482,7 @@
12881482 shadow.material = new cMaterial(obj.material);
12891483 shadow.material.diffuse = 0.0001f;
12901484 shadow.material.specular = 0.0001f;
1485
+ //shadow.projectedVertices[1].x = 300;
12911486
12921487 makeSomething(shadow);
12931488 }
....@@ -1494,9 +1689,9 @@
14941689
14951690 void Overwrite(int mask)
14961691 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1692
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14981693 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
1694
+ Object3D content = Grafreed.clipboard.get(0);
15001695
15011696 if (content instanceof cGroup && ((cGroup)content).transientlink )
15021697 content = ((cGroup)content).get(0);
....@@ -1667,7 +1862,7 @@
16671862 {
16681863 makeSomething(new BezierSurface());
16691864 } else
1670
- if (source == checkerItem)
1865
+ if (source == overlayItem)
16711866 {
16721867 /*
16731868 Object3D obj = new BezierSurface(5,8);
....@@ -1801,23 +1996,6 @@
18011996 csg.addChild(child);
18021997 child.addChild(csg);
18031998 } else
1804
-
1805
- if (source == importGFDItem)
1806
- {
1807
- ImportGFD();
1808
- } else
1809
- if (source == importVRMLX3DItem)
1810
- {
1811
- ImportVRMLX3D();
1812
- } else
1813
- if (source == import3DSItem)
1814
- {
1815
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1816
- } else
1817
- if (source == importOBJItem)
1818
- {
1819
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1820
- } else
18211999 if (source == computeAOItem)
18222000 {
18232001 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1836,7 +2014,7 @@
18362014 if (source == invariantsItem)
18372015 {
18382016 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2017
+ Grafreed.grafreeD.universe.invariants();
18402018 } else
18412019 if (source == memoryItem)
18422020 {
....@@ -1854,6 +2032,35 @@
18542032 if (source == dumpItem)
18552033 {
18562034 DumpObject();
2035
+ } else
2036
+ if (source == minButton)
2037
+ {
2038
+ Minimize();
2039
+ } else
2040
+ if (source == maxButton)
2041
+ {
2042
+ Maximize();
2043
+ } else
2044
+ if (source == fullButton)
2045
+ {
2046
+ ToggleFullScreen();
2047
+ } else
2048
+ if (source == undoButton)
2049
+ {
2050
+ Undo();
2051
+ } else
2052
+ if (source == redoButton)
2053
+ {
2054
+ Redo();
2055
+ } else
2056
+ if (source == saveButton)
2057
+ {
2058
+ Save();
2059
+ } else
2060
+ if (source == oneStepButton)
2061
+ {
2062
+ Globals.ONESTEP = true;
2063
+ cameraView.repaint();
18572064 } else
18582065 if (source == screenfitButton)
18592066 {
....@@ -1904,12 +2111,20 @@
19042111 {
19052112 loadClipboard(true);
19062113 } else
2114
+ if (source == undoItem)
2115
+ {
2116
+ Undo();
2117
+ } else
2118
+ if (source == redoItem)
2119
+ {
2120
+ Redo();
2121
+ } else
19072122 if (source == duplicateItem)
19082123 {
1909
- Object3D keep = GrafreeD.clipboard;
2124
+ Object3D keep = Grafreed.clipboard;
19102125 loadClipboard(false);
19112126 paste(false);
1912
- GrafreeD.clipboard = keep;
2127
+ Grafreed.clipboard = keep;
19132128 } else
19142129 if (source == cloneItem)
19152130 {
....@@ -1927,13 +2142,17 @@
19272142 {
19282143 paste(false);
19292144 } else
2145
+ if (source == pasteIntoItem)
2146
+ {
2147
+ pasteInto(true, false);
2148
+ } else
19302149 if (source == pasteLinkItem)
19312150 {
1932
- pasteInto(false);
2151
+ pasteInto(false, false);
19332152 } else
19342153 if (source == pasteCloneItem)
19352154 {
1936
- pasteInto(true);
2155
+ pasteInto(true, true);
19372156 } else
19382157 if (source == pasteExpandItem)
19392158 {
....@@ -2125,9 +2344,9 @@
21252344 // group.selection.get(0).setMasterThis(content); // should be identity
21262345 // refreshContents();
21272346 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2347
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292348 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2349
+ Object3D content = Grafreed.clipboard.get(0);
21312350
21322351 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332352 content = ((cGroup)content).get(0);
....@@ -2135,11 +2354,11 @@
21352354 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362355 for (int i=0; i<group.selection.size(); i++)
21372356 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2357
+ boolean random = CameraPane.SWITCH;
2358
+ CameraPane.SWITCH = false; // parse all random nodes
21402359 group.selection.get(i).linkVerticesThis(content);
21412360 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2361
+ CameraPane.SWITCH = random;
21432362 }
21442363 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452364 refreshContents();
....@@ -2149,20 +2368,20 @@
21492368 {
21502369 for (int i=0; i<group.selection.size(); i++)
21512370 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2371
+ boolean random = CameraPane.SWITCH;
2372
+ CameraPane.SWITCH = false; // parse all random nodes
21542373 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2374
+ CameraPane.SWITCH = random;
21562375 }
21572376
21582377 refreshContents();
21592378 } else
21602379 if (source == relinkverticesItem)
21612380 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2381
+ boolean random = CameraPane.SWITCH;
2382
+ CameraPane.SWITCH = false; // parse all random nodes
21642383 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2384
+ CameraPane.SWITCH = random;
21662385
21672386 refreshContents();
21682387 } else
....@@ -2177,9 +2396,9 @@
21772396 } else
21782397 if (source == setMasterItem)
21792398 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2399
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812400 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2401
+ Object3D content = Grafreed.clipboard.get(0);
21832402
21842403 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852404 content = ((cGroup)content).get(0);
....@@ -2192,9 +2411,9 @@
21922411 {
21932412 if (group.selection.size() == 1)
21942413 {
2195
- if (GrafreeD.clipboard.size() == 1)
2414
+ if (Grafreed.clipboard.size() == 1)
21962415 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2416
+ Object3D content = Grafreed.clipboard.get(0);
21982417
21992418 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002419 content = ((cGroup)content).get(0);
....@@ -2211,7 +2430,7 @@
22112430 {
22122431 RevertMeshes();
22132432 } else
2214
- if (source == resetMeshItem)
2433
+ if (source == resetAllItem)
22152434 {
22162435 ResetAll();
22172436 } else
....@@ -2260,7 +2479,7 @@
22602479 RandomNode random = new RandomNode();
22612480 group(random);
22622481 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
2482
+ random.name = random.get(0).name + "Switch";
22642483 } else
22652484 if (source == physicsItem)
22662485 {
....@@ -2399,7 +2618,7 @@
23992618 } else
24002619 if (source == genNormalsMESHItem)
24012620 {
2402
- GenNormals(true); // TODO
2621
+ GenNormalsMESH();
24032622 } else
24042623 if (source == genNormalsORGANItem)
24052624 {
....@@ -2464,6 +2683,22 @@
24642683 if (source == unmarkleavesItem)
24652684 {
24662685 MarkLeaves(false);
2686
+ } else
2687
+ if (source == rewindleavesItem)
2688
+ {
2689
+ RewindLeaves(true);
2690
+ } else
2691
+ if (source == unrewindleavesItem)
2692
+ {
2693
+ RewindLeaves(false);
2694
+ } else
2695
+ if (source == randomleavesItem)
2696
+ {
2697
+ RandomLeaves(true);
2698
+ } else
2699
+ if (source == unrandomleavesItem)
2700
+ {
2701
+ RandomLeaves(false);
24672702 } else
24682703 if (source == flipVItem)
24692704 {
....@@ -2549,9 +2784,13 @@
25492784 {
25502785 SmoothMesh();
25512786 } else
2552
- if (source == transformgeometryItem)
2787
+ if (source == transformGeometryItem)
25532788 {
25542789 TransformGeometry();
2790
+ } else
2791
+ if (source == transformChildrenItem)
2792
+ {
2793
+ TransformChildren();
25552794 } else
25562795 if (source == resetTransformItem)
25572796 {
....@@ -2559,7 +2798,11 @@
25592798 } else
25602799 if (source == resetCentroidItem)
25612800 {
2562
- ResetCentroid();
2801
+ ResetCentroid(true);
2802
+ } else
2803
+ if (source == resetCentroidXZItem)
2804
+ {
2805
+ ResetCentroid(false);
25632806 } else
25642807 if (source == resetParentItem)
25652808 {
....@@ -2723,6 +2966,24 @@
27232966 bigThree.ClearUI();
27242967 bigThree.add(centralPanel);
27252968 bigThree.FlushUI();
2969
+
2970
+ cameraView.requestFocusInWindow();
2971
+
2972
+// refreshContents(true);
2973
+//
2974
+// try
2975
+// {
2976
+// java.awt.Robot bot = new java.awt.Robot();
2977
+// int mask = InputEvent.BUTTON1_MASK;
2978
+// bot.mouseMove(100, 100);
2979
+// bot.mousePress(mask);
2980
+// bot.mouseRelease(mask);
2981
+// }
2982
+// catch (Exception e)
2983
+// {
2984
+//
2985
+// }
2986
+
27262987 } else
27272988 if (source == threeButton)
27282989 {
....@@ -2759,6 +3020,8 @@
27593020 bigThree.add(centralPanel);
27603021 bigThree.add(XYZPanel);
27613022 bigThree.FlushUI();
3023
+
3024
+ cameraView.requestFocusInWindow();
27623025 } else
27633026 if (source == fourButton)
27643027 {
....@@ -2794,6 +3057,8 @@
27943057 bigThree.ClearUI();
27953058 bigThree.add(scenePanel);
27963059 bigThree.FlushUI();
3060
+
3061
+ cameraView.requestFocusInWindow();
27973062 } else
27983063 if (source == sixButton)
27993064 {
....@@ -2830,6 +3095,8 @@
28303095 bigThree.add(scenePanel);
28313096 bigThree.add(centralPanel);
28323097 bigThree.FlushUI();
3098
+
3099
+ cameraView.requestFocusInWindow();
28333100 } else
28343101 if (source == sevenButton)
28353102 {
....@@ -2867,6 +3134,8 @@
28673134 bigThree.add(centralPanel);
28683135 bigThree.add(XYZPanel);
28693136 bigThree.FlushUI();
3137
+
3138
+ cameraView.requestFocusInWindow();
28703139 } else
28713140 if (source == rootButton)
28723141 {
....@@ -2878,6 +3147,7 @@
28783147 EditObject(obj);
28793148 }
28803149
3150
+ cameraView.requestFocusInWindow();
28813151 refreshContents(true);
28823152 } else
28833153 if (source == closeButton)
....@@ -2887,18 +3157,27 @@
28873157 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883158 {
28893159 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3160
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913161 {
3162
+ // Patch to avoid bug with transparency.
3163
+ if (!ab.hadMaterial)
3164
+ {
3165
+ ab.object.material = null;
3166
+ }
3167
+
28923168 buttonGroup.remove(ab);
28933169 radioPanel.remove(ab);
28943170
2895
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
28963173 // ab.GetObject().objectUI = null; // ?????????
28973174
28983175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993176 break;
29003177 }
29013178 }
3179
+
3180
+ cameraView.requestFocusInWindow();
29023181 refreshContents(true);
29033182 } else
29043183 if (source == editItem || source == editButton)
....@@ -2915,9 +3194,9 @@
29153194 child.CloseUI();
29163195 listUI.remove(child);
29173196
2918
- child.editWindow = null; // ???????????
3197
+ //child.editWindow = null; // ???????????
29193198 }
2920
- objEditor.ctrlPanel.validate();
3199
+ objEditor.ctrlPanel.FlushUI();
29213200 //objEditor.jTree.clearSelection();
29223201 //objEditor.ResetSliders();
29233202 refreshContents(true);
....@@ -3001,7 +3280,11 @@
30013280 frontView.object = group;
30023281 sideView.object = group;
30033282 }
3004
- group.editWindow = this;
3283
+
3284
+// fix "+" issue
3285
+ //group.editWindow = this;
3286
+ group.manipWindow = this;
3287
+
30053288 /*
30063289 currentLayout = radio.layout;
30073290 if (currentLayout == null)
....@@ -3013,8 +3296,23 @@
30133296 //group.parent = null; // ROOT
30143297 //group.attributes = -1;
30153298 ResetModel();
3299
+
3300
+ cameraView.requestFocusInWindow();
30163301 refreshContents(true);
3017
- }
3302
+ } else if (event.getSource() == editCameraItem)
3303
+ {
3304
+ cameraView.ProtectCamera();
3305
+ cameraView.repaint();
3306
+ return;
3307
+ } else if (event.getSource() == revertCameraItem)
3308
+ {
3309
+ cameraView.RevertCamera();
3310
+ cameraView.repaint();
3311
+ return;
3312
+ // } else if (event.getSource() == textureButton)
3313
+ // {
3314
+ // return; // true;
3315
+ }
30183316 else
30193317 {
30203318 //return super.action(event, arg);
....@@ -3023,7 +3321,6 @@
30233321 }
30243322
30253323 boolean useclient = false;
3026
- cRadio radio;
30273324
30283325 void ToggleRoot()
30293326 {
....@@ -3075,6 +3372,28 @@
30753372 refreshContents();
30763373 }
30773374
3375
+ void TransformChildren()
3376
+ {
3377
+ Object3D obj;
3378
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3379
+ {
3380
+ obj = (Object3D)e.nextElement();
3381
+ obj.KeepTextureMatrices();
3382
+ obj.TransformChildren();
3383
+ obj.RestoreTextureMatrices();
3384
+
3385
+// if (obj.parent == null)
3386
+// {
3387
+// System.out.println("NULL PARENT!");
3388
+// new Exception().printStackTrace();
3389
+// }
3390
+// else
3391
+// TouchTransform(obj);
3392
+// //obj.parent.Touch();
3393
+ }
3394
+
3395
+ refreshContents();
3396
+ }
30783397
30793398 void ResetTransform()
30803399 {
....@@ -3187,7 +3506,7 @@
31873506 refreshContents();
31883507 }
31893508
3190
- void ResetCentroid()
3509
+ void ResetCentroid(boolean full)
31913510 {
31923511 Object3D obj;
31933512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +3521,16 @@
32023521 LA.matIdentity(Object3D.mat);
32033522 obj.getBounds(minima, maxima, false);
32043523 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3524
+ if (full)
3525
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32063526 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32073527 obj.TransformMesh(Object3D.mat);
3528
+
32083529 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3530
+ if (full)
3531
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32103532 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3533
+
32113534 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32123535 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32133536 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +3559,8 @@
32363559
32373560 int size = obj.MemorySize();
32383561
3239
- System.err.println((size/1024) + " KB is the size of " + obj);
3562
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3563
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32403564 }
32413565 }
32423566 catch (Exception e)
....@@ -3273,9 +3597,9 @@
32733597 obj = (Object3D)e.nextElement();
32743598
32753599 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
3600
+ Grafreed.AnalyzeObject(obj);
32773601 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
3602
+ Grafreed.AnalyzeObject(obj.bRep);
32793603
32803604 // System.err.println((size/1024) + " KB is the size of " + obj);
32813605 }
....@@ -3317,6 +3641,13 @@
33173641 void GenNormals(boolean crease)
33183642 {
33193643 group.GenNormalsS(crease);
3644
+
3645
+ refreshContents();
3646
+ }
3647
+
3648
+ void GenNormalsMESH()
3649
+ {
3650
+ group.GenNormalsMeshS();
33203651
33213652 refreshContents();
33223653 }
....@@ -3489,8 +3820,8 @@
34893820
34903821 void ParseVertices()
34913822 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
3823
+ boolean epsequal = Grafreed.epsequal;
3824
+ Grafreed.epsequal = true;
34943825
34953826 for (int i=0; i<group.selection.size(); i++)
34963827 {
....@@ -3515,7 +3846,7 @@
35153846 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35163847 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35173848
3518
- g.add(GrafreeD.clipboard);
3849
+ g.add(Grafreed.clipboard);
35193850
35203851 buffer.add(g);
35213852 }
....@@ -3530,7 +3861,7 @@
35303861 makeSomething(buffer, i==group.selection.size()-1);
35313862 }
35323863
3533
- GrafreeD.epsequal = epsequal;
3864
+ Grafreed.epsequal = epsequal;
35343865
35353866 refreshContents();
35363867 }
....@@ -3548,7 +3879,16 @@
35483879 String pigment = Object3D.GetPigment(tex);
35493880 //String bump = Object3D.GetBump(tex);
35503881
3551
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3882
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3883
+
3884
+ try
3885
+ {
3886
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3887
+ }
3888
+ catch (Exception e)
3889
+ {
3890
+ System.err.println("FAIL: " + node);
3891
+ }
35523892
35533893 double s = v.s;
35543894
....@@ -3636,11 +3976,11 @@
36363976
36373977 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36383978
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
3979
+ boolean random = CameraPane.SWITCH;
3980
+ CameraPane.SWITCH = false; // parse all random nodes
36413981 lowres.linkVerticesThis(null);
36423982 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
3983
+ CameraPane.SWITCH = random;
36443984
36453985 System.err.flush();
36463986
....@@ -3680,7 +4020,7 @@
36804020 return;
36814021
36824022 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4023
+ Object3D ref = Grafreed.clipboard.get(0);
36844024
36854025 Object3D newgroup = new Object3D("Po:" + poses.name);
36864026
....@@ -3874,9 +4214,9 @@
38744214
38754215 void ClipMesh()
38764216 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4217
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784218 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4219
+ Object3D content = Grafreed.clipboard.get(0);
38804220
38814221 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824222 content = ((cGroup)content).get(0);
....@@ -3885,7 +4225,7 @@
38854225 // {
38864226 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874227 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4228
+ group.selection.ClipMesh(Grafreed.clipboard);
38894229 }
38904230 // group.selection.ClipMesh(GrafreeD.clipboard);
38914231 System.out.println("DONE.");
....@@ -3932,6 +4272,18 @@
39324272 void MarkLeaves(boolean hide)
39334273 {
39344274 group.selection.MarkLeaves(hide);
4275
+ refreshContents();
4276
+ }
4277
+
4278
+ void RewindLeaves(boolean hide)
4279
+ {
4280
+ group.selection.RewindLeaves(hide);
4281
+ refreshContents();
4282
+ }
4283
+
4284
+ void RandomLeaves(boolean hide)
4285
+ {
4286
+ group.selection.RandomLeaves(hide);
39354287 refreshContents();
39364288 }
39374289
....@@ -4020,7 +4372,7 @@
40204372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40214373
40224374 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
4375
+ if(elem != group || !newWindow)
40244376 {
40254377 // if (!(elem instanceof Composite))
40264378 // newWindow = false;
....@@ -4110,7 +4462,6 @@
41104462 //case 702: // Event.LIST_DESELECT
41114463 group.deselectAll();
41124464 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41144465 if (tps != null)
41154466 {
41164467 for (int i=0; i < tps.length; i++)
....@@ -4119,29 +4470,28 @@
41194470
41204471 //if (child.parent != null)
41214472 //child.parent.addSelectee(child);
4473
+ objEditor.SetMaterial(child);
41224474 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41264475 }
41274476 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
4477
+// else
4478
+// {
4479
+// objEditor.SetMaterial(group); // .GetMaterial());
4480
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4481
+// System.err.println("info : " + group.GetPath());
4482
+// }
41344483
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4484
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41384485 CameraPane.flash = true;
41394486
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4487
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41414488 // a camera
41424489 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4490
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4491
+ {
4492
+ CameraPane.camerachangeframe = 0; // don't refuse it
4493
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4494
+ }
41454495 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41464496 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41474497 }
....@@ -4154,6 +4504,26 @@
41544504
41554505 freezemodel = false;
41564506 }
4507
+
4508
+ void refreshContents(boolean cp)
4509
+ {
4510
+ if (!Globals.MOUSEDRAGGED)
4511
+ {
4512
+ objEditor.ClearInfo(); // .GetMaterial());
4513
+
4514
+ for (int i=0; i < group.selection.Size(); i++)
4515
+ {
4516
+ Object3D child = (Object3D) group.selection.get(i);
4517
+
4518
+ objEditor.AddInfo(child, this, true);
4519
+ System.err.println("info : " + child.GetPath());
4520
+ }
4521
+
4522
+ objEditor.SetText(); // jan 2014
4523
+ }
4524
+
4525
+ super.refreshContents(cp);
4526
+ }
41574527
41584528 void linkSomething(Object3D thing)
41594529 {
....@@ -4225,16 +4595,19 @@
42254595 {
42264596 if (group.selection.isEmpty())
42274597 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
4598
+
4599
+ Grafreed.clipboardIsTempGroup = false;
42294600 Composite tGroup = null;
42304601 if (group.selection.size() > 0) // 1)
42314602 {
42324603 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
4604
+ Grafreed.clipboardIsTempGroup = true;
42344605 }
42354606
42364607 if (cut)
42374608 {
4609
+ if (Globals.SAVEONMAKE)
4610
+ Save();
42384611 //int indices[] = jList.getSelectedIndices();
42394612 //for (int i = indices.length - 1; i >= 0; i--)
42404613 //jList.remove(indices[i]);
....@@ -4270,16 +4643,16 @@
42704643 //System.out.println("cut " + child);
42714644 //System.out.println("parent = " + child.parent);
42724645 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
4646
+ if (Grafreed.clipboardIsTempGroup)
42744647 tGroup.add/*Child*/(tmp);
42754648 else
4276
- GrafreeD.clipboard = tmp;
4649
+ Grafreed.clipboard = tmp;
42774650 }
42784651 else
4279
- if (GrafreeD.clipboardIsTempGroup)
4652
+ if (Grafreed.clipboardIsTempGroup)
42804653 tGroup.add/*Child*/(child);
42814654 else
4282
- GrafreeD.clipboard = child;
4655
+ Grafreed.clipboard = child;
42834656 }
42844657
42854658 //ResetModel();
....@@ -4311,21 +4684,23 @@
43114684 //System.out.println("cut " + elem);
43124685 //System.out.println("parent = " + elem.parent);
43134686 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
4687
+ if (Grafreed.clipboardIsTempGroup)
43154688 tGroup.add/*Child*/(tmp);
43164689 else
4317
- GrafreeD.clipboard = tmp;
4690
+ Grafreed.clipboard = tmp;
43184691 }
43194692 else
4320
- if (GrafreeD.clipboardIsTempGroup)
4693
+ if (Grafreed.clipboardIsTempGroup)
43214694 tGroup.add/*Child*/(child);
43224695 else
4323
- GrafreeD.clipboard = child;
4696
+ Grafreed.clipboard = child;
43244697 }
43254698
43264699 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
4700
+
4701
+ if (Grafreed.clipboardIsTempGroup)
4702
+ Grafreed.clipboard = tGroup;
4703
+
43294704 if (cut)
43304705 {
43314706 ResetModel();
....@@ -4339,7 +4714,7 @@
43394714 // return;
43404715 boolean first = true;
43414716
4342
- if (GrafreeD.clipboardIsTempGroup)
4717
+ if (Grafreed.clipboardIsTempGroup)
43434718 {
43444719 Composite temp;
43454720
....@@ -4350,7 +4725,7 @@
43504725 temp = (Composite)Applet3D.clipboard.deepCopy();
43514726 */
43524727 Object3D elem;
4353
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4728
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43544729 {
43554730 Object3D child = (Object3D)e.nextElement();
43564731
....@@ -4384,21 +4759,21 @@
43844759 //Object3D cb = Applet3D.clipboard;
43854760 //temp.addChild(cb);
43864761 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4387
- assert(GrafreeD.clipboard.parent == null);
4388
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4762
+ assert(Grafreed.clipboard.parent == null);
4763
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4764
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4765
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4766
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43924767 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
4768
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4769
+ Grafreed.clipboard.get(0).parent = keepparent;
43954770 }
43964771
43974772 ResetModel();
43984773 refreshContents();
43994774 }
44004775
4401
- void pasteInto(boolean copyit)
4776
+ void pasteInto(boolean copyit, boolean clone)
44024777 {
44034778 // if (GrafreeD.clipboard == null)
44044779 // return;
....@@ -4427,15 +4802,22 @@
44274802 if (copyit)
44284803 {
44294804 // paste(false);
4430
- CloneClipboard(false); // sept 2014
4805
+ if (clone)
4806
+ {
4807
+ CloneClipboard(false); // sept 2014
4808
+ }
4809
+ else
4810
+ {
4811
+ paste(false);
4812
+ }
44314813 }
44324814 else
44334815 {
44344816 boolean first = true;
44354817
4436
- if (GrafreeD.clipboardIsTempGroup)
4818
+ if (Grafreed.clipboardIsTempGroup)
44374819 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
4820
+ Composite temp = (Composite)Grafreed.clipboard;
44394821 Object3D copy;
44404822 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44414823 {
....@@ -4445,7 +4827,7 @@
44454827 }
44464828 } else
44474829 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
4830
+ linkSomething(Grafreed.clipboard); //.get(0));
44494831 }
44504832 }
44514833 }
....@@ -4850,21 +5232,6 @@
48505232 }
48515233 */
48525234
4853
- void ImportGFD()
4854
- {
4855
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4856
- browser.show();
4857
- String filename = browser.getFile();
4858
- if (filename != null && filename.length() > 0)
4859
- {
4860
- String fullname = browser.getDirectory() + filename;
4861
-
4862
- //Object3D readobj =
4863
- objEditor.ReadGFD(fullname, objEditor);
4864
- //makeSomething(readobj);
4865
- }
4866
- }
4867
-
48685235 /*
48695236 public void Callback(Object obj)
48705237 {
....@@ -4888,26 +5255,9 @@
48885255 }
48895256 */
48905257
4891
- void ImportVRMLX3D()
4892
- {
4893
- if (GrafreeD.standAlone)
4894
- {
4895
- /**/
4896
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4897
- browser.show();
4898
- String filename = browser.getFile();
4899
- if (filename != null && filename.length() > 0)
4900
- {
4901
- String fullname = browser.getDirectory() + filename;
4902
- LoadVRMLX3D(fullname);
4903
- }
4904
- /**/
4905
- }
4906
- }
4907
-
49085258 String GetFile(String dialogName)
49095259 {
4910
- if (GrafreeD.standAlone)
5260
+ if (Grafreed.standAlone)
49115261 {
49125262 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135263 browser.show();
....@@ -4971,10 +5321,18 @@
49715321 cButton flashSelectionButton;
49725322 cButton editButton;
49735323 cButton uneditButton;
5324
+ JCheckBox allParamsButton;
49745325 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765326 cButton unselectButton;
49775327
5328
+ cButton minButton;
5329
+ cButton maxButton;
5330
+ cButton fullButton;
5331
+ cButton undoButton;
5332
+ cButton redoButton;
5333
+ cButton saveButton;
5334
+ cButton oneStepButton;
5335
+
49785336 cButton screenfitButton;
49795337 cButton screenfitpointButton;
49805338 cButton snapobjectButton;
....@@ -4985,14 +5343,6 @@
49855343 cButton closeButton;
49865344
49875345 cButton setsupportButton;
4988
-
4989
- cButton twoButton;
4990
- cButton sixButton;
4991
- cButton threeButton;
4992
- cButton sevenButton;
4993
- cButton fourButton; // full panel
4994
- cButton oneButton; // full XYZ
4995
- //cButton currentLayout;
49965346
49975347 //
49985348 //Composite
....@@ -5005,6 +5355,8 @@
50055355 private MenuItem lookFromItem;
50065356 private MenuItem switchItem;
50075357 private MenuItem cutItem;
5358
+ private MenuItem undoItem;
5359
+ private MenuItem redoItem;
50085360 private MenuItem duplicateItem;
50095361 private MenuItem cloneItem;
50105362 private MenuItem cloneSupportItem;
....@@ -5018,7 +5370,7 @@
50185370 private MenuItem linkverticesItem;
50195371 private MenuItem relinkverticesItem;
50205372 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
5373
+ private MenuItem resetAllItem;
50225374 private MenuItem stepAllItem;
50235375 private MenuItem revertMeshItem;
50245376 private MenuItem poseMeshItem;
....@@ -5029,6 +5381,7 @@
50295381 private MenuItem mergeGeometriesItem;
50305382 private MenuItem copyItem;
50315383 private MenuItem pasteItem;
5384
+ private MenuItem pasteIntoItem;
50325385 private MenuItem pasteLinkItem;
50335386 private MenuItem pasteCloneItem;
50345387 private MenuItem pasteExpandItem;
....@@ -5067,6 +5420,10 @@
50675420 private MenuItem showleavesItem;
50685421 private MenuItem markleavesItem;
50695422 private MenuItem unmarkleavesItem;
5423
+ private MenuItem rewindleavesItem;
5424
+ private MenuItem unrewindleavesItem;
5425
+ private MenuItem randomleavesItem;
5426
+ private MenuItem unrandomleavesItem;
50705427
50715428 private MenuItem flipVItem;
50725429 private MenuItem unflipVItem;
....@@ -5078,8 +5435,10 @@
50785435 private MenuItem panoTexturesItem;
50795436
50805437 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
5438
+ private MenuItem resetCentroidXZItem;
50825439 private MenuItem resetTransformItem;
5440
+ private MenuItem transformGeometryItem;
5441
+ private MenuItem transformChildrenItem;
50835442 private MenuItem hideItem;
50845443 private MenuItem grabItem;
50855444 private MenuItem backItem;
....@@ -5126,7 +5485,7 @@
51265485 private MenuItem blobItem;
51275486 private MenuItem latheItem;
51285487 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
5488
+ private MenuItem overlayItem;
51305489 private MenuItem meshItem;
51315490 // private MenuItem meshGroupItem;
51325491 private MenuItem springItem;
....@@ -5148,11 +5507,6 @@
51485507 private MenuItem doubleItem;
51495508 private MenuItem tripleItem;
51505509
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51565510 private MenuItem computeAOItem;
51575511 private MenuItem recompileItem;
51585512 private MenuItem editScriptItem;
....@@ -5162,4 +5516,8 @@
51625516 private MenuItem analyzeItem;
51635517 private MenuItem dumpItem;
51645518 //boolean freezemodel = false;
5519
+
5520
+ Menu cameraMenu;
5521
+ MenuItem editCameraItem;
5522
+ MenuItem revertCameraItem;
51655523 }