Normand Briere
2019-06-13 4629090fafbef256abd0686a85ee12042d658868
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,130 @@
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
+ menu.add("-");
180
+
181
+ menu.add("-");
182
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
183
+ pasteIntoItem.addActionListener(this);
184
+ pasteLinkItem = menu.add(new MenuItem("Paste link"));
185
+ pasteLinkItem.addActionListener(this);
186
+ pasteCloneItem = menu.add(new MenuItem("Paste clone"));
187
+ pasteCloneItem.addActionListener(this);
188
+// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189
+// pasteExpandItem.addActionListener(this);
190
+ menu.add("-");
191
+ clearItem = menu.add(new MenuItem("Clear"));
192
+ clearItem.addActionListener(this);
193
+
194
+ if (Globals.ADVANCED)
195
+ {
196
+ // Deletes the cameras...
197
+ clearAllItem = menu.add(new MenuItem("Clear All"));
198
+ clearAllItem.addActionListener(this);
199
+ }
200
+
201
+ menuBar.add(cameraMenu = new Menu("View"));
202
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
203
+ //zBufferItem.addActionListener(this);
204
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205
+ //normalLensItem.addActionListener(this);
206
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
+ revertCameraItem.addActionListener(this);
208
+
209
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
+ toggleFullScreenItem.addItemListener(this);
211
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
+ cameraMenu.add("-");
213
+
214
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
+ toggleTextureItem.addItemListener(this);
216
+ toggleTextureItem.setState(CameraPane.textureon);
217
+
218
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
+ toggleSwitchItem.addItemListener(this);
220
+ toggleSwitchItem.setState(CameraPane.SWITCH);
221
+
222
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ toggleHandleItem.addItemListener(this);
224
+ toggleHandleItem.setState(CameraPane.HANDLES);
225
+
226
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
227
+ togglePaintItem.addItemListener(this);
228
+ togglePaintItem.setState(CameraPane.PAINTMODE);
229
+
230
+ if (Globals.ADVANCED)
231
+ {
232
+ cameraMenu.add("-");
233
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
234
+ toggleLiveItem.addItemListener(this);
235
+ toggleLiveItem.setState(Globals.isLIVE());
236
+
237
+ cameraMenu.add(stepItem = new MenuItem("Step"));
238
+ stepItem.addActionListener(this);
239
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
240
+ // toggleDLItem.addItemListener(this);
241
+ // toggleDLItem.setState(false);
242
+
243
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
244
+ toggleRenderItem.addItemListener(this);
245
+ toggleRenderItem.setState(!CameraPane.frozen);
246
+
247
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248
+ toggleDebugItem.addItemListener(this);
249
+ toggleDebugItem.setState(CameraPane.DEBUG);
250
+
251
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252
+ toggleFrustumItem.addItemListener(this);
253
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
254
+
255
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
256
+ toggleFootContactItem.addItemListener(this);
257
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
258
+
259
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
260
+ toggleTimelineItem.addItemListener(this);
261
+ }
262
+
263
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
264
+// toggleRootItem.addItemListener(this);
265
+// toggleRootItem.setState(false);
266
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
267
+// animationItem.addItemListener(this);
268
+// animationItem.setState(CameraPane.ANIMATION);
269
+ cameraMenu.add("-");
270
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
271
+ editCameraItem.addActionListener(this);
272
+
273
+ if (Globals.ADVANCED)
274
+ {
153275 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154276 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155277 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -161,45 +283,17 @@
161283 lookAtItem.addActionListener(this);
162284 //lookFromItem.addActinoListener(this);
163285 //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
-
286
+ }
287
+
193288 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);
289
+ if (Globals.ADVANCED)
290
+ {
198291 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199292 revertMeshItem.addActionListener(this);
200293 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201294 resetreferencesItem.addActionListener(this);
202295 menu.add("-");
296
+ }
203297 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204298 overwriteGeoItem.addActionListener(this);
205299 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,19 +305,26 @@
211305 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212306 overwriteUVItem.addActionListener(this);
213307 menu.add("-");
308
+ if (Globals.ADVANCED)
309
+ {
214310 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215311 generateMeshItem.addActionListener(this);
216312 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217313 poseMeshItem.addActionListener(this);
218314 menu.add("-");
315
+ }
219316 resetsupportItem = menu.add(new MenuItem("Reset support"));
220317 resetsupportItem.addActionListener(this);
221318 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222319 linkverticesItem.addActionListener(this);
223320 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224321 relinkverticesItem.addActionListener(this);
322
+
323
+ if (Globals.ADVANCED)
324
+ {
225325 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226326 setMasterItem.addActionListener(this);
327
+ }
227328
228329 oe.menuBar.add(menu = new Menu("Group"));
229330 grabItem = menu.add(new MenuItem("Grab"));
....@@ -234,27 +335,32 @@
234335 frontItem.addActionListener(this);
235336 compositeItem = menu.add(new MenuItem("Composite"));
236337 compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
338
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238339 hideItem.addActionListener(this);
239340 ungroupItem = menu.add(new MenuItem("Ungroup"));
240341 ungroupItem.addActionListener(this);
241342 menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
343
+ randomItem = menu.add(new MenuItem("Switch node"));
243344 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);
248345 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249346 switchGeoItem.addActionListener(this);
250347 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251348 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
349
+ morphItem = menu.add(new MenuItem("Morph Group"));
253350 morphItem.addActionListener(this);
351
+
352
+ if (Globals.ADVANCED)
353
+ {
354
+ menu.add("-");
355
+ physicsItem = menu.add(new MenuItem("Physics"));
356
+ physicsItem.addActionListener(this);
357
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
358
+ frameselectorItem.addActionListener(this);
254359 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255360 scriptNodeItem.addActionListener(this);
256361 cameraItem = menu.add(new MenuItem("Camera"));
257362 cameraItem.addActionListener(this);
363
+ }
258364
259365 oe.menuBar.add(menu = new Menu("Object"));
260366 textureItem = menu.add(new MenuItem("Texture"));
....@@ -269,21 +375,29 @@
269375 shadowYItem.addActionListener(this);
270376 shadowZItem = menu.add(new MenuItem("Shadow Z"));
271377 shadowZItem.addActionListener(this);
378
+ if (Globals.ADVANCED)
379
+ {
380
+ menu.add("-");
272381 linkerItem = menu.add(new MenuItem("Linker"));
273382 linkerItem.addActionListener(this);
274
- templateItem = menu.add(new MenuItem("Template"));
275
- templateItem.addActionListener(this);
276383 attributeItem = menu.add(new MenuItem("Attribute"));
277384 attributeItem.addActionListener(this);
385
+ templateItem = menu.add(new MenuItem("Template"));
386
+ templateItem.addActionListener(this);
278387 pointflowItem = menu.add(new MenuItem("Point Flow"));
279388 pointflowItem.addActionListener(this);
389
+ }
280390 menu.add("-");
281391 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282392 resetTransformItem.addActionListener(this);
283393 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284394 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
395
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
396
+ resetCentroidXZItem.addActionListener(this);
397
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
398
+ transformGeometryItem.addActionListener(this);
399
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
400
+ transformChildrenItem.addActionListener(this);
287401
288402 oe.menuBar.add(menu = new Menu("Geometry"));
289403 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +408,11 @@
294408 genNormalsCADItem.addActionListener(this);
295409 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296410 genNormalsMESHItem.addActionListener(this);
411
+ if (Globals.ADVANCED)
412
+ {
297413 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298414 genNormalsMINEItem.addActionListener(this);
415
+ }
299416 stripifyItem = menu.add(new MenuItem("Stripify"));
300417 stripifyItem.addActionListener(this);
301418 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +434,34 @@
317434 reduce34MeshItem.addActionListener(this);
318435 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319436 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322437 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323438 clipMeshItem.addActionListener(this);
439
+
440
+ if (Globals.ADVANCED)
441
+ {
442
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
443
+ smoothMeshItem.addActionListener(this);
444
+ }
324445
325446 oe.menuBar.add(menu = new Menu("Attributes"));
326447 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327448 clearMaterialsItem.addActionListener(this);
449
+ resetAllItem = menu.add(new MenuItem("Reset All"));
450
+ resetAllItem.addActionListener(this);
451
+ stepAllItem = menu.add(new MenuItem("Step All"));
452
+ stepAllItem.addActionListener(this);
328453 menu.add("-");
329454 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330455 liveleavesItem.addActionListener(this);
331456 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332457 unliveleavesItem.addActionListener(this);
458
+ if (Globals.ADVANCED)
459
+ {
333460 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334461 supportleavesItem.addActionListener(this);
335462 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336463 unsupportleavesItem.addActionListener(this);
464
+ }
337465 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338466 hideleavesItem.addActionListener(this);
339467 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -377,29 +505,22 @@
377505 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378506 sortbynameItem.addActionListener(this);
379507 menu.add("-");
508
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
509
+ shareGeometriesItem.addActionListener(this);
510
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
511
+ mergeGeometriesItem.addActionListener(this);
512
+ if (Globals.ADVANCED)
513
+ {
514
+ // Pretty much the same as duplicate and clone.
380515 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381516 extractGeometriesItem.addActionListener(this);
382517 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383518 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);
519
+ }
388520
389521 oe.menuBar.add(menu = new Menu("Insert"));
390522 buildCreateMenu(menu);
391523
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
-
403524 oe.menuBar.add(menu = new Menu("Tools"));
404525 buildToolsMenu(menu);
405526 }
....@@ -436,59 +557,76 @@
436557 */
437558 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438559
560
+ oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
+ undoButton.setToolTipText("Undo changes");
562
+ undoButton.addActionListener(this);
563
+
564
+ oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
+ redoButton.setToolTipText("Redo changes");
566
+ redoButton.addActionListener(this);
567
+
568
+ oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
+ saveButton.setToolTipText("Save changes");
570
+ saveButton.addActionListener(this);
571
+
439572 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
573
+ liveCB.setToolTipText("Enable animation");
441574 liveCB.addItemListener(this);
442575
576
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
+ oneStepButton.setToolTipText("Animate one step forward");
578
+ oneStepButton.addActionListener(this);
579
+
580
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
581
+ fastCB.setToolTipText("Fast mode");
582
+ fastCB.addItemListener(this);
583
+
443584 oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
444585 trackCB.setToolTipText("Enable tracking");
445586 trackCB.addItemListener(this);
446587
447
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
588
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
448589 screenfitButton.setToolTipText("Screen fit");
449590 screenfitButton.addActionListener(this);
450591
451592 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
452593 // screenfitpointButton.addActionListener(this);
453
-// oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
455
- snapobjectButton.addActionListener(this);
456
- snapobjectButton.setToolTipText("Snap Object");
457
- oe.aConstraints.gridx += 1;
458594
459
- //aConstraints.gridx = 0;
460
- //aConstraints.gridy += 1;
461
- oe.aConstraints.weighty = 0;
462
- oe.aConstraints.gridwidth = 1;
463
-
464
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
595
+ if (Globals.ADVANCED)
596
+ {
597
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598
+ snapobjectButton.addActionListener(this);
599
+ snapobjectButton.setToolTipText("Snap Object");
600
+ }
601
+
602
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
465603 flashSelectionButton.setToolTipText("Show selection");
466604 flashSelectionButton.addActionListener(this);
467605
468606 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469607
470
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
608
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
471609 twoButton.setToolTipText("Show center view only");
472610 twoButton.addActionListener(this);
473
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
474612 fourButton.addActionListener(this);
475613 fourButton.setToolTipText("Show left panel only");
476
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
614
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
477615 sixButton.setToolTipText("2-column layout left");
478616 sixButton.addActionListener(this);
479
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
617
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
480618 threeButton.setToolTipText("2-column layout right");
481619 threeButton.addActionListener(this);
482
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
620
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483621 sevenButton.setToolTipText("3-column layout");
484622 sevenButton.addActionListener(this);
485623 //
486624
487
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
625
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
488626 rootButton.setToolTipText("Edit selection in new tab");
489627 rootButton.addActionListener(this);
490628
491
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492630 closeButton.setToolTipText("Close tab");
493631 closeButton.addActionListener(this);
494632 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -496,23 +634,23 @@
496634
497635 cGridBag commandsPanel = new cGridBag();
498636
499
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
637
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500638 editButton.setToolTipText("Edit selection");
501639 editButton.addActionListener(this);
502640
503
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
641
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504642 uneditButton.setToolTipText("Unedit selection");
505643 uneditButton.addActionListener(this);
506644
507
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
645
+ commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
+ allParamsButton.setToolTipText("Edit all params");
647
+ allParamsButton.addActionListener(this);
648
+
649
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
508650 clearPanelButton.setToolTipText("Clear edit panel");
509651 clearPanelButton.addActionListener(this);
510652
511
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
512
- allParamsButton.setToolTipText("All params??");
513
- allParamsButton.addActionListener(this);
514
-
515
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
653
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516654 unselectButton.setToolTipText("Unselect");
517655 unselectButton.addActionListener(this);
518656
....@@ -587,43 +725,35 @@
587725
588726 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
589727 {
590
- //constraints.gridx = 0;
591
- //constraints.gridy = 0;
592
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
593
- fastCB.setToolTipText("Fast mode");
594
- fastCB.addItemListener(this);
595
- //constraints.gridy += 1;
596
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
597
- supportCB.setToolTipText("Enabled rigging");
598
- supportCB.addItemListener(this);
599
-
600
- // constraints.gridy += 1;
601
- // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
602
- // localCB.addItemListener(this);
603
-
604
- //constraints.gridy += 1;
605
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
606
- crowdCB.setToolTipText("Used for crowds");
607
- crowdCB.addItemListener(this);
608
-
609
- //constraints.gridy += 1;
610
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
611
- smoothCB.setToolTipText("Snapping delay");
612
- smoothCB.addItemListener(this);
613
-
614
- //constraints.gridy += 1;
615
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
616
- slowCB.setToolTipText("Smooth interpolation");
617
- slowCB.addItemListener(this);
618
- //constraints.gridy += 1;
619728 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
620729 boxCB.setToolTipText("Display bounding boxes");
621730 boxCB.addItemListener(this);
622
- //constraints.gridy += 1;
731
+
623732 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
624733 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
625734 zoomBoxCB.addItemListener(this);
626735
736
+ if (true) // Globals.ADVANCED)
737
+ {
738
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
+ supportCB.setToolTipText("Enable rigging");
740
+ supportCB.addItemListener(this);
741
+
742
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743
+ // localCB.addItemListener(this);
744
+
745
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746
+ crowdCB.setToolTipText("Used for crowds");
747
+ crowdCB.addItemListener(this);
748
+
749
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
750
+ smoothCB.setToolTipText("Snapping delay");
751
+ smoothCB.addItemListener(this);
752
+
753
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
754
+ slowCB.setToolTipText("Smooth interpolation");
755
+ slowCB.addItemListener(this);
756
+
627757 // constraints.gridy += 1;
628758 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
629759 // speakerMocapCB.addItemListener(this);
....@@ -648,14 +778,14 @@
648778 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
649779 // debugCB.addItemListener(this);
650780
651
- //constraints.gridy += 1;
652781 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
653782 oeilCB.addItemListener(this);
654783
655
- //constraints.gridy += 1;
656784 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
657785 lookAtCB.setToolTipText("Look-at target");
658786 lookAtCB.addItemListener(this);
787
+
788
+ }
659789
660790 cGridBag fill = new cGridBag();
661791
....@@ -676,6 +806,7 @@
676806 buttonGroup.add(radioButton);
677807 radioButton.doClick();
678808 }
809
+
679810 void SetupViews(ObjEditor oe)
680811 {
681812 oe.SetupViews();
....@@ -892,7 +1023,9 @@
8921023 // objEditor.DropFile((java.io.File[]) object, true);
8931024 // return;
8941025 // }
895
- if (string.charAt(0) == '/')
1026
+
1027
+ // File path for Mac and Windows
1028
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8961029 {
8971030 // file(s)
8981031 String[] names = string.split("\n");
....@@ -919,7 +1052,7 @@
9191052
9201053 flashIt = false;
9211054 CameraPane pane = (CameraPane) target;
922
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1055
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9231056 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9241057
9251058 if (group.selection.size() == 1)
....@@ -946,11 +1079,11 @@
9461079 {
9471080 loadClipboard(true);
9481081 objEditor.jTree.setSelectionPath(destinationPath);
949
- pasteInto(false);
1082
+ pasteInto(false, false);
9501083 } else {
9511084 loadClipboard(false);
9521085 objEditor.jTree.setSelectionPath(destinationPath);
953
- pasteInto(false); // true); // ???
1086
+ pasteInto(false, false); // true); // ???
9541087 }
9551088 }
9561089 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1072,27 +1205,33 @@
10721205 kleinItem.addActionListener(this);
10731206 particleItem = menu.add(new MenuItem("Particle system"));
10741207 particleItem.addActionListener(this);
1208
+ if (Globals.ADVANCED)
1209
+ {
10751210 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10761211 ragdollItem.addActionListener(this);
10771212 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10781213 ragdoll2Item.addActionListener(this);
1214
+ }
10791215 menu.add("-");
1080
- meshItem = menu.add(new MenuItem("Mesh"));
1216
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10811217 meshItem.addActionListener(this);
10821218 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10831219 // meshGroupItem.addActionListener(this);
1220
+ if (Globals.ADVANCED)
1221
+ {
10841222 springItem = menu.add(new MenuItem("Spring"));
10851223 springItem.addActionListener(this);
10861224 flagItem = menu.add(new MenuItem("Flag"));
10871225 flagItem.addActionListener(this);
1088
- bezierItem = menu.add(new MenuItem("Patch"));
1089
- bezierItem.addActionListener(this);
1090
- checkerItem = menu.add(new MenuItem("Checker"));
1091
- checkerItem.addActionListener(this);
10921226 blobItem = menu.add(new MenuItem("Blob"));
10931227 blobItem.addActionListener(this);
10941228 latheItem = menu.add(new MenuItem("Lathe"));
10951229 latheItem.addActionListener(this);
1230
+ }
1231
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1232
+ bezierItem.addActionListener(this);
1233
+ overlayItem = menu.add(new MenuItem("Overlay"));
1234
+ overlayItem.addActionListener(this);
10961235 lightItem = menu.add(new MenuItem("Light"));
10971236 lightItem.addActionListener(this);
10981237 menu.add("-");
....@@ -1102,34 +1241,39 @@
11021241 loopItem.addActionListener(this);
11031242 doubleItem = menu.add(new MenuItem("Fork"));
11041243 doubleItem.addActionListener(this);
1244
+ if (Globals.ADVANCED)
1245
+ {
11051246 tripleItem = menu.add(new MenuItem("Trident"));
11061247 tripleItem.addActionListener(this);
1248
+ }
11071249 }
11081250
11091251 void buildToolsMenu(Menu menu)
11101252 {
11111253 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11121254 animationItem.addItemListener(this);
1113
- animationItem.setState(CameraPane.ANIMATION);
1255
+ animationItem.setState(Globals.ANIMATION);
11141256
11151257 menu.add("-");
11161258 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11171259 parseverticesItem.addActionListener(this);
11181260 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11191261 textureFieldItem.addActionListener(this);
1120
- alignItem = menu.add(new MenuItem("Align"));
1262
+ alignItem = menu.add(new MenuItem("Align Objects"));
11211263 alignItem.addActionListener(this);
1122
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1123
- mirrorItem.addActionListener(this);
11241264 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11251265 reduceMorphItem.addActionListener(this);
11261266 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11271267 reduce34MorphItem.addActionListener(this);
1128
-
1268
+ menu.add("-");
11291269 menu.add(computeAOItem = new MenuItem("Compute AO"));
11301270 computeAOItem.addActionListener(this);
1131
- menu.add("-");
11321271
1272
+ if (Globals.ADVANCED)
1273
+ {
1274
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1275
+ mirrorItem.addActionListener(this);
1276
+ menu.add("-");
11331277 menu.add(memoryItem = new MenuItem("Memory Usage"));
11341278 memoryItem.addActionListener(this);
11351279 menu.add(analyzeItem = new MenuItem("Analyze"));
....@@ -1152,6 +1296,7 @@
11521296 menu.add("-");
11531297 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11541298 editScriptItem.addActionListener(this);
1299
+ }
11551300 }
11561301
11571302 void ScreenFit()
....@@ -1480,9 +1625,9 @@
14801625
14811626 void Overwrite(int mask)
14821627 {
1483
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1628
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14841629 {
1485
- Object3D content = GrafreeD.clipboard.get(0);
1630
+ Object3D content = Grafreed.clipboard.get(0);
14861631
14871632 if (content instanceof cGroup && ((cGroup)content).transientlink )
14881633 content = ((cGroup)content).get(0);
....@@ -1653,7 +1798,7 @@
16531798 {
16541799 makeSomething(new BezierSurface());
16551800 } else
1656
- if (source == checkerItem)
1801
+ if (source == overlayItem)
16571802 {
16581803 /*
16591804 Object3D obj = new BezierSurface(5,8);
....@@ -1787,23 +1932,6 @@
17871932 csg.addChild(child);
17881933 child.addChild(csg);
17891934 } else
1790
-
1791
- if (source == importGFDItem)
1792
- {
1793
- ImportGFD();
1794
- } else
1795
- if (source == importVRMLX3DItem)
1796
- {
1797
- ImportVRMLX3D();
1798
- } else
1799
- if (source == import3DSItem)
1800
- {
1801
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1802
- } else
1803
- if (source == importOBJItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1806
- } else
18071935 if (source == computeAOItem)
18081936 {
18091937 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1822,7 +1950,7 @@
18221950 if (source == invariantsItem)
18231951 {
18241952 System.out.println("Invariants:");
1825
- GrafreeD.grafreeD.universe.invariants();
1953
+ Grafreed.grafreeD.universe.invariants();
18261954 } else
18271955 if (source == memoryItem)
18281956 {
....@@ -1840,6 +1968,23 @@
18401968 if (source == dumpItem)
18411969 {
18421970 DumpObject();
1971
+ } else
1972
+ if (source == undoButton)
1973
+ {
1974
+ Undo();
1975
+ } else
1976
+ if (source == redoButton)
1977
+ {
1978
+ Redo();
1979
+ } else
1980
+ if (source == saveButton)
1981
+ {
1982
+ Save();
1983
+ } else
1984
+ if (source == oneStepButton)
1985
+ {
1986
+ Globals.ONESTEP = true;
1987
+ cameraView.repaint();
18431988 } else
18441989 if (source == screenfitButton)
18451990 {
....@@ -1890,12 +2035,20 @@
18902035 {
18912036 loadClipboard(true);
18922037 } else
2038
+ if (source == undoItem)
2039
+ {
2040
+ Undo();
2041
+ } else
2042
+ if (source == redoItem)
2043
+ {
2044
+ Redo();
2045
+ } else
18932046 if (source == duplicateItem)
18942047 {
1895
- Object3D keep = GrafreeD.clipboard;
2048
+ Object3D keep = Grafreed.clipboard;
18962049 loadClipboard(false);
18972050 paste(false);
1898
- GrafreeD.clipboard = keep;
2051
+ Grafreed.clipboard = keep;
18992052 } else
19002053 if (source == cloneItem)
19012054 {
....@@ -1913,13 +2066,17 @@
19132066 {
19142067 paste(false);
19152068 } else
2069
+ if (source == pasteIntoItem)
2070
+ {
2071
+ pasteInto(true, false);
2072
+ } else
19162073 if (source == pasteLinkItem)
19172074 {
1918
- pasteInto(false);
2075
+ pasteInto(false, false);
19192076 } else
19202077 if (source == pasteCloneItem)
19212078 {
1922
- pasteInto(true);
2079
+ pasteInto(true, true);
19232080 } else
19242081 if (source == pasteExpandItem)
19252082 {
....@@ -2111,9 +2268,9 @@
21112268 // group.selection.get(0).setMasterThis(content); // should be identity
21122269 // refreshContents();
21132270 // }
2114
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2271
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21152272 {
2116
- Object3D content = GrafreeD.clipboard.get(0);
2273
+ Object3D content = Grafreed.clipboard.get(0);
21172274
21182275 if (content instanceof cGroup && ((cGroup)content).transientlink )
21192276 content = ((cGroup)content).get(0);
....@@ -2121,11 +2278,11 @@
21212278 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21222279 for (int i=0; i<group.selection.size(); i++)
21232280 {
2124
- boolean random = CameraPane.RANDOM;
2125
- CameraPane.RANDOM = false; // parse all random nodes
2281
+ boolean random = CameraPane.SWITCH;
2282
+ CameraPane.SWITCH = false; // parse all random nodes
21262283 group.selection.get(i).linkVerticesThis(content);
21272284 // group.selection.get(i).setMasterThis(content); // should be identity
2128
- CameraPane.RANDOM = random;
2285
+ CameraPane.SWITCH = random;
21292286 }
21302287 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21312288 refreshContents();
....@@ -2135,20 +2292,20 @@
21352292 {
21362293 for (int i=0; i<group.selection.size(); i++)
21372294 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2295
+ boolean random = CameraPane.SWITCH;
2296
+ CameraPane.SWITCH = false; // parse all random nodes
21402297 group.selection.get(i).linkVerticesThis(null);
2141
- CameraPane.RANDOM = random;
2298
+ CameraPane.SWITCH = random;
21422299 }
21432300
21442301 refreshContents();
21452302 } else
21462303 if (source == relinkverticesItem)
21472304 {
2148
- boolean random = CameraPane.RANDOM;
2149
- CameraPane.RANDOM = false; // parse all random nodes
2305
+ boolean random = CameraPane.SWITCH;
2306
+ CameraPane.SWITCH = false; // parse all random nodes
21502307 group.selection.RelinkToSupport();
2151
- CameraPane.RANDOM = random;
2308
+ CameraPane.SWITCH = random;
21522309
21532310 refreshContents();
21542311 } else
....@@ -2163,9 +2320,9 @@
21632320 } else
21642321 if (source == setMasterItem)
21652322 {
2166
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2323
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21672324 {
2168
- Object3D content = GrafreeD.clipboard.get(0);
2325
+ Object3D content = Grafreed.clipboard.get(0);
21692326
21702327 if (content instanceof cGroup && ((cGroup)content).transientlink )
21712328 content = ((cGroup)content).get(0);
....@@ -2178,9 +2335,9 @@
21782335 {
21792336 if (group.selection.size() == 1)
21802337 {
2181
- if (GrafreeD.clipboard.size() == 1)
2338
+ if (Grafreed.clipboard.size() == 1)
21822339 {
2183
- Object3D content = GrafreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
21842341
21852342 if (content instanceof cGroup && ((cGroup)content).transientlink )
21862343 content = ((cGroup)content).get(0);
....@@ -2197,7 +2354,7 @@
21972354 {
21982355 RevertMeshes();
21992356 } else
2200
- if (source == resetMeshItem)
2357
+ if (source == resetAllItem)
22012358 {
22022359 ResetAll();
22032360 } else
....@@ -2246,7 +2403,7 @@
22462403 RandomNode random = new RandomNode();
22472404 group(random);
22482405 if (random.size() > 0)
2249
- random.name = random.get(0).name + "Rnd";
2406
+ random.name = random.get(0).name + "Switch";
22502407 } else
22512408 if (source == physicsItem)
22522409 {
....@@ -2385,7 +2542,7 @@
23852542 } else
23862543 if (source == genNormalsMESHItem)
23872544 {
2388
- GenNormals(true); // TODO
2545
+ GenNormalsMESH();
23892546 } else
23902547 if (source == genNormalsORGANItem)
23912548 {
....@@ -2535,9 +2692,13 @@
25352692 {
25362693 SmoothMesh();
25372694 } else
2538
- if (source == transformgeometryItem)
2695
+ if (source == transformGeometryItem)
25392696 {
25402697 TransformGeometry();
2698
+ } else
2699
+ if (source == transformChildrenItem)
2700
+ {
2701
+ TransformChildren();
25412702 } else
25422703 if (source == resetTransformItem)
25432704 {
....@@ -2545,7 +2706,11 @@
25452706 } else
25462707 if (source == resetCentroidItem)
25472708 {
2548
- ResetCentroid();
2709
+ ResetCentroid(true);
2710
+ } else
2711
+ if (source == resetCentroidXZItem)
2712
+ {
2713
+ ResetCentroid(false);
25492714 } else
25502715 if (source == resetParentItem)
25512716 {
....@@ -2901,9 +3066,9 @@
29013066 child.CloseUI();
29023067 listUI.remove(child);
29033068
2904
- child.editWindow = null; // ???????????
3069
+ //child.editWindow = null; // ???????????
29053070 }
2906
- objEditor.ctrlPanel.validate();
3071
+ objEditor.ctrlPanel.FlushUI();
29073072 //objEditor.jTree.clearSelection();
29083073 //objEditor.ResetSliders();
29093074 refreshContents(true);
....@@ -2987,7 +3152,10 @@
29873152 frontView.object = group;
29883153 sideView.object = group;
29893154 }
3155
+
3156
+// fix "+" issue
29903157 group.editWindow = this;
3158
+
29913159 /*
29923160 currentLayout = radio.layout;
29933161 if (currentLayout == null)
....@@ -3000,7 +3168,20 @@
30003168 //group.attributes = -1;
30013169 ResetModel();
30023170 refreshContents(true);
3003
- }
3171
+ } else if (event.getSource() == editCameraItem)
3172
+ {
3173
+ cameraView.ProtectCamera();
3174
+ cameraView.repaint();
3175
+ return;
3176
+ } else if (event.getSource() == revertCameraItem)
3177
+ {
3178
+ cameraView.RevertCamera();
3179
+ cameraView.repaint();
3180
+ return;
3181
+ // } else if (event.getSource() == textureButton)
3182
+ // {
3183
+ // return; // true;
3184
+ }
30043185 else
30053186 {
30063187 //return super.action(event, arg);
....@@ -3061,6 +3242,28 @@
30613242 refreshContents();
30623243 }
30633244
3245
+ void TransformChildren()
3246
+ {
3247
+ Object3D obj;
3248
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3249
+ {
3250
+ obj = (Object3D)e.nextElement();
3251
+ obj.KeepTextureMatrices();
3252
+ obj.TransformChildren();
3253
+ obj.RestoreTextureMatrices();
3254
+
3255
+// if (obj.parent == null)
3256
+// {
3257
+// System.out.println("NULL PARENT!");
3258
+// new Exception().printStackTrace();
3259
+// }
3260
+// else
3261
+// TouchTransform(obj);
3262
+// //obj.parent.Touch();
3263
+ }
3264
+
3265
+ refreshContents();
3266
+ }
30643267
30653268 void ResetTransform()
30663269 {
....@@ -3173,7 +3376,7 @@
31733376 refreshContents();
31743377 }
31753378
3176
- void ResetCentroid()
3379
+ void ResetCentroid(boolean full)
31773380 {
31783381 Object3D obj;
31793382 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3188,12 +3391,16 @@
31883391 LA.matIdentity(Object3D.mat);
31893392 obj.getBounds(minima, maxima, false);
31903393 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3191
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3394
+ if (full)
3395
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31923396 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31933397 obj.TransformMesh(Object3D.mat);
3398
+
31943399 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3195
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3400
+ if (full)
3401
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31963402 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3403
+
31973404 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31983405 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31993406 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3222,7 +3429,8 @@
32223429
32233430 int size = obj.MemorySize();
32243431
3225
- System.err.println((size/1024) + " KB is the size of " + obj);
3432
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3433
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32263434 }
32273435 }
32283436 catch (Exception e)
....@@ -3259,9 +3467,9 @@
32593467 obj = (Object3D)e.nextElement();
32603468
32613469 System.out.println("Object is: " + obj);
3262
- GrafreeD.AnalyzeObject(obj);
3470
+ Grafreed.AnalyzeObject(obj);
32633471 System.out.println("Boundary rep: " + obj.bRep);
3264
- GrafreeD.AnalyzeObject(obj.bRep);
3472
+ Grafreed.AnalyzeObject(obj.bRep);
32653473
32663474 // System.err.println((size/1024) + " KB is the size of " + obj);
32673475 }
....@@ -3303,6 +3511,13 @@
33033511 void GenNormals(boolean crease)
33043512 {
33053513 group.GenNormalsS(crease);
3514
+
3515
+ refreshContents();
3516
+ }
3517
+
3518
+ void GenNormalsMESH()
3519
+ {
3520
+ group.GenNormalsMeshS();
33063521
33073522 refreshContents();
33083523 }
....@@ -3475,8 +3690,8 @@
34753690
34763691 void ParseVertices()
34773692 {
3478
- boolean epsequal = GrafreeD.epsequal;
3479
- GrafreeD.epsequal = true;
3693
+ boolean epsequal = Grafreed.epsequal;
3694
+ Grafreed.epsequal = true;
34803695
34813696 for (int i=0; i<group.selection.size(); i++)
34823697 {
....@@ -3501,7 +3716,7 @@
35013716 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35023717 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35033718
3504
- g.add(GrafreeD.clipboard);
3719
+ g.add(Grafreed.clipboard);
35053720
35063721 buffer.add(g);
35073722 }
....@@ -3516,7 +3731,7 @@
35163731 makeSomething(buffer, i==group.selection.size()-1);
35173732 }
35183733
3519
- GrafreeD.epsequal = epsequal;
3734
+ Grafreed.epsequal = epsequal;
35203735
35213736 refreshContents();
35223737 }
....@@ -3534,7 +3749,16 @@
35343749 String pigment = Object3D.GetPigment(tex);
35353750 //String bump = Object3D.GetBump(tex);
35363751
3537
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3752
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3753
+
3754
+ try
3755
+ {
3756
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3757
+ }
3758
+ catch (Exception e)
3759
+ {
3760
+ System.err.println("FAIL: " + node);
3761
+ }
35383762
35393763 double s = v.s;
35403764
....@@ -3622,11 +3846,11 @@
36223846
36233847 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36243848
3625
- boolean random = CameraPane.RANDOM;
3626
- CameraPane.RANDOM = false; // parse all random nodes
3849
+ boolean random = CameraPane.SWITCH;
3850
+ CameraPane.SWITCH = false; // parse all random nodes
36273851 lowres.linkVerticesThis(null);
36283852 lowres.linkVerticesThis(sn);
3629
- CameraPane.RANDOM = random;
3853
+ CameraPane.SWITCH = random;
36303854
36313855 System.err.flush();
36323856
....@@ -3666,7 +3890,7 @@
36663890 return;
36673891
36683892 Object3D poses = group.selection.get(0);
3669
- Object3D ref = GrafreeD.clipboard.get(0);
3893
+ Object3D ref = Grafreed.clipboard.get(0);
36703894
36713895 Object3D newgroup = new Object3D("Po:" + poses.name);
36723896
....@@ -3860,9 +4084,9 @@
38604084
38614085 void ClipMesh()
38624086 {
3863
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4087
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38644088 {
3865
- Object3D content = GrafreeD.clipboard.get(0);
4089
+ Object3D content = Grafreed.clipboard.get(0);
38664090
38674091 if (content instanceof cGroup && ((cGroup)content).transientlink )
38684092 content = ((cGroup)content).get(0);
....@@ -3871,7 +4095,7 @@
38714095 // {
38724096 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38734097 // }
3874
- group.selection.ClipMesh(GrafreeD.clipboard);
4098
+ group.selection.ClipMesh(Grafreed.clipboard);
38754099 }
38764100 // group.selection.ClipMesh(GrafreeD.clipboard);
38774101 System.out.println("DONE.");
....@@ -4006,7 +4230,7 @@
40064230 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40074231
40084232 Object3D elem = (Object3D)group.selection.elementAt(i);
4009
- if(elem != group)
4233
+ if(elem != group || !newWindow)
40104234 {
40114235 // if (!(elem instanceof Composite))
40124236 // newWindow = false;
....@@ -4120,14 +4344,17 @@
41204344
41214345 objEditor.SetText(); // jan 2014
41224346
4123
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4347
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41244348 CameraPane.flash = true;
41254349
4126
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4350
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41274351 // a camera
41284352 {
4129
- CameraPane.camerachangeframe = 0; // don't refuse it
4130
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4353
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4354
+ {
4355
+ CameraPane.camerachangeframe = 0; // don't refuse it
4356
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4357
+ }
41314358 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41324359 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41334360 }
....@@ -4211,16 +4438,18 @@
42114438 {
42124439 if (group.selection.isEmpty())
42134440 return;
4214
- GrafreeD.clipboardIsTempGroup = false;
4441
+
4442
+ Grafreed.clipboardIsTempGroup = false;
42154443 Composite tGroup = null;
42164444 if (group.selection.size() > 0) // 1)
42174445 {
42184446 tGroup = new cGroup();
4219
- GrafreeD.clipboardIsTempGroup = true;
4447
+ Grafreed.clipboardIsTempGroup = true;
42204448 }
42214449
42224450 if (cut)
42234451 {
4452
+ Save();
42244453 //int indices[] = jList.getSelectedIndices();
42254454 //for (int i = indices.length - 1; i >= 0; i--)
42264455 //jList.remove(indices[i]);
....@@ -4256,16 +4485,16 @@
42564485 //System.out.println("cut " + child);
42574486 //System.out.println("parent = " + child.parent);
42584487 // tmp.addChild(child);
4259
- if (GrafreeD.clipboardIsTempGroup)
4488
+ if (Grafreed.clipboardIsTempGroup)
42604489 tGroup.add/*Child*/(tmp);
42614490 else
4262
- GrafreeD.clipboard = tmp;
4491
+ Grafreed.clipboard = tmp;
42634492 }
42644493 else
4265
- if (GrafreeD.clipboardIsTempGroup)
4494
+ if (Grafreed.clipboardIsTempGroup)
42664495 tGroup.add/*Child*/(child);
42674496 else
4268
- GrafreeD.clipboard = child;
4497
+ Grafreed.clipboard = child;
42694498 }
42704499
42714500 //ResetModel();
....@@ -4297,21 +4526,23 @@
42974526 //System.out.println("cut " + elem);
42984527 //System.out.println("parent = " + elem.parent);
42994528 // tmp.addChild(elem);
4300
- if (GrafreeD.clipboardIsTempGroup)
4529
+ if (Grafreed.clipboardIsTempGroup)
43014530 tGroup.add/*Child*/(tmp);
43024531 else
4303
- GrafreeD.clipboard = tmp;
4532
+ Grafreed.clipboard = tmp;
43044533 }
43054534 else
4306
- if (GrafreeD.clipboardIsTempGroup)
4535
+ if (Grafreed.clipboardIsTempGroup)
43074536 tGroup.add/*Child*/(child);
43084537 else
4309
- GrafreeD.clipboard = child;
4538
+ Grafreed.clipboard = child;
43104539 }
43114540
43124541 }
4313
- if (GrafreeD.clipboardIsTempGroup)
4314
- GrafreeD.clipboard = tGroup;
4542
+
4543
+ if (Grafreed.clipboardIsTempGroup)
4544
+ Grafreed.clipboard = tGroup;
4545
+
43154546 if (cut)
43164547 {
43174548 ResetModel();
....@@ -4325,7 +4556,7 @@
43254556 // return;
43264557 boolean first = true;
43274558
4328
- if (GrafreeD.clipboardIsTempGroup)
4559
+ if (Grafreed.clipboardIsTempGroup)
43294560 {
43304561 Composite temp;
43314562
....@@ -4336,7 +4567,7 @@
43364567 temp = (Composite)Applet3D.clipboard.deepCopy();
43374568 */
43384569 Object3D elem;
4339
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4570
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43404571 {
43414572 Object3D child = (Object3D)e.nextElement();
43424573
....@@ -4370,21 +4601,21 @@
43704601 //Object3D cb = Applet3D.clipboard;
43714602 //temp.addChild(cb);
43724603 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4373
- assert(GrafreeD.clipboard.parent == null);
4374
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4375
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4376
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4377
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4604
+ assert(Grafreed.clipboard.parent == null);
4605
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4606
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4607
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4608
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43784609 else
4379
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4380
- GrafreeD.clipboard.get(0).parent = keepparent;
4610
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4611
+ Grafreed.clipboard.get(0).parent = keepparent;
43814612 }
43824613
43834614 ResetModel();
43844615 refreshContents();
43854616 }
43864617
4387
- void pasteInto(boolean copyit)
4618
+ void pasteInto(boolean copyit, boolean clone)
43884619 {
43894620 // if (GrafreeD.clipboard == null)
43904621 // return;
....@@ -4413,15 +4644,22 @@
44134644 if (copyit)
44144645 {
44154646 // paste(false);
4416
- CloneClipboard(false); // sept 2014
4647
+ if (clone)
4648
+ {
4649
+ CloneClipboard(false); // sept 2014
4650
+ }
4651
+ else
4652
+ {
4653
+ paste(false);
4654
+ }
44174655 }
44184656 else
44194657 {
44204658 boolean first = true;
44214659
4422
- if (GrafreeD.clipboardIsTempGroup)
4660
+ if (Grafreed.clipboardIsTempGroup)
44234661 {
4424
- Composite temp = (Composite)GrafreeD.clipboard;
4662
+ Composite temp = (Composite)Grafreed.clipboard;
44254663 Object3D copy;
44264664 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44274665 {
....@@ -4431,7 +4669,7 @@
44314669 }
44324670 } else
44334671 {
4434
- linkSomething(GrafreeD.clipboard); //.get(0));
4672
+ linkSomething(Grafreed.clipboard); //.get(0));
44354673 }
44364674 }
44374675 }
....@@ -4836,21 +5074,6 @@
48365074 }
48375075 */
48385076
4839
- void ImportGFD()
4840
- {
4841
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4842
- browser.show();
4843
- String filename = browser.getFile();
4844
- if (filename != null && filename.length() > 0)
4845
- {
4846
- String fullname = browser.getDirectory() + filename;
4847
-
4848
- //Object3D readobj =
4849
- objEditor.ReadGFD(fullname, objEditor);
4850
- //makeSomething(readobj);
4851
- }
4852
- }
4853
-
48545077 /*
48555078 public void Callback(Object obj)
48565079 {
....@@ -4874,26 +5097,9 @@
48745097 }
48755098 */
48765099
4877
- void ImportVRMLX3D()
4878
- {
4879
- if (GrafreeD.standAlone)
4880
- {
4881
- /**/
4882
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4883
- browser.show();
4884
- String filename = browser.getFile();
4885
- if (filename != null && filename.length() > 0)
4886
- {
4887
- String fullname = browser.getDirectory() + filename;
4888
- LoadVRMLX3D(fullname);
4889
- }
4890
- /**/
4891
- }
4892
- }
4893
-
48945100 String GetFile(String dialogName)
48955101 {
4896
- if (GrafreeD.standAlone)
5102
+ if (Grafreed.standAlone)
48975103 {
48985104 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48995105 browser.show();
....@@ -4957,10 +5163,15 @@
49575163 cButton flashSelectionButton;
49585164 cButton editButton;
49595165 cButton uneditButton;
5166
+ JCheckBox allParamsButton;
49605167 cButton clearpanelButton;
4961
- cButton allParamsButton;
49625168 cButton unselectButton;
49635169
5170
+ cButton saveButton;
5171
+ cButton undoButton;
5172
+ cButton redoButton;
5173
+ cButton oneStepButton;
5174
+
49645175 cButton screenfitButton;
49655176 cButton screenfitpointButton;
49665177 cButton snapobjectButton;
....@@ -4991,6 +5202,8 @@
49915202 private MenuItem lookFromItem;
49925203 private MenuItem switchItem;
49935204 private MenuItem cutItem;
5205
+ private MenuItem undoItem;
5206
+ private MenuItem redoItem;
49945207 private MenuItem duplicateItem;
49955208 private MenuItem cloneItem;
49965209 private MenuItem cloneSupportItem;
....@@ -5004,7 +5217,7 @@
50045217 private MenuItem linkverticesItem;
50055218 private MenuItem relinkverticesItem;
50065219 private MenuItem setMasterItem;
5007
- private MenuItem resetMeshItem;
5220
+ private MenuItem resetAllItem;
50085221 private MenuItem stepAllItem;
50095222 private MenuItem revertMeshItem;
50105223 private MenuItem poseMeshItem;
....@@ -5015,6 +5228,7 @@
50155228 private MenuItem mergeGeometriesItem;
50165229 private MenuItem copyItem;
50175230 private MenuItem pasteItem;
5231
+ private MenuItem pasteIntoItem;
50185232 private MenuItem pasteLinkItem;
50195233 private MenuItem pasteCloneItem;
50205234 private MenuItem pasteExpandItem;
....@@ -5064,8 +5278,10 @@
50645278 private MenuItem panoTexturesItem;
50655279
50665280 private MenuItem resetCentroidItem;
5067
- private MenuItem transformgeometryItem;
5281
+ private MenuItem resetCentroidXZItem;
50685282 private MenuItem resetTransformItem;
5283
+ private MenuItem transformGeometryItem;
5284
+ private MenuItem transformChildrenItem;
50695285 private MenuItem hideItem;
50705286 private MenuItem grabItem;
50715287 private MenuItem backItem;
....@@ -5112,7 +5328,7 @@
51125328 private MenuItem blobItem;
51135329 private MenuItem latheItem;
51145330 private MenuItem bezierItem;
5115
- private MenuItem checkerItem;
5331
+ private MenuItem overlayItem;
51165332 private MenuItem meshItem;
51175333 // private MenuItem meshGroupItem;
51185334 private MenuItem springItem;
....@@ -5134,11 +5350,6 @@
51345350 private MenuItem doubleItem;
51355351 private MenuItem tripleItem;
51365352
5137
- private MenuItem importGFDItem;
5138
- private MenuItem importVRMLX3DItem;
5139
- private MenuItem import3DSItem;
5140
- private MenuItem importOBJItem;
5141
-
51425353 private MenuItem computeAOItem;
51435354 private MenuItem recompileItem;
51445355 private MenuItem editScriptItem;
....@@ -5148,4 +5359,8 @@
51485359 private MenuItem analyzeItem;
51495360 private MenuItem dumpItem;
51505361 //boolean freezemodel = false;
5362
+
5363
+ Menu cameraMenu;
5364
+ MenuItem editCameraItem;
5365
+ MenuItem revertCameraItem;
51515366 }