Normand Briere
2019-07-21 d32f24f147068e6cbecb31c7f98047f68bc8b58a
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,
....@@ -59,6 +60,12 @@
5960 this.copy = this.group = group;
6061 //selectees = this.group.selectees;
6162
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6269 if(ui)
6370 SetupUI(objEditor);
6471 }
....@@ -73,16 +80,28 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ SetupMenu2(this); //objEditor);
7784 SetupUI2(objEditor);
7885 objEditor.SetupUI(true);
7986 SetupViews(objEditor);
8087
8188 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8297 }
8398
8499 void CloneSelection(boolean supports)
85100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
86105 // Object3D keep = GrafreeD.clipboard;
87106 //Object3D obj;
88107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +112,19 @@
93112
94113 makeSomething(clone, i==group.selection.size()-1);
95114 }
115
+ Globals.REPLACEONMAKE = keep;
96116 }
97117
98118 void CloneClipboard(boolean supports)
99119 {
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));
120
+ assert(Grafreed.clipboard.parent == null);
121
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
122
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
123
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
124
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105125 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
126
+ makeSomething(CloneObject(Grafreed.clipboard, false));
127
+ Grafreed.clipboard.get(0).parent = keepparent;
108128 }
109129
110130 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +138,7 @@
118138 // obj.support = null;
119139 if (!supports)
120140 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
141
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122142 obj.parent = parent;
123143 // obj.support = support;
124144 // clone.support = support; // aout 2013
....@@ -147,30 +167,29 @@
147167
148168 //JTextField nameField;
149169
150
- void SetupMenu2(ObjEditor oe)
170
+ void SetupMenu2(GroupEditor oe)
151171 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
172
+ oe.jTree = new cTree();
173
+
163174 Menu menu;
164175 oe.menuBar.add(menu = new Menu("Edit"));
165176 //editItem = menu.add(new MenuItem("Edit"));
166177 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
178
+
179
+// undoItem = menu.add(new MenuItem("Undo"));
180
+// undoItem.addActionListener(this);
181
+// redoItem = menu.add(new MenuItem("Redo"));
182
+// redoItem.addActionListener(this);
183
+// menu.add("-");
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168185 duplicateItem.addActionListener(this);
169
- menu.add("-");
170186 cloneItem = menu.add(new MenuItem("Clone"));
171187 cloneItem.addActionListener(this);
188
+ if (Globals.ADVANCED)
189
+ {
172190 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173191 cloneSupportItem.addActionListener(this);
192
+ }
174193 menu.add("-");
175194 cutItem = menu.add(new MenuItem("Cut"));
176195 cutItem.addActionListener(this);
....@@ -178,27 +197,123 @@
178197 copyItem.addActionListener(this);
179198 pasteItem = menu.add(new MenuItem("Paste"));
180199 pasteItem.addActionListener(this);
200
+
201
+ menu.add("-");
202
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
203
+ pasteIntoItem.addActionListener(this);
181204 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182205 pasteLinkItem.addActionListener(this);
183206 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184207 pasteCloneItem.addActionListener(this);
185208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186209 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
210
+ menu.add("-");
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
213
+
214
+ if (Globals.ADVANCED)
215
+ {
216
+ // Deletes the cameras...
189217 clearAllItem = menu.add(new MenuItem("Clear All"));
190218 clearAllItem.addActionListener(this);
219
+ }
220
+
221
+ menuBar.add(cameraMenu = new Menu("View"));
222
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
223
+ //zBufferItem.addActionListener(this);
224
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
225
+ //normalLensItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
228
+
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
241
+
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
243
+ toggleHandleItem.addItemListener(this);
244
+ toggleHandleItem.setState(CameraPane.HANDLES);
245
+
246
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
247
+ togglePaintItem.addItemListener(this);
248
+ togglePaintItem.setState(CameraPane.PAINTMODE);
249
+
250
+ if (Globals.ADVANCED)
251
+ {
252
+ cameraMenu.add("-");
253
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
254
+ toggleLiveItem.addItemListener(this);
255
+ toggleLiveItem.setState(Globals.isLIVE());
191256
257
+ cameraMenu.add(stepItem = new MenuItem("Step"));
258
+ stepItem.addActionListener(this);
259
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
260
+ // toggleDLItem.addItemListener(this);
261
+ // toggleDLItem.setState(false);
262
+
263
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
264
+ toggleRenderItem.addItemListener(this);
265
+ toggleRenderItem.setState(!CameraPane.frozen);
266
+
267
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
268
+ toggleDebugItem.addItemListener(this);
269
+ toggleDebugItem.setState(Globals.DEBUG);
270
+
271
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
272
+ toggleFrustumItem.addItemListener(this);
273
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
274
+
275
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
276
+ toggleFootContactItem.addItemListener(this);
277
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
278
+
279
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
280
+ toggleTimelineItem.addItemListener(this);
281
+ }
282
+
283
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
284
+// toggleRootItem.addItemListener(this);
285
+// toggleRootItem.setState(false);
286
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
287
+// animationItem.addItemListener(this);
288
+// animationItem.setState(CameraPane.ANIMATION);
289
+ cameraMenu.add("-");
290
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
291
+ editCameraItem.addActionListener(this);
292
+
293
+ if (Globals.ADVANCED)
294
+ {
295
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
296
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
298
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
299
+ oe.cameraMenu.add("-");
300
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
301
+ openWindowItem.addActionListener(this);
302
+ editLeafItem.addActionListener(this);
303
+ lookAtItem.addActionListener(this);
304
+ //lookFromItem.addActinoListener(this);
305
+ //switchViewItem.addActionListener(this);
306
+ }
307
+
192308 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);
309
+ if (Globals.ADVANCED)
310
+ {
197311 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198312 revertMeshItem.addActionListener(this);
199313 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200314 resetreferencesItem.addActionListener(this);
201315 menu.add("-");
316
+ }
202317 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203318 overwriteGeoItem.addActionListener(this);
204319 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +325,104 @@
210325 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211326 overwriteUVItem.addActionListener(this);
212327 menu.add("-");
328
+ if (Globals.ADVANCED)
329
+ {
213330 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214331 generateMeshItem.addActionListener(this);
215332 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216333 poseMeshItem.addActionListener(this);
217334 menu.add("-");
335
+ }
218336 resetsupportItem = menu.add(new MenuItem("Reset support"));
219337 resetsupportItem.addActionListener(this);
220338 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221339 linkverticesItem.addActionListener(this);
222340 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223341 relinkverticesItem.addActionListener(this);
342
+
343
+ if (Globals.ADVANCED)
344
+ {
224345 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225346 setMasterItem.addActionListener(this);
347
+ }
226348
227349 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
230352 backItem = menu.add(new MenuItem("Back"));
231353 backItem.addActionListener(this);
232354 frontItem = menu.add(new MenuItem("Front"));
233355 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
361
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237362 hideItem.addActionListener(this);
363
+ }
238364 ungroupItem = menu.add(new MenuItem("Ungroup"));
239365 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- 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);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
247373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248374 switchGeoItem.addActionListener(this);
249375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250376 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
377
+ morphItem = menu.add(new MenuItem("Morph Group"));
252378 morphItem.addActionListener(this);
379
+
380
+ menu.add("-");
381
+ physicsItem = menu.add(new MenuItem("Physics"));
382
+ physicsItem.addActionListener(this);
383
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
384
+ frameselectorItem.addActionListener(this);
253385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254386 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
387
+ }
257388
258389 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
261392 billboardItem = menu.add(new MenuItem("Billboard"));
262393 billboardItem.addActionListener(this);
263394 csgItem = menu.add(new MenuItem("CSG"));
264395 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266397 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268399 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
405
+ if (Globals.ADVANCED)
406
+ {
407
+ menu.add("-");
271408 linkerItem = menu.add(new MenuItem("Linker"));
272409 linkerItem.addActionListener(this);
273410 templateItem = menu.add(new MenuItem("Template"));
274411 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277412 pointflowItem = menu.add(new MenuItem("Point Flow"));
278413 pointflowItem.addActionListener(this);
414
+ }
279415 menu.add("-");
280416 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281417 resetTransformItem.addActionListener(this);
282418 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283419 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
420
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
421
+ resetCentroidXZItem.addActionListener(this);
422
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
423
+ transformGeometryItem.addActionListener(this);
424
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
425
+ transformChildrenItem.addActionListener(this);
286426
287427 oe.menuBar.add(menu = new Menu("Geometry"));
288428 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +433,11 @@
293433 genNormalsCADItem.addActionListener(this);
294434 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295435 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ if (Globals.ADVANCED)
437
+ {
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297439 genNormalsMINEItem.addActionListener(this);
440
+ }
298441 stripifyItem = menu.add(new MenuItem("Stripify"));
299442 stripifyItem.addActionListener(this);
300443 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +459,34 @@
316459 reduce34MeshItem.addActionListener(this);
317460 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318461 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321462 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322463 clipMeshItem.addActionListener(this);
464
+
465
+ if (Globals.ADVANCED)
466
+ {
467
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
468
+ smoothMeshItem.addActionListener(this);
469
+ }
323470
324471 oe.menuBar.add(menu = new Menu("Attributes"));
325472 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326473 clearMaterialsItem.addActionListener(this);
474
+ resetAllItem = menu.add(new MenuItem("Reset All"));
475
+ resetAllItem.addActionListener(this);
476
+ stepAllItem = menu.add(new MenuItem("Step All"));
477
+ stepAllItem.addActionListener(this);
327478 menu.add("-");
328479 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329480 liveleavesItem.addActionListener(this);
330481 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331482 unliveleavesItem.addActionListener(this);
483
+ if (Globals.ADVANCED)
484
+ {
332485 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333486 supportleavesItem.addActionListener(this);
334487 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335488 unsupportleavesItem.addActionListener(this);
489
+ }
336490 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337491 hideleavesItem.addActionListener(this);
338492 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +495,14 @@
341495 markleavesItem.addActionListener(this);
342496 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343497 unmarkleavesItem.addActionListener(this);
498
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
499
+ rewindleavesItem.addActionListener(this);
500
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
501
+ unrewindleavesItem.addActionListener(this);
502
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
503
+ randomleavesItem.addActionListener(this);
504
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
505
+ unrandomleavesItem.addActionListener(this);
344506 menu.add("-");
345507 flipVItem = menu.add(new MenuItem("Flip V"));
346508 flipVItem.addActionListener(this);
....@@ -376,35 +538,41 @@
376538 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377539 sortbynameItem.addActionListener(this);
378540 menu.add("-");
541
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
542
+ shareGeometriesItem.addActionListener(this);
543
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
544
+ mergeGeometriesItem.addActionListener(this);
545
+ if (Globals.ADVANCED)
546
+ {
547
+ // Pretty much the same as duplicate and clone.
379548 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380549 extractGeometriesItem.addActionListener(this);
381550 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382551 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);
552
+ }
387553
388554 oe.menuBar.add(menu = new Menu("Insert"));
389555 buildCreateMenu(menu);
390556
391
-
392
- 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..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402557 oe.menuBar.add(menu = new Menu("Tools"));
403558 buildToolsMenu(menu);
404559 }
405560
561
+
406562 void SetupUI2(ObjEditor oe)
407563 {
564
+ // June 2019
565
+ if (oe == null)
566
+ {
567
+ //super.SetupUI2(this);
568
+ //return;
569
+ }
570
+
571
+ if (copy != group)
572
+ {
573
+ //super.SetupUI2(this);
574
+ }
575
+
408576 //new Exception().printStackTrace();
409577
410578 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,150 +601,231 @@
433601 oe.radioPanel.add(dummyButton);
434602 oe.buttonGroup.add(dummyButton);
435603 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
439607
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
608
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
609
+
610
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ //minButton.setToolTipText("Minimize window");
612
+ //minButton.addActionListener(this);
613
+
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
620
+
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ fullButton.setToolTipText("Full-screen window");
623
+ fullButton.addActionListener(this);
624
+
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
632
+
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
661
+ liveCB.setToolTipText("Enable animation");
441662 liveCB.addItemListener(this);
442663
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ oneStepButton.setToolTipText("Animate one step forward");
666
+ oneStepButton.addActionListener(this);
667
+
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
669
+ fastCB.setToolTipText("Fast mode");
461670 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
671
+
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
468677
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510679 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515680
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
523
- oe.aConstraints.gridx += 1;
524
- oe.aConstraints.weighty = 0;
525
- oe.aConstraints.gridwidth = 1;
681
+ if (Globals.ADVANCED)
682
+ {
683
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ snapobjectButton.addActionListener(this);
685
+ snapobjectButton.setToolTipText("Snap Object");
686
+ }
687
+
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
526689
527
- //
528
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
529
- twoButton.addActionListener(this);
530
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
531691 fourButton.addActionListener(this);
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
692
+ fourButton.setToolTipText("Show left panel only");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
533701 sixButton.addActionListener(this);
534
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
535
- threeButton.addActionListener(this);
536
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
537
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
538708 //
539709
540
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
541712 rootButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
713
+
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ closeButton.setToolTipText("Close tab");
544716 closeButton.addActionListener(this);
545717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
546718 //clearButton.addActionListener(this);
547
- oe.aConstraints.gridx += 1;
548
-
549
- oe.aConstraints.gridx = 1; //
550
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
551
- editButton.addActionListener(this);
552
- oe.aConstraints.gridx += 1;
553
- oe.aConstraints.weighty = 0;
554
- oe.aConstraints.gridwidth = 1;
555719
556
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
751
+
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
801
+ editButton.addActionListener(this);
802
+
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
557805 uneditButton.addActionListener(this);
558806
559
- oe.aConstraints.gridx += 1;
560
- oe.aConstraints.weighty = 0;
561
- oe.aConstraints.gridwidth = 1;
562
-
563
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
564
- clearPanelButton.addActionListener(this);
565
-
566
- oe.aConstraints.gridx += 1;
567
- oe.aConstraints.weighty = 0;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
571809 allParamsButton.addActionListener(this);
572810
573
- oe.aConstraints.gridx += 1;
574
- oe.aConstraints.weighty = 0;
575
- oe.aConstraints.gridwidth = 1;
576
-
577
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ clearPanelButton.setToolTipText("Clear edit panel");
813
+ clearPanelButton.addActionListener(this);
814
+
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ unselectButton.setToolTipText("Unselect");
578817 unselectButton.addActionListener(this);
579818
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
822
+
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
828
+
580829 // oe.aConstraints.gridx += 1;
581830 // oe.aConstraints.weighty = 0;
582831 // oe.aConstraints.gridwidth = 1;
....@@ -588,40 +837,25 @@
588837 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
589838 // gcButton.addActionListener(this);
590839
591
- oe.aConstraints.gridx = 0;
592
- oe.aConstraints.gridy += 1;
593
-
594
- //ctrlPanel.add(objList = new List(5, true));
595
- oe.aConstraints.gridwidth = 100;
596
- // oe.aConstraints.gridheight = 100;
597
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
598
- oe.aConstraints.gridheight = 1;
599
- oe.aConstraints.weighty = 0.5;
600
- oe.aConstraints.gridx = 0;
601
- JScrollPane jSP;
840
+ cGridBag jSPPanel = new cGridBag();
841
+
842
+ JScrollPane jSP;
602843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
603
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
604845 ResetModel();
605
- oe.aConstraints.weighty = 0.5;
606
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
607
- oe.aConstraints.gridy += 1;
608
- oe.aConstraints.gridwidth = 1;
609
-
610
- oe.aConstraints.weighty = 0;
611
- oe.aConstraints.gridwidth = 2;
612
-
613
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
614
- colorCB.addItemListener(this);
615
- oe.aConstraints.gridx += 2;
616
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
617
- materialCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
620
- textureCB.addItemListener(this);
621
-
622
- oe.aConstraints.gridx = 0;
623
- oe.aConstraints.gridy += 1;
624846
847
+ oe.treePanel.add(jSPPanel);
848
+ oe.treePanel.Return();
849
+
850
+ oe.treePanel.add(copyOptionsPanel);
851
+ oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
855
+
856
+// mainPanel.setDividerLocation(0.5); //1.0);
857
+// mainPanel.setResizeWeight(0.5);
858
+
625859 //jList.addListSelectionListener(this);
626860 oe.jTree.addTreeSelectionListener(this);
627861 //jTree.setRootVisible(false);
....@@ -640,23 +874,160 @@
640874 dgr.addDragGestureListener(this);
641875 }catch(Exception e) {}
642876 */
643
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
644878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
645879 }
880
+
881
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
882
+ {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
897
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
898
+ boxCB.setToolTipText("Display bounding boxes");
899
+ boxCB.addItemListener(this);
900
+
901
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
903
+ zoomBoxCB.addItemListener(this);
904
+
905
+ if (true) // Globals.ADVANCED)
906
+ {
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
914
+
915
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
916
+ // localCB.addItemListener(this);
917
+
918
+ panel.Return();
919
+
920
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
921
+ crowdCB.setToolTipText("Used for crowds");
922
+ crowdCB.addItemListener(this);
923
+
924
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
925
+ smoothCB.setToolTipText("Snapping delay");
926
+ smoothCB.addItemListener(this);
927
+
928
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
929
+ slowCB.setToolTipText("Smooth interpolation");
930
+ slowCB.addItemListener(this);
931
+
932
+// constraints.gridy += 1;
933
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
934
+// speakerMocapCB.addItemListener(this);
935
+
936
+ panel.Return();
937
+
938
+ if (false)
939
+ {
940
+ // handled in scripts
941
+ //constraints.gridy += 1;
942
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
943
+ speakerCameraCB.addItemListener(this);
944
+
945
+ //constraints.gridy += 1;
946
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
947
+ speakerFocusCB.addItemListener(this);
948
+
949
+ //constraints.gridy += 1;
950
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
951
+ smoothfocusCB.addItemListener(this);
952
+ panel.Return();
953
+ }
954
+
955
+//constraints.gridx += 1;
956
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
957
+// debugCB.addItemListener(this);
958
+
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
963
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
965
+ oeilCB.addItemListener(this);
966
+
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
987
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
988
+ lookAtCB.setToolTipText("Look-at target");
989
+ lookAtCB.addItemListener(this);
990
+ }
991
+
992
+ }
993
+
994
+ cGridBag fill = new cGridBag();
995
+ fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
1000
+
1001
+ panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
1004
+
1005
+ }
6461006
6471007 void EditObject(Object3D obj)
6481008 {
649
- cRadio dummyButton = new cRadio(obj.name);
650
- dummyButton.SetObject(obj);
651
- dummyButton.layout = sevenButton;
652
- dummyButton.SetCamera(cameraView.renderCamera, false);
653
- dummyButton.addActionListener(this);
654
- radioPanel.add(dummyButton);
655
- buttonGroup.add(dummyButton);
656
- dummyButton.doClick();
1009
+ cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
1018
+ radioButton.SetObject(obj);
1019
+ radioButton.layout = sixButton; // sevenButton;
1020
+ radioButton.SetCamera(cameraView.renderCamera, false);
1021
+ radioButton.addActionListener(this);
1022
+ radioPanel.add(radioButton);
1023
+ buttonGroup.add(radioButton);
1024
+ radioButton.doClick();
6571025 }
1026
+
6581027 void SetupViews(ObjEditor oe)
6591028 {
1029
+ theFrame = this;
1030
+
6601031 oe.SetupViews();
6611032
6621033 System.out.println("SetupViews");
....@@ -665,22 +1036,28 @@
6651036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6661037 }
6671038
668
- JCheckBox liveCB;
669
- JCheckBox supportCB;
670
- JCheckBox localCB;
671
- JCheckBox crowdCB;
672
- JCheckBox smoothCB;
673
- JCheckBox fastCB;
674
- JCheckBox slowCB;
675
- JCheckBox boxCB;
676
- JCheckBox trackCB;
677
- JCheckBox smoothfocusCB;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
6781052 // JCheckBox speakerMocapCB;
679
- JCheckBox speakerCameraCB;
680
- JCheckBox speakerFocusCB;
681
- JCheckBox debugCB;
682
- JCheckBox oeilCB;
683
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
6841061
6851062 // static int COLOR = 1;
6861063 // static int MATERIAL = 2;
....@@ -688,9 +1065,9 @@
6881065
6891066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6901067
691
- JCheckBox colorCB;
692
- JCheckBox materialCB;
693
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
6941071
6951072 public void itemStateChanged(ItemEvent e)
6961073 {
....@@ -715,10 +1092,10 @@
7151092 dropAttributes |= Object3D.TEXTURE;
7161093 else
7171094 dropAttributes &= ~Object3D.TEXTURE;
718
- }
719
- else if(e.getSource() == liveCB)
1095
+ } else if(e.getSource() == liveCB)
7201096 {
7211097 cameraView.ToggleLive();
1098
+ refreshContents(false);
7221099 }
7231100 else if(e.getSource() == supportCB)
7241101 {
....@@ -754,6 +1131,10 @@
7541131 cameraView.repaint();
7551132 // refreshContents();
7561133 }
1134
+ else if(e.getSource() == zoomBoxCB)
1135
+ {
1136
+ cameraView.ToggleZoomBoxMode();
1137
+ }
7571138 else if(e.getSource() == smoothfocusCB)
7581139 {
7591140 cameraView.ToggleSmoothFocus();
....@@ -779,6 +1160,18 @@
7791160 {
7801161 cameraView.ToggleOeil();
7811162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
7821175 else if(e.getSource() == lookAtCB)
7831176 {
7841177 cameraView.ToggleLookAt();
....@@ -795,7 +1188,8 @@
7951188
7961189 /**/
7971190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
798
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
7991193 if ((path == null) || (path.getPathCount() <= 1)) {
8001194 // We can't move the root node or an empty selection
8011195 return;
....@@ -858,8 +1252,6 @@
8581252 }
8591253 }
8601254
861
- String string = (String) object;
862
-
8631255 System.out.println("Transfer = " + object + "; drop : " + target);
8641256 // if( object instanceof java.io.File[])
8651257 // {
....@@ -867,7 +1259,11 @@
8671259 // objEditor.DropFile((java.io.File[]) object, true);
8681260 // return;
8691261 // }
870
- if (string.charAt(0) == '/')
1262
+
1263
+ String string = object.toString();
1264
+
1265
+ // File path for Mac and Windows
1266
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8711267 {
8721268 // file(s)
8731269 String[] names = string.split("\n");
....@@ -894,7 +1290,7 @@
8941290
8951291 flashIt = false;
8961292 CameraPane pane = (CameraPane) target;
897
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1293
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8981294 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8991295
9001296 if (group.selection.size() == 1)
....@@ -910,23 +1306,33 @@
9101306
9111307 assert target == objEditor.jTree;
9121308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
9131310 try {
914
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9151312 } catch (Exception e) {
9161313 System.out.println("destinationPath : " + destinationPath);
9171314 return;
9181315 }
9191316
920
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
9211318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
9221328 loadClipboard(true);
9231329 objEditor.jTree.setSelectionPath(destinationPath);
924
- pasteInto(false);
925
- } else {
926
- loadClipboard(false);
927
- objEditor.jTree.setSelectionPath(destinationPath);
928
- pasteInto(false); // true); // ???
929
- }
1330
+ pasteInto(false, false);
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
9301336 }
9311337 public void dropActionChanged(DropTargetDragEvent dtde)
9321338 // Called if the user has modified the current drop gesture
....@@ -1031,85 +1437,107 @@
10311437 {
10321438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10331439 //heightFieldItem.addActionListener(this);
1034
- gridItem = menu.add(new MenuItem("Grid"));
1035
- gridItem.addActionListener(this);
1036
- rectoidItem = menu.add(new MenuItem("Box"));
1037
- rectoidItem.addActionListener(this);
1038
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1039
- ellipsoidItem.addActionListener(this);
1040
- coneItem = menu.add(new MenuItem("Cone"));
1041
- coneItem.addActionListener(this);
1042
- torusItem = menu.add(new MenuItem("Torus"));
1043
- torusItem.addActionListener(this);
1044
- superItem = menu.add(new MenuItem("Superellipsoid"));
1045
- superItem.addActionListener(this);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
10461458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10471459 kleinItem.addActionListener(this);
1048
- particleItem = menu.add(new MenuItem("Particle system"));
1049
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
1464
+ if (Globals.ADVANCED)
1465
+ {
10501466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10511467 ragdollItem.addActionListener(this);
10521468 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10531469 ragdoll2Item.addActionListener(this);
1470
+ }
10541471 menu.add("-");
1055
- meshItem = menu.add(new MenuItem("Mesh"));
1472
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10561473 meshItem.addActionListener(this);
10571474 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10581475 // meshGroupItem.addActionListener(this);
1476
+ if (Globals.ADVANCED)
1477
+ {
10591478 springItem = menu.add(new MenuItem("Spring"));
10601479 springItem.addActionListener(this);
10611480 flagItem = menu.add(new MenuItem("Flag"));
10621481 flagItem.addActionListener(this);
1063
- bezierItem = menu.add(new MenuItem("Patch"));
1064
- bezierItem.addActionListener(this);
1065
- checkerItem = menu.add(new MenuItem("Checker"));
1066
- checkerItem.addActionListener(this);
10671482 blobItem = menu.add(new MenuItem("Blob"));
10681483 blobItem.addActionListener(this);
10691484 latheItem = menu.add(new MenuItem("Lathe"));
10701485 latheItem.addActionListener(this);
1071
- lightItem = menu.add(new MenuItem("Light"));
1072
- lightItem.addActionListener(this);
1486
+ }
1487
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1488
+ bezierItem.addActionListener(this);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
10731493 menu.add("-");
10741494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10751495 //superLoopItem.addActionListener(this);
1076
- loopItem = menu.add(new MenuItem("Loop"));
1077
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
10781498 doubleItem = menu.add(new MenuItem("Fork"));
10791499 doubleItem.addActionListener(this);
1500
+ if (Globals.ADVANCED)
1501
+ {
10801502 tripleItem = menu.add(new MenuItem("Trident"));
10811503 tripleItem.addActionListener(this);
1504
+ }
10821505 }
10831506
10841507 void buildToolsMenu(Menu menu)
10851508 {
10861509 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10871510 animationItem.addItemListener(this);
1088
- animationItem.setState(CameraPane.ANIMATION);
1511
+ animationItem.setState(Globals.ANIMATION);
1512
+
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
10891515
10901516 menu.add("-");
10911517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10921518 parseverticesItem.addActionListener(this);
10931519 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10941520 textureFieldItem.addActionListener(this);
1095
- alignItem = menu.add(new MenuItem("Align"));
1521
+ alignItem = menu.add(new MenuItem("Align Objects"));
10961522 alignItem.addActionListener(this);
1097
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1098
- mirrorItem.addActionListener(this);
10991523 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11001524 reduceMorphItem.addActionListener(this);
11011525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11021526 reduce34MorphItem.addActionListener(this);
1103
-
1104
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1105
- computeAOItem.addActionListener(this);
11061527 menu.add("-");
1107
-
11081528 menu.add(memoryItem = new MenuItem("Memory Usage"));
11091529 memoryItem.addActionListener(this);
1530
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1531
+ computeAOItem.addActionListener(this);
1532
+
1533
+ if (Globals.ADVANCED)
1534
+ {
1535
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1536
+ mirrorItem.addActionListener(this);
1537
+ menu.add("-");
11101538 menu.add(analyzeItem = new MenuItem("Analyze"));
11111539 analyzeItem.addActionListener(this);
1112
- menu.add(dumpItem = new MenuItem("Dump"));
1540
+ menu.add(dumpItem = new MenuItem("Print"));
11131541 dumpItem.addActionListener(this);
11141542 // menu.add(pathItem = new MenuItem("From-to path"));
11151543 // pathItem.addActionListener(this);
....@@ -1118,6 +1546,8 @@
11181546 resetParentItem.addActionListener(this);
11191547 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11201548 repairParentItem.addActionListener(this);
1549
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1550
+ repairShadowItem.addActionListener(this);
11211551 menu.add(invariantsItem = new MenuItem("Invariants"));
11221552 invariantsItem.addActionListener(this);
11231553 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1125,6 +1555,7 @@
11251555 menu.add("-");
11261556 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11271557 editScriptItem.addActionListener(this);
1558
+ }
11281559 }
11291560
11301561 void ScreenFit()
....@@ -1247,9 +1678,34 @@
12471678 shadow.material = new cMaterial(obj.material);
12481679 shadow.material.diffuse = 0.0001f;
12491680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
12501682
12511683 makeSomething(shadow);
12521684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
12531709
12541710 /**
12551711 * applyExample
....@@ -1453,9 +1909,9 @@
14531909
14541910 void Overwrite(int mask)
14551911 {
1456
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1912
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14571913 {
1458
- Object3D content = GrafreeD.clipboard.get(0);
1914
+ Object3D content = Grafreed.clipboard.get(0);
14591915
14601916 if (content instanceof cGroup && ((cGroup)content).transientlink )
14611917 content = ((cGroup)content).get(0);
....@@ -1478,6 +1934,7 @@
14781934 //
14791935 public void actionPerformed(ActionEvent event) // , Object arg)
14801936 {
1937
+ Object source = event.getSource();
14811938 /*
14821939 if (event.getSource() == nameField)
14831940 {
....@@ -1489,11 +1946,11 @@
14891946 }
14901947 else
14911948 */
1492
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1949
+ if (source == lookAtItem || source == lookFromItem)
14931950 {
14941951 ScreenFit();
14951952 } else
1496
- if (event.getSource() == switchItem)
1953
+ if (source == switchViewItem)
14971954 {
14981955 cVector v1 = new cVector();
14991956 cVector v2 = new cVector();
....@@ -1502,11 +1959,11 @@
15021959 objEditor.cameraView.renderCamera.setAim(v2, v1);
15031960 objEditor.cameraView.repaint();
15041961 } else
1505
- if (event.getSource() == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
15061963 {
15071964 makeSomething(new Box());
15081965 } else
1509
- if (event.getSource() == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
15101967 {
15111968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15121969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1527,9 +1984,9 @@
15271984 applyExample(particleGeom, "SMOKE");
15281985 makeSomething(particleGeom);
15291986 } else
1530
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1987
+ if (source == ragdollItem || source == ragdoll2Item)
15311988 {
1532
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1989
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15331990
15341991 ragdoll.toParent = LA.newMatrix();
15351992 ragdoll.fromParent = LA.newMatrix();
....@@ -1547,7 +2004,7 @@
15472004 } else
15482005 /*
15492006 */
1550
- if (event.getSource() == heightFieldItem)
2007
+ if (source == heightFieldItem)
15512008 {
15522009 Object3D obj = new Object3D();
15532010
....@@ -1585,31 +2042,31 @@
15852042
15862043 makeSomething(obj);
15872044 } else
1588
- if (event.getSource() == gridItem)
2045
+ if (source == gridItem || source == gridButton)
15892046 {
15902047 makeSomething(new Grid());
15912048 } else
1592
- if (event.getSource() == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
15932050 {
15942051 makeSomething(new Sphere());
15952052 } else
1596
- if (event.getSource() == coneItem)
2053
+ if (source == coneItem || source == coneButton)
15972054 {
15982055 makeSomething(new Cone());
15992056 } else
1600
- if (event.getSource() == torusItem)
2057
+ if (source == torusItem || source == torusButton)
16012058 {
16022059 makeSomething(new Torus());
16032060 } else
1604
- if (event.getSource() == superItem)
2061
+ if (source == superItem || source == superButton)
16052062 {
16062063 makeSomething(new Superellipsoid());
16072064 } else
1608
- if (event.getSource() == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
16092066 {
16102067 makeSomething(new Klein());
16112068 } else
1612
- if (event.getSource() == blobItem)
2069
+ if (source == blobItem)
16132070 {
16142071 Blob blob = new Blob();
16152072 BlobComponent comp = new BlobComponent();
....@@ -1617,15 +2074,15 @@
16172074 //blob.retile();
16182075 makeSomething(blob);
16192076 } else
1620
- if (event.getSource() == latheItem)
2077
+ if (source == latheItem)
16212078 {
16222079 makeSomething(new Lathe());
16232080 } else
1624
- if (event.getSource() == bezierItem)
2081
+ if (source == bezierItem)
16252082 {
16262083 makeSomething(new BezierSurface());
16272084 } else
1628
- if (event.getSource() == checkerItem)
2085
+ if (source == overlayItem || source == overlayButton)
16292086 {
16302087 /*
16312088 Object3D obj = new BezierSurface(5,8);
....@@ -1640,7 +2097,7 @@
16402097 */
16412098 makeSomething(new Checker());
16422099 } else
1643
- if (event.getSource() == meshItem)
2100
+ if (source == meshItem)
16442101 {
16452102 Object3D itemtomake = new Object3D();
16462103 Object3D child;
....@@ -1661,35 +2118,35 @@
16612118 makeSomething(child);
16622119 }
16632120 } else
1664
- if (event.getSource() == springItem)
2121
+ if (source == springItem)
16652122 {
16662123 cSpring s = new cSpring();
16672124 s.setup();
16682125 makeSomething(s);
16692126 } else
1670
- if (event.getSource() == flagItem)
2127
+ if (source == flagItem)
16712128 {
16722129 cSpring s = new cFlag();
16732130 s.setup();
16742131 makeSomething(s);
16752132 } else
1676
- if (event.getSource() == lightItem)
2133
+ if (source == lightItem || source == lightButton)
16772134 {
16782135 makeSomething(new Light());
16792136 } else
1680
- if (event.getSource() == csgItem)
2137
+ if (source == csgItem)
16812138 {
16822139 group(new CSG());
16832140 } else
1684
- if (event.getSource() == templateItem)
2141
+ if (source == templateItem)
16852142 {
16862143 group(new cTemplate());
16872144 } else
1688
- if (event.getSource() == attributeItem)
2145
+ if (source == attributeItem)
16892146 {
16902147 makeSomething(new Attribute());
16912148 } else
1692
- if (event.getSource() == pointflowItem)
2149
+ if (source == pointflowItem)
16932150 {
16942151 makeSomething(new PointFlow());
16952152 } else
....@@ -1701,7 +2158,7 @@
17012158 } else
17022159 */
17032160
1704
- if (event.getSource() == superLoopItem)
2161
+ if (source == superLoopItem)
17052162 {
17062163 Composite g = new cGroup();
17072164 for (int i=0; i<15; i++)
....@@ -1723,30 +2180,30 @@
17232180
17242181 group(g);
17252182 } else
1726
- if (event.getSource() == loopItem)
2183
+ if (source == loopItem || source == loopButton)
17272184 {
17282185 Composite csg = new GroupLeaf();
17292186 csg.count = 5;
17302187 group(csg);
1731
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
17322189 csg.addChild(child);
17332190 child.addChild(csg);
17342191 } else
1735
- if (event.getSource() == doubleItem)
2192
+ if (source == doubleItem)
17362193 {
1737
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
17382195 csg.count = 5;
17392196 group(csg);
1740
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
17412198 csg.addChild(child);
17422199 child.addChild(csg);
1743
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
17442201 csg.addChild(child);
17452202 child.addChild(csg);
17462203 } else
1747
- if (event.getSource() == tripleItem)
2204
+ if (source == tripleItem)
17482205 {
1749
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
17502207 csg.count = 4;
17512208 group(csg);
17522209 Composite child = new cGroup();
....@@ -1759,73 +2216,98 @@
17592216 csg.addChild(child);
17602217 child.addChild(csg);
17612218 } else
1762
-
1763
- if (event.getSource() == importGFDItem)
2219
+ if (source == computeAOItem)
17642220 {
1765
- ImportGFD();
2221
+ Globals.drawMode = CameraPane.OCCLUSION;
2222
+ Globals.theRenderer.repaint();
17662223 } else
1767
- if (event.getSource() == importVRMLX3DItem)
1768
- {
1769
- ImportVRMLX3D();
1770
- } else
1771
- if (event.getSource() == import3DSItem)
1772
- {
1773
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1774
- } else
1775
- if (event.getSource() == importOBJItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1778
- } else
1779
- if (event.getSource() == computeAOItem)
1780
- {
1781
- CameraPane.drawMode = CameraPane.OCCLUSION;
1782
- CameraPane.theRenderer.repaint();
1783
- } else
1784
- if (event.getSource() == recompileItem)
2224
+ if (source == recompileItem)
17852225 {
17862226 Recompile();
17872227 refreshContents();
17882228 } else
1789
- if (event.getSource() == editScriptItem)
2229
+ if (source == editScriptItem)
17902230 {
17912231 OpenDialog();
17922232 refreshContents();
17932233 } else
1794
- if (event.getSource() == invariantsItem)
2234
+ if (source == invariantsItem)
17952235 {
17962236 System.out.println("Invariants:");
1797
- GrafreeD.grafreeD.universe.invariants();
2237
+ Grafreed.grafreeD.universe.invariants();
17982238 } else
1799
- if (event.getSource() == memoryItem)
2239
+ if (source == memoryItem)
18002240 {
18012241 //System.out.println("Invariants:");
18022242 PrintMemory();
18032243 } else
1804
- if (event.getSource() == pathItem)
2244
+ if (source == pathItem)
18052245 {
18062246 PrintPath();
18072247 } else
1808
- if (event.getSource() == analyzeItem)
2248
+ if (source == analyzeItem)
18092249 {
18102250 AnalyzeObject();
18112251 } else
1812
- if (event.getSource() == dumpItem)
2252
+ if (source == dumpItem)
18132253 {
18142254 DumpObject();
18152255 } else
1816
- if (event.getSource() == screenfitButton)
2256
+ if (source == minButton)
18172257 {
1818
- //Reload(lastConverter, lastFilename, true);
2258
+ Minimize();
2259
+ } else
2260
+ if (source == maxButton)
2261
+ {
2262
+ Maximize();
2263
+ } else
2264
+ if (source == fullButton)
2265
+ {
2266
+ ToggleFullScreen();
2267
+ } else
2268
+ if (source == undoButton)
2269
+ {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2273
+ Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
2284
+ } else
2285
+ if (source == redoButton)
2286
+ {
2287
+ // Go to next version
2288
+ Redo();
2289
+ } else
2290
+ if (source == saveButton)
2291
+ {
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
2295
+ } else
2296
+ if (source == oneStepButton)
2297
+ {
2298
+ Globals.ONESTEP = true;
2299
+ cameraView.repaint();
2300
+ } else
2301
+ if (source == screenfitButton)
2302
+ {
18192303 ScreenFit();
18202304 } else
1821
- if (event.getSource() == screenfitpointButton)
2305
+ if (source == screenfitpointButton)
18222306 {
1823
- //Reload(lastConverter, lastFilename, true);
18242307 ScreenFitPoint();
18252308 } else
1826
- if (event.getSource() == snapobjectButton)
2309
+ if (source == snapobjectButton)
18272310 {
1828
- //Reload(lastConverter, lastFilename, true);
18292311 SnapObject();
18302312 } else
18312313 // if (event.getSource() == recompileButton)
....@@ -1834,13 +2316,13 @@
18342316 // Recompile();
18352317 // refreshContents();
18362318 // } else
1837
- if (event.getSource() == gcButton)
2319
+ if (source == gcButton)
18382320 {
18392321 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18402322 System.gc();
18412323 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422324 } else
1843
- if (event.getSource() == editLeafItem)
2325
+ if (source == editLeafItem)
18442326 {
18452327 Object3D obj;
18462328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1854,62 +2336,74 @@
18542336 }
18552337 refreshContents(true);
18562338 } else
1857
- if (event.getSource() == openWindowItem)
2339
+ if (source == openWindowItem)
18582340 {
18592341 EditSelection(true);
18602342 } else
1861
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2343
+ if (source == cutItem || source == clearButton)
18622344 {
18632345 loadClipboard(true);
18642346 } else
1865
- if (event.getSource() == duplicateItem)
2347
+ if (source == undoItem)
18662348 {
1867
- Object3D keep = GrafreeD.clipboard;
2349
+ Undo();
2350
+ } else
2351
+ if (source == redoItem)
2352
+ {
2353
+ Redo();
2354
+ } else
2355
+ if (source == duplicateItem)
2356
+ {
2357
+ Object3D keep = Grafreed.clipboard;
18682358 loadClipboard(false);
18692359 paste(false);
1870
- GrafreeD.clipboard = keep;
2360
+ Grafreed.clipboard = keep;
18712361 } else
1872
- if (event.getSource() == cloneItem)
2362
+ if (source == cloneItem)
18732363 {
18742364 CloneSelection(false);
18752365 } else
1876
- if (event.getSource() == cloneSupportItem)
2366
+ if (source == cloneSupportItem)
18772367 {
18782368 CloneSelection(true);
18792369 } else
1880
- if (event.getSource() == copyItem)
2370
+ if (source == copyItem)
18812371 {
18822372 loadClipboard(false);
18832373 } else
1884
- if (event.getSource() == pasteItem)
2374
+ if (source == pasteItem)
18852375 {
18862376 paste(false);
18872377 } else
1888
- if (event.getSource() == pasteLinkItem)
2378
+ if (source == pasteIntoItem)
18892379 {
1890
- pasteInto(false);
2380
+ pasteInto(true, false);
18912381 } else
1892
- if (event.getSource() == pasteCloneItem)
2382
+ if (source == pasteLinkItem)
18932383 {
1894
- pasteInto(true);
2384
+ pasteInto(false, false);
18952385 } else
1896
- if (event.getSource() == pasteExpandItem)
2386
+ if (source == pasteCloneItem)
2387
+ {
2388
+ pasteInto(true, true);
2389
+ } else
2390
+ if (source == pasteExpandItem)
18972391 {
18982392 paste(true);
18992393 } else
1900
- if (event.getSource() == synchronizeItem)
2394
+ if (source == synchronizeItem)
19012395 {
19022396 Overwrite(Object3D.TRANSFORM);
19032397 } else
1904
- if (event.getSource() == overwriteNameItem)
2398
+ if (source == overwriteNameItem)
19052399 {
19062400 Overwrite(Object3D.NAME);
19072401 } else
1908
- if (event.getSource() == overwriteUVItem)
2402
+ if (source == overwriteUVItem)
19092403 {
19102404 Overwrite(Object3D.UV);
19112405 } else
1912
- if (event.getSource() == overwriteMatItem)
2406
+ if (source == overwriteMatItem)
19132407 {
19142408 /* july 2015
19152409 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1929,7 +2423,7 @@
19292423
19302424 Overwrite(dropAttributes);
19312425 }
1932
- if (event.getSource() == overwriteGeoItem)
2426
+ if (source == overwriteGeoItem)
19332427 {
19342428 Overwrite(Object3D.GEOMETRY);
19352429 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1946,7 +2440,7 @@
19462440 // refreshContents();
19472441 // }
19482442 } else
1949
- if (event.getSource() == generateMeshItem)
2443
+ if (source == generateMeshItem)
19502444 {
19512445 //if (group.selection.size() == 1)
19522446 // for (int i=0; i<group.selection.size(); i++)
....@@ -1957,7 +2451,7 @@
19572451 ResetModel();
19582452 refreshContents();
19592453 } else
1960
- if (event.getSource() == extractGeometriesItem)
2454
+ if (source == extractGeometriesItem)
19612455 {
19622456 boolean one = false;
19632457
....@@ -1984,7 +2478,7 @@
19842478 ResetModel();
19852479 refreshContents();
19862480 } else
1987
- if (event.getSource() == cloneGeometriesItem)
2481
+ if (source == cloneGeometriesItem)
19882482 {
19892483 boolean one = false;
19902484
....@@ -2010,7 +2504,7 @@
20102504 ResetModel();
20112505 refreshContents();
20122506 } else
2013
- if (event.getSource() == shareGeometriesItem)
2507
+ if (source == shareGeometriesItem)
20142508 {
20152509 boolean one = false;
20162510
....@@ -2040,7 +2534,7 @@
20402534 refreshContents();
20412535 }
20422536 } else
2043
- if (event.getSource() == mergeGeometriesItem)
2537
+ if (source == mergeGeometriesItem)
20442538 {
20452539 boolean one = false;
20462540
....@@ -2070,7 +2564,7 @@
20702564 ResetModel();
20712565 refreshContents();
20722566 } else
2073
- if (event.getSource() == linkverticesItem)
2567
+ if (source == linkverticesItem)
20742568 {
20752569 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20762570 // {
....@@ -2083,48 +2577,48 @@
20832577 // group.selection.get(0).setMasterThis(content); // should be identity
20842578 // refreshContents();
20852579 // }
2086
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2580
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20872581 {
2088
- Object3D content = GrafreeD.clipboard.get(0);
2582
+ Object3D content = Grafreed.clipboard.get(0);
20892583
20902584 if (content instanceof cGroup && ((cGroup)content).transientlink )
20912585 content = ((cGroup)content).get(0);
20922586
2093
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2587
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20942588 for (int i=0; i<group.selection.size(); i++)
20952589 {
2096
- boolean random = CameraPane.RANDOM;
2097
- CameraPane.RANDOM = false; // parse all random nodes
2590
+ boolean random = CameraPane.SWITCH;
2591
+ CameraPane.SWITCH = false; // parse all random nodes
20982592 group.selection.get(i).linkVerticesThis(content);
20992593 // group.selection.get(i).setMasterThis(content); // should be identity
2100
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21012595 }
2102
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2596
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21032597 refreshContents();
21042598 }
21052599 } else
2106
- if (event.getSource() == resetsupportItem)
2600
+ if (source == resetsupportItem)
21072601 {
21082602 for (int i=0; i<group.selection.size(); i++)
21092603 {
2110
- boolean random = CameraPane.RANDOM;
2111
- CameraPane.RANDOM = false; // parse all random nodes
2604
+ boolean random = CameraPane.SWITCH;
2605
+ CameraPane.SWITCH = false; // parse all random nodes
21122606 group.selection.get(i).linkVerticesThis(null);
2113
- CameraPane.RANDOM = random;
2607
+ CameraPane.SWITCH = random;
21142608 }
21152609
21162610 refreshContents();
21172611 } else
2118
- if (event.getSource() == relinkverticesItem)
2612
+ if (source == relinkverticesItem)
21192613 {
2120
- boolean random = CameraPane.RANDOM;
2121
- CameraPane.RANDOM = false; // parse all random nodes
2614
+ boolean random = CameraPane.SWITCH;
2615
+ CameraPane.SWITCH = false; // parse all random nodes
21222616 group.selection.RelinkToSupport();
2123
- CameraPane.RANDOM = random;
2617
+ CameraPane.SWITCH = random;
21242618
21252619 refreshContents();
21262620 } else
2127
- if (event.getSource() == resetreferencesItem)
2621
+ if (source == resetreferencesItem)
21282622 {
21292623 for (int i=0; i<group.selection.size(); i++)
21302624 {
....@@ -2133,11 +2627,11 @@
21332627
21342628 refreshContents();
21352629 } else
2136
- if (event.getSource() == setMasterItem)
2630
+ if (source == setMasterItem)
21372631 {
2138
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2632
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21392633 {
2140
- Object3D content = GrafreeD.clipboard.get(0);
2634
+ Object3D content = Grafreed.clipboard.get(0);
21412635
21422636 if (content instanceof cGroup && ((cGroup)content).transientlink )
21432637 content = ((cGroup)content).get(0);
....@@ -2146,13 +2640,13 @@
21462640 refreshContents();
21472641 }
21482642 } else
2149
- if (event.getSource() == poseMeshItem)
2643
+ if (source == poseMeshItem)
21502644 {
21512645 if (group.selection.size() == 1)
21522646 {
2153
- if (GrafreeD.clipboard.size() == 1)
2647
+ if (Grafreed.clipboard.size() == 1)
21542648 {
2155
- Object3D content = GrafreeD.clipboard.get(0);
2649
+ Object3D content = Grafreed.clipboard.get(0);
21562650
21572651 if (content instanceof cGroup && ((cGroup)content).transientlink )
21582652 content = ((cGroup)content).get(0);
....@@ -2165,19 +2659,19 @@
21652659 }
21662660
21672661 } else
2168
- if (event.getSource() == revertMeshItem)
2662
+ if (source == revertMeshItem)
21692663 {
21702664 RevertMeshes();
21712665 } else
2172
- if (event.getSource() == resetMeshItem)
2666
+ if (source == resetAllItem)
21732667 {
21742668 ResetAll();
21752669 } else
2176
- if (event.getSource() == stepAllItem)
2670
+ if (source == stepAllItem)
21772671 {
21782672 StepAll();
21792673 } else
2180
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
21812675 {
21822676 //int indices[] = jList.getSelectedIndices();
21832677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2185,46 +2679,46 @@
21852679
21862680 ClearSelection(false);
21872681 } else
2188
- if (event.getSource() == clearAllItem)
2682
+ if (source == clearAllItem)
21892683 {
21902684 ClearSelection(true);
21912685 } else
2192
- if (event.getSource() == grabItem)
2686
+ if (source == grabItem || source == groupButton)
21932687 {
2194
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
21952689 } else
2196
- if (event.getSource() == hideItem)
2690
+ if (source == hideItem)
21972691 {
21982692 group(new HiddenObject());
21992693 } else
2200
- if (event.getSource() == frontItem)
2694
+ if (source == frontItem)
22012695 {
22022696 front();
22032697 } else
2204
- if (event.getSource() == backItem)
2698
+ if (source == backItem)
22052699 {
22062700 back();
22072701 } else
2208
- if (event.getSource() == cameraItem)
2702
+ if (source == cameraItem)
22092703 {
22102704 makeSomething(new Camera());
22112705 } else
2212
- if (event.getSource() == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
22132707 {
22142708 group(new Composite());
22152709 } else
2216
- if (event.getSource() == randomItem)
2710
+ if (source == switchItem || source == switchButton)
22172711 {
22182712 RandomNode random = new RandomNode();
22192713 group(random);
22202714 if (random.size() > 0)
2221
- random.name = random.get(0).name + "Rnd";
2715
+ random.name = random.get(0).name + "Switch";
22222716 } else
2223
- if (event.getSource() == physicsItem)
2717
+ if (source == physicsItem)
22242718 {
22252719 group(new PhysicsNode());
22262720 } else
2227
- if (event.getSource() == frameselectorItem)
2721
+ if (source == frameselectorItem)
22282722 {
22292723 for (int i=0; i<group.selection.size(); i++)
22302724 {
....@@ -2236,7 +2730,7 @@
22362730 ResetModel();
22372731 refreshContents();
22382732 } else
2239
- if (event.getSource() == switchGeoItem)
2733
+ if (source == switchGeoItem)
22402734 {
22412735 for (int i=0; i<group.selection.size(); i++)
22422736 {
....@@ -2248,7 +2742,7 @@
22482742 ResetModel();
22492743 refreshContents();
22502744 } else
2251
- if (event.getSource() == switchTransfoItem)
2745
+ if (source == switchTransfoItem)
22522746 {
22532747 for (int i=0; i<group.selection.size(); i++)
22542748 {
....@@ -2260,7 +2754,7 @@
22602754 ResetModel();
22612755 refreshContents();
22622756 } else
2263
- if (event.getSource() == morphItem)
2757
+ if (source == morphItem)
22642758 {
22652759 for (int i=0; i<group.selection.size(); i++)
22662760 {
....@@ -2272,7 +2766,7 @@
22722766 ResetModel();
22732767 refreshContents();
22742768 } else
2275
- if (event.getSource() == scriptNodeItem)
2769
+ if (source == scriptNodeItem)
22762770 {
22772771 boolean atleastone = false;
22782772
....@@ -2311,215 +2805,252 @@
23112805 }
23122806 }
23132807 } else
2314
- if (event.getSource() == linkerItem)
2808
+ if (source == linkerItem)
23152809 {
23162810 group(new cLinker());
23172811 } else
2318
- if (event.getSource() == textureItem)
2812
+ if (source == textureItem || source == textureButton)
23192813 {
23202814 group(new TextureNode());
23212815 } else
2322
- if (event.getSource() == billboardItem)
2816
+ if (source == billboardItem)
23232817 {
23242818 group(new BillboardNode());
23252819 } else
2326
- if (event.getSource() == shadowXItem)
2820
+ if (source == shadowXItem)
23272821 {
23282822 CastShadow(0);
23292823 } else
2330
- if (event.getSource() == shadowYItem)
2824
+ if (source == shadowYItem)
23312825 {
23322826 CastShadow(1);
23332827 } else
2334
- if (event.getSource() == shadowZItem)
2828
+ if (source == shadowZItem)
23352829 {
23362830 CastShadow(2);
23372831 } else
2338
- if (event.getSource() == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
23392833 {
2340
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
23412836 for (int i=0; i<group.selection.size(); i++)
23422837 {
2343
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
23442843 }
23452844
2346
- ClearSelection(false);
2347
-
2348
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
23492856 } else
2350
- if (event.getSource() == genUVItem)
2857
+ if (source == genUVItem)
23512858 {
23522859 GenUV();
23532860 } else
2354
- if (event.getSource() == genNormalsCADItem)
2861
+ if (source == genNormalsCADItem)
23552862 {
23562863 GenNormals(true);
23572864 } else
2358
- if (event.getSource() == genNormalsMESHItem)
2865
+ if (source == genNormalsMESHItem)
23592866 {
2360
- GenNormals(true); // TODO
2867
+ GenNormalsMESH();
23612868 } else
2362
- if (event.getSource() == genNormalsORGANItem)
2869
+ if (source == genNormalsORGANItem)
23632870 {
23642871 GenNormals(false);
23652872 } else
2366
- if (event.getSource() == genNormalsMINEItem)
2873
+ if (source == genNormalsMINEItem)
23672874 {
23682875 GenNormalsMINE();
23692876 } else
2370
- if (event.getSource() == stripifyItem)
2877
+ if (source == stripifyItem)
23712878 {
23722879 Stripify();
23732880 } else
2374
- if (event.getSource() == unstripifyItem)
2881
+ if (source == unstripifyItem)
23752882 {
23762883 Unstripify();
23772884 } else
2378
- if (event.getSource() == trimItem)
2885
+ if (source == trimItem)
23792886 {
23802887 Trim();
23812888 } else
2382
- if (event.getSource() == untrimItem)
2889
+ if (source == untrimItem)
23832890 {
23842891 Untrim();
23852892 } else
2386
- if (event.getSource() == clearColorsItem)
2893
+ if (source == clearColorsItem)
23872894 {
23882895 ClearColors();
23892896 } else
2390
- if (event.getSource() == clearMaterialsItem)
2897
+ if (source == clearMaterialsItem)
23912898 {
23922899 ClearMaterials();
23932900 } else
2394
- if (event.getSource() == liveleavesItem)
2901
+ if (source == liveleavesItem)
23952902 {
23962903 LiveLeaves(true);
23972904 } else
2398
- if (event.getSource() == unliveleavesItem)
2905
+ if (source == unliveleavesItem)
23992906 {
24002907 LiveLeaves(false);
24012908 } else
2402
- if (event.getSource() == supportleavesItem)
2909
+ if (source == supportleavesItem)
24032910 {
24042911 SupportLeaves(true);
24052912 } else
2406
- if (event.getSource() == unsupportleavesItem)
2913
+ if (source == unsupportleavesItem)
24072914 {
24082915 SupportLeaves(false);
24092916 } else
2410
- if (event.getSource() == hideleavesItem)
2917
+ if (source == hideleavesItem)
24112918 {
24122919 HideLeaves(true);
24132920 } else
2414
- if (event.getSource() == showleavesItem)
2921
+ if (source == showleavesItem)
24152922 {
24162923 HideLeaves(false);
24172924 } else
2418
- if (event.getSource() == markleavesItem)
2925
+ if (source == markleavesItem)
24192926 {
24202927 MarkLeaves(true);
24212928 } else
2422
- if (event.getSource() == unmarkleavesItem)
2929
+ if (source == unmarkleavesItem)
24232930 {
24242931 MarkLeaves(false);
24252932 } else
2426
- if (event.getSource() == flipVItem)
2933
+ if (source == rewindleavesItem)
2934
+ {
2935
+ RewindLeaves(true);
2936
+ } else
2937
+ if (source == unrewindleavesItem)
2938
+ {
2939
+ RewindLeaves(false);
2940
+ } else
2941
+ if (source == randomleavesItem)
2942
+ {
2943
+ RandomLeaves(true);
2944
+ } else
2945
+ if (source == unrandomleavesItem)
2946
+ {
2947
+ RandomLeaves(false);
2948
+ } else
2949
+ if (source == flipVItem)
24272950 {
24282951 FlipV(true);
24292952 } else
2430
- if (event.getSource() == unflipVItem)
2953
+ if (source == unflipVItem)
24312954 {
24322955 FlipV(false);
24332956 } else
2434
- if (event.getSource() == lowTexturesItem)
2957
+ if (source == lowTexturesItem)
24352958 {
24362959 SetTexRes(0);
24372960 } else
2438
- if (event.getSource() == normalTexturesItem)
2961
+ if (source == normalTexturesItem)
24392962 {
24402963 SetTexRes(1);
24412964 } else
2442
- if (event.getSource() == highTexturesItem)
2965
+ if (source == highTexturesItem)
24432966 {
24442967 SetTexRes(2);
24452968 } else
2446
- if (event.getSource() == veryhighTexturesItem)
2969
+ if (source == veryhighTexturesItem)
24472970 {
24482971 SetTexRes(3);
24492972 } else
2450
- if (event.getSource() == maxTexturesItem)
2973
+ if (source == maxTexturesItem)
24512974 {
24522975 SetTexRes(4);
24532976 } else
2454
- if (event.getSource() == panoTexturesItem)
2977
+ if (source == panoTexturesItem)
24552978 {
24562979 SetTexRes(5);
24572980 } else
2458
- if (event.getSource() == reverseNormalsItem)
2981
+ if (source == reverseNormalsItem)
24592982 {
24602983 ReverseNormals();
24612984 } else
2462
- if (event.getSource() == parseverticesItem)
2985
+ if (source == parseverticesItem)
24632986 {
24642987 ParseVertices();
24652988 } else
2466
- if (event.getSource() == textureFieldItem)
2989
+ if (source == textureFieldItem)
24672990 {
24682991 TextureVertices();
24692992 } else
2470
- if (event.getSource() == alignItem)
2993
+ if (source == alignItem)
24712994 {
24722995 Align();
24732996 } else
2474
- if (event.getSource() == mirrorItem)
2997
+ if (source == mirrorItem)
24752998 {
24762999 MirrorPoses();
24773000 } else
2478
- if (event.getSource() == reduceMorphItem)
3001
+ if (source == reduceMorphItem)
24793002 {
24803003 MeshReduction(false);
24813004 } else
2482
- if (event.getSource() == reduce34MorphItem)
3005
+ if (source == reduce34MorphItem)
24833006 {
24843007 MeshReduction(true);
24853008 } else
2486
- if (event.getSource() == reverseTrianglesItem)
3009
+ if (source == reverseTrianglesItem)
24873010 {
24883011 ReverseTriangles();
24893012 } else
2490
- if (event.getSource() == reduceMeshItem)
3013
+ if (source == reduceMeshItem)
24913014 {
24923015 ReduceMesh(false);
24933016 } else
2494
- if (event.getSource() == reduce34MeshItem)
3017
+ if (source == reduce34MeshItem)
24953018 {
24963019 ReduceMesh(true);
24973020 } else
2498
- if (event.getSource() == increaseMeshItem)
3021
+ if (source == increaseMeshItem)
24993022 {
25003023 IncreaseMesh();
25013024 } else
2502
- if (event.getSource() == clipMeshItem)
3025
+ if (source == clipMeshItem)
25033026 {
25043027 ClipMesh();
25053028 } else
2506
- if (event.getSource() == smoothMeshItem)
3029
+ if (source == smoothMeshItem)
25073030 {
25083031 SmoothMesh();
25093032 } else
2510
- if (event.getSource() == transformgeometryItem)
3033
+ if (source == transformGeometryItem)
25113034 {
25123035 TransformGeometry();
25133036 } else
2514
- if (event.getSource() == resetTransformItem)
3037
+ if (source == transformChildrenItem)
3038
+ {
3039
+ TransformChildren();
3040
+ } else
3041
+ if (source == resetTransformItem)
25153042 {
25163043 ResetTransform();
25173044 } else
2518
- if (event.getSource() == resetCentroidItem)
3045
+ if (source == resetCentroidItem)
25193046 {
2520
- ResetCentroid();
3047
+ ResetCentroid(true);
25213048 } else
2522
- if (event.getSource() == resetParentItem)
3049
+ if (source == resetCentroidXZItem)
3050
+ {
3051
+ ResetCentroid(false);
3052
+ } else
3053
+ if (source == resetParentItem)
25233054 {
25243055 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25253056 {
....@@ -2529,7 +3060,7 @@
25293060
25303061 refreshContents();
25313062 } else
2532
- if (event.getSource() == repairParentItem)
3063
+ if (source == repairParentItem)
25333064 {
25343065 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25353066 {
....@@ -2543,7 +3074,21 @@
25433074
25443075 refreshContents();
25453076 } else
2546
- if (event.getSource() == sortbysizeItem)
3077
+ if (source == repairShadowItem)
3078
+ {
3079
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3080
+ {
3081
+ Object3D obj = (Object3D)e.nextElement();
3082
+ obj.RepairShadow();
3083
+// for (int i=0; i<obj.size(); i++)
3084
+// {
3085
+// obj.get(i).parent = obj;
3086
+// }
3087
+ }
3088
+
3089
+ refreshContents();
3090
+ } else
3091
+ if (source == sortbysizeItem)
25473092 {
25483093 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25493094 {
....@@ -2555,7 +3100,7 @@
25553100 ResetModel();
25563101 refreshContents();
25573102 } else
2558
- if (event.getSource() == sortbynameItem)
3103
+ if (source == sortbynameItem)
25593104 {
25603105 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25613106 {
....@@ -2567,7 +3112,7 @@
25673112 ResetModel();
25683113 refreshContents();
25693114 } else
2570
- if (event.getSource() == attachPigmentItem)
3115
+ if (source == attachPigmentItem)
25713116 {
25723117 String texture = GetFile("Attach pigment");
25733118 Object3D obj;
....@@ -2579,7 +3124,7 @@
25793124
25803125 refreshContents();
25813126 } else
2582
- if (event.getSource() == detachPigmentItem)
3127
+ if (source == detachPigmentItem)
25833128 {
25843129 Object3D obj;
25853130 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2590,7 +3135,7 @@
25903135
25913136 refreshContents();
25923137 } else
2593
- if (event.getSource() == attachBumpItem)
3138
+ if (source == attachBumpItem)
25943139 {
25953140 String texture = GetFile("Attach bump");
25963141 Object3D obj;
....@@ -2602,18 +3147,18 @@
26023147
26033148 refreshContents();
26043149 } else
2605
- if (event.getSource() == detachBumpItem)
3150
+ if (source == detachBumpItem)
26063151 {
26073152 Object3D obj;
26083153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26093154 {
26103155 obj = (Object3D)e.nextElement();
2611
- obj.SetBumpTexture(null);
3156
+ obj.ResetBumpTexture();
26123157 }
26133158
26143159 refreshContents();
26153160 } else
2616
- if (event.getSource() == pigmentBumpItem)
3161
+ if (source == pigmentBumpItem)
26173162 {
26183163 Object3D obj;
26193164 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2624,158 +3169,237 @@
26243169
26253170 refreshContents();
26263171 } else
2627
- if (event.getSource() == flashSelectionButton)
3172
+ if (source == flashSelectionButton)
26283173 {
26293174 CameraPane.flash = true;
26303175 refreshContents();
26313176 } else
2632
- if (event.getSource() == oneButton)
3177
+ if (source == oneButton)
26333178 {
26343179 } else
2635
- if (event.getSource() == twoButton)
3180
+ if (source == twoButton)
26363181 {
26373182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
26383187 // bug
26393188 //gridPanel.setDividerLocation(1.0);
26403189 //bigPanel.setDividerLocation(0.0);
2641
- bigThree.remove(scenePanel);
2642
- bigThree.remove(cameraPanel);
2643
- bigThree.remove(XYZPanel);
2644
- aWindowConstraints.gridx = 0;
2645
- aWindowConstraints.gridy = 0;
2646
- aWindowConstraints.gridwidth = 1;
2647
- // aConstraints.gridheight = 3;
2648
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2649
- aWindowConstraints.weightx = 0;
2650
- aWindowConstraints.weighty = 1;
2651
- //bigThree.add(jtp, aWindowConstraints);
2652
- aWindowConstraints.weightx = 1;
2653
- aWindowConstraints.gridwidth = 3;
2654
- // aConstraints.gridheight = 3;
2655
- aWindowConstraints.gridx = 1;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- bigThree.add(cameraPanel, aWindowConstraints);
2658
- aWindowConstraints.weightx = 0;
2659
- aWindowConstraints.gridx = 4;
2660
- aWindowConstraints.gridwidth = 1;
2661
- // aConstraints.gridheight = 3;
2662
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2663
- //bigThree.add(XYZPanel, aWindowConstraints);
2664
- bigThree.revalidate();
3190
+// bigThree.remove(scenePanel);
3191
+// bigThree.remove(centralPanel);
3192
+// bigThree.remove(XYZPanel);
3193
+// aWindowConstraints.gridx = 0;
3194
+// aWindowConstraints.gridy = 0;
3195
+// aWindowConstraints.gridwidth = 1;
3196
+// // aConstraints.gridheight = 3;
3197
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3198
+// aWindowConstraints.weightx = 0;
3199
+// aWindowConstraints.weighty = 1;
3200
+// //bigThree.add(jtp, aWindowConstraints);
3201
+// aWindowConstraints.weightx = 1;
3202
+// aWindowConstraints.gridwidth = 3;
3203
+// // aConstraints.gridheight = 3;
3204
+// aWindowConstraints.gridx = 1;
3205
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3206
+// bigThree.add(centralPanel, aWindowConstraints);
3207
+// aWindowConstraints.weightx = 0;
3208
+// aWindowConstraints.gridx = 4;
3209
+// aWindowConstraints.gridwidth = 1;
3210
+// // aConstraints.gridheight = 3;
3211
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3212
+// //bigThree.add(XYZPanel, aWindowConstraints);
3213
+// scenePanel.setVisible(false);
3214
+// centralPanel.setVisible(true);
3215
+// XYZPanel.setVisible(false);
3216
+ bigThree.ClearUI();
3217
+ bigThree.add(centralPanel);
3218
+ bigThree.FlushUI();
3219
+
3220
+ cameraView.requestFocusInWindow();
3221
+
3222
+// refreshContents(true);
3223
+//
3224
+// try
3225
+// {
3226
+// java.awt.Robot bot = new java.awt.Robot();
3227
+// int mask = InputEvent.BUTTON1_MASK;
3228
+// bot.mouseMove(100, 100);
3229
+// bot.mousePress(mask);
3230
+// bot.mouseRelease(mask);
3231
+// }
3232
+// catch (Exception e)
3233
+// {
3234
+//
3235
+// }
3236
+
26653237 } else
2666
- if (event.getSource() == threeButton)
3238
+ if (source == threeButton)
26673239 {
26683240 radio.layout = threeButton;
2669
- bigThree.remove(scenePanel);
2670
- bigThree.remove(cameraPanel);
2671
- bigThree.remove(XYZPanel);
2672
- aWindowConstraints.gridx = 0;
2673
- aWindowConstraints.gridy = 0;
2674
- aWindowConstraints.gridwidth = 1;
2675
- // aConstraints.gridheight = 3;
2676
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2677
- aWindowConstraints.weightx = 0;
2678
- aWindowConstraints.weighty = 1;
2679
- //bigThree.add(jtp, aWindowConstraints);
2680
- aWindowConstraints.weightx = 1;
2681
- aWindowConstraints.gridwidth = 3;
2682
- // aConstraints.gridheight = 3;
2683
- aWindowConstraints.gridx = 1;
2684
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2685
- bigThree.add(cameraPanel, aWindowConstraints);
2686
- aWindowConstraints.weightx = 0;
2687
- aWindowConstraints.gridx = 4;
2688
- aWindowConstraints.gridwidth = 1;
2689
- // aConstraints.gridheight = 3;
2690
- aConstraints.fill = GridBagConstraints.VERTICAL;
2691
- bigThree.add(XYZPanel, aWindowConstraints);
2692
- bigThree.revalidate();
3241
+
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
3245
+// bigThree.remove(scenePanel);
3246
+// bigThree.remove(centralPanel);
3247
+// bigThree.remove(XYZPanel);
3248
+// aWindowConstraints.gridx = 0;
3249
+// aWindowConstraints.gridy = 0;
3250
+// aWindowConstraints.gridwidth = 1;
3251
+// // aConstraints.gridheight = 3;
3252
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3253
+// aWindowConstraints.weightx = 0;
3254
+// aWindowConstraints.weighty = 1;
3255
+// //bigThree.add(jtp, aWindowConstraints);
3256
+// aWindowConstraints.weightx = 1;
3257
+// aWindowConstraints.gridwidth = 3;
3258
+// // aConstraints.gridheight = 3;
3259
+// aWindowConstraints.gridx = 1;
3260
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3261
+// bigThree.add(centralPanel, aWindowConstraints);
3262
+// aWindowConstraints.weightx = 0;
3263
+// aWindowConstraints.gridx = 4;
3264
+// aWindowConstraints.gridwidth = 1;
3265
+// // aConstraints.gridheight = 3;
3266
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3267
+// bigThree.add(XYZPanel, aWindowConstraints);
3268
+// bigThree.validate();
3269
+// scenePanel.setVisible(false);
3270
+// centralPanel.setVisible(true);
3271
+// XYZPanel.setVisible(true);
3272
+ bigThree.ClearUI();
3273
+ bigThree.add(centralPanel);
3274
+ bigThree.add(XYZPanel);
3275
+ bigThree.FlushUI();
3276
+
3277
+ cameraView.requestFocusInWindow();
26933278 } else
2694
- if (event.getSource() == fourButton)
3279
+ if (source == fourButton)
26953280 {
26963281 radio.layout = fourButton;
2697
- bigThree.remove(scenePanel);
2698
- bigThree.remove(cameraPanel);
2699
- bigThree.remove(XYZPanel);
2700
- aWindowConstraints.gridx = 0;
2701
- aWindowConstraints.gridy = 0;
2702
- aWindowConstraints.gridwidth = 1;
2703
- // aWindowConstraints.gridheight = 3;
2704
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2705
- aWindowConstraints.weightx = 1;
2706
- aWindowConstraints.weighty = 1;
2707
- bigThree.add(scenePanel, aWindowConstraints);
2708
- aWindowConstraints.weightx = 1;
2709
- aWindowConstraints.gridwidth = 3;
2710
- // aConstraints.gridheight = 3;
2711
- aWindowConstraints.gridx = 1;
2712
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2713
- //bigThree.add(cameraPanel, aWindowConstraints);
2714
- aWindowConstraints.weightx = 0;
2715
- aWindowConstraints.gridx = 4;
2716
- aWindowConstraints.gridwidth = 1;
2717
- // aWindowConstraints.gridheight = 3;
2718
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2719
- //bigThree.add(XYZPanel, aWindowConstraints);
2720
- bigThree.revalidate();
3282
+
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
3286
+// bigThree.remove(scenePanel);
3287
+// bigThree.remove(centralPanel);
3288
+// bigThree.remove(XYZPanel);
3289
+// aWindowConstraints.gridx = 0;
3290
+// aWindowConstraints.gridy = 0;
3291
+// aWindowConstraints.gridwidth = 1;
3292
+// // aWindowConstraints.gridheight = 3;
3293
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3294
+// aWindowConstraints.weightx = 1;
3295
+// aWindowConstraints.weighty = 1;
3296
+// bigThree.add(scenePanel, aWindowConstraints);
3297
+// aWindowConstraints.weightx = 1;
3298
+// aWindowConstraints.gridwidth = 3;
3299
+// // aConstraints.gridheight = 3;
3300
+// aWindowConstraints.gridx = 1;
3301
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3302
+// //bigThree.add(cameraPanel, aWindowConstraints);
3303
+// aWindowConstraints.weightx = 0;
3304
+// aWindowConstraints.gridx = 4;
3305
+// aWindowConstraints.gridwidth = 1;
3306
+// // aWindowConstraints.gridheight = 3;
3307
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3308
+// //bigThree.add(XYZPanel, aWindowConstraints);
3309
+// bigThree.validate();
3310
+// scenePanel.setVisible(true);
3311
+// centralPanel.setVisible(false);
3312
+// XYZPanel.setVisible(false);
3313
+ bigThree.ClearUI();
3314
+ bigThree.add(scenePanel);
3315
+ bigThree.FlushUI();
3316
+
3317
+ cameraView.requestFocusInWindow();
27213318 } else
2722
- if (event.getSource() == sixButton)
3319
+ if (source == sixButton)
27233320 {
27243321 radio.layout = sixButton;
2725
- bigThree.remove(scenePanel);
2726
- bigThree.remove(cameraPanel);
2727
- bigThree.remove(XYZPanel);
2728
- aWindowConstraints.gridx = 0;
2729
- aWindowConstraints.gridy = 0;
2730
- aWindowConstraints.gridwidth = 1;
2731
- // aConstraints.gridheight = 3;
2732
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2733
- aWindowConstraints.weightx = 0;
2734
- aWindowConstraints.weighty = 1;
2735
- bigThree.add(scenePanel, aWindowConstraints);
2736
- aWindowConstraints.weightx = 1;
2737
- aWindowConstraints.gridwidth = 3;
2738
- // aWindowConstraints.gridheight = 3;
2739
- aWindowConstraints.gridx = 1;
2740
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2741
- bigThree.add(cameraPanel, aWindowConstraints);
2742
- aWindowConstraints.weightx = 0;
2743
- aWindowConstraints.gridx = 4;
2744
- aWindowConstraints.gridwidth = 1;
2745
- // aWindowConstraints.gridheight = 3;
2746
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2747
- //bigThree.add(XYZPanel, aConstraints);
2748
- bigThree.revalidate();
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
3325
+
3326
+// bigThree.remove(scenePanel);
3327
+// bigThree.remove(centralPanel);
3328
+// bigThree.remove(XYZPanel);
3329
+// aWindowConstraints.gridx = 0;
3330
+// aWindowConstraints.gridy = 0;
3331
+// aWindowConstraints.gridwidth = 1;
3332
+// // aConstraints.gridheight = 3;
3333
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3334
+// aWindowConstraints.weightx = 0;
3335
+// aWindowConstraints.weighty = 1;
3336
+// bigThree.add(scenePanel, aWindowConstraints);
3337
+// aWindowConstraints.weightx = 1;
3338
+// aWindowConstraints.gridwidth = 3;
3339
+// // aWindowConstraints.gridheight = 3;
3340
+// aWindowConstraints.gridx = 1;
3341
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3342
+// bigThree.add(centralPanel, aWindowConstraints);
3343
+// aWindowConstraints.weightx = 0;
3344
+// aWindowConstraints.gridx = 4;
3345
+// aWindowConstraints.gridwidth = 1;
3346
+// // aWindowConstraints.gridheight = 3;
3347
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3348
+// //bigThree.add(XYZPanel, aConstraints);
3349
+// bigThree.validate();
3350
+// scenePanel.setVisible(true);
3351
+// centralPanel.setVisible(true);
3352
+// XYZPanel.setVisible(false);
3353
+ bigThree.ClearUI();
3354
+ bigThree.add(scenePanel);
3355
+ bigThree.add(centralPanel);
3356
+ bigThree.FlushUI();
3357
+
3358
+ cameraView.requestFocusInWindow();
27493359 } else
2750
- if (event.getSource() == sevenButton)
3360
+ if (source == sevenButton)
27513361 {
27523362 radio.layout = sevenButton;
2753
- bigThree.remove(scenePanel);
2754
- bigThree.remove(cameraPanel);
2755
- bigThree.remove(XYZPanel);
2756
- aWindowConstraints.gridx = 0;
2757
- aWindowConstraints.gridy = 0;
2758
- aWindowConstraints.gridwidth = 1;
2759
- // aWindowConstraints.gridheight = 3;
2760
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2761
- aWindowConstraints.weightx = 0;
2762
- aWindowConstraints.weighty = 1;
2763
- bigThree.add(scenePanel, aWindowConstraints);
2764
- aWindowConstraints.weightx = 1;
2765
- aWindowConstraints.gridwidth = 3;
2766
- // aWindowConstraints.gridheight = 3;
2767
- aWindowConstraints.gridx = 1;
2768
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2769
- bigThree.add(cameraPanel, aWindowConstraints);
2770
- aWindowConstraints.weightx = 0;
2771
- aWindowConstraints.gridx = 4;
2772
- aWindowConstraints.gridwidth = 1;
2773
- // aConstraints.gridheight = 3;
2774
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2775
- bigThree.add(XYZPanel, aWindowConstraints);
2776
- bigThree.revalidate();
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
3366
+
3367
+// bigThree.remove(scenePanel);
3368
+// bigThree.remove(centralPanel);
3369
+// bigThree.remove(XYZPanel);
3370
+// aWindowConstraints.gridx = 0;
3371
+// aWindowConstraints.gridy = 0;
3372
+// aWindowConstraints.gridwidth = 1;
3373
+// // aWindowConstraints.gridheight = 3;
3374
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3375
+// aWindowConstraints.weightx = 0;
3376
+// aWindowConstraints.weighty = 1;
3377
+// bigThree.add(scenePanel, aWindowConstraints);
3378
+// aWindowConstraints.weightx = 1;
3379
+// aWindowConstraints.gridwidth = 3;
3380
+// // aWindowConstraints.gridheight = 3;
3381
+// aWindowConstraints.gridx = 1;
3382
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3383
+// bigThree.add(centralPanel, aWindowConstraints);
3384
+// aWindowConstraints.weightx = 0;
3385
+// aWindowConstraints.gridx = 4;
3386
+// aWindowConstraints.gridwidth = 1;
3387
+// // aConstraints.gridheight = 3;
3388
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3389
+// bigThree.add(XYZPanel, aWindowConstraints);
3390
+// bigThree.validate();
3391
+// scenePanel.setVisible(true);
3392
+// centralPanel.setVisible(true);
3393
+// XYZPanel.setVisible(true);
3394
+ bigThree.ClearUI();
3395
+ bigThree.add(scenePanel);
3396
+ bigThree.add(centralPanel);
3397
+ bigThree.add(XYZPanel);
3398
+ bigThree.FlushUI();
3399
+
3400
+ cameraView.requestFocusInWindow();
27773401 } else
2778
- if (event.getSource() == rootButton)
3402
+ if (source == rootButton)
27793403 {
27803404 Object3D obj;
27813405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2785,66 +3409,84 @@
27853409 EditObject(obj);
27863410 }
27873411
3412
+ cameraView.requestFocusInWindow();
27883413 refreshContents(true);
27893414 } else
2790
- if (event.getSource() == closeButton)
3415
+ if (source == closeButton)
27913416 {
27923417 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27933418 cRadio ab;
27943419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27953420 {
27963421 ab = (cRadio)e.nextElement();
2797
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27983423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
27993430 buttonGroup.remove(ab);
28003431 radioPanel.remove(ab);
28013432
2802
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
28033435 // ab.GetObject().objectUI = null; // ?????????
28043436
28053437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28063438 break;
28073439 }
28083440 }
3441
+
3442
+ cameraView.requestFocusInWindow();
28093443 refreshContents(true);
28103444 } else
2811
- if (event.getSource() == editItem || event.getSource() == editButton)
3445
+ if (source == editItem || source == editButton)
28123446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
28133453 EditSelection(false);
28143454 } else
2815
- if (event.getSource() == uneditButton)
3455
+ if (source == uneditButton)
28163456 {
28173457 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28183458 {
28193459 Object3D child = (Object3D)e.nextElement();
28203460 if(child.editWindow != null)
28213461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
28223463 child.CloseUI();
28233464 listUI.remove(child);
28243465
2825
- child.editWindow = null; // ???????????
3466
+ //child.editWindow = null; // ???????????
28263467 }
2827
- objEditor.ctrlPanel.revalidate();
3468
+ objEditor.ctrlPanel.FlushUI();
28283469 //objEditor.jTree.clearSelection();
28293470 //objEditor.ResetSliders();
28303471 refreshContents(true);
28313472 } else
2832
- if (event.getSource() == clearPanelButton)
3473
+ if (source == clearPanelButton)
28333474 {
28343475 assert(copy == group);
28353476 //copy.ClearUI();
28363477 for (Object3D obj : listUI)
28373478 {
3479
+ obj.pinned = false;
28383480 obj.CloseUI();
28393481 }
28403482 listUI.clear();
28413483 refreshContents(true);
28423484 } else
2843
- if (event.getSource() == allParamsButton)
3485
+ if (source == allParamsButton)
28443486 {
28453487 assert(copy == group);
28463488
2847
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28483490
28493491 for (Object3D obj : listUI)
28503492 {
....@@ -2861,19 +3503,19 @@
28613503
28623504 refreshContents(true);
28633505 } else
2864
- if (event.getSource() == unselectButton)
3506
+ if (source == unselectButton)
28653507 {
28663508 objEditor.jTree.clearSelection();
28673509 // ?? oct 2012 GrafreeD.clipboard.clear();
28683510 objEditor.ResetSliders();
28693511 refreshContents(true);
28703512 } else
2871
- if(event.getSource() instanceof cRadio)
3513
+ if(source instanceof cRadio)
28723514 {
28733515 group.parent = keepparent;
28743516 group.attributes = 0;
28753517 //group.editWindow = null;
2876
- /*cRadio*/ radio = (cRadio)event.getSource();
3518
+ /*cRadio*/ radio = (cRadio)source;
28773519 Object3D obj = radio.GetObject();
28783520 System.out.println("Edit " + obj);
28793521 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2893,7 +3535,10 @@
28933535 }
28943536
28953537 copy = group;
2896
- //CameraPane.theRenderer.object = group;
3538
+
3539
+ SetUndoStates();
3540
+
3541
+ //Globals.theRenderer.object = group;
28973542 if(!useclient)
28983543 {
28993544 cameraView.renderCamera = radio.camera;
....@@ -2902,25 +3547,52 @@
29023547 cameraView.cameras[cameraView.cameracount] = radio.camera;
29033548 cameraView.targetLookAt.set(radio.camera.lookAt);
29043549 cameraView.object = group;
2905
- cameraView.lighttouched = true;
3550
+ //cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
29063552 topView.object = group;
29073553 frontView.object = group;
29083554 sideView.object = group;
29093555 }
2910
- group.editWindow = this;
3556
+
3557
+// fix "+" issue
3558
+ //group.editWindow = this;
3559
+ group.manipWindow = this;
3560
+
29113561 /*
29123562 currentLayout = radio.layout;
29133563 if (currentLayout == null)
29143564 currentLayout = sevenButton;
29153565 */
29163566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
29173574 keepparent = group.parent;
29183575 // PARENT = NULL or not???
29193576 //group.parent = null; // ROOT
29203577 //group.attributes = -1;
29213578 ResetModel();
3579
+
3580
+ cameraView.requestFocusInWindow();
29223581 refreshContents(true);
2923
- }
3582
+ } else if (event.getSource() == editCameraItem)
3583
+ {
3584
+ cameraView.ProtectCamera();
3585
+ cameraView.repaint();
3586
+ return;
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3588
+ {
3589
+ cameraView.RevertCamera();
3590
+ cameraView.repaint();
3591
+ return;
3592
+ // } else if (event.getSource() == textureButton)
3593
+ // {
3594
+ // return; // true;
3595
+ }
29243596 else
29253597 {
29263598 //return super.action(event, arg);
....@@ -2929,7 +3601,6 @@
29293601 }
29303602
29313603 boolean useclient = false;
2932
- cRadio radio;
29333604
29343605 void ToggleRoot()
29353606 {
....@@ -2938,7 +3609,7 @@
29383609 if (useclient)
29393610 {
29403611 cameraView.object = client;
2941
- cameraView.lighttouched = true;
3612
+ Globals.lighttouched = true;
29423613 //topView.object = client;
29433614 //frontView.object = client;
29443615 //sideView.object = client;
....@@ -2946,7 +3617,7 @@
29463617 else
29473618 {
29483619 cameraView.object = group;
2949
- cameraView.lighttouched = true;
3620
+ Globals.lighttouched = true;
29503621 //topView.object = group;
29513622 //frontView.object = group;
29523623 //sideView.object = group;
....@@ -2981,6 +3652,28 @@
29813652 refreshContents();
29823653 }
29833654
3655
+ void TransformChildren()
3656
+ {
3657
+ Object3D obj;
3658
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3659
+ {
3660
+ obj = (Object3D)e.nextElement();
3661
+ obj.KeepTextureMatrices();
3662
+ obj.TransformChildren();
3663
+ obj.RestoreTextureMatrices();
3664
+
3665
+// if (obj.parent == null)
3666
+// {
3667
+// System.out.println("NULL PARENT!");
3668
+// new Exception().printStackTrace();
3669
+// }
3670
+// else
3671
+// TouchTransform(obj);
3672
+// //obj.parent.Touch();
3673
+ }
3674
+
3675
+ refreshContents();
3676
+ }
29843677
29853678 void ResetTransform()
29863679 {
....@@ -3093,7 +3786,7 @@
30933786 refreshContents();
30943787 }
30953788
3096
- void ResetCentroid()
3789
+ void ResetCentroid(boolean full)
30973790 {
30983791 Object3D obj;
30993792 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3108,12 +3801,16 @@
31083801 LA.matIdentity(Object3D.mat);
31093802 obj.getBounds(minima, maxima, false);
31103803 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3111
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3804
+ if (full)
3805
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31123806 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31133807 obj.TransformMesh(Object3D.mat);
3808
+
31143809 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3115
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3810
+ if (full)
3811
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31163812 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3813
+
31173814 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31183815 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31193816 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3142,7 +3839,8 @@
31423839
31433840 int size = obj.MemorySize();
31443841
3145
- System.err.println((size/1024) + " KB is the size of " + obj);
3842
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3843
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31463844 }
31473845 }
31483846 catch (Exception e)
....@@ -3179,9 +3877,9 @@
31793877 obj = (Object3D)e.nextElement();
31803878
31813879 System.out.println("Object is: " + obj);
3182
- GrafreeD.AnalyzeObject(obj);
3880
+ Grafreed.AnalyzeObject(obj);
31833881 System.out.println("Boundary rep: " + obj.bRep);
3184
- GrafreeD.AnalyzeObject(obj.bRep);
3882
+ Grafreed.AnalyzeObject(obj.bRep);
31853883
31863884 // System.err.println((size/1024) + " KB is the size of " + obj);
31873885 }
....@@ -3223,6 +3921,13 @@
32233921 void GenNormals(boolean crease)
32243922 {
32253923 group.GenNormalsS(crease);
3924
+
3925
+ refreshContents();
3926
+ }
3927
+
3928
+ void GenNormalsMESH()
3929
+ {
3930
+ group.GenNormalsMeshS();
32263931
32273932 refreshContents();
32283933 }
....@@ -3395,8 +4100,8 @@
33954100
33964101 void ParseVertices()
33974102 {
3398
- boolean epsequal = GrafreeD.epsequal;
3399
- GrafreeD.epsequal = true;
4103
+ boolean epsequal = Grafreed.epsequal;
4104
+ Grafreed.epsequal = true;
34004105
34014106 for (int i=0; i<group.selection.size(); i++)
34024107 {
....@@ -3421,7 +4126,7 @@
34214126 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34224127 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34234128
3424
- g.add(GrafreeD.clipboard);
4129
+ g.add(Grafreed.clipboard);
34254130
34264131 buffer.add(g);
34274132 }
....@@ -3436,7 +4141,7 @@
34364141 makeSomething(buffer, i==group.selection.size()-1);
34374142 }
34384143
3439
- GrafreeD.epsequal = epsequal;
4144
+ Grafreed.epsequal = epsequal;
34404145
34414146 refreshContents();
34424147 }
....@@ -3454,7 +4159,16 @@
34544159 String pigment = Object3D.GetPigment(tex);
34554160 //String bump = Object3D.GetBump(tex);
34564161
3457
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4162
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4163
+
4164
+ try
4165
+ {
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
4167
+ }
4168
+ catch (Exception e)
4169
+ {
4170
+ System.err.println("FAIL: " + node);
4171
+ }
34584172
34594173 double s = v.s;
34604174
....@@ -3542,11 +4256,11 @@
35424256
35434257 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35444258
3545
- boolean random = CameraPane.RANDOM;
3546
- CameraPane.RANDOM = false; // parse all random nodes
4259
+ boolean random = CameraPane.SWITCH;
4260
+ CameraPane.SWITCH = false; // parse all random nodes
35474261 lowres.linkVerticesThis(null);
35484262 lowres.linkVerticesThis(sn);
3549
- CameraPane.RANDOM = random;
4263
+ CameraPane.SWITCH = random;
35504264
35514265 System.err.flush();
35524266
....@@ -3586,7 +4300,7 @@
35864300 return;
35874301
35884302 Object3D poses = group.selection.get(0);
3589
- Object3D ref = GrafreeD.clipboard.get(0);
4303
+ Object3D ref = Grafreed.clipboard.get(0);
35904304
35914305 Object3D newgroup = new Object3D("Po:" + poses.name);
35924306
....@@ -3755,7 +4469,7 @@
37554469 group.selection.RelinkToSupport(); // july 2014
37564470 System.out.println("DONE.");
37574471 refreshContents();
3758
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4472
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37594473 }
37604474
37614475 void ReduceMesh(boolean reduction34)
....@@ -3780,9 +4494,9 @@
37804494
37814495 void ClipMesh()
37824496 {
3783
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4497
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37844498 {
3785
- Object3D content = GrafreeD.clipboard.get(0);
4499
+ Object3D content = Grafreed.clipboard.get(0);
37864500
37874501 if (content instanceof cGroup && ((cGroup)content).transientlink )
37884502 content = ((cGroup)content).get(0);
....@@ -3791,7 +4505,7 @@
37914505 // {
37924506 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37934507 // }
3794
- group.selection.ClipMesh(GrafreeD.clipboard);
4508
+ group.selection.ClipMesh(Grafreed.clipboard);
37954509 }
37964510 // group.selection.ClipMesh(GrafreeD.clipboard);
37974511 System.out.println("DONE.");
....@@ -3838,6 +4552,18 @@
38384552 void MarkLeaves(boolean hide)
38394553 {
38404554 group.selection.MarkLeaves(hide);
4555
+ refreshContents();
4556
+ }
4557
+
4558
+ void RewindLeaves(boolean hide)
4559
+ {
4560
+ group.selection.RewindLeaves(hide);
4561
+ refreshContents();
4562
+ }
4563
+
4564
+ void RandomLeaves(boolean hide)
4565
+ {
4566
+ group.selection.RandomLeaves(hide);
38414567 refreshContents();
38424568 }
38434569
....@@ -3912,28 +4638,25 @@
39124638 // }
39134639 // }
39144640
3915
- static boolean allparams = true;
3916
-
3917
- static Vector<Object3D> listUI = new Vector<Object3D>();
3918
-
39194641 void EditSelection(boolean newWindow)
39204642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
39214649 // aConstraints.gridy = 0;
39224650 for (int i=0; i<group.selection.size(); i++)
39234651 {
39244652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39254653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3926
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39274655
39284656 Object3D elem = (Object3D)group.selection.elementAt(i);
3929
- if(elem != group)
4657
+ if(elem != group || !newWindow)
39304658 {
3931
- // if (!(elem instanceof Composite))
3932
- // newWindow = false;
3933
- listUI.add(elem);
3934
- elem.openEditWindow(this, newWindow); //, false);
3935
- System.out.println("edit : " + elem);
3936
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
39374660 }
39384661 }
39394662 }
....@@ -4008,7 +4731,8 @@
40084731 //new Exception().printStackTrace();
40094732
40104733 freezemodel = true;
4011
-
4734
+ ClearUnpinned();
4735
+
40124736 /**/
40134737 //switch (event.id)
40144738 {
....@@ -4016,7 +4740,6 @@
40164740 //case 702: // Event.LIST_DESELECT
40174741 group.deselectAll();
40184742 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4019
- objEditor.ClearInfo(); // .GetMaterial());
40204743 if (tps != null)
40214744 {
40224745 for (int i=0; i < tps.length; i++)
....@@ -4025,33 +4748,39 @@
40254748
40264749 //if (child.parent != null)
40274750 //child.parent.addSelectee(child);
4751
+ objEditor.SetMaterial(child);
40284752 group.addSelectee(child);
4029
- objEditor.SetMaterial(child); // .GetMaterial());
4030
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4031
- System.err.println("info : " + child.GetPath());
40324753 }
40334754 }
4034
- else
4035
- {
4036
- objEditor.SetMaterial(group); // .GetMaterial());
4037
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4038
- System.err.println("info : " + group.GetPath());
4039
- }
4755
+// else
4756
+// {
4757
+// objEditor.SetMaterial(group); // .GetMaterial());
4758
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4759
+// System.err.println("info : " + group.GetPath());
4760
+// }
40404761
4041
- objEditor.SetText(); // jan 2014
4042
-
4043
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4762
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40444763 CameraPane.flash = true;
40454764
4046
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4765
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40474766 // a camera
40484767 {
4049
- CameraPane.camerachangeframe = 0; // don't refuse it
4050
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4051
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4052
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4769
+ {
4770
+ CameraPane.camerachangeframe = 0; // don't refuse it
4771
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4772
+ }
4773
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4774
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40534775 }
40544776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
40554784 refreshContents();
40564785 //return true;
40574786 }
....@@ -4060,6 +4789,35 @@
40604789
40614790 freezemodel = false;
40624791 }
4792
+
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
4801
+ void refreshContents(boolean cp)
4802
+ {
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4805
+ {
4806
+ objEditor.ClearInfo(); // .GetMaterial());
4807
+
4808
+ for (int i=0; i < group.selection.Size(); i++)
4809
+ {
4810
+ Object3D child = (Object3D) group.selection.get(i);
4811
+
4812
+ objEditor.AddInfo(child, this, true);
4813
+ System.err.println("info : " + child.GetPath());
4814
+ }
4815
+
4816
+ objEditor.SetText(); // jan 2014
4817
+ }
4818
+
4819
+ super.refreshContents(cp);
4820
+ }
40634821
40644822 void linkSomething(Object3D thing)
40654823 {
....@@ -4131,16 +4889,19 @@
41314889 {
41324890 if (group.selection.isEmpty())
41334891 return;
4134
- GrafreeD.clipboardIsTempGroup = false;
4892
+
4893
+ Grafreed.clipboardIsTempGroup = false;
41354894 Composite tGroup = null;
41364895 if (group.selection.size() > 0) // 1)
41374896 {
41384897 tGroup = new cGroup();
4139
- GrafreeD.clipboardIsTempGroup = true;
4898
+ Grafreed.clipboardIsTempGroup = true;
41404899 }
41414900
41424901 if (cut)
41434902 {
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
41444905 //int indices[] = jList.getSelectedIndices();
41454906 //for (int i = indices.length - 1; i >= 0; i--)
41464907 //jList.remove(indices[i]);
....@@ -4176,16 +4937,16 @@
41764937 //System.out.println("cut " + child);
41774938 //System.out.println("parent = " + child.parent);
41784939 // tmp.addChild(child);
4179
- if (GrafreeD.clipboardIsTempGroup)
4940
+ if (Grafreed.clipboardIsTempGroup)
41804941 tGroup.add/*Child*/(tmp);
41814942 else
4182
- GrafreeD.clipboard = tmp;
4943
+ Grafreed.clipboard = tmp;
41834944 }
41844945 else
4185
- if (GrafreeD.clipboardIsTempGroup)
4946
+ if (Grafreed.clipboardIsTempGroup)
41864947 tGroup.add/*Child*/(child);
41874948 else
4188
- GrafreeD.clipboard = child;
4949
+ Grafreed.clipboard = child;
41894950 }
41904951
41914952 //ResetModel();
....@@ -4217,21 +4978,23 @@
42174978 //System.out.println("cut " + elem);
42184979 //System.out.println("parent = " + elem.parent);
42194980 // tmp.addChild(elem);
4220
- if (GrafreeD.clipboardIsTempGroup)
4981
+ if (Grafreed.clipboardIsTempGroup)
42214982 tGroup.add/*Child*/(tmp);
42224983 else
4223
- GrafreeD.clipboard = tmp;
4984
+ Grafreed.clipboard = tmp;
42244985 }
42254986 else
4226
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
42274988 tGroup.add/*Child*/(child);
42284989 else
4229
- GrafreeD.clipboard = child;
4990
+ Grafreed.clipboard = child;
42304991 }
42314992
42324993 }
4233
- if (GrafreeD.clipboardIsTempGroup)
4234
- GrafreeD.clipboard = tGroup;
4994
+
4995
+ if (Grafreed.clipboardIsTempGroup)
4996
+ Grafreed.clipboard = tGroup;
4997
+
42354998 if (cut)
42364999 {
42375000 ResetModel();
....@@ -4241,11 +5004,15 @@
42415004
42425005 void paste(boolean expand)
42435006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
42445011 // if (GrafreeD.clipboard == null)
42455012 // return;
42465013 boolean first = true;
42475014
4248
- if (GrafreeD.clipboardIsTempGroup)
5015
+ if (Grafreed.clipboardIsTempGroup)
42495016 {
42505017 Composite temp;
42515018
....@@ -4256,7 +5023,7 @@
42565023 temp = (Composite)Applet3D.clipboard.deepCopy();
42575024 */
42585025 Object3D elem;
4259
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5026
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
42605027 {
42615028 Object3D child = (Object3D)e.nextElement();
42625029
....@@ -4290,21 +5057,22 @@
42905057 //Object3D cb = Applet3D.clipboard;
42915058 //temp.addChild(cb);
42925059 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4293
- assert(GrafreeD.clipboard.parent == null);
4294
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4295
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4296
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4297
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5060
+ assert(Grafreed.clipboard.parent == null);
5061
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5062
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5063
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5064
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42985065 else
4299
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4300
- GrafreeD.clipboard.get(0).parent = keepparent;
5066
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5067
+ Grafreed.clipboard.get(0).parent = keepparent;
43015068 }
43025069
5070
+ Globals.REPLACEONMAKE = keep;
43035071 ResetModel();
43045072 refreshContents();
43055073 }
43065074
4307
- void pasteInto(boolean copyit)
5075
+ void pasteInto(boolean copyit, boolean clone)
43085076 {
43095077 // if (GrafreeD.clipboard == null)
43105078 // return;
....@@ -4333,15 +5101,22 @@
43335101 if (copyit)
43345102 {
43355103 // paste(false);
4336
- CloneClipboard(false); // sept 2014
5104
+ if (clone)
5105
+ {
5106
+ CloneClipboard(false); // sept 2014
5107
+ }
5108
+ else
5109
+ {
5110
+ paste(false);
5111
+ }
43375112 }
43385113 else
43395114 {
43405115 boolean first = true;
43415116
4342
- if (GrafreeD.clipboardIsTempGroup)
5117
+ if (Grafreed.clipboardIsTempGroup)
43435118 {
4344
- Composite temp = (Composite)GrafreeD.clipboard;
5119
+ Composite temp = (Composite)Grafreed.clipboard;
43455120 Object3D copy;
43465121 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43475122 {
....@@ -4351,7 +5126,7 @@
43515126 }
43525127 } else
43535128 {
4354
- linkSomething(GrafreeD.clipboard); //.get(0));
5129
+ linkSomething(Grafreed.clipboard); //.get(0));
43555130 }
43565131 }
43575132 }
....@@ -4428,6 +5203,10 @@
44285203
44295204 void group(Object3D csg, boolean grab)
44305205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
44315210 if (//false) // why??
44325211 !group.selection.isEmpty())
44335212 {
....@@ -4541,10 +5320,15 @@
45415320 //node.add(csg);
45425321 //makeSomething(node);
45435322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
45445324 }
45455325
45465326 void Ungroup(Object3D g)
45475327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
45485332 if (g instanceof HiddenObject)
45495333 {
45505334 HiddenObject h = (HiddenObject) g;
....@@ -4561,6 +5345,7 @@
45615345 objEditor.makeSomething(g.get(i), false);
45625346 }
45635347 }
5348
+ Globals.REPLACEONMAKE = keep;
45645349 }
45655350
45665351 void ungroup()
....@@ -4756,21 +5541,6 @@
47565541 }
47575542 */
47585543
4759
- void ImportGFD()
4760
- {
4761
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4762
- browser.show();
4763
- String filename = browser.getFile();
4764
- if (filename != null && filename.length() > 0)
4765
- {
4766
- String fullname = browser.getDirectory() + filename;
4767
-
4768
- //Object3D readobj =
4769
- objEditor.ReadGFD(fullname, objEditor);
4770
- //makeSomething(readobj);
4771
- }
4772
- }
4773
-
47745544 /*
47755545 public void Callback(Object obj)
47765546 {
....@@ -4794,26 +5564,9 @@
47945564 }
47955565 */
47965566
4797
- void ImportVRMLX3D()
4798
- {
4799
- if (GrafreeD.standAlone)
4800
- {
4801
- /**/
4802
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4803
- browser.show();
4804
- String filename = browser.getFile();
4805
- if (filename != null && filename.length() > 0)
4806
- {
4807
- String fullname = browser.getDirectory() + filename;
4808
- LoadVRMLX3D(fullname);
4809
- }
4810
- /**/
4811
- }
4812
- }
4813
-
48145567 String GetFile(String dialogName)
48155568 {
4816
- if (GrafreeD.standAlone)
5569
+ if (Grafreed.standAlone)
48175570 {
48185571 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48195572 browser.show();
....@@ -4877,10 +5630,33 @@
48775630 cButton flashSelectionButton;
48785631 cButton editButton;
48795632 cButton uneditButton;
5633
+ JCheckBox allParamsButton;
48805634 cButton clearpanelButton;
4881
- cButton allParamsButton;
48825635 cButton unselectButton;
48835636
5637
+ cButton restoreCameraButton;
5638
+
5639
+ cButton saveButton;
5640
+ cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
5659
+
48845660 cButton screenfitButton;
48855661 cButton screenfitpointButton;
48865662 cButton snapobjectButton;
....@@ -4892,14 +5668,6 @@
48925668
48935669 cButton setsupportButton;
48945670
4895
- cButton twoButton;
4896
- cButton sixButton;
4897
- cButton threeButton;
4898
- cButton sevenButton;
4899
- cButton fourButton; // full panel
4900
- cButton oneButton; // full XYZ
4901
- //cButton currentLayout;
4902
-
49035671 //
49045672 //Composite
49055673 Object3D // to do !!
....@@ -4909,9 +5677,11 @@
49095677 //JTree jTree;
49105678 private MenuItem lookAtItem;
49115679 private MenuItem lookFromItem;
4912
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
49135681 private MenuItem cutItem;
4914
- private MenuItem duplicateItem;
5682
+ private MenuItem undoItem;
5683
+ private MenuItem redoItem;
5684
+ private JMenuItem duplicateItem;
49155685 private MenuItem cloneItem;
49165686 private MenuItem cloneSupportItem;
49175687 private MenuItem overwriteGeoItem;
....@@ -4924,7 +5694,7 @@
49245694 private MenuItem linkverticesItem;
49255695 private MenuItem relinkverticesItem;
49265696 private MenuItem setMasterItem;
4927
- private MenuItem resetMeshItem;
5697
+ private MenuItem resetAllItem;
49285698 private MenuItem stepAllItem;
49295699 private MenuItem revertMeshItem;
49305700 private MenuItem poseMeshItem;
....@@ -4935,10 +5705,11 @@
49355705 private MenuItem mergeGeometriesItem;
49365706 private MenuItem copyItem;
49375707 private MenuItem pasteItem;
5708
+ private MenuItem pasteIntoItem;
49385709 private MenuItem pasteLinkItem;
49395710 private MenuItem pasteCloneItem;
49405711 private MenuItem pasteExpandItem;
4941
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
49425713 private MenuItem clearAllItem;
49435714 private MenuItem genUVItem;
49445715 private MenuItem genNormalsMESHItem;
....@@ -4973,6 +5744,10 @@
49735744 private MenuItem showleavesItem;
49745745 private MenuItem markleavesItem;
49755746 private MenuItem unmarkleavesItem;
5747
+ private MenuItem rewindleavesItem;
5748
+ private MenuItem unrewindleavesItem;
5749
+ private MenuItem randomleavesItem;
5750
+ private MenuItem unrandomleavesItem;
49765751
49775752 private MenuItem flipVItem;
49785753 private MenuItem unflipVItem;
....@@ -4984,15 +5759,17 @@
49845759 private MenuItem panoTexturesItem;
49855760
49865761 private MenuItem resetCentroidItem;
4987
- private MenuItem transformgeometryItem;
5762
+ private MenuItem resetCentroidXZItem;
49885763 private MenuItem resetTransformItem;
5764
+ private MenuItem transformGeometryItem;
5765
+ private MenuItem transformChildrenItem;
49895766 private MenuItem hideItem;
49905767 private MenuItem grabItem;
49915768 private MenuItem backItem;
49925769 private MenuItem frontItem;
49935770 private MenuItem cameraItem;
49945771 private MenuItem compositeItem;
4995
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
49965773 private MenuItem physicsItem;
49975774 private MenuItem frameselectorItem;
49985775 private MenuItem scriptNodeItem;
....@@ -5007,6 +5784,7 @@
50075784
50085785 private MenuItem resetParentItem;
50095786 private MenuItem repairParentItem;
5787
+ private MenuItem repairShadowItem;
50105788 private MenuItem sortbysizeItem;
50115789 private MenuItem sortbynameItem;
50125790
....@@ -5031,7 +5809,7 @@
50315809 private MenuItem blobItem;
50325810 private MenuItem latheItem;
50335811 private MenuItem bezierItem;
5034
- private MenuItem checkerItem;
5812
+ private MenuItem overlayItem;
50355813 private MenuItem meshItem;
50365814 // private MenuItem meshGroupItem;
50375815 private MenuItem springItem;
....@@ -5053,11 +5831,6 @@
50535831 private MenuItem doubleItem;
50545832 private MenuItem tripleItem;
50555833
5056
- private MenuItem importGFDItem;
5057
- private MenuItem importVRMLX3DItem;
5058
- private MenuItem import3DSItem;
5059
- private MenuItem importOBJItem;
5060
-
50615834 private MenuItem computeAOItem;
50625835 private MenuItem recompileItem;
50635836 private MenuItem editScriptItem;
....@@ -5067,4 +5840,8 @@
50675840 private MenuItem analyzeItem;
50685841 private MenuItem dumpItem;
50695842 //boolean freezemodel = false;
5843
+
5844
+ Menu cameraMenu;
5845
+ MenuItem editCameraItem;
5846
+ MenuItem restoreCameraItem;
50705847 }