Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
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,
....@@ -22,6 +23,31 @@
2223 DragGestureListener, DragSourceListener, DropTargetListener,
2324 ItemListener // ListSelectionListener
2425 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ skyboxButton.setToolTipText(s);
33
+ skyboxButton.addActionListener(new ActionListener()
34
+ {
35
+ @Override
36
+ public void actionPerformed(ActionEvent e)
37
+ {
38
+ ChangeSkybox(path);
39
+ }
40
+ });
41
+ }
42
+
43
+ public void ChangeSkybox(String name)
44
+ {
45
+ cameraView.envyoff = false;
46
+ cameraView.skyboxname = name;
47
+ cameraView.skyboxext = "jpg";
48
+ cameraView.repaint();
49
+ }
50
+
2551 //ObjEditor objEditor;
2652 public void closeUI2()
2753 {
....@@ -59,6 +85,12 @@
5985 this.copy = this.group = group;
6086 //selectees = this.group.selectees;
6187
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6294 if(ui)
6395 SetupUI(objEditor);
6496 }
....@@ -73,17 +105,29 @@
73105 this.copy = this.group = copy;
74106 //selectees = this.group.selectees;
75107
76
- SetupMenu2(objEditor);
108
+ SetupMenu2(this); //objEditor);
77109 SetupUI2(objEditor);
78110 objEditor.SetupUI(true);
79111 SetupViews(objEditor);
80112
81113 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114
+
115
+ if (copy.versions == null)
116
+ {
117
+ copy.versions = new byte[100][];
118
+ copy.versionindex = -1;
119
+
120
+ Save(true);
121
+ }
82122 }
83123
84124 void CloneSelection(boolean supports)
85125 {
86
- // Object3D keep = GraphreeD.clipboard;
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
130
+ // Object3D keep = GrafreeD.clipboard;
87131 //Object3D obj;
88132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89133 {
....@@ -93,18 +137,19 @@
93137
94138 makeSomething(clone, i==group.selection.size()-1);
95139 }
140
+ Globals.REPLACEONMAKE = keep;
96141 }
97142
98143 void CloneClipboard(boolean supports)
99144 {
100
- assert(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.clipboard.get(0), false));
145
+ assert(Grafreed.clipboard.parent == null);
146
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
147
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
148
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
149
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105150 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
151
+ makeSomething(CloneObject(Grafreed.clipboard, false));
152
+ Grafreed.clipboard.get(0).parent = keepparent;
108153 }
109154
110155 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +163,7 @@
118163 // obj.support = null;
119164 if (!supports)
120165 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
166
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122167 obj.parent = parent;
123168 // obj.support = support;
124169 // clone.support = support; // aout 2013
....@@ -147,30 +192,29 @@
147192
148193 //JTextField nameField;
149194
150
- void SetupMenu2(ObjEditor oe)
195
+ void SetupMenu2(GroupEditor oe)
151196 {
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);
197
+ oe.jTree = new cTree();
198
+
163199 Menu menu;
164200 oe.menuBar.add(menu = new Menu("Edit"));
165201 //editItem = menu.add(new MenuItem("Edit"));
166202 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
203
+
204
+// undoItem = menu.add(new MenuItem("Undo"));
205
+// undoItem.addActionListener(this);
206
+// redoItem = menu.add(new MenuItem("Redo"));
207
+// redoItem.addActionListener(this);
208
+// menu.add("-");
209
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168210 duplicateItem.addActionListener(this);
169
- menu.add("-");
170211 cloneItem = menu.add(new MenuItem("Clone"));
171212 cloneItem.addActionListener(this);
213
+ if (Globals.ADVANCED)
214
+ {
172215 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173216 cloneSupportItem.addActionListener(this);
217
+ }
174218 menu.add("-");
175219 cutItem = menu.add(new MenuItem("Cut"));
176220 cutItem.addActionListener(this);
....@@ -178,27 +222,123 @@
178222 copyItem.addActionListener(this);
179223 pasteItem = menu.add(new MenuItem("Paste"));
180224 pasteItem.addActionListener(this);
225
+
226
+ menu.add("-");
227
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
228
+ pasteIntoItem.addActionListener(this);
181229 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182230 pasteLinkItem.addActionListener(this);
183231 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184232 pasteCloneItem.addActionListener(this);
185233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186234 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
235
+ menu.add("-");
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
238
+
239
+ if (Globals.ADVANCED)
240
+ {
241
+ // Deletes the cameras...
189242 clearAllItem = menu.add(new MenuItem("Clear All"));
190243 clearAllItem.addActionListener(this);
244
+ }
245
+
246
+ menuBar.add(cameraMenu = new Menu("View"));
247
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
248
+ //zBufferItem.addActionListener(this);
249
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
250
+ //normalLensItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
253
+
254
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
255
+// toggleFullScreenItem.addItemListener(this);
256
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
257
+// cameraMenu.add("-");
258
+//
259
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
260
+// toggleTextureItem.addItemListener(this);
261
+// toggleTextureItem.setState(CameraPane.textureon);
262
+//
263
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
264
+// toggleSwitchItem.addItemListener(this);
265
+// toggleSwitchItem.setState(CameraPane.SWITCH);
266
+
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
268
+ toggleHandleItem.addItemListener(this);
269
+ toggleHandleItem.setState(CameraPane.HANDLES);
270
+
271
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
272
+ togglePaintItem.addItemListener(this);
273
+ togglePaintItem.setState(CameraPane.PAINTMODE);
274
+
275
+ if (Globals.ADVANCED)
276
+ {
277
+ cameraMenu.add("-");
278
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
279
+ toggleLiveItem.addItemListener(this);
280
+ toggleLiveItem.setState(Globals.isLIVE());
191281
282
+ cameraMenu.add(stepItem = new MenuItem("Step"));
283
+ stepItem.addActionListener(this);
284
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
285
+ // toggleDLItem.addItemListener(this);
286
+ // toggleDLItem.setState(false);
287
+
288
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
289
+ toggleRenderItem.addItemListener(this);
290
+ toggleRenderItem.setState(!CameraPane.frozen);
291
+
292
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
293
+ toggleDebugItem.addItemListener(this);
294
+ toggleDebugItem.setState(Globals.DEBUG);
295
+
296
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
297
+ toggleFrustumItem.addItemListener(this);
298
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
299
+
300
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
301
+ toggleFootContactItem.addItemListener(this);
302
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
303
+
304
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
305
+ toggleTimelineItem.addItemListener(this);
306
+ }
307
+
308
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
309
+// toggleRootItem.addItemListener(this);
310
+// toggleRootItem.setState(false);
311
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
312
+// animationItem.addItemListener(this);
313
+// animationItem.setState(CameraPane.ANIMATION);
314
+ cameraMenu.add("-");
315
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
316
+ editCameraItem.addActionListener(this);
317
+
318
+ if (Globals.ADVANCED)
319
+ {
320
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
321
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
323
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
324
+ oe.cameraMenu.add("-");
325
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
326
+ openWindowItem.addActionListener(this);
327
+ editLeafItem.addActionListener(this);
328
+ lookAtItem.addActionListener(this);
329
+ //lookFromItem.addActinoListener(this);
330
+ //switchViewItem.addActionListener(this);
331
+ }
332
+
192333 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);
334
+ if (Globals.ADVANCED)
335
+ {
197336 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198337 revertMeshItem.addActionListener(this);
199338 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200339 resetreferencesItem.addActionListener(this);
201340 menu.add("-");
341
+ }
202342 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203343 overwriteGeoItem.addActionListener(this);
204344 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +350,104 @@
210350 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211351 overwriteUVItem.addActionListener(this);
212352 menu.add("-");
353
+ if (Globals.ADVANCED)
354
+ {
213355 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214356 generateMeshItem.addActionListener(this);
215357 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216358 poseMeshItem.addActionListener(this);
217359 menu.add("-");
360
+ }
218361 resetsupportItem = menu.add(new MenuItem("Reset support"));
219362 resetsupportItem.addActionListener(this);
220363 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221364 linkverticesItem.addActionListener(this);
365
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
366
+ relinkverticesItem.addActionListener(this);
367
+
368
+ if (Globals.ADVANCED)
369
+ {
222370 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223371 setMasterItem.addActionListener(this);
372
+ }
224373
225374 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
228
- frontItem = menu.add(new MenuItem("Front"));
229
- frontItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
230377 backItem = menu.add(new MenuItem("Back"));
231378 backItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
379
+ frontItem = menu.add(new MenuItem("Front"));
380
+ frontItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
386
+ hideItem = menu.add(new MenuItem("Hidden Group"));
387
+ hideItem.addActionListener(this);
388
+ }
389
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
390
+ ungroupItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
241398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242399 switchGeoItem.addActionListener(this);
243400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244401 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
402
+ morphItem = menu.add(new MenuItem("Morph Group"));
246403 morphItem.addActionListener(this);
404
+
405
+ menu.add("-");
406
+ physicsItem = menu.add(new MenuItem("Physics"));
407
+ physicsItem.addActionListener(this);
408
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
409
+ frameselectorItem.addActionListener(this);
247410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248411 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
412
+ }
251413
252414 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
417
+ billboardItem = menu.add(new MenuItem("Billboard"));
418
+ billboardItem.addActionListener(this);
255419 csgItem = menu.add(new MenuItem("CSG"));
256420 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258422 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260424 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
430
+ if (Globals.ADVANCED)
431
+ {
432
+ menu.add("-");
263433 linkerItem = menu.add(new MenuItem("Linker"));
264434 linkerItem.addActionListener(this);
265435 templateItem = menu.add(new MenuItem("Template"));
266436 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269437 pointflowItem = menu.add(new MenuItem("Point Flow"));
270438 pointflowItem.addActionListener(this);
439
+ }
271440 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274441 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275442 resetTransformItem.addActionListener(this);
276443 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277444 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
445
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
446
+ resetCentroidXZItem.addActionListener(this);
447
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
448
+ transformGeometryItem.addActionListener(this);
449
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
450
+ transformChildrenItem.addActionListener(this);
280451
281452 oe.menuBar.add(menu = new Menu("Geometry"));
282453 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +456,13 @@
285456 genNormalsORGANItem.addActionListener(this);
286457 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287458 genNormalsCADItem.addActionListener(this);
459
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
460
+ genNormalsMESHItem.addActionListener(this);
461
+ if (Globals.ADVANCED)
462
+ {
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
464
+ genNormalsMINEItem.addActionListener(this);
465
+ }
288466 stripifyItem = menu.add(new MenuItem("Stripify"));
289467 stripifyItem.addActionListener(this);
290468 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +484,34 @@
306484 reduce34MeshItem.addActionListener(this);
307485 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308486 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311487 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312488 clipMeshItem.addActionListener(this);
489
+
490
+ if (Globals.ADVANCED)
491
+ {
492
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
493
+ smoothMeshItem.addActionListener(this);
494
+ }
313495
314496 oe.menuBar.add(menu = new Menu("Attributes"));
315497 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316498 clearMaterialsItem.addActionListener(this);
499
+ resetAllItem = menu.add(new MenuItem("Reset All"));
500
+ resetAllItem.addActionListener(this);
501
+ stepAllItem = menu.add(new MenuItem("Step All"));
502
+ stepAllItem.addActionListener(this);
317503 menu.add("-");
318504 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319505 liveleavesItem.addActionListener(this);
320506 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321507 unliveleavesItem.addActionListener(this);
508
+ if (Globals.ADVANCED)
509
+ {
322510 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323511 supportleavesItem.addActionListener(this);
324512 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325513 unsupportleavesItem.addActionListener(this);
514
+ }
326515 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327516 hideleavesItem.addActionListener(this);
328517 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +520,14 @@
331520 markleavesItem.addActionListener(this);
332521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333522 unmarkleavesItem.addActionListener(this);
523
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
524
+ rewindleavesItem.addActionListener(this);
525
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
526
+ unrewindleavesItem.addActionListener(this);
527
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
528
+ randomleavesItem.addActionListener(this);
529
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
530
+ unrandomleavesItem.addActionListener(this);
334531 menu.add("-");
335532 flipVItem = menu.add(new MenuItem("Flip V"));
336533 flipVItem.addActionListener(this);
....@@ -356,45 +553,56 @@
356553 attachBumpItem.addActionListener(this);
357554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
358555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
359557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
360558 detachPigmentItem.addActionListener(this);
361559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
362560 detachBumpItem.addActionListener(this);
561
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
562
+ embedTexturesItem.addActionListener(this);
563
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
564
+ deEmbedTexturesItem.addActionListener(this);
363565 menu.add("-");
364566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
365567 sortbysizeItem.addActionListener(this);
366568 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367569 sortbynameItem.addActionListener(this);
368570 menu.add("-");
571
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
572
+ shareGeometriesItem.addActionListener(this);
573
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
574
+ mergeGeometriesItem.addActionListener(this);
575
+ if (Globals.ADVANCED)
576
+ {
577
+ // Pretty much the same as duplicate and clone.
369578 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370579 extractGeometriesItem.addActionListener(this);
371580 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372581 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
582
+ }
377583
378584 oe.menuBar.add(menu = new Menu("Insert"));
379585 buildCreateMenu(menu);
380586
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392587 oe.menuBar.add(menu = new Menu("Tools"));
393588 buildToolsMenu(menu);
394589 }
395590
591
+
396592 void SetupUI2(ObjEditor oe)
397593 {
594
+ // June 2019
595
+ if (oe == null)
596
+ {
597
+ //super.SetupUI2(this);
598
+ //return;
599
+ }
600
+
601
+ if (copy != group)
602
+ {
603
+ //super.SetupUI2(this);
604
+ }
605
+
398606 //new Exception().printStackTrace();
399607
400608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +631,327 @@
423631 oe.radioPanel.add(dummyButton);
424632 oe.buttonGroup.add(dummyButton);
425633 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
429637
430
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
638
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
639
+
640
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
+ //minButton.setToolTipText("Minimize window");
642
+ //minButton.addActionListener(this);
643
+
644
+ if (Globals.ADVANCED)
645
+ {
646
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ maxButton.setToolTipText("Maximize window");
648
+ maxButton.addActionListener(this);
649
+ }
650
+
651
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ fullButton.setToolTipText("Full-screen window");
653
+ fullButton.addActionListener(this);
654
+
655
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ screenfitButton.setToolTipText("Screen fit");
657
+ screenfitButton.addActionListener(this);
658
+
659
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ restoreCameraButton.setToolTipText("Restore viewpoint");
661
+ restoreCameraButton.addActionListener(this);
662
+
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
665
+ saveButton.addActionListener(this);
666
+
667
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ undoButton.setToolTipText("Previous version");
669
+ undoButton.addActionListener(this);
670
+ undoButton.setEnabled(false);
671
+
672
+ cGridBag updown = new cGridBag().setVertical(true);
673
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ restoreButton.setToolTipText("Restore current");
675
+ restoreButton.addActionListener(this);
676
+ restoreButton.setEnabled(false);
677
+
678
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ replaceButton.setToolTipText("Replace current");
680
+ replaceButton.addActionListener(this);
681
+ replaceButton.setEnabled(false);
682
+
683
+ copyOptionsPanel.add(updown);
684
+
685
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ redoButton.setToolTipText("Next version");
687
+ redoButton.addActionListener(this);
688
+ redoButton.setEnabled(false);
689
+
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
691
+ liveCB.setToolTipText("Enable animation");
431692 liveCB.addItemListener(this);
432693
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ oneStepButton.setToolTipText("Animate one step forward");
696
+ oneStepButton.addActionListener(this);
697
+
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
699
+ fastCB.setToolTipText("Fast mode");
451700 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.addItemListener(this);
701
+
702
+ //oe.toolboxPanel.Return();
703
+
704
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
705
+// trackCB.setToolTipText("Enable tracking");
706
+// trackCB.addItemListener(this);
458707
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
493
- trackCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
497
- screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
499708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500709 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505710
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
512
- flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516
-
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
519
- twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
711
+ if (Globals.ADVANCED)
712
+ {
713
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ snapobjectButton.addActionListener(this);
715
+ snapobjectButton.setToolTipText("Snap Object");
716
+
717
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521718 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
523
- sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
719
+ fourButton.setToolTipText("Show control panel only");
720
+ }
721
+
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
723
+
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
726
+ twoButton.addActionListener(this);
727
+ this.fullscreenLayout = twoButton;
728
+
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
525731 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
527
- sevenButton.addActionListener(this);
732
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ sixButton.setToolTipText("Show 3D view and controls");
734
+ sixButton.addActionListener(this);
735
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+// sevenButton.setToolTipText("3-column layout");
737
+// sevenButton.addActionListener(this);
528738 //
529739
530
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
740
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ rootButton.setToolTipText("Open selection in new tab");
531742 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
743
+
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ closeButton.setToolTipText("Close tab");
534746 closeButton.addActionListener(this);
535747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536748 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538
-
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
541
- editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545749
546
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
750
+ cGridBag row1 = new cGridBag();
751
+
752
+ // INSERT
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ gridButton.setToolTipText("Create grid");
755
+ gridButton.addActionListener(this);
756
+
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ boxButton.setToolTipText("Create box");
759
+ boxButton.addActionListener(this);
760
+
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ sphereButton.setToolTipText("Create sphere");
763
+ sphereButton.addActionListener(this);
764
+
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ coneButton.setToolTipText("Create cone");
767
+ coneButton.addActionListener(this);
768
+
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ torusButton.setToolTipText("Create torus");
771
+ torusButton.addActionListener(this);
772
+
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
774
+ superButton.setToolTipText("Create superellipsoid");
775
+ superButton.addActionListener(this);
776
+
777
+ if (Globals.ADVANCED)
778
+ {
779
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ kleinButton.setToolTipText("Create Klein bottle");
781
+ kleinButton.addActionListener(this);
782
+ }
783
+
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ particlesButton.setToolTipText("Create particle system");
786
+ particlesButton.addActionListener(this);
787
+
788
+ oe.toolboxPanel.add(row1);
789
+
790
+ cGridBag row2 = new cGridBag();
791
+
792
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
793
+ groupButton.setToolTipText("Create group");
794
+ groupButton.addActionListener(this);
795
+
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ compositeButton.setToolTipText("Create composite");
798
+ compositeButton.addActionListener(this);
799
+
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ switchButton.setToolTipText("Create item switcher");
802
+ switchButton.addActionListener(this);
803
+
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ loopButton.setToolTipText("Create loop");
806
+ loopButton.addActionListener(this);
807
+
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ textureButton.setToolTipText("Create texture");
810
+ textureButton.addActionListener(this);
811
+
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ overlayButton.setToolTipText("Create overlay");
814
+ overlayButton.addActionListener(this);
815
+
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ lightButton.setToolTipText("Create light");
818
+ lightButton.addActionListener(this);
819
+
820
+ oe.toolboxPanel.add(row2);
821
+
822
+ // ENVYMAPS
823
+ cGridBag row3 = new cGridBag();
824
+ row3.preferredHeight = 20;
825
+
826
+ AddSkyboxButton("default", "rgb", row3);
827
+ AddSkyboxButton("default", "cornell", row3);
828
+ AddSkyboxButton("default", "uffizi", row3);
829
+ AddSkyboxButton("default", "CloudyHills", row3);
830
+ AddSkyboxButton("default", "skycube", row3);
831
+
832
+ oe.toolboxPanel.add(row3);
833
+
834
+ cGridBag row4 = new cGridBag();
835
+ row4.preferredHeight = 20;
836
+
837
+ AddSkyboxButton("bridge", "Bridge2", row4);
838
+ AddSkyboxButton("urban", "GamlaStan2", row4);
839
+ AddSkyboxButton("urban", "Parliament", row4);
840
+ AddSkyboxButton("urban", "Roundabout", row4);
841
+
842
+ oe.toolboxPanel.add(row4);
843
+
844
+ cGridBag row5 = new cGridBag();
845
+ row5.preferredHeight = 20;
846
+
847
+ AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
+ AddSkyboxButton("urban", "UnionSquare", row5);
851
+
852
+ oe.toolboxPanel.add(row5);
853
+
854
+ cGridBag row6 = new cGridBag();
855
+ row6.preferredHeight = 20;
856
+
857
+ AddSkyboxButton("park", "BerzeliiPark", row6);
858
+ AddSkyboxButton("park", "Buddha", row6);
859
+ AddSkyboxButton("park", "CNTower2", row6);
860
+ //AddSkyboxButton("park", "Fatbursparken", row6);
861
+ AddSkyboxButton("park", "NiagaraFalls1", row6);
862
+
863
+ oe.toolboxPanel.add(row6);
864
+
865
+ cGridBag row7 = new cGridBag();
866
+ row7.preferredHeight = 20;
867
+
868
+ AddSkyboxButton("park", "NiagaraFalls3", row7);
869
+ AddSkyboxButton("park", "Park", row7);
870
+ //AddSkyboxButton("park", "Park2", row6);
871
+ //AddSkyboxButton("park", "Path", row6);
872
+ AddSkyboxButton("park", "Pond", row7);
873
+ AddSkyboxButton("park", "Skansen", row7);
874
+
875
+ oe.toolboxPanel.add(row7);
876
+
877
+ cGridBag row8 = new cGridBag();
878
+ row8.preferredHeight = 20;
879
+
880
+ AddSkyboxButton("park", "Skansen2", row8);
881
+ AddSkyboxButton("park", "Skansen3", row8);
882
+ AddSkyboxButton("park", "Skansen4", row8);
883
+ AddSkyboxButton("park", "Skansen5", row8);
884
+
885
+ oe.toolboxPanel.add(row8);
886
+
887
+ cGridBag row9 = new cGridBag();
888
+ row9.preferredHeight = 20;
889
+
890
+ AddSkyboxButton("park", "Stairs", row9);
891
+ //AddSkyboxButton("park", "Tantolunden", row6);
892
+ //AddSkyboxButton("park", "Tantolunden3", row6);
893
+ AddSkyboxButton("park", "Tantolunden4", row9);
894
+
895
+ oe.toolboxPanel.add(row9);
896
+/*
897
+BerzeliiPark
898
+Buddha
899
+CNTower2
900
+Fatbursparken
901
+NiagaraFalls1
902
+NiagaraFalls3
903
+Park
904
+Park2
905
+Path
906
+Pond
907
+Skansen
908
+Skansen2
909
+Skansen3
910
+Skansen4
911
+Skansen5
912
+Stairs
913
+Tantolunden
914
+Tantolunden3
915
+Tantolunden4
916
+ */
917
+
918
+ for (int i=1; --i>=0;)
919
+ {
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
922
+ }
923
+
924
+ // EDIT panel
925
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
926
+ editButton.setToolTipText("Pin selection controls");
927
+ editButton.addActionListener(this);
928
+
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
547931 uneditButton.addActionListener(this);
548932
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
561935 allParamsButton.addActionListener(this);
562936
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
937
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
938
+ clearPanelButton.setToolTipText("Clear edit panel");
939
+ clearPanelButton.addActionListener(this);
940
+
941
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+ unselectButton.setToolTipText("Unselect");
568943 unselectButton.addActionListener(this);
569944
945
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
946
+ flashSelectionButton.setToolTipText("Highlight selection");
947
+ flashSelectionButton.addActionListener(this);
948
+
949
+ editCommandsPanel.preferredHeight = 1;
950
+
951
+ SetPinStates(false);
952
+// oe.treePanel.add(commandsPanel);
953
+// oe.treePanel.Return();
954
+
570955 // oe.aConstraints.gridx += 1;
571956 // oe.aConstraints.weighty = 0;
572957 // oe.aConstraints.gridwidth = 1;
....@@ -578,47 +963,32 @@
578963 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
579964 // gcButton.addActionListener(this);
580965
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
966
+ cGridBag jSPPanel = new cGridBag();
967
+
968
+ JScrollPane jSP;
592969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
594971 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
599
-
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
604
- colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
607
- materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
- textureCB.addItemListener(this);
611
-
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
614972
973
+ oe.treePanel.add(jSPPanel);
974
+ oe.treePanel.Return();
975
+
976
+ oe.treePanel.add(copyOptionsPanel);
977
+ oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
981
+
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
984
+
615985 //jList.addListSelectionListener(this);
616986 oe.jTree.addTreeSelectionListener(this);
617987 //jTree.setRootVisible(false);
618988 //jTree.setEditable(true);
619989 oe.jTree.setDragEnabled(true);
620990 //jTree.setPreferredSize(new Dimension(10,10));
621
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
622992
623993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
624994
....@@ -630,23 +1000,160 @@
6301000 dgr.addDragGestureListener(this);
6311001 }catch(Exception e) {}
6321002 */
633
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
6341004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6351005 }
1006
+
1007
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1008
+ {
1009
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1010
+ colorCB.setToolTipText("Copy color when dropped");
1011
+ colorCB.addItemListener(this);
1012
+
1013
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1014
+ materialCB.setToolTipText("Copy material when dropped");
1015
+ materialCB.addItemListener(this);
1016
+
1017
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1018
+ textureCB.setToolTipText("Copy texture when dropped");
1019
+ textureCB.addItemListener(this);
1020
+
1021
+ panel.Return();
1022
+
1023
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1024
+ boxCB.setToolTipText("Display bounding boxes");
1025
+ boxCB.addItemListener(this);
1026
+
1027
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
1029
+ zoomBoxCB.addItemListener(this);
1030
+
1031
+ if (true) // Globals.ADVANCED)
1032
+ {
1033
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1034
+// supportCB.setToolTipText("Enable rigging");
1035
+// supportCB.addItemListener(this);
1036
+
1037
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1038
+ freezeCB.setToolTipText("Fast moving camera");
1039
+ freezeCB.addItemListener(this);
1040
+
1041
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1042
+ // localCB.addItemListener(this);
1043
+
1044
+ panel.Return();
1045
+
1046
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1047
+ crowdCB.setToolTipText("Used for crowds");
1048
+ crowdCB.addItemListener(this);
1049
+
1050
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1051
+ smoothCB.setToolTipText("Snapping delay");
1052
+ smoothCB.addItemListener(this);
1053
+
1054
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1055
+ slowCB.setToolTipText("Smooth interpolation");
1056
+ slowCB.addItemListener(this);
1057
+
1058
+// constraints.gridy += 1;
1059
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1060
+// speakerMocapCB.addItemListener(this);
1061
+
1062
+ panel.Return();
1063
+
1064
+ if (false)
1065
+ {
1066
+ // handled in scripts
1067
+ //constraints.gridy += 1;
1068
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1069
+ speakerCameraCB.addItemListener(this);
1070
+
1071
+ //constraints.gridy += 1;
1072
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1073
+ speakerFocusCB.addItemListener(this);
1074
+
1075
+ //constraints.gridy += 1;
1076
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1077
+ smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
1079
+ }
1080
+
1081
+//constraints.gridx += 1;
1082
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1083
+// debugCB.addItemListener(this);
1084
+
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
1089
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
1091
+ oeilCB.addItemListener(this);
1092
+
1093
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1094
+ shadowCB.setToolTipText("When live compute shadows");
1095
+ shadowCB.addItemListener(this);
1096
+
1097
+ panel.Return();
1098
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1099
+ toggleTextureCB.setToolTipText("Load textures");
1100
+ toggleTextureCB.addItemListener(this);
1101
+
1102
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1103
+ toggleSwitchCB.setToolTipText("Choose a single item");
1104
+ toggleSwitchCB.addItemListener(this);
1105
+
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
1109
+
1110
+ panel.Return();
1111
+ if (Globals.ADVANCED)
1112
+ {
1113
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1114
+ lookAtCB.setToolTipText("Look-at target");
1115
+ lookAtCB.addItemListener(this);
1116
+ }
1117
+
1118
+ }
1119
+
1120
+ cGridBag fill = new cGridBag();
1121
+ fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
1126
+
1127
+ panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
1130
+
1131
+ }
6361132
6371133 void EditObject(Object3D obj)
6381134 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
1135
+ cRadio radioButton = new cRadio(obj.name);
1136
+
1137
+ // June 2019. Patch to avoid bug with transparency.
1138
+ radioButton.hadMaterial = obj.material != null;
1139
+ if (!radioButton.hadMaterial)
1140
+ {
1141
+ obj.material = new cMaterial();
1142
+ }
1143
+
1144
+ radioButton.SetObject(obj);
1145
+ radioButton.layout = sixButton; // sevenButton;
1146
+ radioButton.SetCamera(cameraView.renderCamera, false);
1147
+ radioButton.addActionListener(this);
1148
+ radioPanel.add(radioButton);
1149
+ buttonGroup.add(radioButton);
1150
+ radioButton.doClick();
6471151 }
1152
+
6481153 void SetupViews(ObjEditor oe)
6491154 {
1155
+ theFrame = this;
1156
+
6501157 oe.SetupViews();
6511158
6521159 System.out.println("SetupViews");
....@@ -655,22 +1162,28 @@
6551162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6561163 }
6571164
658
- JCheckBox liveCB;
659
- JCheckBox supportCB;
660
- JCheckBox localCB;
661
- JCheckBox crowdCB;
662
- JCheckBox smoothCB;
663
- JCheckBox fastCB;
664
- JCheckBox slowCB;
665
- JCheckBox boxCB;
666
- JCheckBox trackCB;
667
- JCheckBox smoothfocusCB;
1165
+ cToggleButton liveCB;
1166
+ cCheckBox supportCB;
1167
+ cCheckBox localCB;
1168
+ cCheckBox crowdCB;
1169
+ cCheckBox smoothCB;
1170
+ cToggleButton fastCB;
1171
+ cCheckBox slowCB;
1172
+ cCheckBox boxCB;
1173
+ cCheckBox zoomBoxCB;
1174
+ cCheckBox freezeCB;
1175
+ //cToggleButton trackCB;
1176
+ cCheckBox trackCB;
1177
+ cCheckBox smoothfocusCB;
6681178 // JCheckBox speakerMocapCB;
669
- JCheckBox speakerCameraCB;
670
- JCheckBox speakerFocusCB;
671
- JCheckBox debugCB;
672
- JCheckBox oeilCB;
673
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
6741187
6751188 // static int COLOR = 1;
6761189 // static int MATERIAL = 2;
....@@ -678,9 +1191,9 @@
6781191
6791192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6801193
681
- JCheckBox colorCB;
682
- JCheckBox materialCB;
683
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
6841197
6851198 public void itemStateChanged(ItemEvent e)
6861199 {
....@@ -705,10 +1218,10 @@
7051218 dropAttributes |= Object3D.TEXTURE;
7061219 else
7071220 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
1221
+ } else if(e.getSource() == liveCB)
7101222 {
7111223 cameraView.ToggleLive();
1224
+ refreshContents(false);
7121225 }
7131226 else if(e.getSource() == supportCB)
7141227 {
....@@ -744,6 +1257,10 @@
7441257 cameraView.repaint();
7451258 // refreshContents();
7461259 }
1260
+ else if(e.getSource() == zoomBoxCB)
1261
+ {
1262
+ cameraView.ToggleZoomBoxMode();
1263
+ }
7471264 else if(e.getSource() == smoothfocusCB)
7481265 {
7491266 cameraView.ToggleSmoothFocus();
....@@ -769,6 +1286,18 @@
7691286 {
7701287 cameraView.ToggleOeil();
7711288 }
1289
+ else if(e.getSource() == shadowCB)
1290
+ {
1291
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1292
+ }
1293
+ else if(e.getSource() == freezeCB)
1294
+ {
1295
+ Globals.FREEZEONMOVE ^= true;
1296
+ }
1297
+ else if(e.getSource() == autokeepCB)
1298
+ {
1299
+ Globals.REPLACEONMAKE ^= true;
1300
+ }
7721301 else if(e.getSource() == lookAtCB)
7731302 {
7741303 cameraView.ToggleLookAt();
....@@ -785,7 +1314,8 @@
7851314
7861315 /**/
7871316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
788
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
7891319 if ((path == null) || (path.getPathCount() <= 1)) {
7901320 // We can't move the root node or an empty selection
7911321 return;
....@@ -848,8 +1378,6 @@
8481378 }
8491379 }
8501380
851
- String string = (String) object;
852
-
8531381 System.out.println("Transfer = " + object + "; drop : " + target);
8541382 // if( object instanceof java.io.File[])
8551383 // {
....@@ -857,7 +1385,11 @@
8571385 // objEditor.DropFile((java.io.File[]) object, true);
8581386 // return;
8591387 // }
860
- if (string.charAt(0) == '/')
1388
+
1389
+ String string = object.toString();
1390
+
1391
+ // File path for Mac and Windows
1392
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8611393 {
8621394 // file(s)
8631395 String[] names = string.split("\n");
....@@ -884,7 +1416,7 @@
8841416
8851417 flashIt = false;
8861418 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1419
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881420 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891421
8901422 if (group.selection.size() == 1)
....@@ -900,23 +1432,33 @@
9001432
9011433 assert target == objEditor.jTree;
9021434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
9031436 try {
904
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9051438 } catch (Exception e) {
9061439 System.out.println("destinationPath : " + destinationPath);
9071440 return;
9081441 }
9091442
910
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
9111444 {
1445
+ Object3D child = (Object3D)group.selection.elementAt(i);
1446
+
1447
+ // Cannot move into itself
1448
+ if (child == destinationLeaf)
1449
+ return;
1450
+ }
1451
+
1452
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1453
+// {
9121454 loadClipboard(true);
9131455 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
915
- } else {
916
- loadClipboard(false);
917
- objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
919
- }
1456
+ pasteInto(false, false);
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
9201462 }
9211463 public void dropActionChanged(DropTargetDragEvent dtde)
9221464 // Called if the user has modified the current drop gesture
....@@ -1021,83 +1563,107 @@
10211563 {
10221564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10231565 //heightFieldItem.addActionListener(this);
1024
- gridItem = menu.add(new MenuItem("Grid"));
1025
- gridItem.addActionListener(this);
1026
- rectoidItem = menu.add(new MenuItem("Box"));
1027
- rectoidItem.addActionListener(this);
1028
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1029
- ellipsoidItem.addActionListener(this);
1030
- coneItem = menu.add(new MenuItem("Cone"));
1031
- coneItem.addActionListener(this);
1032
- torusItem = menu.add(new MenuItem("Torus"));
1033
- torusItem.addActionListener(this);
1034
- superItem = menu.add(new MenuItem("Superellipsoid"));
1035
- superItem.addActionListener(this);
1036
- particleItem = menu.add(new MenuItem("Particle system"));
1037
- particleItem.addActionListener(this);
1566
+// gridItem = menu.add(new MenuItem("Grid"));
1567
+// gridItem.addActionListener(this);
1568
+// rectoidItem = menu.add(new MenuItem("Box"));
1569
+// rectoidItem.addActionListener(this);
1570
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1571
+// ellipsoidItem.addActionListener(this);
1572
+// coneItem = menu.add(new MenuItem("Cone"));
1573
+// coneItem.addActionListener(this);
1574
+// torusItem = menu.add(new MenuItem("Torus"));
1575
+// torusItem.addActionListener(this);
1576
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1577
+// superItem.addActionListener(this);
1578
+
1579
+ cameraItem = menu.add(new MenuItem("Camera"));
1580
+ cameraItem.addActionListener(this);
1581
+
1582
+ if (!Globals.ADVANCED)
1583
+ {
1584
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1585
+ kleinItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
1590
+ if (Globals.ADVANCED)
1591
+ {
10381592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391593 ragdollItem.addActionListener(this);
10401594 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411595 ragdoll2Item.addActionListener(this);
1596
+ }
10421597 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1598
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441599 meshItem.addActionListener(this);
10451600 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461601 // meshGroupItem.addActionListener(this);
1602
+ if (Globals.ADVANCED)
1603
+ {
10471604 springItem = menu.add(new MenuItem("Spring"));
10481605 springItem.addActionListener(this);
10491606 flagItem = menu.add(new MenuItem("Flag"));
10501607 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551608 blobItem = menu.add(new MenuItem("Blob"));
10561609 blobItem.addActionListener(this);
10571610 latheItem = menu.add(new MenuItem("Lathe"));
10581611 latheItem.addActionListener(this);
1059
- lightItem = menu.add(new MenuItem("Light"));
1060
- lightItem.addActionListener(this);
1612
+ }
1613
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1614
+ bezierItem.addActionListener(this);
1615
+// overlayItem = menu.add(new MenuItem("Overlay"));
1616
+// overlayItem.addActionListener(this);
1617
+// lightItem = menu.add(new MenuItem("Light"));
1618
+// lightItem.addActionListener(this);
10611619 menu.add("-");
10621620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10631621 //superLoopItem.addActionListener(this);
1064
- loopItem = menu.add(new MenuItem("Loop"));
1065
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
10661624 doubleItem = menu.add(new MenuItem("Fork"));
10671625 doubleItem.addActionListener(this);
1626
+ if (Globals.ADVANCED)
1627
+ {
10681628 tripleItem = menu.add(new MenuItem("Trident"));
10691629 tripleItem.addActionListener(this);
1630
+ }
10701631 }
10711632
10721633 void buildToolsMenu(Menu menu)
10731634 {
10741635 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751636 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1637
+ animationItem.setState(Globals.ANIMATION);
1638
+
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
10771641
10781642 menu.add("-");
10791643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801644 parseverticesItem.addActionListener(this);
10811645 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821646 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1647
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841648 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871649 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881650 reduceMorphItem.addActionListener(this);
10891651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901652 reduce34MorphItem.addActionListener(this);
1091
-
1092
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1093
- computeAOItem.addActionListener(this);
10941653 menu.add("-");
1095
-
10961654 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971655 memoryItem.addActionListener(this);
1656
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1657
+ computeAOItem.addActionListener(this);
1658
+
1659
+ if (Globals.ADVANCED)
1660
+ {
1661
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1662
+ mirrorItem.addActionListener(this);
1663
+ menu.add("-");
10981664 menu.add(analyzeItem = new MenuItem("Analyze"));
10991665 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1666
+ menu.add(dumpItem = new MenuItem("Print"));
11011667 dumpItem.addActionListener(this);
11021668 // menu.add(pathItem = new MenuItem("From-to path"));
11031669 // pathItem.addActionListener(this);
....@@ -1106,6 +1672,8 @@
11061672 resetParentItem.addActionListener(this);
11071673 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081674 repairParentItem.addActionListener(this);
1675
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1676
+ repairShadowItem.addActionListener(this);
11091677 menu.add(invariantsItem = new MenuItem("Invariants"));
11101678 invariantsItem.addActionListener(this);
11111679 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1681,7 @@
11131681 menu.add("-");
11141682 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151683 editScriptItem.addActionListener(this);
1684
+ }
11161685 }
11171686
11181687 void ScreenFit()
....@@ -1235,9 +1804,34 @@
12351804 shadow.material = new cMaterial(obj.material);
12361805 shadow.material.diffuse = 0.0001f;
12371806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
12381808
12391809 makeSomething(shadow);
12401810 }
1811
+
1812
+ private void ClearUnpinned()
1813
+ {
1814
+ //for (Object3D obj : listUI)
1815
+ for (int i=listUI.size(); --i>=0;)
1816
+ {
1817
+ Object3D obj = listUI.elementAt(i);
1818
+ if (!obj.pinned)
1819
+ {
1820
+ obj.CloseUI();
1821
+ listUI.remove(i);
1822
+ }
1823
+ }
1824
+ }
1825
+
1826
+ private void EditElement(Object3D elem, boolean newWindow)
1827
+ {
1828
+ // if (!(elem instanceof Composite))
1829
+ // newWindow = false;
1830
+ listUI.add(elem);
1831
+ elem.openEditWindow(this, newWindow); //, false);
1832
+ System.out.println("edit : " + elem);
1833
+ elem.editWindow.refreshContents(true); // ? new
1834
+ }
12411835
12421836 /**
12431837 * applyExample
....@@ -1441,9 +2035,9 @@
14412035
14422036 void Overwrite(int mask)
14432037 {
1444
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2038
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14452039 {
1446
- Object3D content = GraphreeD.clipboard.get(0);
2040
+ Object3D content = Grafreed.clipboard.get(0);
14472041
14482042 if (content instanceof cGroup && ((cGroup)content).transientlink )
14492043 content = ((cGroup)content).get(0);
....@@ -1466,6 +2060,7 @@
14662060 //
14672061 public void actionPerformed(ActionEvent event) // , Object arg)
14682062 {
2063
+ Object source = event.getSource();
14692064 /*
14702065 if (event.getSource() == nameField)
14712066 {
....@@ -1477,11 +2072,11 @@
14772072 }
14782073 else
14792074 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2075
+ if (source == lookAtItem || source == lookFromItem)
14812076 {
14822077 ScreenFit();
14832078 } else
1484
- if (event.getSource() == switchItem)
2079
+ if (source == switchViewItem)
14852080 {
14862081 cVector v1 = new cVector();
14872082 cVector v2 = new cVector();
....@@ -1490,11 +2085,11 @@
14902085 objEditor.cameraView.renderCamera.setAim(v2, v1);
14912086 objEditor.cameraView.repaint();
14922087 } else
1493
- if (event.getSource() == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
14942089 {
14952090 makeSomething(new Box());
14962091 } else
1497
- if (event.getSource() == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
14982093 {
14992094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15002095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +2110,9 @@
15152110 applyExample(particleGeom, "SMOKE");
15162111 makeSomething(particleGeom);
15172112 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2113
+ if (source == ragdollItem || source == ragdoll2Item)
15192114 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2115
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15212116
15222117 ragdoll.toParent = LA.newMatrix();
15232118 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +2130,7 @@
15352130 } else
15362131 /*
15372132 */
1538
- if (event.getSource() == heightFieldItem)
2133
+ if (source == heightFieldItem)
15392134 {
15402135 Object3D obj = new Object3D();
15412136
....@@ -1573,27 +2168,31 @@
15732168
15742169 makeSomething(obj);
15752170 } else
1576
- if (event.getSource() == gridItem)
2171
+ if (source == gridItem || source == gridButton)
15772172 {
15782173 makeSomething(new Grid());
15792174 } else
1580
- if (event.getSource() == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
15812176 {
15822177 makeSomething(new Sphere());
15832178 } else
1584
- if (event.getSource() == coneItem)
2179
+ if (source == coneItem || source == coneButton)
15852180 {
15862181 makeSomething(new Cone());
15872182 } else
1588
- if (event.getSource() == torusItem)
2183
+ if (source == torusItem || source == torusButton)
15892184 {
15902185 makeSomething(new Torus());
15912186 } else
1592
- if (event.getSource() == superItem)
2187
+ if (source == superItem || source == superButton)
15932188 {
15942189 makeSomething(new Superellipsoid());
15952190 } else
1596
- if (event.getSource() == blobItem)
2191
+ if (source == kleinItem || source == kleinButton)
2192
+ {
2193
+ makeSomething(new Klein());
2194
+ } else
2195
+ if (source == blobItem)
15972196 {
15982197 Blob blob = new Blob();
15992198 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +2200,15 @@
16012200 //blob.retile();
16022201 makeSomething(blob);
16032202 } else
1604
- if (event.getSource() == latheItem)
2203
+ if (source == latheItem)
16052204 {
16062205 makeSomething(new Lathe());
16072206 } else
1608
- if (event.getSource() == bezierItem)
2207
+ if (source == bezierItem)
16092208 {
16102209 makeSomething(new BezierSurface());
16112210 } else
1612
- if (event.getSource() == checkerItem)
2211
+ if (source == overlayItem || source == overlayButton)
16132212 {
16142213 /*
16152214 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +2223,7 @@
16242223 */
16252224 makeSomething(new Checker());
16262225 } else
1627
- if (event.getSource() == meshItem)
2226
+ if (source == meshItem)
16282227 {
16292228 Object3D itemtomake = new Object3D();
16302229 Object3D child;
....@@ -1645,35 +2244,52 @@
16452244 makeSomething(child);
16462245 }
16472246 } else
1648
- if (event.getSource() == springItem)
2247
+ if (source == springItem)
16492248 {
16502249 cSpring s = new cSpring();
16512250 s.setup();
16522251 makeSomething(s);
16532252 } else
1654
- if (event.getSource() == flagItem)
2253
+ if (source == flagItem)
16552254 {
16562255 cSpring s = new cFlag();
16572256 s.setup();
16582257 makeSomething(s);
16592258 } else
1660
- if (event.getSource() == lightItem)
2259
+ if (source == lightItem || source == lightButton)
16612260 {
16622261 makeSomething(new Light());
16632262 } else
1664
- if (event.getSource() == csgItem)
2263
+// if (source == skybox1Button ||
2264
+// source == skybox2Button ||
2265
+// source == skybox3Button ||
2266
+// source == skybox4Button ||
2267
+// source == skybox5Button ||
2268
+// source == skybox6Button ||
2269
+// source == skybox7Button ||
2270
+// source == skybox11Button ||
2271
+// source == skybox12Button ||
2272
+// source == skybox13Button ||
2273
+// source == skybox14Button ||
2274
+// source == skybox15Button ||
2275
+// source == skybox16Button ||
2276
+// source == skybox17Button)
2277
+// {
2278
+// ChangeSkybox(source);
2279
+// } else
2280
+ if (source == csgItem)
16652281 {
16662282 group(new CSG());
16672283 } else
1668
- if (event.getSource() == templateItem)
2284
+ if (source == templateItem)
16692285 {
16702286 group(new cTemplate());
16712287 } else
1672
- if (event.getSource() == attributeItem)
2288
+ if (source == attributeItem)
16732289 {
16742290 makeSomething(new Attribute());
16752291 } else
1676
- if (event.getSource() == pointflowItem)
2292
+ if (source == pointflowItem)
16772293 {
16782294 makeSomething(new PointFlow());
16792295 } else
....@@ -1685,7 +2301,7 @@
16852301 } else
16862302 */
16872303
1688
- if (event.getSource() == superLoopItem)
2304
+ if (source == superLoopItem)
16892305 {
16902306 Composite g = new cGroup();
16912307 for (int i=0; i<15; i++)
....@@ -1707,30 +2323,30 @@
17072323
17082324 group(g);
17092325 } else
1710
- if (event.getSource() == loopItem)
2326
+ if (source == loopItem || source == loopButton)
17112327 {
17122328 Composite csg = new GroupLeaf();
17132329 csg.count = 5;
17142330 group(csg);
1715
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
17162332 csg.addChild(child);
17172333 child.addChild(csg);
17182334 } else
1719
- if (event.getSource() == doubleItem)
2335
+ if (source == doubleItem)
17202336 {
1721
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
17222338 csg.count = 5;
17232339 group(csg);
1724
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
17252341 csg.addChild(child);
17262342 child.addChild(csg);
1727
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
17282344 csg.addChild(child);
17292345 child.addChild(csg);
17302346 } else
1731
- if (event.getSource() == tripleItem)
2347
+ if (source == tripleItem)
17322348 {
1733
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
17342350 csg.count = 4;
17352351 group(csg);
17362352 Composite child = new cGroup();
....@@ -1743,73 +2359,98 @@
17432359 csg.addChild(child);
17442360 child.addChild(csg);
17452361 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
2362
+ if (source == computeAOItem)
17482363 {
1749
- ImportGFD();
2364
+ Globals.drawMode = CameraPane.OCCLUSION;
2365
+ cameraView.repaint();
17502366 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
2367
+ if (source == recompileItem)
17692368 {
17702369 Recompile();
17712370 refreshContents();
17722371 } else
1773
- if (event.getSource() == editScriptItem)
2372
+ if (source == editScriptItem)
17742373 {
17752374 OpenDialog();
17762375 refreshContents();
17772376 } else
1778
- if (event.getSource() == invariantsItem)
2377
+ if (source == invariantsItem)
17792378 {
17802379 System.out.println("Invariants:");
1781
- GraphreeD.theApplet3D.universe.invariants();
2380
+ Grafreed.grafreeD.universe.invariants();
17822381 } else
1783
- if (event.getSource() == memoryItem)
2382
+ if (source == memoryItem)
17842383 {
17852384 //System.out.println("Invariants:");
17862385 PrintMemory();
17872386 } else
1788
- if (event.getSource() == pathItem)
2387
+ if (source == pathItem)
17892388 {
17902389 PrintPath();
17912390 } else
1792
- if (event.getSource() == analyzeItem)
2391
+ if (source == analyzeItem)
17932392 {
17942393 AnalyzeObject();
17952394 } else
1796
- if (event.getSource() == dumpItem)
2395
+ if (source == dumpItem)
17972396 {
17982397 DumpObject();
17992398 } else
1800
- if (event.getSource() == screenfitButton)
2399
+ if (source == minButton)
18012400 {
1802
- //Reload(lastConverter, lastFilename, true);
2401
+ Minimize();
2402
+ } else
2403
+ if (source == maxButton)
2404
+ {
2405
+ Maximize();
2406
+ } else
2407
+ if (source == fullButton)
2408
+ {
2409
+ ToggleFullScreen();
2410
+ } else
2411
+ if (source == undoButton)
2412
+ {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2416
+ Undo();
2417
+ } else
2418
+ if (source == restoreButton)
2419
+ {
2420
+ // Restore current version
2421
+ Restore();
2422
+ } else
2423
+ if (source == replaceButton)
2424
+ {
2425
+ // Overwrite current version
2426
+ Replace();
2427
+ } else
2428
+ if (source == redoButton)
2429
+ {
2430
+ // Go to next version
2431
+ Redo();
2432
+ } else
2433
+ if (source == saveButton)
2434
+ {
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
2438
+ } else
2439
+ if (source == oneStepButton)
2440
+ {
2441
+ Globals.ONESTEP = true;
2442
+ cameraView.repaint();
2443
+ } else
2444
+ if (source == screenfitButton)
2445
+ {
18032446 ScreenFit();
18042447 } else
1805
- if (event.getSource() == screenfitpointButton)
2448
+ if (source == screenfitpointButton)
18062449 {
1807
- //Reload(lastConverter, lastFilename, true);
18082450 ScreenFitPoint();
18092451 } else
1810
- if (event.getSource() == snapobjectButton)
2452
+ if (source == snapobjectButton)
18112453 {
1812
- //Reload(lastConverter, lastFilename, true);
18132454 SnapObject();
18142455 } else
18152456 // if (event.getSource() == recompileButton)
....@@ -1818,13 +2459,13 @@
18182459 // Recompile();
18192460 // refreshContents();
18202461 // } else
1821
- if (event.getSource() == gcButton)
2462
+ if (source == gcButton)
18222463 {
18232464 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242465 System.gc();
18252466 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262467 } else
1827
- if (event.getSource() == editLeafItem)
2468
+ if (source == editLeafItem)
18282469 {
18292470 Object3D obj;
18302471 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,65 +2479,78 @@
18382479 }
18392480 refreshContents(true);
18402481 } else
1841
- if (event.getSource() == openWindowItem)
2482
+ if (source == openWindowItem)
18422483 {
18432484 EditSelection(true);
18442485 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2486
+ if (source == cutItem || source == clearButton)
18462487 {
18472488 loadClipboard(true);
18482489 } else
1849
- if (event.getSource() == duplicateItem)
2490
+ if (source == undoItem)
18502491 {
1851
- Object3D keep = GraphreeD.clipboard;
2492
+ Undo();
2493
+ } else
2494
+ if (source == redoItem)
2495
+ {
2496
+ Redo();
2497
+ } else
2498
+ if (source == duplicateItem)
2499
+ {
2500
+ Object3D keep = Grafreed.clipboard;
18522501 loadClipboard(false);
18532502 paste(false);
1854
- GraphreeD.clipboard = keep;
2503
+ Grafreed.clipboard = keep;
18552504 } else
1856
- if (event.getSource() == cloneItem)
2505
+ if (source == cloneItem)
18572506 {
18582507 CloneSelection(false);
18592508 } else
1860
- if (event.getSource() == cloneSupportItem)
2509
+ if (source == cloneSupportItem)
18612510 {
18622511 CloneSelection(true);
18632512 } else
1864
- if (event.getSource() == copyItem)
2513
+ if (source == copyItem)
18652514 {
18662515 loadClipboard(false);
18672516 } else
1868
- if (event.getSource() == pasteItem)
2517
+ if (source == pasteItem)
18692518 {
18702519 paste(false);
18712520 } else
1872
- if (event.getSource() == pasteLinkItem)
2521
+ if (source == pasteIntoItem)
18732522 {
1874
- pasteInto(false);
2523
+ pasteInto(true, false);
18752524 } else
1876
- if (event.getSource() == pasteCloneItem)
2525
+ if (source == pasteLinkItem)
18772526 {
1878
- pasteInto(true);
2527
+ pasteInto(false, false);
18792528 } else
1880
- if (event.getSource() == pasteExpandItem)
2529
+ if (source == pasteCloneItem)
2530
+ {
2531
+ pasteInto(true, true);
2532
+ } else
2533
+ if (source == pasteExpandItem)
18812534 {
18822535 paste(true);
18832536 } else
1884
- if (event.getSource() == synchronizeItem)
2537
+ if (source == synchronizeItem)
18852538 {
18862539 Overwrite(Object3D.TRANSFORM);
18872540 } else
1888
- if (event.getSource() == overwriteNameItem)
2541
+ if (source == overwriteNameItem)
18892542 {
18902543 Overwrite(Object3D.NAME);
18912544 } else
1892
- if (event.getSource() == overwriteUVItem)
2545
+ if (source == overwriteUVItem)
18932546 {
18942547 Overwrite(Object3D.UV);
18952548 } else
1896
- if (event.getSource() == overwriteMatItem)
2549
+ if (source == overwriteMatItem)
18972550 {
2551
+ /* july 2015
18982552 if ((dropAttributes & Object3D.TEXTURE) == 0)
1899
- Overwrite(Object3D.MATERIAL);
2553
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
19002554 else
19012555 {
19022556 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1908,13 +2562,16 @@
19082562 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
19092563 }
19102564 }
2565
+ */
2566
+
2567
+ Overwrite(dropAttributes);
19112568 }
1912
- if (event.getSource() == overwriteGeoItem)
2569
+ if (source == overwriteGeoItem)
19132570 {
19142571 Overwrite(Object3D.GEOMETRY);
1915
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2572
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
19162573 // {
1917
-// Object3D content = GraphreeD.clipboard.get(0);
2574
+// Object3D content = GrafreeD.clipboard.get(0);
19182575 //
19192576 // if (content instanceof cGroup && ((cGroup)content).transientlink )
19202577 // content = ((cGroup)content).get(0);
....@@ -1926,7 +2583,7 @@
19262583 // refreshContents();
19272584 // }
19282585 } else
1929
- if (event.getSource() == generateMeshItem)
2586
+ if (source == generateMeshItem)
19302587 {
19312588 //if (group.selection.size() == 1)
19322589 // for (int i=0; i<group.selection.size(); i++)
....@@ -1937,7 +2594,7 @@
19372594 ResetModel();
19382595 refreshContents();
19392596 } else
1940
- if (event.getSource() == extractGeometriesItem)
2597
+ if (source == extractGeometriesItem)
19412598 {
19422599 boolean one = false;
19432600
....@@ -1964,7 +2621,7 @@
19642621 ResetModel();
19652622 refreshContents();
19662623 } else
1967
- if (event.getSource() == cloneGeometriesItem)
2624
+ if (source == cloneGeometriesItem)
19682625 {
19692626 boolean one = false;
19702627
....@@ -1990,32 +2647,37 @@
19902647 ResetModel();
19912648 refreshContents();
19922649 } else
1993
- if (event.getSource() == shareGeometriesItem)
2650
+ if (source == shareGeometriesItem)
19942651 {
19952652 boolean one = false;
19962653
19972654 if (group.selection.size() == 1)
19982655 one = true;
19992656
2657
+ Object3D merge = null;
2658
+
20002659 Object3D content = new cGroup();
20012660
20022661 for (int i=0; i<group.selection.size(); i++)
20032662 {
2004
- Object3D sel = new Merge(group.selection.get(i));
2663
+ merge = new Merge(group.selection.get(i));
20052664
20062665 if (one)
2007
- makeSomething(sel, false);
2666
+ makeSomething(merge, false);
20082667 else
2009
- content.addChild(sel);
2668
+ content.addChild(merge);
20102669 }
20112670
20122671 if (!one)
2013
- makeSomething(content, false);
2014
-
2015
- ResetModel();
2016
- refreshContents();
2672
+ makeSomething(content, true);
2673
+ else
2674
+ {
2675
+ ResetModel();
2676
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2677
+ refreshContents();
2678
+ }
20172679 } else
2018
- if (event.getSource() == mergeGeometriesItem)
2680
+ if (source == mergeGeometriesItem)
20192681 {
20202682 boolean one = false;
20212683
....@@ -2045,11 +2707,11 @@
20452707 ResetModel();
20462708 refreshContents();
20472709 } else
2048
- if (event.getSource() == linkverticesItem)
2710
+ if (source == linkverticesItem)
20492711 {
2050
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2712
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20512713 // {
2052
-// Object3D content = GraphreeD.clipboard.get(0);
2714
+// Object3D content = GrafreeD.clipboard.get(0);
20532715 //
20542716 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20552717 // content = ((cGroup)content).get(0);
....@@ -2058,39 +2720,48 @@
20582720 // group.selection.get(0).setMasterThis(content); // should be identity
20592721 // refreshContents();
20602722 // }
2061
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2723
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20622724 {
2063
- Object3D content = GraphreeD.clipboard.get(0);
2725
+ Object3D content = Grafreed.clipboard.get(0);
20642726
20652727 if (content instanceof cGroup && ((cGroup)content).transientlink )
20662728 content = ((cGroup)content).get(0);
20672729
2068
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2730
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20692731 for (int i=0; i<group.selection.size(); i++)
20702732 {
2071
- boolean random = CameraPane.RANDOM;
2072
- CameraPane.RANDOM = false; // parse all random nodes
2733
+ boolean random = CameraPane.SWITCH;
2734
+ CameraPane.SWITCH = false; // parse all random nodes
20732735 group.selection.get(i).linkVerticesThis(content);
20742736 // group.selection.get(i).setMasterThis(content); // should be identity
2075
- CameraPane.RANDOM = random;
2737
+ CameraPane.SWITCH = random;
20762738 }
2077
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2739
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20782740 refreshContents();
20792741 }
20802742 } else
2081
- if (event.getSource() == resetsupportItem)
2743
+ if (source == resetsupportItem)
20822744 {
20832745 for (int i=0; i<group.selection.size(); i++)
20842746 {
2085
- boolean random = CameraPane.RANDOM;
2086
- CameraPane.RANDOM = false; // parse all random nodes
2747
+ boolean random = CameraPane.SWITCH;
2748
+ CameraPane.SWITCH = false; // parse all random nodes
20872749 group.selection.get(i).linkVerticesThis(null);
2088
- CameraPane.RANDOM = random;
2750
+ CameraPane.SWITCH = random;
20892751 }
20902752
20912753 refreshContents();
20922754 } else
2093
- if (event.getSource() == resetreferencesItem)
2755
+ if (source == relinkverticesItem)
2756
+ {
2757
+ boolean random = CameraPane.SWITCH;
2758
+ CameraPane.SWITCH = false; // parse all random nodes
2759
+ group.selection.RelinkToSupport();
2760
+ CameraPane.SWITCH = random;
2761
+
2762
+ refreshContents();
2763
+ } else
2764
+ if (source == resetreferencesItem)
20942765 {
20952766 for (int i=0; i<group.selection.size(); i++)
20962767 {
....@@ -2099,11 +2770,11 @@
20992770
21002771 refreshContents();
21012772 } else
2102
- if (event.getSource() == setMasterItem)
2773
+ if (source == setMasterItem)
21032774 {
2104
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2775
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21052776 {
2106
- Object3D content = GraphreeD.clipboard.get(0);
2777
+ Object3D content = Grafreed.clipboard.get(0);
21072778
21082779 if (content instanceof cGroup && ((cGroup)content).transientlink )
21092780 content = ((cGroup)content).get(0);
....@@ -2112,13 +2783,13 @@
21122783 refreshContents();
21132784 }
21142785 } else
2115
- if (event.getSource() == poseMeshItem)
2786
+ if (source == poseMeshItem)
21162787 {
21172788 if (group.selection.size() == 1)
21182789 {
2119
- if (GraphreeD.clipboard.size() == 1)
2790
+ if (Grafreed.clipboard.size() == 1)
21202791 {
2121
- Object3D content = GraphreeD.clipboard.get(0);
2792
+ Object3D content = Grafreed.clipboard.get(0);
21222793
21232794 if (content instanceof cGroup && ((cGroup)content).transientlink )
21242795 content = ((cGroup)content).get(0);
....@@ -2131,19 +2802,19 @@
21312802 }
21322803
21332804 } else
2134
- if (event.getSource() == revertMeshItem)
2805
+ if (source == revertMeshItem)
21352806 {
21362807 RevertMeshes();
21372808 } else
2138
- if (event.getSource() == resetMeshItem)
2809
+ if (source == resetAllItem)
21392810 {
21402811 ResetAll();
21412812 } else
2142
- if (event.getSource() == stepAllItem)
2813
+ if (source == stepAllItem)
21432814 {
21442815 StepAll();
21452816 } else
2146
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
21472818 {
21482819 //int indices[] = jList.getSelectedIndices();
21492820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2151,42 +2822,46 @@
21512822
21522823 ClearSelection(false);
21532824 } else
2154
- if (event.getSource() == clearAllItem)
2825
+ if (source == clearAllItem)
21552826 {
21562827 ClearSelection(true);
21572828 } else
2158
- if (event.getSource() == grabItem)
2829
+ if (source == grabItem || source == groupButton)
21592830 {
2160
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
21612832 } else
2162
- if (event.getSource() == frontItem)
2833
+ if (source == hideItem)
2834
+ {
2835
+ group(new HiddenObject());
2836
+ } else
2837
+ if (source == frontItem)
21632838 {
21642839 front();
21652840 } else
2166
- if (event.getSource() == backItem)
2841
+ if (source == backItem)
21672842 {
21682843 back();
21692844 } else
2170
- if (event.getSource() == cameraItem)
2845
+ if (source == cameraItem)
21712846 {
21722847 makeSomething(new Camera());
21732848 } else
2174
- if (event.getSource() == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
21752850 {
21762851 group(new Composite());
21772852 } else
2178
- if (event.getSource() == randomItem)
2853
+ if (source == switchItem || source == switchButton)
21792854 {
21802855 RandomNode random = new RandomNode();
21812856 group(random);
21822857 if (random.size() > 0)
2183
- random.name = random.get(0).name + "Rnd";
2858
+ random.name = random.get(0).name + "Switch";
21842859 } else
2185
- if (event.getSource() == physicsItem)
2860
+ if (source == physicsItem)
21862861 {
21872862 group(new PhysicsNode());
21882863 } else
2189
- if (event.getSource() == frameselectorItem)
2864
+ if (source == frameselectorItem)
21902865 {
21912866 for (int i=0; i<group.selection.size(); i++)
21922867 {
....@@ -2198,7 +2873,7 @@
21982873 ResetModel();
21992874 refreshContents();
22002875 } else
2201
- if (event.getSource() == switchGeoItem)
2876
+ if (source == switchGeoItem)
22022877 {
22032878 for (int i=0; i<group.selection.size(); i++)
22042879 {
....@@ -2210,7 +2885,7 @@
22102885 ResetModel();
22112886 refreshContents();
22122887 } else
2213
- if (event.getSource() == switchTransfoItem)
2888
+ if (source == switchTransfoItem)
22142889 {
22152890 for (int i=0; i<group.selection.size(); i++)
22162891 {
....@@ -2222,7 +2897,7 @@
22222897 ResetModel();
22232898 refreshContents();
22242899 } else
2225
- if (event.getSource() == morphItem)
2900
+ if (source == morphItem)
22262901 {
22272902 for (int i=0; i<group.selection.size(); i++)
22282903 {
....@@ -2234,7 +2909,7 @@
22342909 ResetModel();
22352910 refreshContents();
22362911 } else
2237
- if (event.getSource() == scriptNodeItem)
2912
+ if (source == scriptNodeItem)
22382913 {
22392914 boolean atleastone = false;
22402915
....@@ -2273,195 +2948,252 @@
22732948 }
22742949 }
22752950 } else
2276
- if (event.getSource() == linkerItem)
2951
+ if (source == linkerItem)
22772952 {
22782953 group(new cLinker());
22792954 } else
2280
- if (event.getSource() == textureItem)
2955
+ if (source == textureItem || source == textureButton)
22812956 {
22822957 group(new TextureNode());
22832958 } else
2284
- if (event.getSource() == shadowXItem)
2959
+ if (source == billboardItem)
2960
+ {
2961
+ group(new BillboardNode());
2962
+ } else
2963
+ if (source == shadowXItem)
22852964 {
22862965 CastShadow(0);
22872966 } else
2288
- if (event.getSource() == shadowYItem)
2967
+ if (source == shadowYItem)
22892968 {
22902969 CastShadow(1);
22912970 } else
2292
- if (event.getSource() == shadowZItem)
2971
+ if (source == shadowZItem)
22932972 {
22942973 CastShadow(2);
22952974 } else
2296
- if (event.getSource() == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
22972976 {
2298
- ungroup();
2977
+ boolean hasRoot = false;
2978
+
2979
+ for (int i=0; i<group.selection.size(); i++)
2980
+ {
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
2986
+ }
2987
+
2988
+ if (!hasRoot)
2989
+ {
2990
+ for (int i=0; i<group.selection.size(); i++)
2991
+ {
2992
+ Ungroup(group.selection.get(i));
2993
+ }
2994
+
2995
+ ClearSelection(false);
2996
+
2997
+ refreshContents();
2998
+ }
22992999 } else
2300
- if (event.getSource() == genUVItem)
3000
+ if (source == genUVItem)
23013001 {
23023002 GenUV();
23033003 } else
2304
- if (event.getSource() == genNormalsCADItem)
3004
+ if (source == genNormalsCADItem)
23053005 {
23063006 GenNormals(true);
23073007 } else
2308
- if (event.getSource() == genNormalsORGANItem)
3008
+ if (source == genNormalsMESHItem)
3009
+ {
3010
+ GenNormalsMESH();
3011
+ } else
3012
+ if (source == genNormalsORGANItem)
23093013 {
23103014 GenNormals(false);
23113015 } else
2312
- if (event.getSource() == stripifyItem)
3016
+ if (source == genNormalsMINEItem)
3017
+ {
3018
+ GenNormalsMINE();
3019
+ } else
3020
+ if (source == stripifyItem)
23133021 {
23143022 Stripify();
23153023 } else
2316
- if (event.getSource() == unstripifyItem)
3024
+ if (source == unstripifyItem)
23173025 {
23183026 Unstripify();
23193027 } else
2320
- if (event.getSource() == trimItem)
3028
+ if (source == trimItem)
23213029 {
23223030 Trim();
23233031 } else
2324
- if (event.getSource() == untrimItem)
3032
+ if (source == untrimItem)
23253033 {
23263034 Untrim();
23273035 } else
2328
- if (event.getSource() == clearColorsItem)
3036
+ if (source == clearColorsItem)
23293037 {
23303038 ClearColors();
23313039 } else
2332
- if (event.getSource() == clearMaterialsItem)
3040
+ if (source == clearMaterialsItem)
23333041 {
23343042 ClearMaterials();
23353043 } else
2336
- if (event.getSource() == liveleavesItem)
3044
+ if (source == liveleavesItem)
23373045 {
23383046 LiveLeaves(true);
23393047 } else
2340
- if (event.getSource() == unliveleavesItem)
3048
+ if (source == unliveleavesItem)
23413049 {
23423050 LiveLeaves(false);
23433051 } else
2344
- if (event.getSource() == supportleavesItem)
3052
+ if (source == supportleavesItem)
23453053 {
23463054 SupportLeaves(true);
23473055 } else
2348
- if (event.getSource() == unsupportleavesItem)
3056
+ if (source == unsupportleavesItem)
23493057 {
23503058 SupportLeaves(false);
23513059 } else
2352
- if (event.getSource() == hideleavesItem)
3060
+ if (source == hideleavesItem)
23533061 {
23543062 HideLeaves(true);
23553063 } else
2356
- if (event.getSource() == showleavesItem)
3064
+ if (source == showleavesItem)
23573065 {
23583066 HideLeaves(false);
23593067 } else
2360
- if (event.getSource() == markleavesItem)
3068
+ if (source == markleavesItem)
23613069 {
23623070 MarkLeaves(true);
23633071 } else
2364
- if (event.getSource() == unmarkleavesItem)
3072
+ if (source == unmarkleavesItem)
23653073 {
23663074 MarkLeaves(false);
23673075 } else
2368
- if (event.getSource() == flipVItem)
3076
+ if (source == rewindleavesItem)
3077
+ {
3078
+ RewindLeaves(true);
3079
+ } else
3080
+ if (source == unrewindleavesItem)
3081
+ {
3082
+ RewindLeaves(false);
3083
+ } else
3084
+ if (source == randomleavesItem)
3085
+ {
3086
+ RandomLeaves(true);
3087
+ } else
3088
+ if (source == unrandomleavesItem)
3089
+ {
3090
+ RandomLeaves(false);
3091
+ } else
3092
+ if (source == flipVItem)
23693093 {
23703094 FlipV(true);
23713095 } else
2372
- if (event.getSource() == unflipVItem)
3096
+ if (source == unflipVItem)
23733097 {
23743098 FlipV(false);
23753099 } else
2376
- if (event.getSource() == lowTexturesItem)
3100
+ if (source == lowTexturesItem)
23773101 {
23783102 SetTexRes(0);
23793103 } else
2380
- if (event.getSource() == normalTexturesItem)
3104
+ if (source == normalTexturesItem)
23813105 {
23823106 SetTexRes(1);
23833107 } else
2384
- if (event.getSource() == highTexturesItem)
3108
+ if (source == highTexturesItem)
23853109 {
23863110 SetTexRes(2);
23873111 } else
2388
- if (event.getSource() == veryhighTexturesItem)
3112
+ if (source == veryhighTexturesItem)
23893113 {
23903114 SetTexRes(3);
23913115 } else
2392
- if (event.getSource() == maxTexturesItem)
3116
+ if (source == maxTexturesItem)
23933117 {
23943118 SetTexRes(4);
23953119 } else
2396
- if (event.getSource() == panoTexturesItem)
3120
+ if (source == panoTexturesItem)
23973121 {
23983122 SetTexRes(5);
23993123 } else
2400
- if (event.getSource() == reverseNormalsItem)
3124
+ if (source == reverseNormalsItem)
24013125 {
24023126 ReverseNormals();
24033127 } else
2404
- if (event.getSource() == parseverticesItem)
3128
+ if (source == parseverticesItem)
24053129 {
24063130 ParseVertices();
24073131 } else
2408
- if (event.getSource() == textureFieldItem)
3132
+ if (source == textureFieldItem)
24093133 {
24103134 TextureVertices();
24113135 } else
2412
- if (event.getSource() == alignItem)
3136
+ if (source == alignItem)
24133137 {
24143138 Align();
24153139 } else
2416
- if (event.getSource() == mirrorItem)
3140
+ if (source == mirrorItem)
24173141 {
24183142 MirrorPoses();
24193143 } else
2420
- if (event.getSource() == reduceMorphItem)
3144
+ if (source == reduceMorphItem)
24213145 {
24223146 MeshReduction(false);
24233147 } else
2424
- if (event.getSource() == reduce34MorphItem)
3148
+ if (source == reduce34MorphItem)
24253149 {
24263150 MeshReduction(true);
24273151 } else
2428
- if (event.getSource() == reverseTrianglesItem)
3152
+ if (source == reverseTrianglesItem)
24293153 {
24303154 ReverseTriangles();
24313155 } else
2432
- if (event.getSource() == reduceMeshItem)
3156
+ if (source == reduceMeshItem)
24333157 {
24343158 ReduceMesh(false);
24353159 } else
2436
- if (event.getSource() == reduce34MeshItem)
3160
+ if (source == reduce34MeshItem)
24373161 {
24383162 ReduceMesh(true);
24393163 } else
2440
- if (event.getSource() == increaseMeshItem)
3164
+ if (source == increaseMeshItem)
24413165 {
24423166 IncreaseMesh();
24433167 } else
2444
- if (event.getSource() == clipMeshItem)
3168
+ if (source == clipMeshItem)
24453169 {
24463170 ClipMesh();
24473171 } else
2448
- if (event.getSource() == smoothMeshItem)
3172
+ if (source == smoothMeshItem)
24493173 {
24503174 SmoothMesh();
24513175 } else
2452
- if (event.getSource() == transformgeometryItem)
3176
+ if (source == transformGeometryItem)
24533177 {
24543178 TransformGeometry();
24553179 } else
2456
- if (event.getSource() == resetTransformItem)
3180
+ if (source == transformChildrenItem)
3181
+ {
3182
+ TransformChildren();
3183
+ } else
3184
+ if (source == resetTransformItem)
24573185 {
24583186 ResetTransform();
24593187 } else
2460
- if (event.getSource() == resetCentroidItem)
3188
+ if (source == resetCentroidItem)
24613189 {
2462
- ResetCentroid();
3190
+ ResetCentroid(true);
24633191 } else
2464
- if (event.getSource() == resetParentItem)
3192
+ if (source == resetCentroidXZItem)
3193
+ {
3194
+ ResetCentroid(false);
3195
+ } else
3196
+ if (source == resetParentItem)
24653197 {
24663198 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24673199 {
....@@ -2471,7 +3203,7 @@
24713203
24723204 refreshContents();
24733205 } else
2474
- if (event.getSource() == repairParentItem)
3206
+ if (source == repairParentItem)
24753207 {
24763208 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773209 {
....@@ -2485,7 +3217,21 @@
24853217
24863218 refreshContents();
24873219 } else
2488
- if (event.getSource() == sortbysizeItem)
3220
+ if (source == repairShadowItem)
3221
+ {
3222
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3223
+ {
3224
+ Object3D obj = (Object3D)e.nextElement();
3225
+ obj.RepairShadow();
3226
+// for (int i=0; i<obj.size(); i++)
3227
+// {
3228
+// obj.get(i).parent = obj;
3229
+// }
3230
+ }
3231
+
3232
+ refreshContents();
3233
+ } else
3234
+ if (source == sortbysizeItem)
24893235 {
24903236 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24913237 {
....@@ -2497,7 +3243,7 @@
24973243 ResetModel();
24983244 refreshContents();
24993245 } else
2500
- if (event.getSource() == sortbynameItem)
3246
+ if (source == sortbynameItem)
25013247 {
25023248 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25033249 {
....@@ -2509,7 +3255,7 @@
25093255 ResetModel();
25103256 refreshContents();
25113257 } else
2512
- if (event.getSource() == attachPigmentItem)
3258
+ if (source == attachPigmentItem)
25133259 {
25143260 String texture = GetFile("Attach pigment");
25153261 Object3D obj;
....@@ -2521,7 +3267,7 @@
25213267
25223268 refreshContents();
25233269 } else
2524
- if (event.getSource() == detachPigmentItem)
3270
+ if (source == detachPigmentItem)
25253271 {
25263272 Object3D obj;
25273273 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2532,7 +3278,7 @@
25323278
25333279 refreshContents();
25343280 } else
2535
- if (event.getSource() == attachBumpItem)
3281
+ if (source == attachBumpItem)
25363282 {
25373283 String texture = GetFile("Attach bump");
25383284 Object3D obj;
....@@ -2544,18 +3290,18 @@
25443290
25453291 refreshContents();
25463292 } else
2547
- if (event.getSource() == detachBumpItem)
3293
+ if (source == detachBumpItem)
25483294 {
25493295 Object3D obj;
25503296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513297 {
25523298 obj = (Object3D)e.nextElement();
2553
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
25543300 }
25553301
25563302 refreshContents();
25573303 } else
2558
- if (event.getSource() == pigmentBumpItem)
3304
+ if (source == pigmentBumpItem)
25593305 {
25603306 Object3D obj;
25613307 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2566,158 +3312,262 @@
25663312
25673313 refreshContents();
25683314 } else
2569
- if (event.getSource() == flashSelectionButton)
3315
+ if (source == embedTexturesItem)
3316
+ {
3317
+ Object3D obj;
3318
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3319
+ {
3320
+ obj = (Object3D)e.nextElement();
3321
+ obj.EmbedTextures(true);
3322
+ }
3323
+
3324
+ refreshContents();
3325
+ } else
3326
+ if (source == deEmbedTexturesItem)
3327
+ {
3328
+ Object3D obj;
3329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3330
+ {
3331
+ obj = (Object3D)e.nextElement();
3332
+ obj.EmbedTextures(false);
3333
+ }
3334
+
3335
+ CameraPane.texturepigment.clear();
3336
+ CameraPane.texturebump.clear();
3337
+
3338
+ refreshContents();
3339
+ } else
3340
+ if (source == flashSelectionButton)
25703341 {
25713342 CameraPane.flash = true;
25723343 refreshContents();
25733344 } else
2574
- if (event.getSource() == oneButton)
3345
+ if (source == oneButton)
25753346 {
25763347 } else
2577
- if (event.getSource() == twoButton)
3348
+ if (source == twoButton)
25783349 {
25793350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
25803355 // bug
25813356 //gridPanel.setDividerLocation(1.0);
25823357 //bigPanel.setDividerLocation(0.0);
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2591
- aWindowConstraints.weightx = 0;
2592
- aWindowConstraints.weighty = 1;
2593
- //bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
3358
+// bigThree.remove(scenePanel);
3359
+// bigThree.remove(centralPanel);
3360
+// bigThree.remove(XYZPanel);
3361
+// aWindowConstraints.gridx = 0;
3362
+// aWindowConstraints.gridy = 0;
3363
+// aWindowConstraints.gridwidth = 1;
3364
+// // aConstraints.gridheight = 3;
3365
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3366
+// aWindowConstraints.weightx = 0;
3367
+// aWindowConstraints.weighty = 1;
3368
+// //bigThree.add(jtp, aWindowConstraints);
3369
+// aWindowConstraints.weightx = 1;
3370
+// aWindowConstraints.gridwidth = 3;
3371
+// // aConstraints.gridheight = 3;
3372
+// aWindowConstraints.gridx = 1;
3373
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3374
+// bigThree.add(centralPanel, aWindowConstraints);
3375
+// aWindowConstraints.weightx = 0;
3376
+// aWindowConstraints.gridx = 4;
3377
+// aWindowConstraints.gridwidth = 1;
3378
+// // aConstraints.gridheight = 3;
3379
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3380
+// //bigThree.add(XYZPanel, aWindowConstraints);
3381
+// scenePanel.setVisible(false);
3382
+// centralPanel.setVisible(true);
3383
+// XYZPanel.setVisible(false);
3384
+ bigThree.ClearUI();
3385
+ bigThree.add(centralPanel);
3386
+ bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
3389
+
3390
+// refreshContents(true);
3391
+//
3392
+// try
3393
+// {
3394
+// java.awt.Robot bot = new java.awt.Robot();
3395
+// int mask = InputEvent.BUTTON1_MASK;
3396
+// bot.mouseMove(100, 100);
3397
+// bot.mousePress(mask);
3398
+// bot.mouseRelease(mask);
3399
+// }
3400
+// catch (Exception e)
3401
+// {
3402
+//
3403
+// }
3404
+
26073405 } else
2608
- if (event.getSource() == threeButton)
3406
+ if (source == threeButton)
26093407 {
26103408 radio.layout = threeButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- //bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aConstraints.gridheight = 3;
2632
- aConstraints.fill = GridBagConstraints.VERTICAL;
2633
- bigThree.add(XYZPanel, aWindowConstraints);
2634
- bigThree.revalidate();
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
3412
+
3413
+// bigThree.remove(scenePanel);
3414
+// bigThree.remove(centralPanel);
3415
+// bigThree.remove(XYZPanel);
3416
+// aWindowConstraints.gridx = 0;
3417
+// aWindowConstraints.gridy = 0;
3418
+// aWindowConstraints.gridwidth = 1;
3419
+// // aConstraints.gridheight = 3;
3420
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3421
+// aWindowConstraints.weightx = 0;
3422
+// aWindowConstraints.weighty = 1;
3423
+// //bigThree.add(jtp, aWindowConstraints);
3424
+// aWindowConstraints.weightx = 1;
3425
+// aWindowConstraints.gridwidth = 3;
3426
+// // aConstraints.gridheight = 3;
3427
+// aWindowConstraints.gridx = 1;
3428
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3429
+// bigThree.add(centralPanel, aWindowConstraints);
3430
+// aWindowConstraints.weightx = 0;
3431
+// aWindowConstraints.gridx = 4;
3432
+// aWindowConstraints.gridwidth = 1;
3433
+// // aConstraints.gridheight = 3;
3434
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3435
+// bigThree.add(XYZPanel, aWindowConstraints);
3436
+// bigThree.validate();
3437
+// scenePanel.setVisible(false);
3438
+// centralPanel.setVisible(true);
3439
+// XYZPanel.setVisible(true);
3440
+ bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
3442
+ bigThree.add(centralPanel);
3443
+ bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
26353446 } else
2636
- if (event.getSource() == fourButton)
3447
+ if (source == fourButton)
26373448 {
26383449 radio.layout = fourButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2647
- aWindowConstraints.weightx = 1;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- //bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aWindowConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- //bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
3453
+
3454
+// bigThree.remove(scenePanel);
3455
+// bigThree.remove(centralPanel);
3456
+// bigThree.remove(XYZPanel);
3457
+// aWindowConstraints.gridx = 0;
3458
+// aWindowConstraints.gridy = 0;
3459
+// aWindowConstraints.gridwidth = 1;
3460
+// // aWindowConstraints.gridheight = 3;
3461
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3462
+// aWindowConstraints.weightx = 1;
3463
+// aWindowConstraints.weighty = 1;
3464
+// bigThree.add(scenePanel, aWindowConstraints);
3465
+// aWindowConstraints.weightx = 1;
3466
+// aWindowConstraints.gridwidth = 3;
3467
+// // aConstraints.gridheight = 3;
3468
+// aWindowConstraints.gridx = 1;
3469
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3470
+// //bigThree.add(cameraPanel, aWindowConstraints);
3471
+// aWindowConstraints.weightx = 0;
3472
+// aWindowConstraints.gridx = 4;
3473
+// aWindowConstraints.gridwidth = 1;
3474
+// // aWindowConstraints.gridheight = 3;
3475
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3476
+// //bigThree.add(XYZPanel, aWindowConstraints);
3477
+// bigThree.validate();
3478
+// scenePanel.setVisible(true);
3479
+// centralPanel.setVisible(false);
3480
+// XYZPanel.setVisible(false);
3481
+ bigThree.ClearUI();
3482
+ bigThree.add(scenePanel);
3483
+ bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
26633486 } else
2664
- if (event.getSource() == sixButton)
3487
+ if (source == sixButton)
26653488 {
26663489 radio.layout = sixButton;
2667
- bigThree.remove(jtp);
2668
- bigThree.remove(cameraPanel);
2669
- bigThree.remove(XYZPanel);
2670
- aWindowConstraints.gridx = 0;
2671
- aWindowConstraints.gridy = 0;
2672
- aWindowConstraints.gridwidth = 1;
2673
- // aConstraints.gridheight = 3;
2674
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2675
- aWindowConstraints.weightx = 0;
2676
- aWindowConstraints.weighty = 1;
2677
- bigThree.add(jtp, aWindowConstraints);
2678
- aWindowConstraints.weightx = 1;
2679
- aWindowConstraints.gridwidth = 3;
2680
- // aWindowConstraints.gridheight = 3;
2681
- aWindowConstraints.gridx = 1;
2682
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2683
- bigThree.add(cameraPanel, aWindowConstraints);
2684
- aWindowConstraints.weightx = 0;
2685
- aWindowConstraints.gridx = 4;
2686
- aWindowConstraints.gridwidth = 1;
2687
- // aWindowConstraints.gridheight = 3;
2688
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2689
- //bigThree.add(XYZPanel, aConstraints);
2690
- bigThree.revalidate();
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
3493
+
3494
+// bigThree.remove(scenePanel);
3495
+// bigThree.remove(centralPanel);
3496
+// bigThree.remove(XYZPanel);
3497
+// aWindowConstraints.gridx = 0;
3498
+// aWindowConstraints.gridy = 0;
3499
+// aWindowConstraints.gridwidth = 1;
3500
+// // aConstraints.gridheight = 3;
3501
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3502
+// aWindowConstraints.weightx = 0;
3503
+// aWindowConstraints.weighty = 1;
3504
+// bigThree.add(scenePanel, aWindowConstraints);
3505
+// aWindowConstraints.weightx = 1;
3506
+// aWindowConstraints.gridwidth = 3;
3507
+// // aWindowConstraints.gridheight = 3;
3508
+// aWindowConstraints.gridx = 1;
3509
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3510
+// bigThree.add(centralPanel, aWindowConstraints);
3511
+// aWindowConstraints.weightx = 0;
3512
+// aWindowConstraints.gridx = 4;
3513
+// aWindowConstraints.gridwidth = 1;
3514
+// // aWindowConstraints.gridheight = 3;
3515
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3516
+// //bigThree.add(XYZPanel, aConstraints);
3517
+// bigThree.validate();
3518
+// scenePanel.setVisible(true);
3519
+// centralPanel.setVisible(true);
3520
+// XYZPanel.setVisible(false);
3521
+ bigThree.ClearUI();
3522
+ bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
3524
+ bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
26913527 } else
2692
- if (event.getSource() == sevenButton)
3528
+ if (source == sevenButton)
26933529 {
26943530 radio.layout = sevenButton;
2695
- bigThree.remove(jtp);
2696
- bigThree.remove(cameraPanel);
2697
- bigThree.remove(XYZPanel);
2698
- aWindowConstraints.gridx = 0;
2699
- aWindowConstraints.gridy = 0;
2700
- aWindowConstraints.gridwidth = 1;
2701
- // aWindowConstraints.gridheight = 3;
2702
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2703
- aWindowConstraints.weightx = 0;
2704
- aWindowConstraints.weighty = 1;
2705
- bigThree.add(jtp, aWindowConstraints);
2706
- aWindowConstraints.weightx = 1;
2707
- aWindowConstraints.gridwidth = 3;
2708
- // aWindowConstraints.gridheight = 3;
2709
- aWindowConstraints.gridx = 1;
2710
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2711
- bigThree.add(cameraPanel, aWindowConstraints);
2712
- aWindowConstraints.weightx = 0;
2713
- aWindowConstraints.gridx = 4;
2714
- aWindowConstraints.gridwidth = 1;
2715
- // aConstraints.gridheight = 3;
2716
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2717
- bigThree.add(XYZPanel, aWindowConstraints);
2718
- bigThree.revalidate();
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
3534
+
3535
+// bigThree.remove(scenePanel);
3536
+// bigThree.remove(centralPanel);
3537
+// bigThree.remove(XYZPanel);
3538
+// aWindowConstraints.gridx = 0;
3539
+// aWindowConstraints.gridy = 0;
3540
+// aWindowConstraints.gridwidth = 1;
3541
+// // aWindowConstraints.gridheight = 3;
3542
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3543
+// aWindowConstraints.weightx = 0;
3544
+// aWindowConstraints.weighty = 1;
3545
+// bigThree.add(scenePanel, aWindowConstraints);
3546
+// aWindowConstraints.weightx = 1;
3547
+// aWindowConstraints.gridwidth = 3;
3548
+// // aWindowConstraints.gridheight = 3;
3549
+// aWindowConstraints.gridx = 1;
3550
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3551
+// bigThree.add(centralPanel, aWindowConstraints);
3552
+// aWindowConstraints.weightx = 0;
3553
+// aWindowConstraints.gridx = 4;
3554
+// aWindowConstraints.gridwidth = 1;
3555
+// // aConstraints.gridheight = 3;
3556
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3557
+// bigThree.add(XYZPanel, aWindowConstraints);
3558
+// bigThree.validate();
3559
+// scenePanel.setVisible(true);
3560
+// centralPanel.setVisible(true);
3561
+// XYZPanel.setVisible(true);
3562
+ bigThree.ClearUI();
3563
+ bigThree.add(scenePanel);
3564
+ bigThree.add(centralPanel);
3565
+ bigThree.add(XYZPanel);
3566
+ bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
27193569 } else
2720
- if (event.getSource() == rootButton)
3570
+ if (source == rootButton)
27213571 {
27223572 Object3D obj;
27233573 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2727,66 +3577,84 @@
27273577 EditObject(obj);
27283578 }
27293579
3580
+ cameraView.requestFocusInWindow();
27303581 refreshContents(true);
27313582 } else
2732
- if (event.getSource() == closeButton)
3583
+ if (source == closeButton)
27333584 {
27343585 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27353586 cRadio ab;
27363587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27373588 {
27383589 ab = (cRadio)e.nextElement();
2739
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27403591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
27413598 buttonGroup.remove(ab);
27423599 radioPanel.remove(ab);
27433600
2744
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
27453603 // ab.GetObject().objectUI = null; // ?????????
27463604
27473605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27483606 break;
27493607 }
27503608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
27513611 refreshContents(true);
27523612 } else
2753
- if (event.getSource() == editItem || event.getSource() == editButton)
3613
+ if (source == editItem || source == editButton)
27543614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
27553621 EditSelection(false);
27563622 } else
2757
- if (event.getSource() == uneditButton)
3623
+ if (source == uneditButton)
27583624 {
27593625 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27603626 {
27613627 Object3D child = (Object3D)e.nextElement();
27623628 if(child.editWindow != null)
27633629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
27643631 child.CloseUI();
27653632 listUI.remove(child);
27663633
2767
- child.editWindow = null; // ???????????
3634
+ //child.editWindow = null; // ???????????
27683635 }
2769
- objEditor.ctrlPanel.revalidate();
3636
+ objEditor.ctrlPanel.FlushUI();
27703637 //objEditor.jTree.clearSelection();
27713638 //objEditor.ResetSliders();
27723639 refreshContents(true);
27733640 } else
2774
- if (event.getSource() == clearPanelButton)
3641
+ if (source == clearPanelButton)
27753642 {
27763643 assert(copy == group);
27773644 //copy.ClearUI();
27783645 for (Object3D obj : listUI)
27793646 {
3647
+ obj.pinned = false;
27803648 obj.CloseUI();
27813649 }
27823650 listUI.clear();
27833651 refreshContents(true);
27843652 } else
2785
- if (event.getSource() == allParamsButton)
3653
+ if (source == allParamsButton)
27863654 {
27873655 assert(copy == group);
27883656
2789
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27903658
27913659 for (Object3D obj : listUI)
27923660 {
....@@ -2803,19 +3671,19 @@
28033671
28043672 refreshContents(true);
28053673 } else
2806
- if (event.getSource() == unselectButton)
3674
+ if (source == unselectButton)
28073675 {
28083676 objEditor.jTree.clearSelection();
2809
- // ?? oct 2012 GraphreeD.clipboard.clear();
3677
+ // ?? oct 2012 GrafreeD.clipboard.clear();
28103678 objEditor.ResetSliders();
28113679 refreshContents(true);
28123680 } else
2813
- if(event.getSource() instanceof cRadio)
3681
+ if(source instanceof cRadio)
28143682 {
28153683 group.parent = keepparent;
28163684 group.attributes = 0;
28173685 //group.editWindow = null;
2818
- /*cRadio*/ radio = (cRadio)event.getSource();
3686
+ /*cRadio*/ radio = (cRadio)source;
28193687 Object3D obj = radio.GetObject();
28203688 System.out.println("Edit " + obj);
28213689 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2835,7 +3703,10 @@
28353703 }
28363704
28373705 copy = group;
2838
- //CameraPane.theRenderer.object = group;
3706
+
3707
+ SetUndoStates();
3708
+
3709
+ //Globals.theRenderer.object = group;
28393710 if(!useclient)
28403711 {
28413712 cameraView.renderCamera = radio.camera;
....@@ -2844,25 +3715,52 @@
28443715 cameraView.cameras[cameraView.cameracount] = radio.camera;
28453716 cameraView.targetLookAt.set(radio.camera.lookAt);
28463717 cameraView.object = group;
2847
- cameraView.lighttouched = true;
3718
+ //cameraView.lighttouched = true;
3719
+ Globals.lighttouched = true;
28483720 topView.object = group;
28493721 frontView.object = group;
28503722 sideView.object = group;
28513723 }
2852
- group.editWindow = this;
3724
+
3725
+// fix "+" issue
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
3728
+
28533729 /*
28543730 currentLayout = radio.layout;
28553731 if (currentLayout == null)
28563732 currentLayout = sevenButton;
28573733 */
28583734 radio.layout.doClick();
3735
+
3736
+ ClearUnpinned();
3737
+ //Grafreed.Assert(group != null);
3738
+ //Grafreed.Assert(group.selection != null);
3739
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3740
+ if (group.selection == null || group.selection.size() == 1)
3741
+ EditSelection(false);
28593742 keepparent = group.parent;
28603743 // PARENT = NULL or not???
28613744 //group.parent = null; // ROOT
28623745 //group.attributes = -1;
28633746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
28643749 refreshContents(true);
2865
- }
3750
+ } else if (event.getSource() == editCameraItem)
3751
+ {
3752
+ cameraView.ProtectCamera();
3753
+ cameraView.repaint();
3754
+ return;
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3756
+ {
3757
+ cameraView.RevertCamera();
3758
+ cameraView.repaint();
3759
+ return;
3760
+ // } else if (event.getSource() == textureButton)
3761
+ // {
3762
+ // return; // true;
3763
+ }
28663764 else
28673765 {
28683766 //return super.action(event, arg);
....@@ -2871,7 +3769,6 @@
28713769 }
28723770
28733771 boolean useclient = false;
2874
- cRadio radio;
28753772
28763773 void ToggleRoot()
28773774 {
....@@ -2880,7 +3777,7 @@
28803777 if (useclient)
28813778 {
28823779 cameraView.object = client;
2883
- cameraView.lighttouched = true;
3780
+ Globals.lighttouched = true;
28843781 //topView.object = client;
28853782 //frontView.object = client;
28863783 //sideView.object = client;
....@@ -2888,7 +3785,7 @@
28883785 else
28893786 {
28903787 cameraView.object = group;
2891
- cameraView.lighttouched = true;
3788
+ Globals.lighttouched = true;
28923789 //topView.object = group;
28933790 //frontView.object = group;
28943791 //sideView.object = group;
....@@ -2923,6 +3820,28 @@
29233820 refreshContents();
29243821 }
29253822
3823
+ void TransformChildren()
3824
+ {
3825
+ Object3D obj;
3826
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3827
+ {
3828
+ obj = (Object3D)e.nextElement();
3829
+ obj.KeepTextureMatrices();
3830
+ obj.TransformChildren();
3831
+ obj.RestoreTextureMatrices();
3832
+
3833
+// if (obj.parent == null)
3834
+// {
3835
+// System.out.println("NULL PARENT!");
3836
+// new Exception().printStackTrace();
3837
+// }
3838
+// else
3839
+// TouchTransform(obj);
3840
+// //obj.parent.Touch();
3841
+ }
3842
+
3843
+ refreshContents();
3844
+ }
29263845
29273846 void ResetTransform()
29283847 {
....@@ -3035,7 +3954,7 @@
30353954 refreshContents();
30363955 }
30373956
3038
- void ResetCentroid()
3957
+ void ResetCentroid(boolean full)
30393958 {
30403959 Object3D obj;
30413960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3050,12 +3969,16 @@
30503969 LA.matIdentity(Object3D.mat);
30513970 obj.getBounds(minima, maxima, false);
30523971 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3053
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3972
+ if (full)
3973
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30543974 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30553975 obj.TransformMesh(Object3D.mat);
3976
+
30563977 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3978
+ if (full)
3979
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30583980 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3981
+
30593982 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30603983 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30613984 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3084,7 +4007,8 @@
30844007
30854008 int size = obj.MemorySize();
30864009
3087
- System.err.println((size/1024) + " KB is the size of " + obj);
4010
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4011
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30884012 }
30894013 }
30904014 catch (Exception e)
....@@ -3121,9 +4045,9 @@
31214045 obj = (Object3D)e.nextElement();
31224046
31234047 System.out.println("Object is: " + obj);
3124
- GraphreeD.AnalyzeObject(obj);
4048
+ Grafreed.AnalyzeObject(obj);
31254049 System.out.println("Boundary rep: " + obj.bRep);
3126
- GraphreeD.AnalyzeObject(obj.bRep);
4050
+ Grafreed.AnalyzeObject(obj.bRep);
31274051
31284052 // System.err.println((size/1024) + " KB is the size of " + obj);
31294053 }
....@@ -3165,6 +4089,20 @@
31654089 void GenNormals(boolean crease)
31664090 {
31674091 group.GenNormalsS(crease);
4092
+
4093
+ refreshContents();
4094
+ }
4095
+
4096
+ void GenNormalsMESH()
4097
+ {
4098
+ group.GenNormalsMeshS();
4099
+
4100
+ refreshContents();
4101
+ }
4102
+
4103
+ void GenNormalsMINE()
4104
+ {
4105
+ group.selection.GenNormalsMINE();
31684106
31694107 refreshContents();
31704108 }
....@@ -3250,7 +4188,7 @@
32504188 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
32514189 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32524190 //
3253
-// g.add(GraphreeD.clipboard);
4191
+// g.add(GrafreeD.clipboard);
32544192 //
32554193 // buffer.add(g);
32564194 // }
....@@ -3269,8 +4207,8 @@
32694207 // nodes = new Object3D();
32704208 // vertices = new Vector<Vertex>();
32714209 //
3272
-// boolean epsequal = GraphreeD.epsequal;
3273
-// GraphreeD.epsequal = true;
4210
+// boolean epsequal = GrafreeD.epsequal;
4211
+// GrafreeD.epsequal = true;
32744212 //
32754213 // for (int i=0; i<group.selection.size(); i++)
32764214 // {
....@@ -3311,7 +4249,7 @@
33114249 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33124250 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33134251 //
3314
-// g.add(GraphreeD.clipboard);
4252
+// g.add(GrafreeD.clipboard);
33154253 //
33164254 // buffer.add(g);
33174255 // }
....@@ -3319,7 +4257,7 @@
33194257 // makeSomething(buffer, i==group.selection.size()-1);
33204258 // }
33214259 //
3322
-// GraphreeD.epsequal = epsequal;
4260
+// GrafreeD.epsequal = epsequal;
33234261 //
33244262 // //buffer = null;
33254263 // temprep = null;
....@@ -3330,8 +4268,8 @@
33304268
33314269 void ParseVertices()
33324270 {
3333
- boolean epsequal = GraphreeD.epsequal;
3334
- GraphreeD.epsequal = true;
4271
+ boolean epsequal = Grafreed.epsequal;
4272
+ Grafreed.epsequal = true;
33354273
33364274 for (int i=0; i<group.selection.size(); i++)
33374275 {
....@@ -3356,7 +4294,7 @@
33564294 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33574295 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33584296
3359
- g.add(GraphreeD.clipboard);
4297
+ g.add(Grafreed.clipboard);
33604298
33614299 buffer.add(g);
33624300 }
....@@ -3371,7 +4309,7 @@
33714309 makeSomething(buffer, i==group.selection.size()-1);
33724310 }
33734311
3374
- GraphreeD.epsequal = epsequal;
4312
+ Grafreed.epsequal = epsequal;
33754313
33764314 refreshContents();
33774315 }
....@@ -3389,7 +4327,16 @@
33894327 String pigment = Object3D.GetPigment(tex);
33904328 //String bump = Object3D.GetBump(tex);
33914329
3392
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4330
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4331
+
4332
+ try
4333
+ {
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4335
+ }
4336
+ catch (Exception e)
4337
+ {
4338
+ System.err.println("FAIL: " + node);
4339
+ }
33934340
33944341 double s = v.s;
33954342
....@@ -3416,7 +4363,7 @@
34164363 scale /= 3;
34174364
34184365 scale /= 0xFF;
3419
- scale /= 4;
4366
+ // c'est quoi ca? scale /= 4;
34204367
34214368 //v.AO = scale;
34224369
....@@ -3437,12 +4384,26 @@
34374384
34384385 void Align()
34394386 {
4387
+ if (group.selection.size() == 0)
4388
+ return;
4389
+
4390
+ cVector bbmin = new cVector();
4391
+ cVector bbmax = new cVector();
4392
+
4393
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4394
+
4395
+ double dx = bbmax.x - bbmin.x;
4396
+ double dy = bbmax.y - bbmin.y;
4397
+ double dz = bbmax.z - bbmin.z;
4398
+
4399
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4400
+
34404401 for (int i=0; i<group.selection.size(); i++)
34414402 {
34424403 Object3D obj = group.selection.get(i);
34434404
3444
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3445
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4405
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4406
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34464407 }
34474408
34484409 refreshContents();
....@@ -3455,7 +4416,7 @@
34554416 // ref.SaveSupports();
34564417 // Object3D par = ref.parent;
34574418 // ref.parent = null;
3458
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4419
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
34594420 // ref.parent = par;
34604421 // ref.RestoreSupports();
34614422
....@@ -3463,11 +4424,11 @@
34634424
34644425 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34654426
3466
- boolean random = CameraPane.RANDOM;
3467
- CameraPane.RANDOM = false; // parse all random nodes
4427
+ boolean random = CameraPane.SWITCH;
4428
+ CameraPane.SWITCH = false; // parse all random nodes
34684429 lowres.linkVerticesThis(null);
34694430 lowres.linkVerticesThis(sn);
3470
- CameraPane.RANDOM = random;
4431
+ CameraPane.SWITCH = random;
34714432
34724433 System.err.flush();
34734434
....@@ -3485,7 +4446,7 @@
34854446 // lowres.SaveSupports();
34864447 // par = lowres.parent;
34874448 // lowres.parent = null;
3488
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4449
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
34894450 Object3D newlow = CloneObject(lowres, false);
34904451 newlow.name = sn.switchobject.get(i).name;
34914452 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3507,7 +4468,7 @@
35074468 return;
35084469
35094470 Object3D poses = group.selection.get(0);
3510
- Object3D ref = GraphreeD.clipboard.get(0);
4471
+ Object3D ref = Grafreed.clipboard.get(0);
35114472
35124473 Object3D newgroup = new Object3D("Po:" + poses.name);
35134474
....@@ -3676,7 +4637,7 @@
36764637 group.selection.RelinkToSupport(); // july 2014
36774638 System.out.println("DONE.");
36784639 refreshContents();
3679
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4640
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36804641 }
36814642
36824643 void ReduceMesh(boolean reduction34)
....@@ -3701,20 +4662,20 @@
37014662
37024663 void ClipMesh()
37034664 {
3704
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4665
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37054666 {
3706
- Object3D content = GraphreeD.clipboard.get(0);
4667
+ Object3D content = Grafreed.clipboard.get(0);
37074668
37084669 if (content instanceof cGroup && ((cGroup)content).transientlink )
37094670 content = ((cGroup)content).get(0);
37104671
37114672 // for (int i=0; i<group.selection.size(); i++)
37124673 // {
3713
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4674
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37144675 // }
3715
- group.selection.ClipMesh(GraphreeD.clipboard);
4676
+ group.selection.ClipMesh(Grafreed.clipboard);
37164677 }
3717
-// group.selection.ClipMesh(GraphreeD.clipboard);
4678
+// group.selection.ClipMesh(GrafreeD.clipboard);
37184679 System.out.println("DONE.");
37194680 refreshContents();
37204681 }
....@@ -3759,6 +4720,18 @@
37594720 void MarkLeaves(boolean hide)
37604721 {
37614722 group.selection.MarkLeaves(hide);
4723
+ refreshContents();
4724
+ }
4725
+
4726
+ void RewindLeaves(boolean hide)
4727
+ {
4728
+ group.selection.RewindLeaves(hide);
4729
+ refreshContents();
4730
+ }
4731
+
4732
+ void RandomLeaves(boolean hide)
4733
+ {
4734
+ group.selection.RandomLeaves(hide);
37624735 refreshContents();
37634736 }
37644737
....@@ -3833,28 +4806,25 @@
38334806 // }
38344807 // }
38354808
3836
- static boolean allparams = true;
3837
-
3838
- static Vector<Object3D> listUI = new Vector<Object3D>();
3839
-
38404809 void EditSelection(boolean newWindow)
38414810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
38424817 // aConstraints.gridy = 0;
38434818 for (int i=0; i<group.selection.size(); i++)
38444819 {
38454820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38464821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3847
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38484823
38494824 Object3D elem = (Object3D)group.selection.elementAt(i);
3850
- if(elem != group)
4825
+ if(elem != group || !newWindow)
38514826 {
3852
- // if (!(elem instanceof Composite))
3853
- // newWindow = false;
3854
- listUI.add(elem);
3855
- elem.openEditWindow(this, newWindow); //, false);
3856
- System.out.println("edit : " + elem);
3857
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
38584828 }
38594829 }
38604830 }
....@@ -3929,7 +4899,8 @@
39294899 //new Exception().printStackTrace();
39304900
39314901 freezemodel = true;
3932
-
4902
+ ClearUnpinned();
4903
+
39334904 /**/
39344905 //switch (event.id)
39354906 {
....@@ -3937,7 +4908,6 @@
39374908 //case 702: // Event.LIST_DESELECT
39384909 group.deselectAll();
39394910 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3940
- objEditor.ClearInfo(); // .GetMaterial());
39414911 if (tps != null)
39424912 {
39434913 for (int i=0; i < tps.length; i++)
....@@ -3946,33 +4916,39 @@
39464916
39474917 //if (child.parent != null)
39484918 //child.parent.addSelectee(child);
4919
+ objEditor.SetMaterial(child);
39494920 group.addSelectee(child);
3950
- objEditor.SetMaterial(child); // .GetMaterial());
3951
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3952
- System.err.println("info : " + child.GetPath());
39534921 }
39544922 }
3955
- else
3956
- {
3957
- objEditor.SetMaterial(group); // .GetMaterial());
3958
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3959
- System.err.println("info : " + group.GetPath());
3960
- }
4923
+// else
4924
+// {
4925
+// objEditor.SetMaterial(group); // .GetMaterial());
4926
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4927
+// System.err.println("info : " + group.GetPath());
4928
+// }
39614929
3962
- objEditor.SetText(); // jan 2014
3963
-
3964
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4930
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39654931 CameraPane.flash = true;
39664932
3967
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4933
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39684934 // a camera
39694935 {
3970
- CameraPane.camerachangeframe = 0; // don't refuse it
3971
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3972
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3973
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4937
+ {
4938
+ CameraPane.camerachangeframe = 0; // don't refuse it
4939
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4940
+ }
4941
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4942
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39744943 }
39754944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
39764952 refreshContents();
39774953 //return true;
39784954 }
....@@ -3981,6 +4957,35 @@
39814957
39824958 freezemodel = false;
39834959 }
4960
+
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
4969
+ void refreshContents(boolean cp)
4970
+ {
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4973
+ {
4974
+ objEditor.ClearInfo(); // .GetMaterial());
4975
+
4976
+ for (int i=0; i < group.selection.Size(); i++)
4977
+ {
4978
+ Object3D child = (Object3D) group.selection.get(i);
4979
+
4980
+ objEditor.AddInfo(child, this, true);
4981
+ System.err.println("info : " + child.GetPath());
4982
+ }
4983
+
4984
+ objEditor.SetText(); // jan 2014
4985
+ }
4986
+
4987
+ super.refreshContents(cp);
4988
+ }
39844989
39854990 void linkSomething(Object3D thing)
39864991 {
....@@ -4052,16 +5057,19 @@
40525057 {
40535058 if (group.selection.isEmpty())
40545059 return;
4055
- GraphreeD.clipboardIsTempGroup = false;
5060
+
5061
+ Grafreed.clipboardIsTempGroup = false;
40565062 Composite tGroup = null;
40575063 if (group.selection.size() > 0) // 1)
40585064 {
40595065 tGroup = new cGroup();
4060
- GraphreeD.clipboardIsTempGroup = true;
5066
+ Grafreed.clipboardIsTempGroup = true;
40615067 }
40625068
40635069 if (cut)
40645070 {
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
40655073 //int indices[] = jList.getSelectedIndices();
40665074 //for (int i = indices.length - 1; i >= 0; i--)
40675075 //jList.remove(indices[i]);
....@@ -4097,16 +5105,16 @@
40975105 //System.out.println("cut " + child);
40985106 //System.out.println("parent = " + child.parent);
40995107 // tmp.addChild(child);
4100
- if (GraphreeD.clipboardIsTempGroup)
5108
+ if (Grafreed.clipboardIsTempGroup)
41015109 tGroup.add/*Child*/(tmp);
41025110 else
4103
- GraphreeD.clipboard = tmp;
5111
+ Grafreed.clipboard = tmp;
41045112 }
41055113 else
4106
- if (GraphreeD.clipboardIsTempGroup)
5114
+ if (Grafreed.clipboardIsTempGroup)
41075115 tGroup.add/*Child*/(child);
41085116 else
4109
- GraphreeD.clipboard = child;
5117
+ Grafreed.clipboard = child;
41105118 }
41115119
41125120 //ResetModel();
....@@ -4138,21 +5146,23 @@
41385146 //System.out.println("cut " + elem);
41395147 //System.out.println("parent = " + elem.parent);
41405148 // tmp.addChild(elem);
4141
- if (GraphreeD.clipboardIsTempGroup)
5149
+ if (Grafreed.clipboardIsTempGroup)
41425150 tGroup.add/*Child*/(tmp);
41435151 else
4144
- GraphreeD.clipboard = tmp;
5152
+ Grafreed.clipboard = tmp;
41455153 }
41465154 else
4147
- if (GraphreeD.clipboardIsTempGroup)
5155
+ if (Grafreed.clipboardIsTempGroup)
41485156 tGroup.add/*Child*/(child);
41495157 else
4150
- GraphreeD.clipboard = child;
5158
+ Grafreed.clipboard = child;
41515159 }
41525160
41535161 }
4154
- if (GraphreeD.clipboardIsTempGroup)
4155
- GraphreeD.clipboard = tGroup;
5162
+
5163
+ if (Grafreed.clipboardIsTempGroup)
5164
+ Grafreed.clipboard = tGroup;
5165
+
41565166 if (cut)
41575167 {
41585168 ResetModel();
....@@ -4162,11 +5172,15 @@
41625172
41635173 void paste(boolean expand)
41645174 {
4165
- // if (GraphreeD.clipboard == null)
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
5179
+ // if (GrafreeD.clipboard == null)
41665180 // return;
41675181 boolean first = true;
41685182
4169
- if (GraphreeD.clipboardIsTempGroup)
5183
+ if (Grafreed.clipboardIsTempGroup)
41705184 {
41715185 Composite temp;
41725186
....@@ -4177,7 +5191,7 @@
41775191 temp = (Composite)Applet3D.clipboard.deepCopy();
41785192 */
41795193 Object3D elem;
4180
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5194
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41815195 {
41825196 Object3D child = (Object3D)e.nextElement();
41835197
....@@ -4191,7 +5205,7 @@
41915205 else
41925206 elem = child.deepCopy(); // ?
41935207 child.parent = keepparent;
4194
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5208
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
41955209 // elem = elem.get(0);
41965210 makeSomething(elem, true); // ?? first);
41975211 //group.addChild(elem);
....@@ -4211,23 +5225,24 @@
42115225 //Object3D cb = Applet3D.clipboard;
42125226 //temp.addChild(cb);
42135227 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4214
- assert(GraphreeD.clipboard.parent == null);
4215
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4216
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4217
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4218
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
5228
+ assert(Grafreed.clipboard.parent == null);
5229
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5230
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5231
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5232
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42195233 else
4220
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4221
- GraphreeD.clipboard.get(0).parent = keepparent;
5234
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5235
+ Grafreed.clipboard.get(0).parent = keepparent;
42225236 }
42235237
5238
+ Globals.REPLACEONMAKE = keep;
42245239 ResetModel();
42255240 refreshContents();
42265241 }
42275242
4228
- void pasteInto(boolean copyit)
5243
+ void pasteInto(boolean copyit, boolean clone)
42295244 {
4230
-// if (GraphreeD.clipboard == null)
5245
+// if (GrafreeD.clipboard == null)
42315246 // return;
42325247
42335248 if (group.selection.size() != 1)
....@@ -4254,15 +5269,22 @@
42545269 if (copyit)
42555270 {
42565271 // paste(false);
4257
- CloneClipboard(false); // sept 2014
5272
+ if (clone)
5273
+ {
5274
+ CloneClipboard(false); // sept 2014
5275
+ }
5276
+ else
5277
+ {
5278
+ paste(false);
5279
+ }
42585280 }
42595281 else
42605282 {
42615283 boolean first = true;
42625284
4263
- if (GraphreeD.clipboardIsTempGroup)
5285
+ if (Grafreed.clipboardIsTempGroup)
42645286 {
4265
- Composite temp = (Composite)GraphreeD.clipboard;
5287
+ Composite temp = (Composite)Grafreed.clipboard;
42665288 Object3D copy;
42675289 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42685290 {
....@@ -4272,7 +5294,7 @@
42725294 }
42735295 } else
42745296 {
4275
- linkSomething(GraphreeD.clipboard); //.get(0));
5297
+ linkSomething(Grafreed.clipboard); //.get(0));
42765298 }
42775299 }
42785300 }
....@@ -4349,6 +5371,10 @@
43495371
43505372 void group(Object3D csg, boolean grab)
43515373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
43525378 if (//false) // why??
43535379 !group.selection.isEmpty())
43545380 {
....@@ -4462,8 +5488,34 @@
44625488 //node.add(csg);
44635489 //makeSomething(node);
44645490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
44655492 }
44665493
5494
+ void Ungroup(Object3D g)
5495
+ {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
5500
+ if (g instanceof HiddenObject)
5501
+ {
5502
+ HiddenObject h = (HiddenObject) g;
5503
+
5504
+ for (int i=0; i<h.ActualSize(); i++)
5505
+ {
5506
+ objEditor.makeSomething(h.get(i), false);
5507
+ }
5508
+ }
5509
+ else
5510
+ {
5511
+ for (int i=0; i<g.Size(); i++)
5512
+ {
5513
+ objEditor.makeSomething(g.get(i), false);
5514
+ }
5515
+ }
5516
+ Globals.REPLACEONMAKE = keep;
5517
+ }
5518
+
44675519 void ungroup()
44685520 {
44695521 /*
....@@ -4657,21 +5709,6 @@
46575709 }
46585710 */
46595711
4660
- void ImportGFD()
4661
- {
4662
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4663
- browser.show();
4664
- String filename = browser.getFile();
4665
- if (filename != null && filename.length() > 0)
4666
- {
4667
- String fullname = browser.getDirectory() + filename;
4668
-
4669
- //Object3D readobj =
4670
- objEditor.ReadGFD(fullname, objEditor);
4671
- //makeSomething(readobj);
4672
- }
4673
- }
4674
-
46755712 /*
46765713 public void Callback(Object obj)
46775714 {
....@@ -4695,26 +5732,9 @@
46955732 }
46965733 */
46975734
4698
- void ImportVRMLX3D()
4699
- {
4700
- if (GraphreeD.standAlone)
4701
- {
4702
- /**/
4703
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4704
- browser.show();
4705
- String filename = browser.getFile();
4706
- if (filename != null && filename.length() > 0)
4707
- {
4708
- String fullname = browser.getDirectory() + filename;
4709
- LoadVRMLX3D(fullname);
4710
- }
4711
- /**/
4712
- }
4713
- }
4714
-
47155735 String GetFile(String dialogName)
47165736 {
4717
- if (GraphreeD.standAlone)
5737
+ if (Grafreed.standAlone)
47185738 {
47195739 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47205740 browser.show();
....@@ -4778,10 +5798,49 @@
47785798 cButton flashSelectionButton;
47795799 cButton editButton;
47805800 cButton uneditButton;
5801
+ JCheckBox allParamsButton;
47815802 cButton clearpanelButton;
4782
- cButton allParamsButton;
47835803 cButton unselectButton;
47845804
5805
+ cButton restoreCameraButton;
5806
+
5807
+ cButton saveButton;
5808
+ cButton oneStepButton;
5809
+
5810
+ cButton groupButton;
5811
+ cButton ungroupButton;
5812
+ cButton compositeButton;
5813
+ cButton switchButton;
5814
+ cButton loopButton;
5815
+ cButton textureButton;
5816
+
5817
+ cButton skybox1Button;
5818
+ cButton skybox2Button;
5819
+ cButton skybox3Button;
5820
+ cButton skybox4Button;
5821
+ cButton skybox5Button;
5822
+ cButton skybox6Button;
5823
+ cButton skybox7Button;
5824
+
5825
+ cButton skybox11Button;
5826
+ cButton skybox12Button;
5827
+ cButton skybox13Button;
5828
+ cButton skybox14Button;
5829
+ cButton skybox15Button;
5830
+ cButton skybox16Button;
5831
+ cButton skybox17Button;
5832
+
5833
+ cButton gridButton;
5834
+ cButton boxButton;
5835
+ cButton sphereButton;
5836
+ cButton coneButton;
5837
+ cButton torusButton;
5838
+ cButton superButton;
5839
+ cButton kleinButton;
5840
+ cButton particlesButton;
5841
+ cButton overlayButton;
5842
+ cButton lightButton;
5843
+
47855844 cButton screenfitButton;
47865845 cButton screenfitpointButton;
47875846 cButton snapobjectButton;
....@@ -4793,14 +5852,6 @@
47935852
47945853 cButton setsupportButton;
47955854
4796
- cButton twoButton;
4797
- cButton sixButton;
4798
- cButton threeButton;
4799
- cButton sevenButton;
4800
- cButton fourButton; // full panel
4801
- cButton oneButton; // full XYZ
4802
- //cButton currentLayout;
4803
-
48045855 //
48055856 //Composite
48065857 Object3D // to do !!
....@@ -4810,9 +5861,11 @@
48105861 //JTree jTree;
48115862 private MenuItem lookAtItem;
48125863 private MenuItem lookFromItem;
4813
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
48145865 private MenuItem cutItem;
4815
- private MenuItem duplicateItem;
5866
+ private MenuItem undoItem;
5867
+ private MenuItem redoItem;
5868
+ private JMenuItem duplicateItem;
48165869 private MenuItem cloneItem;
48175870 private MenuItem cloneSupportItem;
48185871 private MenuItem overwriteGeoItem;
....@@ -4823,8 +5876,9 @@
48235876 private MenuItem resetsupportItem;
48245877 private MenuItem resetreferencesItem;
48255878 private MenuItem linkverticesItem;
5879
+ private MenuItem relinkverticesItem;
48265880 private MenuItem setMasterItem;
4827
- private MenuItem resetMeshItem;
5881
+ private MenuItem resetAllItem;
48285882 private MenuItem stepAllItem;
48295883 private MenuItem revertMeshItem;
48305884 private MenuItem poseMeshItem;
....@@ -4835,14 +5889,17 @@
48355889 private MenuItem mergeGeometriesItem;
48365890 private MenuItem copyItem;
48375891 private MenuItem pasteItem;
5892
+ private MenuItem pasteIntoItem;
48385893 private MenuItem pasteLinkItem;
48395894 private MenuItem pasteCloneItem;
48405895 private MenuItem pasteExpandItem;
4841
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
48425897 private MenuItem clearAllItem;
48435898 private MenuItem genUVItem;
5899
+ private MenuItem genNormalsMESHItem;
48445900 private MenuItem genNormalsCADItem;
48455901 private MenuItem genNormalsORGANItem;
5902
+ private MenuItem genNormalsMINEItem;
48465903 private MenuItem stripifyItem;
48475904 private MenuItem unstripifyItem;
48485905 private MenuItem trimItem;
....@@ -4871,6 +5928,10 @@
48715928 private MenuItem showleavesItem;
48725929 private MenuItem markleavesItem;
48735930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
48745935
48755936 private MenuItem flipVItem;
48765937 private MenuItem unflipVItem;
....@@ -4882,14 +5943,17 @@
48825943 private MenuItem panoTexturesItem;
48835944
48845945 private MenuItem resetCentroidItem;
4885
- private MenuItem transformgeometryItem;
5946
+ private MenuItem resetCentroidXZItem;
48865947 private MenuItem resetTransformItem;
5948
+ private MenuItem transformGeometryItem;
5949
+ private MenuItem transformChildrenItem;
5950
+ private MenuItem hideItem;
48875951 private MenuItem grabItem;
48885952 private MenuItem backItem;
48895953 private MenuItem frontItem;
48905954 private MenuItem cameraItem;
48915955 private MenuItem compositeItem;
4892
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
48935957 private MenuItem physicsItem;
48945958 private MenuItem frameselectorItem;
48955959 private MenuItem scriptNodeItem;
....@@ -4904,6 +5968,7 @@
49045968
49055969 private MenuItem resetParentItem;
49065970 private MenuItem repairParentItem;
5971
+ private MenuItem repairShadowItem;
49075972 private MenuItem sortbysizeItem;
49085973 private MenuItem sortbynameItem;
49095974
....@@ -4912,6 +5977,8 @@
49125977 private MenuItem attachBumpItem;
49135978 private MenuItem detachBumpItem;
49145979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
49155982
49165983 private MenuItem particleItem;
49175984 private MenuItem ragdollItem;
....@@ -4924,10 +5991,11 @@
49245991 private MenuItem coneItem;
49255992 private MenuItem torusItem;
49265993 private MenuItem superItem;
5994
+ private MenuItem kleinItem;
49275995 private MenuItem blobItem;
49285996 private MenuItem latheItem;
49295997 private MenuItem bezierItem;
4930
- private MenuItem checkerItem;
5998
+ private MenuItem overlayItem;
49315999 private MenuItem meshItem;
49326000 // private MenuItem meshGroupItem;
49336001 private MenuItem springItem;
....@@ -4936,6 +6004,7 @@
49366004 private MenuItem csgItem;
49376005 private MenuItem templateItem;
49386006 private MenuItem textureItem;
6007
+ private MenuItem billboardItem;
49396008 private MenuItem shadowXItem;
49406009 private MenuItem shadowYItem;
49416010 private MenuItem shadowZItem;
....@@ -4948,11 +6017,6 @@
49486017 private MenuItem doubleItem;
49496018 private MenuItem tripleItem;
49506019
4951
- private MenuItem importGFDItem;
4952
- private MenuItem importVRMLX3DItem;
4953
- private MenuItem import3DSItem;
4954
- private MenuItem importOBJItem;
4955
-
49566020 private MenuItem computeAOItem;
49576021 private MenuItem recompileItem;
49586022 private MenuItem editScriptItem;
....@@ -4962,4 +6026,8 @@
49626026 private MenuItem analyzeItem;
49636027 private MenuItem dumpItem;
49646028 //boolean freezemodel = false;
6029
+
6030
+ Menu cameraMenu;
6031
+ MenuItem editCameraItem;
6032
+ MenuItem restoreCameraItem;
49656033 }