Normand Briere
2019-06-09 cd87df088b1850ba0c90beb6c866c443e4eaf3b9
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- 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));
105106 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -149,6 +150,8 @@
149150
150151 void SetupMenu2(ObjEditor oe)
151152 {
153
+ if (Globals.ADVANCED)
154
+ {
152155 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153156 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154157 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,17 +163,21 @@
160163 lookAtItem.addActionListener(this);
161164 //lookFromItem.addActinoListener(this);
162165 //switchItem.addActionListener(this);
166
+ }
167
+
163168 Menu menu;
164169 oe.menuBar.add(menu = new Menu("Edit"));
165170 //editItem = menu.add(new MenuItem("Edit"));
166171 //editItem.addActionListener(this);
167172 duplicateItem = menu.add(new MenuItem("Duplicate"));
168173 duplicateItem.addActionListener(this);
169
- menu.add("-");
170174 cloneItem = menu.add(new MenuItem("Clone"));
171175 cloneItem.addActionListener(this);
176
+ if (Globals.ADVANCED)
177
+ {
172178 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173179 cloneSupportItem.addActionListener(this);
180
+ }
174181 menu.add("-");
175182 cutItem = menu.add(new MenuItem("Cut"));
176183 cutItem.addActionListener(this);
....@@ -178,27 +185,37 @@
178185 copyItem.addActionListener(this);
179186 pasteItem = menu.add(new MenuItem("Paste"));
180187 pasteItem.addActionListener(this);
188
+ menu.add("-");
189
+
190
+ menu.add("-");
191
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
192
+ pasteIntoItem.addActionListener(this);
181193 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182194 pasteLinkItem.addActionListener(this);
183195 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184196 pasteCloneItem.addActionListener(this);
185197 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186198 // pasteExpandItem.addActionListener(this);
199
+ menu.add("-");
187200 clearItem = menu.add(new MenuItem("Clear"));
188201 clearItem.addActionListener(this);
202
+
203
+ if (Globals.ADVANCED)
204
+ {
205
+ // Deletes the cameras...
189206 clearAllItem = menu.add(new MenuItem("Clear All"));
190207 clearAllItem.addActionListener(this);
208
+ }
191209
192210 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
211
+ if (Globals.ADVANCED)
212
+ {
197213 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198214 revertMeshItem.addActionListener(this);
199215 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200216 resetreferencesItem.addActionListener(this);
201217 menu.add("-");
218
+ }
202219 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203220 overwriteGeoItem.addActionListener(this);
204221 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,19 +227,26 @@
210227 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211228 overwriteUVItem.addActionListener(this);
212229 menu.add("-");
230
+ if (Globals.ADVANCED)
231
+ {
213232 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214233 generateMeshItem.addActionListener(this);
215234 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216235 poseMeshItem.addActionListener(this);
217236 menu.add("-");
237
+ }
218238 resetsupportItem = menu.add(new MenuItem("Reset support"));
219239 resetsupportItem.addActionListener(this);
220240 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221241 linkverticesItem.addActionListener(this);
222242 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223243 relinkverticesItem.addActionListener(this);
244
+
245
+ if (Globals.ADVANCED)
246
+ {
224247 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225248 setMasterItem.addActionListener(this);
249
+ }
226250
227251 oe.menuBar.add(menu = new Menu("Group"));
228252 grabItem = menu.add(new MenuItem("Grab"));
....@@ -233,27 +257,32 @@
233257 frontItem.addActionListener(this);
234258 compositeItem = menu.add(new MenuItem("Composite"));
235259 compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
260
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237261 hideItem.addActionListener(this);
238262 ungroupItem = menu.add(new MenuItem("Ungroup"));
239263 ungroupItem.addActionListener(this);
240264 menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
265
+ randomItem = menu.add(new MenuItem("Switch node"));
242266 randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
247267 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248268 switchGeoItem.addActionListener(this);
249269 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250270 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
271
+ morphItem = menu.add(new MenuItem("Morph Group"));
252272 morphItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
276
+ menu.add("-");
277
+ physicsItem = menu.add(new MenuItem("Physics"));
278
+ physicsItem.addActionListener(this);
279
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
280
+ frameselectorItem.addActionListener(this);
253281 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254282 scriptNodeItem.addActionListener(this);
255283 cameraItem = menu.add(new MenuItem("Camera"));
256284 cameraItem.addActionListener(this);
285
+ }
257286
258287 oe.menuBar.add(menu = new Menu("Object"));
259288 textureItem = menu.add(new MenuItem("Texture"));
....@@ -268,21 +297,29 @@
268297 shadowYItem.addActionListener(this);
269298 shadowZItem = menu.add(new MenuItem("Shadow Z"));
270299 shadowZItem.addActionListener(this);
300
+ if (Globals.ADVANCED)
301
+ {
302
+ menu.add("-");
271303 linkerItem = menu.add(new MenuItem("Linker"));
272304 linkerItem.addActionListener(this);
273
- templateItem = menu.add(new MenuItem("Template"));
274
- templateItem.addActionListener(this);
275305 attributeItem = menu.add(new MenuItem("Attribute"));
276306 attributeItem.addActionListener(this);
307
+ templateItem = menu.add(new MenuItem("Template"));
308
+ templateItem.addActionListener(this);
277309 pointflowItem = menu.add(new MenuItem("Point Flow"));
278310 pointflowItem.addActionListener(this);
311
+ }
279312 menu.add("-");
280313 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281314 resetTransformItem.addActionListener(this);
282315 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283316 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
317
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
318
+ resetCentroidXZItem.addActionListener(this);
319
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
320
+ transformGeometryItem.addActionListener(this);
321
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
322
+ transformChildrenItem.addActionListener(this);
286323
287324 oe.menuBar.add(menu = new Menu("Geometry"));
288325 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +330,11 @@
293330 genNormalsCADItem.addActionListener(this);
294331 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295332 genNormalsMESHItem.addActionListener(this);
333
+ if (Globals.ADVANCED)
334
+ {
296335 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297336 genNormalsMINEItem.addActionListener(this);
337
+ }
298338 stripifyItem = menu.add(new MenuItem("Stripify"));
299339 stripifyItem.addActionListener(this);
300340 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +356,34 @@
316356 reduce34MeshItem.addActionListener(this);
317357 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318358 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321359 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322360 clipMeshItem.addActionListener(this);
361
+
362
+ if (Globals.ADVANCED)
363
+ {
364
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
365
+ smoothMeshItem.addActionListener(this);
366
+ }
323367
324368 oe.menuBar.add(menu = new Menu("Attributes"));
325369 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326370 clearMaterialsItem.addActionListener(this);
371
+ resetAllItem = menu.add(new MenuItem("Reset All"));
372
+ resetAllItem.addActionListener(this);
373
+ stepAllItem = menu.add(new MenuItem("Step All"));
374
+ stepAllItem.addActionListener(this);
327375 menu.add("-");
328376 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329377 liveleavesItem.addActionListener(this);
330378 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331379 unliveleavesItem.addActionListener(this);
380
+ if (Globals.ADVANCED)
381
+ {
332382 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333383 supportleavesItem.addActionListener(this);
334384 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335385 unsupportleavesItem.addActionListener(this);
386
+ }
336387 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337388 hideleavesItem.addActionListener(this);
338389 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -376,28 +427,34 @@
376427 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377428 sortbynameItem.addActionListener(this);
378429 menu.add("-");
430
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
431
+ shareGeometriesItem.addActionListener(this);
432
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
433
+ mergeGeometriesItem.addActionListener(this);
434
+ if (Globals.ADVANCED)
435
+ {
436
+ // Pretty much the same as duplicate and clone.
379437 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380438 extractGeometriesItem.addActionListener(this);
381439 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382440 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
441
+ }
387442
388443 oe.menuBar.add(menu = new Menu("Insert"));
389444 buildCreateMenu(menu);
390445
391
-
392446 oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
398448 importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
+ menu.add("-");
450
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
400451 import3DSItem.addActionListener(this);
452
+ menu.add("-");
453
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
+ importVRMLX3DItem.addActionListener(this);
455
+ menu.add("-");
456
+ importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
+ importGFDItem.addActionListener(this);
401458
402459 oe.menuBar.add(menu = new Menu("Tools"));
403460 buildToolsMenu(menu);
....@@ -433,110 +490,98 @@
433490 oe.radioPanel.add(dummyButton);
434491 oe.buttonGroup.add(dummyButton);
435492 */
436
- aConstraints.gridy += 1;
437
-
438493 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439494
440
- oe.aConstraints.gridwidth = 1;
441
- oe.aConstraints.gridx = 0;
442
-
443
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
444
- liveCB.setToolTipText("Enabled animation");
495
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
+ liveCB.setToolTipText("Enable animation");
445497 liveCB.addItemListener(this);
446498
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
499
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500
+ oneStepButton.setToolTipText("Animate one step forward");
501
+ oneStepButton.addActionListener(this);
502
+
503
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
504
+ fastCB.setToolTipText("Fast mode");
505
+ fastCB.addItemListener(this);
506
+
507
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
449508 trackCB.setToolTipText("Enable tracking");
450509 trackCB.addItemListener(this);
451510
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
511
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
454512 screenfitButton.setToolTipText("Screen fit");
455513 screenfitButton.addActionListener(this);
456
- oe.aConstraints.gridx += 1;
514
+
457515 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
458516 // screenfitpointButton.addActionListener(this);
459
-// oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
461
- snapobjectButton.addActionListener(this);
462
- snapobjectButton.setToolTipText("Snap Object");
463
- oe.aConstraints.gridx += 1;
464517
465
- //aConstraints.gridx = 0;
466
- //aConstraints.gridy += 1;
467
- oe.aConstraints.weighty = 0;
468
- oe.aConstraints.gridwidth = 1;
469
-
470
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
518
+ if (Globals.ADVANCED)
519
+ {
520
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521
+ snapobjectButton.addActionListener(this);
522
+ snapobjectButton.setToolTipText("Snap Object");
523
+ }
524
+
525
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
471526 flashSelectionButton.setToolTipText("Show selection");
472527 flashSelectionButton.addActionListener(this);
473528
474
- oe.toolbarPanel.add(new cButton(" ", false));
529
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
475530
476
- oe.aConstraints.gridx += 1;
477
- oe.aConstraints.weighty = 0;
478
- oe.aConstraints.gridwidth = 1;
479
-
480
- //
481
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
531
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
482532 twoButton.setToolTipText("Show center view only");
483533 twoButton.addActionListener(this);
484
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
534
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485535 fourButton.addActionListener(this);
486536 fourButton.setToolTipText("Show left panel only");
487
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
537
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
488538 sixButton.setToolTipText("2-column layout left");
489539 sixButton.addActionListener(this);
490
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
540
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
491541 threeButton.setToolTipText("2-column layout right");
492542 threeButton.addActionListener(this);
493
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
543
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
494544 sevenButton.setToolTipText("3-column layout");
495545 sevenButton.addActionListener(this);
496546 //
497547
498
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
499
- rootButton.setToolTipText("Edit object in new tab");
548
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
+ rootButton.setToolTipText("Edit selection in new tab");
500550 rootButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
551
+
552
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
503553 closeButton.setToolTipText("Close tab");
504554 closeButton.addActionListener(this);
505555 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
506556 //clearButton.addActionListener(this);
507
- oe.aConstraints.gridx += 1;
508557
509
- oe.aConstraints.gridx = 1; //
510
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
558
+ cGridBag commandsPanel = new cGridBag();
559
+
560
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
+ editButton.setToolTipText("Edit selection");
511562 editButton.addActionListener(this);
512
- oe.aConstraints.gridx += 1;
513
- oe.aConstraints.weighty = 0;
514
- oe.aConstraints.gridwidth = 1;
515563
516
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
564
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
+ uneditButton.setToolTipText("Unedit selection");
517566 uneditButton.addActionListener(this);
518567
519
- oe.aConstraints.gridx += 1;
520
- oe.aConstraints.weighty = 0;
521
- oe.aConstraints.gridwidth = 1;
522
-
523
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
524
- clearPanelButton.addActionListener(this);
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
568
+ commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
+ allParamsButton.setToolTipText("Edit all params");
531570 allParamsButton.addActionListener(this);
532571
533
- oe.aConstraints.gridx += 1;
534
- oe.aConstraints.weighty = 0;
535
- oe.aConstraints.gridwidth = 1;
536
-
537
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
572
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
+ clearPanelButton.setToolTipText("Clear edit panel");
574
+ clearPanelButton.addActionListener(this);
575
+
576
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
+ unselectButton.setToolTipText("Unselect");
538578 unselectButton.addActionListener(this);
539579
580
+ commandsPanel.preferredHeight = 1;
581
+
582
+ oe.treePanel.add(commandsPanel);
583
+ oe.treePanel.Return();
584
+
540585 // oe.aConstraints.gridx += 1;
541586 // oe.aConstraints.weighty = 0;
542587 // oe.aConstraints.gridwidth = 1;
....@@ -548,40 +593,37 @@
548593 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
549594 // gcButton.addActionListener(this);
550595
551
- oe.aConstraints.gridx = 0;
552
- oe.aConstraints.gridy += 1;
553
-
554
- //ctrlPanel.add(objList = new List(5, true));
555
- oe.aConstraints.gridwidth = 100;
556
- // oe.aConstraints.gridheight = 100;
557
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
558
- oe.aConstraints.gridheight = 1;
559
- oe.aConstraints.weighty = 0.5;
560
- oe.aConstraints.gridx = 0;
561
- JScrollPane jSP;
596
+ cGridBag jSPPanel = new cGridBag();
597
+
598
+ JScrollPane jSP;
562599 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
563
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
600
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
564601 ResetModel();
565
- oe.aConstraints.weighty = 0.5;
566
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
567
- oe.aConstraints.gridy += 1;
568
- oe.aConstraints.gridwidth = 1;
602
+
603
+ oe.treePanel.add(jSPPanel);
604
+ oe.treePanel.Return();
569605
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 2;
572
-
573
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
+ cGridBag copyOptionsPanel = new cGridBag();
607
+
608
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
+ colorCB.setToolTipText("Copy color when dropped");
574610 colorCB.addItemListener(this);
575
- oe.aConstraints.gridx += 2;
576
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
611
+
612
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
+ materialCB.setToolTipText("Copy material when dropped");
577614 materialCB.addItemListener(this);
578
- oe.aConstraints.gridx += 2;
579
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
615
+
616
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
+ textureCB.setToolTipText("Copy texture when dropped");
580618 textureCB.addItemListener(this);
581619
582
- oe.aConstraints.gridx = 0;
583
- oe.aConstraints.gridy += 1;
620
+ copyOptionsPanel.preferredHeight = 1;
621
+ oe.treePanel.add(copyOptionsPanel);
622
+ oe.treePanel.Return();
584623
624
+// mainPanel.setDividerLocation(0.5); //1.0);
625
+// mainPanel.setResizeWeight(0.5);
626
+
585627 //jList.addListSelectionListener(this);
586628 oe.jTree.addTreeSelectionListener(this);
587629 //jTree.setRootVisible(false);
....@@ -604,45 +646,37 @@
604646 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
605647 }
606648
607
- void AddOptions(JPanel panel, GridBagConstraints constraints)
649
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
608650 {
609
- constraints.gridx = 0;
610
- constraints.gridy = 0;
611
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), constraints);
612
- fastCB.setToolTipText("Fast mode");
613
- fastCB.addItemListener(this);
614
- constraints.gridy += 1;
615
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), constraints);
616
- supportCB.setToolTipText("Enabled rigging");
617
- supportCB.addItemListener(this);
618
-
619
- // constraints.gridy += 1;
620
- // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
621
- // localCB.addItemListener(this);
622
-
623
- constraints.gridy += 1;
624
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), constraints);
625
- crowdCB.setToolTipText("Used for crowds");
626
- crowdCB.addItemListener(this);
627
-
628
- constraints.gridy += 1;
629
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), constraints);
630
- smoothCB.setToolTipText("Snapping delay");
631
- smoothCB.addItemListener(this);
632
-
633
- constraints.gridy += 1;
634
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), constraints);
635
- slowCB.setToolTipText("Smooth interpolation");
636
- slowCB.addItemListener(this);
637
- constraints.gridy += 1;
638
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), constraints);
651
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
639652 boxCB.setToolTipText("Display bounding boxes");
640653 boxCB.addItemListener(this);
641
- constraints.gridy += 1;
642
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), constraints);
654
+
655
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
643656 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
644657 zoomBoxCB.addItemListener(this);
645658
659
+ if (true) // Globals.ADVANCED)
660
+ {
661
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
+ supportCB.setToolTipText("Enable rigging");
663
+ supportCB.addItemListener(this);
664
+
665
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
666
+ // localCB.addItemListener(this);
667
+
668
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
669
+ crowdCB.setToolTipText("Used for crowds");
670
+ crowdCB.addItemListener(this);
671
+
672
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
673
+ smoothCB.setToolTipText("Snapping delay");
674
+ smoothCB.addItemListener(this);
675
+
676
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
677
+ slowCB.setToolTipText("Smooth interpolation");
678
+ slowCB.addItemListener(this);
679
+
646680 // constraints.gridy += 1;
647681 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
648682 // speakerMocapCB.addItemListener(this);
....@@ -650,16 +684,16 @@
650684 if (false)
651685 {
652686 // handled in scripts
653
- constraints.gridy += 1;
654
- panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), constraints);
687
+ //constraints.gridy += 1;
688
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
655689 speakerCameraCB.addItemListener(this);
656690
657
- constraints.gridy += 1;
658
- panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), constraints);
691
+ //constraints.gridy += 1;
692
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
659693 speakerFocusCB.addItemListener(this);
660694
661
- constraints.gridy += 1;
662
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), constraints);
695
+ //constraints.gridy += 1;
696
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
663697 smoothfocusCB.addItemListener(this);
664698 }
665699
....@@ -667,14 +701,20 @@
667701 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
668702 // debugCB.addItemListener(this);
669703
670
- constraints.gridy += 1;
671
- panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), constraints);
704
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
672705 oeilCB.addItemListener(this);
673706
674
- constraints.gridy += 1;
675
- panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), constraints);
707
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
676708 lookAtCB.setToolTipText("Look-at target");
677709 lookAtCB.addItemListener(this);
710
+
711
+ }
712
+
713
+ cGridBag fill = new cGridBag();
714
+
715
+ fill.preferredHeight = 200;
716
+
717
+ panel.add(fill);
678718
679719 }
680720
....@@ -905,7 +945,9 @@
905945 // objEditor.DropFile((java.io.File[]) object, true);
906946 // return;
907947 // }
908
- if (string.charAt(0) == '/')
948
+
949
+ // File path for Mac and Windows
950
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
909951 {
910952 // file(s)
911953 String[] names = string.split("\n");
....@@ -932,7 +974,7 @@
932974
933975 flashIt = false;
934976 CameraPane pane = (CameraPane) target;
935
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
977
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
936978 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
937979
938980 if (group.selection.size() == 1)
....@@ -959,11 +1001,11 @@
9591001 {
9601002 loadClipboard(true);
9611003 objEditor.jTree.setSelectionPath(destinationPath);
962
- pasteInto(false);
1004
+ pasteInto(false, false);
9631005 } else {
9641006 loadClipboard(false);
9651007 objEditor.jTree.setSelectionPath(destinationPath);
966
- pasteInto(false); // true); // ???
1008
+ pasteInto(false, false); // true); // ???
9671009 }
9681010 }
9691011 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1085,27 +1127,33 @@
10851127 kleinItem.addActionListener(this);
10861128 particleItem = menu.add(new MenuItem("Particle system"));
10871129 particleItem.addActionListener(this);
1130
+ if (Globals.ADVANCED)
1131
+ {
10881132 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10891133 ragdollItem.addActionListener(this);
10901134 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10911135 ragdoll2Item.addActionListener(this);
1136
+ }
10921137 menu.add("-");
1093
- meshItem = menu.add(new MenuItem("Mesh"));
1138
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10941139 meshItem.addActionListener(this);
10951140 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10961141 // meshGroupItem.addActionListener(this);
1142
+ if (Globals.ADVANCED)
1143
+ {
10971144 springItem = menu.add(new MenuItem("Spring"));
10981145 springItem.addActionListener(this);
10991146 flagItem = menu.add(new MenuItem("Flag"));
11001147 flagItem.addActionListener(this);
1101
- bezierItem = menu.add(new MenuItem("Patch"));
1102
- bezierItem.addActionListener(this);
1103
- checkerItem = menu.add(new MenuItem("Checker"));
1104
- checkerItem.addActionListener(this);
11051148 blobItem = menu.add(new MenuItem("Blob"));
11061149 blobItem.addActionListener(this);
11071150 latheItem = menu.add(new MenuItem("Lathe"));
11081151 latheItem.addActionListener(this);
1152
+ }
1153
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1154
+ bezierItem.addActionListener(this);
1155
+ overlayItem = menu.add(new MenuItem("Overlay"));
1156
+ overlayItem.addActionListener(this);
11091157 lightItem = menu.add(new MenuItem("Light"));
11101158 lightItem.addActionListener(this);
11111159 menu.add("-");
....@@ -1115,34 +1163,39 @@
11151163 loopItem.addActionListener(this);
11161164 doubleItem = menu.add(new MenuItem("Fork"));
11171165 doubleItem.addActionListener(this);
1166
+ if (Globals.ADVANCED)
1167
+ {
11181168 tripleItem = menu.add(new MenuItem("Trident"));
11191169 tripleItem.addActionListener(this);
1170
+ }
11201171 }
11211172
11221173 void buildToolsMenu(Menu menu)
11231174 {
11241175 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11251176 animationItem.addItemListener(this);
1126
- animationItem.setState(CameraPane.ANIMATION);
1177
+ animationItem.setState(Globals.ANIMATION);
11271178
11281179 menu.add("-");
11291180 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11301181 parseverticesItem.addActionListener(this);
11311182 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11321183 textureFieldItem.addActionListener(this);
1133
- alignItem = menu.add(new MenuItem("Align"));
1184
+ alignItem = menu.add(new MenuItem("Align Objects"));
11341185 alignItem.addActionListener(this);
1135
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1136
- mirrorItem.addActionListener(this);
11371186 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11381187 reduceMorphItem.addActionListener(this);
11391188 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11401189 reduce34MorphItem.addActionListener(this);
1141
-
1190
+ menu.add("-");
11421191 menu.add(computeAOItem = new MenuItem("Compute AO"));
11431192 computeAOItem.addActionListener(this);
1144
- menu.add("-");
11451193
1194
+ if (Globals.ADVANCED)
1195
+ {
1196
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1197
+ mirrorItem.addActionListener(this);
1198
+ menu.add("-");
11461199 menu.add(memoryItem = new MenuItem("Memory Usage"));
11471200 memoryItem.addActionListener(this);
11481201 menu.add(analyzeItem = new MenuItem("Analyze"));
....@@ -1165,6 +1218,7 @@
11651218 menu.add("-");
11661219 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11671220 editScriptItem.addActionListener(this);
1221
+ }
11681222 }
11691223
11701224 void ScreenFit()
....@@ -1493,9 +1547,9 @@
14931547
14941548 void Overwrite(int mask)
14951549 {
1496
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1550
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14971551 {
1498
- Object3D content = GrafreeD.clipboard.get(0);
1552
+ Object3D content = Grafreed.clipboard.get(0);
14991553
15001554 if (content instanceof cGroup && ((cGroup)content).transientlink )
15011555 content = ((cGroup)content).get(0);
....@@ -1666,7 +1720,7 @@
16661720 {
16671721 makeSomething(new BezierSurface());
16681722 } else
1669
- if (source == checkerItem)
1723
+ if (source == overlayItem)
16701724 {
16711725 /*
16721726 Object3D obj = new BezierSurface(5,8);
....@@ -1815,7 +1869,15 @@
18151869 } else
18161870 if (source == importOBJItem)
18171871 {
1818
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1872
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
+ browser.setVisible(true);
1875
+ String filename = browser.getFile();
1876
+ if (filename != null && filename.length() > 0)
1877
+ {
1878
+ String fullname = browser.getDirectory() + filename;
1879
+ makeSomething(ReadOBJ(fullname), true);
1880
+ }
18191881 } else
18201882 if (source == computeAOItem)
18211883 {
....@@ -1835,7 +1897,7 @@
18351897 if (source == invariantsItem)
18361898 {
18371899 System.out.println("Invariants:");
1838
- GrafreeD.grafreeD.universe.invariants();
1900
+ Grafreed.grafreeD.universe.invariants();
18391901 } else
18401902 if (source == memoryItem)
18411903 {
....@@ -1853,6 +1915,11 @@
18531915 if (source == dumpItem)
18541916 {
18551917 DumpObject();
1918
+ } else
1919
+ if (source == oneStepButton)
1920
+ {
1921
+ Globals.ONESTEP = true;
1922
+ cameraView.repaint();
18561923 } else
18571924 if (source == screenfitButton)
18581925 {
....@@ -1905,10 +1972,10 @@
19051972 } else
19061973 if (source == duplicateItem)
19071974 {
1908
- Object3D keep = GrafreeD.clipboard;
1975
+ Object3D keep = Grafreed.clipboard;
19091976 loadClipboard(false);
19101977 paste(false);
1911
- GrafreeD.clipboard = keep;
1978
+ Grafreed.clipboard = keep;
19121979 } else
19131980 if (source == cloneItem)
19141981 {
....@@ -1926,13 +1993,17 @@
19261993 {
19271994 paste(false);
19281995 } else
1996
+ if (source == pasteIntoItem)
1997
+ {
1998
+ pasteInto(true, false);
1999
+ } else
19292000 if (source == pasteLinkItem)
19302001 {
1931
- pasteInto(false);
2002
+ pasteInto(false, false);
19322003 } else
19332004 if (source == pasteCloneItem)
19342005 {
1935
- pasteInto(true);
2006
+ pasteInto(true, true);
19362007 } else
19372008 if (source == pasteExpandItem)
19382009 {
....@@ -2124,9 +2195,9 @@
21242195 // group.selection.get(0).setMasterThis(content); // should be identity
21252196 // refreshContents();
21262197 // }
2127
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2198
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21282199 {
2129
- Object3D content = GrafreeD.clipboard.get(0);
2200
+ Object3D content = Grafreed.clipboard.get(0);
21302201
21312202 if (content instanceof cGroup && ((cGroup)content).transientlink )
21322203 content = ((cGroup)content).get(0);
....@@ -2134,11 +2205,11 @@
21342205 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21352206 for (int i=0; i<group.selection.size(); i++)
21362207 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2208
+ boolean random = CameraPane.SWITCH;
2209
+ CameraPane.SWITCH = false; // parse all random nodes
21392210 group.selection.get(i).linkVerticesThis(content);
21402211 // group.selection.get(i).setMasterThis(content); // should be identity
2141
- CameraPane.RANDOM = random;
2212
+ CameraPane.SWITCH = random;
21422213 }
21432214 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21442215 refreshContents();
....@@ -2148,20 +2219,20 @@
21482219 {
21492220 for (int i=0; i<group.selection.size(); i++)
21502221 {
2151
- boolean random = CameraPane.RANDOM;
2152
- CameraPane.RANDOM = false; // parse all random nodes
2222
+ boolean random = CameraPane.SWITCH;
2223
+ CameraPane.SWITCH = false; // parse all random nodes
21532224 group.selection.get(i).linkVerticesThis(null);
2154
- CameraPane.RANDOM = random;
2225
+ CameraPane.SWITCH = random;
21552226 }
21562227
21572228 refreshContents();
21582229 } else
21592230 if (source == relinkverticesItem)
21602231 {
2161
- boolean random = CameraPane.RANDOM;
2162
- CameraPane.RANDOM = false; // parse all random nodes
2232
+ boolean random = CameraPane.SWITCH;
2233
+ CameraPane.SWITCH = false; // parse all random nodes
21632234 group.selection.RelinkToSupport();
2164
- CameraPane.RANDOM = random;
2235
+ CameraPane.SWITCH = random;
21652236
21662237 refreshContents();
21672238 } else
....@@ -2176,9 +2247,9 @@
21762247 } else
21772248 if (source == setMasterItem)
21782249 {
2179
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2250
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21802251 {
2181
- Object3D content = GrafreeD.clipboard.get(0);
2252
+ Object3D content = Grafreed.clipboard.get(0);
21822253
21832254 if (content instanceof cGroup && ((cGroup)content).transientlink )
21842255 content = ((cGroup)content).get(0);
....@@ -2191,9 +2262,9 @@
21912262 {
21922263 if (group.selection.size() == 1)
21932264 {
2194
- if (GrafreeD.clipboard.size() == 1)
2265
+ if (Grafreed.clipboard.size() == 1)
21952266 {
2196
- Object3D content = GrafreeD.clipboard.get(0);
2267
+ Object3D content = Grafreed.clipboard.get(0);
21972268
21982269 if (content instanceof cGroup && ((cGroup)content).transientlink )
21992270 content = ((cGroup)content).get(0);
....@@ -2210,7 +2281,7 @@
22102281 {
22112282 RevertMeshes();
22122283 } else
2213
- if (source == resetMeshItem)
2284
+ if (source == resetAllItem)
22142285 {
22152286 ResetAll();
22162287 } else
....@@ -2259,7 +2330,7 @@
22592330 RandomNode random = new RandomNode();
22602331 group(random);
22612332 if (random.size() > 0)
2262
- random.name = random.get(0).name + "Rnd";
2333
+ random.name = random.get(0).name + "Switch";
22632334 } else
22642335 if (source == physicsItem)
22652336 {
....@@ -2548,9 +2619,13 @@
25482619 {
25492620 SmoothMesh();
25502621 } else
2551
- if (source == transformgeometryItem)
2622
+ if (source == transformGeometryItem)
25522623 {
25532624 TransformGeometry();
2625
+ } else
2626
+ if (source == transformChildrenItem)
2627
+ {
2628
+ TransformChildren();
25542629 } else
25552630 if (source == resetTransformItem)
25562631 {
....@@ -2558,7 +2633,11 @@
25582633 } else
25592634 if (source == resetCentroidItem)
25602635 {
2561
- ResetCentroid();
2636
+ ResetCentroid(true);
2637
+ } else
2638
+ if (source == resetCentroidXZItem)
2639
+ {
2640
+ ResetCentroid(false);
25622641 } else
25632642 if (source == resetParentItem)
25642643 {
....@@ -2720,7 +2799,7 @@
27202799 // centralPanel.setVisible(true);
27212800 // XYZPanel.setVisible(false);
27222801 bigThree.ClearUI();
2723
- bigThree.addComponent(centralPanel);
2802
+ bigThree.add(centralPanel);
27242803 bigThree.FlushUI();
27252804 } else
27262805 if (source == threeButton)
....@@ -2755,8 +2834,8 @@
27552834 // centralPanel.setVisible(true);
27562835 // XYZPanel.setVisible(true);
27572836 bigThree.ClearUI();
2758
- bigThree.addComponent(centralPanel);
2759
- bigThree.addComponent(XYZPanel);
2837
+ bigThree.add(centralPanel);
2838
+ bigThree.add(XYZPanel);
27602839 bigThree.FlushUI();
27612840 } else
27622841 if (source == fourButton)
....@@ -2791,7 +2870,7 @@
27912870 // centralPanel.setVisible(false);
27922871 // XYZPanel.setVisible(false);
27932872 bigThree.ClearUI();
2794
- bigThree.addComponent(scenePanel);
2873
+ bigThree.add(scenePanel);
27952874 bigThree.FlushUI();
27962875 } else
27972876 if (source == sixButton)
....@@ -2826,8 +2905,8 @@
28262905 // centralPanel.setVisible(true);
28272906 // XYZPanel.setVisible(false);
28282907 bigThree.ClearUI();
2829
- bigThree.addComponent(scenePanel);
2830
- bigThree.addComponent(centralPanel);
2908
+ bigThree.add(scenePanel);
2909
+ bigThree.add(centralPanel);
28312910 bigThree.FlushUI();
28322911 } else
28332912 if (source == sevenButton)
....@@ -2862,9 +2941,9 @@
28622941 // centralPanel.setVisible(true);
28632942 // XYZPanel.setVisible(true);
28642943 bigThree.ClearUI();
2865
- bigThree.addComponent(scenePanel);
2866
- bigThree.addComponent(centralPanel);
2867
- bigThree.addComponent(XYZPanel);
2944
+ bigThree.add(scenePanel);
2945
+ bigThree.add(centralPanel);
2946
+ bigThree.add(XYZPanel);
28682947 bigThree.FlushUI();
28692948 } else
28702949 if (source == rootButton)
....@@ -2916,7 +2995,7 @@
29162995
29172996 child.editWindow = null; // ???????????
29182997 }
2919
- objEditor.ctrlPanel.revalidate();
2998
+ objEditor.ctrlPanel.FlushUI();
29202999 //objEditor.jTree.clearSelection();
29213000 //objEditor.ResetSliders();
29223001 refreshContents(true);
....@@ -3074,6 +3153,28 @@
30743153 refreshContents();
30753154 }
30763155
3156
+ void TransformChildren()
3157
+ {
3158
+ Object3D obj;
3159
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3160
+ {
3161
+ obj = (Object3D)e.nextElement();
3162
+ obj.KeepTextureMatrices();
3163
+ obj.TransformChildren();
3164
+ obj.RestoreTextureMatrices();
3165
+
3166
+// if (obj.parent == null)
3167
+// {
3168
+// System.out.println("NULL PARENT!");
3169
+// new Exception().printStackTrace();
3170
+// }
3171
+// else
3172
+// TouchTransform(obj);
3173
+// //obj.parent.Touch();
3174
+ }
3175
+
3176
+ refreshContents();
3177
+ }
30773178
30783179 void ResetTransform()
30793180 {
....@@ -3186,7 +3287,7 @@
31863287 refreshContents();
31873288 }
31883289
3189
- void ResetCentroid()
3290
+ void ResetCentroid(boolean full)
31903291 {
31913292 Object3D obj;
31923293 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3201,12 +3302,16 @@
32013302 LA.matIdentity(Object3D.mat);
32023303 obj.getBounds(minima, maxima, false);
32033304 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3204
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3305
+ if (full)
3306
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32053307 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32063308 obj.TransformMesh(Object3D.mat);
3309
+
32073310 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3208
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3311
+ if (full)
3312
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32093313 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3314
+
32103315 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32113316 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32123317 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3272,9 +3377,9 @@
32723377 obj = (Object3D)e.nextElement();
32733378
32743379 System.out.println("Object is: " + obj);
3275
- GrafreeD.AnalyzeObject(obj);
3380
+ Grafreed.AnalyzeObject(obj);
32763381 System.out.println("Boundary rep: " + obj.bRep);
3277
- GrafreeD.AnalyzeObject(obj.bRep);
3382
+ Grafreed.AnalyzeObject(obj.bRep);
32783383
32793384 // System.err.println((size/1024) + " KB is the size of " + obj);
32803385 }
....@@ -3488,8 +3593,8 @@
34883593
34893594 void ParseVertices()
34903595 {
3491
- boolean epsequal = GrafreeD.epsequal;
3492
- GrafreeD.epsequal = true;
3596
+ boolean epsequal = Grafreed.epsequal;
3597
+ Grafreed.epsequal = true;
34933598
34943599 for (int i=0; i<group.selection.size(); i++)
34953600 {
....@@ -3514,7 +3619,7 @@
35143619 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35153620 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35163621
3517
- g.add(GrafreeD.clipboard);
3622
+ g.add(Grafreed.clipboard);
35183623
35193624 buffer.add(g);
35203625 }
....@@ -3529,7 +3634,7 @@
35293634 makeSomething(buffer, i==group.selection.size()-1);
35303635 }
35313636
3532
- GrafreeD.epsequal = epsequal;
3637
+ Grafreed.epsequal = epsequal;
35333638
35343639 refreshContents();
35353640 }
....@@ -3547,7 +3652,16 @@
35473652 String pigment = Object3D.GetPigment(tex);
35483653 //String bump = Object3D.GetBump(tex);
35493654
3550
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3655
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3656
+
3657
+ try
3658
+ {
3659
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3660
+ }
3661
+ catch (Exception e)
3662
+ {
3663
+ System.err.println("FAIL: " + node);
3664
+ }
35513665
35523666 double s = v.s;
35533667
....@@ -3635,11 +3749,11 @@
36353749
36363750 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36373751
3638
- boolean random = CameraPane.RANDOM;
3639
- CameraPane.RANDOM = false; // parse all random nodes
3752
+ boolean random = CameraPane.SWITCH;
3753
+ CameraPane.SWITCH = false; // parse all random nodes
36403754 lowres.linkVerticesThis(null);
36413755 lowres.linkVerticesThis(sn);
3642
- CameraPane.RANDOM = random;
3756
+ CameraPane.SWITCH = random;
36433757
36443758 System.err.flush();
36453759
....@@ -3679,7 +3793,7 @@
36793793 return;
36803794
36813795 Object3D poses = group.selection.get(0);
3682
- Object3D ref = GrafreeD.clipboard.get(0);
3796
+ Object3D ref = Grafreed.clipboard.get(0);
36833797
36843798 Object3D newgroup = new Object3D("Po:" + poses.name);
36853799
....@@ -3873,9 +3987,9 @@
38733987
38743988 void ClipMesh()
38753989 {
3876
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3990
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38773991 {
3878
- Object3D content = GrafreeD.clipboard.get(0);
3992
+ Object3D content = Grafreed.clipboard.get(0);
38793993
38803994 if (content instanceof cGroup && ((cGroup)content).transientlink )
38813995 content = ((cGroup)content).get(0);
....@@ -3884,7 +3998,7 @@
38843998 // {
38853999 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38864000 // }
3887
- group.selection.ClipMesh(GrafreeD.clipboard);
4001
+ group.selection.ClipMesh(Grafreed.clipboard);
38884002 }
38894003 // group.selection.ClipMesh(GrafreeD.clipboard);
38904004 System.out.println("DONE.");
....@@ -4124,12 +4238,12 @@
41244238 System.err.println("info : " + child.GetPath());
41254239 }
41264240 }
4127
- else
4128
- {
4129
- objEditor.SetMaterial(group); // .GetMaterial());
4130
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4131
- System.err.println("info : " + group.GetPath());
4132
- }
4241
+// else
4242
+// {
4243
+// objEditor.SetMaterial(group); // .GetMaterial());
4244
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4245
+// System.err.println("info : " + group.GetPath());
4246
+// }
41334247
41344248 objEditor.SetText(); // jan 2014
41354249
....@@ -4224,12 +4338,12 @@
42244338 {
42254339 if (group.selection.isEmpty())
42264340 return;
4227
- GrafreeD.clipboardIsTempGroup = false;
4341
+ Grafreed.clipboardIsTempGroup = false;
42284342 Composite tGroup = null;
42294343 if (group.selection.size() > 0) // 1)
42304344 {
42314345 tGroup = new cGroup();
4232
- GrafreeD.clipboardIsTempGroup = true;
4346
+ Grafreed.clipboardIsTempGroup = true;
42334347 }
42344348
42354349 if (cut)
....@@ -4269,16 +4383,16 @@
42694383 //System.out.println("cut " + child);
42704384 //System.out.println("parent = " + child.parent);
42714385 // tmp.addChild(child);
4272
- if (GrafreeD.clipboardIsTempGroup)
4386
+ if (Grafreed.clipboardIsTempGroup)
42734387 tGroup.add/*Child*/(tmp);
42744388 else
4275
- GrafreeD.clipboard = tmp;
4389
+ Grafreed.clipboard = tmp;
42764390 }
42774391 else
4278
- if (GrafreeD.clipboardIsTempGroup)
4392
+ if (Grafreed.clipboardIsTempGroup)
42794393 tGroup.add/*Child*/(child);
42804394 else
4281
- GrafreeD.clipboard = child;
4395
+ Grafreed.clipboard = child;
42824396 }
42834397
42844398 //ResetModel();
....@@ -4310,21 +4424,21 @@
43104424 //System.out.println("cut " + elem);
43114425 //System.out.println("parent = " + elem.parent);
43124426 // tmp.addChild(elem);
4313
- if (GrafreeD.clipboardIsTempGroup)
4427
+ if (Grafreed.clipboardIsTempGroup)
43144428 tGroup.add/*Child*/(tmp);
43154429 else
4316
- GrafreeD.clipboard = tmp;
4430
+ Grafreed.clipboard = tmp;
43174431 }
43184432 else
4319
- if (GrafreeD.clipboardIsTempGroup)
4433
+ if (Grafreed.clipboardIsTempGroup)
43204434 tGroup.add/*Child*/(child);
43214435 else
4322
- GrafreeD.clipboard = child;
4436
+ Grafreed.clipboard = child;
43234437 }
43244438
43254439 }
4326
- if (GrafreeD.clipboardIsTempGroup)
4327
- GrafreeD.clipboard = tGroup;
4440
+ if (Grafreed.clipboardIsTempGroup)
4441
+ Grafreed.clipboard = tGroup;
43284442 if (cut)
43294443 {
43304444 ResetModel();
....@@ -4338,7 +4452,7 @@
43384452 // return;
43394453 boolean first = true;
43404454
4341
- if (GrafreeD.clipboardIsTempGroup)
4455
+ if (Grafreed.clipboardIsTempGroup)
43424456 {
43434457 Composite temp;
43444458
....@@ -4349,7 +4463,7 @@
43494463 temp = (Composite)Applet3D.clipboard.deepCopy();
43504464 */
43514465 Object3D elem;
4352
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4466
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43534467 {
43544468 Object3D child = (Object3D)e.nextElement();
43554469
....@@ -4383,21 +4497,21 @@
43834497 //Object3D cb = Applet3D.clipboard;
43844498 //temp.addChild(cb);
43854499 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4386
- assert(GrafreeD.clipboard.parent == null);
4387
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4388
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4389
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4390
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4500
+ assert(Grafreed.clipboard.parent == null);
4501
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4502
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4503
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4504
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43914505 else
4392
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4393
- GrafreeD.clipboard.get(0).parent = keepparent;
4506
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4507
+ Grafreed.clipboard.get(0).parent = keepparent;
43944508 }
43954509
43964510 ResetModel();
43974511 refreshContents();
43984512 }
43994513
4400
- void pasteInto(boolean copyit)
4514
+ void pasteInto(boolean copyit, boolean clone)
44014515 {
44024516 // if (GrafreeD.clipboard == null)
44034517 // return;
....@@ -4426,15 +4540,22 @@
44264540 if (copyit)
44274541 {
44284542 // paste(false);
4429
- CloneClipboard(false); // sept 2014
4543
+ if (clone)
4544
+ {
4545
+ CloneClipboard(false); // sept 2014
4546
+ }
4547
+ else
4548
+ {
4549
+ paste(false);
4550
+ }
44304551 }
44314552 else
44324553 {
44334554 boolean first = true;
44344555
4435
- if (GrafreeD.clipboardIsTempGroup)
4556
+ if (Grafreed.clipboardIsTempGroup)
44364557 {
4437
- Composite temp = (Composite)GrafreeD.clipboard;
4558
+ Composite temp = (Composite)Grafreed.clipboard;
44384559 Object3D copy;
44394560 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44404561 {
....@@ -4444,7 +4565,7 @@
44444565 }
44454566 } else
44464567 {
4447
- linkSomething(GrafreeD.clipboard); //.get(0));
4568
+ linkSomething(Grafreed.clipboard); //.get(0));
44484569 }
44494570 }
44504571 }
....@@ -4889,7 +5010,7 @@
48895010
48905011 void ImportVRMLX3D()
48915012 {
4892
- if (GrafreeD.standAlone)
5013
+ if (Grafreed.standAlone)
48935014 {
48945015 /**/
48955016 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4906,7 +5027,7 @@
49065027
49075028 String GetFile(String dialogName)
49085029 {
4909
- if (GrafreeD.standAlone)
5030
+ if (Grafreed.standAlone)
49105031 {
49115032 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49125033 browser.show();
....@@ -4970,10 +5091,12 @@
49705091 cButton flashSelectionButton;
49715092 cButton editButton;
49725093 cButton uneditButton;
5094
+ JCheckBox allParamsButton;
49735095 cButton clearpanelButton;
4974
- cButton allParamsButton;
49755096 cButton unselectButton;
49765097
5098
+ cButton oneStepButton;
5099
+
49775100 cButton screenfitButton;
49785101 cButton screenfitpointButton;
49795102 cButton snapobjectButton;
....@@ -5017,7 +5140,7 @@
50175140 private MenuItem linkverticesItem;
50185141 private MenuItem relinkverticesItem;
50195142 private MenuItem setMasterItem;
5020
- private MenuItem resetMeshItem;
5143
+ private MenuItem resetAllItem;
50215144 private MenuItem stepAllItem;
50225145 private MenuItem revertMeshItem;
50235146 private MenuItem poseMeshItem;
....@@ -5028,6 +5151,7 @@
50285151 private MenuItem mergeGeometriesItem;
50295152 private MenuItem copyItem;
50305153 private MenuItem pasteItem;
5154
+ private MenuItem pasteIntoItem;
50315155 private MenuItem pasteLinkItem;
50325156 private MenuItem pasteCloneItem;
50335157 private MenuItem pasteExpandItem;
....@@ -5077,8 +5201,10 @@
50775201 private MenuItem panoTexturesItem;
50785202
50795203 private MenuItem resetCentroidItem;
5080
- private MenuItem transformgeometryItem;
5204
+ private MenuItem resetCentroidXZItem;
50815205 private MenuItem resetTransformItem;
5206
+ private MenuItem transformGeometryItem;
5207
+ private MenuItem transformChildrenItem;
50825208 private MenuItem hideItem;
50835209 private MenuItem grabItem;
50845210 private MenuItem backItem;
....@@ -5125,7 +5251,7 @@
51255251 private MenuItem blobItem;
51265252 private MenuItem latheItem;
51275253 private MenuItem bezierItem;
5128
- private MenuItem checkerItem;
5254
+ private MenuItem overlayItem;
51295255 private MenuItem meshItem;
51305256 // private MenuItem meshGroupItem;
51315257 private MenuItem springItem;