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,16 +105,28 @@
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 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
86130 // Object3D keep = GrafreeD.clipboard;
87131 //Object3D obj;
88132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -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(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
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(GrafreeD.clipboard, false));
107
- GrafreeD.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)GrafreeD.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,79 +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);
222365 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223366 relinkverticesItem.addActionListener(this);
367
+
368
+ if (Globals.ADVANCED)
369
+ {
224370 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225371 setMasterItem.addActionListener(this);
372
+ }
226373
227374 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
230377 backItem = menu.add(new MenuItem("Back"));
231378 backItem.addActionListener(this);
232379 frontItem = menu.add(new MenuItem("Front"));
233380 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
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"));
237387 hideItem.addActionListener(this);
388
+ }
238389 ungroupItem = menu.add(new MenuItem("Ungroup"));
239390 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
247398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248399 switchGeoItem.addActionListener(this);
249400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250401 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
402
+ morphItem = menu.add(new MenuItem("Morph Group"));
252403 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);
253410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254411 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
412
+ }
257413
258414 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
261417 billboardItem = menu.add(new MenuItem("Billboard"));
262418 billboardItem.addActionListener(this);
263419 csgItem = menu.add(new MenuItem("CSG"));
264420 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266422 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268424 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
430
+ if (Globals.ADVANCED)
431
+ {
432
+ menu.add("-");
271433 linkerItem = menu.add(new MenuItem("Linker"));
272434 linkerItem.addActionListener(this);
273435 templateItem = menu.add(new MenuItem("Template"));
274436 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277437 pointflowItem = menu.add(new MenuItem("Point Flow"));
278438 pointflowItem.addActionListener(this);
439
+ }
279440 menu.add("-");
280441 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281442 resetTransformItem.addActionListener(this);
282443 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283444 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.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);
286451
287452 oe.menuBar.add(menu = new Menu("Geometry"));
288453 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +458,11 @@
293458 genNormalsCADItem.addActionListener(this);
294459 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295460 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
461
+ if (Globals.ADVANCED)
462
+ {
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297464 genNormalsMINEItem.addActionListener(this);
465
+ }
298466 stripifyItem = menu.add(new MenuItem("Stripify"));
299467 stripifyItem.addActionListener(this);
300468 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +484,34 @@
316484 reduce34MeshItem.addActionListener(this);
317485 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318486 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321487 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322488 clipMeshItem.addActionListener(this);
489
+
490
+ if (Globals.ADVANCED)
491
+ {
492
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
493
+ smoothMeshItem.addActionListener(this);
494
+ }
323495
324496 oe.menuBar.add(menu = new Menu("Attributes"));
325497 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326498 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);
327503 menu.add("-");
328504 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329505 liveleavesItem.addActionListener(this);
330506 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331507 unliveleavesItem.addActionListener(this);
508
+ if (Globals.ADVANCED)
509
+ {
332510 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333511 supportleavesItem.addActionListener(this);
334512 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335513 unsupportleavesItem.addActionListener(this);
514
+ }
336515 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337516 hideleavesItem.addActionListener(this);
338517 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +520,14 @@
341520 markleavesItem.addActionListener(this);
342521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343522 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);
344531 menu.add("-");
345532 flipVItem = menu.add(new MenuItem("Flip V"));
346533 flipVItem.addActionListener(this);
....@@ -366,45 +553,56 @@
366553 attachBumpItem.addActionListener(this);
367554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
368555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
369557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
370558 detachPigmentItem.addActionListener(this);
371559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
372560 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);
373565 menu.add("-");
374566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
375567 sortbysizeItem.addActionListener(this);
376568 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377569 sortbynameItem.addActionListener(this);
378570 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.
379578 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380579 extractGeometriesItem.addActionListener(this);
381580 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382581 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
582
+ }
387583
388584 oe.menuBar.add(menu = new Menu("Insert"));
389585 buildCreateMenu(menu);
390586
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402587 oe.menuBar.add(menu = new Menu("Tools"));
403588 buildToolsMenu(menu);
404589 }
405590
591
+
406592 void SetupUI2(ObjEditor oe)
407593 {
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
+
408606 //new Exception().printStackTrace();
409607
410608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,110 +631,327 @@
433631 oe.radioPanel.add(dummyButton);
434632 oe.buttonGroup.add(dummyButton);
435633 */
436
- aConstraints.gridy += 1;
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
437637
438638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439639
440
- oe.aConstraints.gridwidth = 1;
441
- oe.aConstraints.gridx = 0;
640
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
+ //minButton.setToolTipText("Minimize window");
642
+ //minButton.addActionListener(this);
442643
443
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
444
- liveCB.setToolTipText("Enabled animation");
445
- liveCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
449
- trackCB.setToolTipText("Enable tracking");
450
- trackCB.addItemListener(this);
451
-
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
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);
454656 screenfitButton.setToolTipText("Screen fit");
455657 screenfitButton.addActionListener(this);
456
- oe.aConstraints.gridx += 1;
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");
692
+ liveCB.addItemListener(this);
693
+
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");
700
+ fastCB.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);
707
+
457708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
458709 // screenfitpointButton.addActionListener(this);
459
-// oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
461
- snapobjectButton.addActionListener(this);
462
- snapobjectButton.setToolTipText("Snap Object");
463
- oe.aConstraints.gridx += 1;
464710
465
- //aConstraints.gridx = 0;
466
- //aConstraints.gridy += 1;
467
- oe.aConstraints.weighty = 0;
468
- oe.aConstraints.gridwidth = 1;
469
-
470
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
471
- flashSelectionButton.setToolTipText("Show selection");
472
- flashSelectionButton.addActionListener(this);
473
-
474
- oe.toolbarPanel.add(new cButton(" ", false));
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.aConstraints.weighty = 0;
478
- oe.aConstraints.gridwidth = 1;
479
-
480
- //
481
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
482
- twoButton.setToolTipText("Show center view only");
483
- twoButton.addActionListener(this);
484
- 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);
485718 fourButton.addActionListener(this);
486
- fourButton.setToolTipText("Show left panel only");
487
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
488
- sixButton.setToolTipText("2-column layout left");
489
- sixButton.addActionListener(this);
490
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
491
- threeButton.setToolTipText("2-column layout right");
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");
492731 threeButton.addActionListener(this);
493
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
494
- sevenButton.setToolTipText("3-column layout");
495
- 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);
496738 //
497739
498
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
499
- rootButton.setToolTipText("Edit object in new tab");
740
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ rootButton.setToolTipText("Open selection in new tab");
500742 rootButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
743
+
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
503745 closeButton.setToolTipText("Close tab");
504746 closeButton.addActionListener(this);
505747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
506748 //clearButton.addActionListener(this);
507
- oe.aConstraints.gridx += 1;
508
-
509
- oe.aConstraints.gridx = 1; //
510
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
511
- editButton.addActionListener(this);
512
- oe.aConstraints.gridx += 1;
513
- oe.aConstraints.weighty = 0;
514
- oe.aConstraints.gridwidth = 1;
515749
516
- 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");
517931 uneditButton.addActionListener(this);
518932
519
- oe.aConstraints.gridx += 1;
520
- oe.aConstraints.weighty = 0;
521
- oe.aConstraints.gridwidth = 1;
522
-
523
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
524
- clearPanelButton.addActionListener(this);
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
531935 allParamsButton.addActionListener(this);
532936
533
- oe.aConstraints.gridx += 1;
534
- oe.aConstraints.weighty = 0;
535
- oe.aConstraints.gridwidth = 1;
536
-
537
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
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");
538943 unselectButton.addActionListener(this);
539944
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
+
540955 // oe.aConstraints.gridx += 1;
541956 // oe.aConstraints.weighty = 0;
542957 // oe.aConstraints.gridwidth = 1;
....@@ -548,47 +963,32 @@
548963 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
549964 // gcButton.addActionListener(this);
550965
551
- oe.aConstraints.gridx = 0;
552
- oe.aConstraints.gridy += 1;
553
-
554
- //ctrlPanel.add(objList = new List(5, true));
555
- oe.aConstraints.gridwidth = 100;
556
- // oe.aConstraints.gridheight = 100;
557
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
558
- oe.aConstraints.gridheight = 1;
559
- oe.aConstraints.weighty = 0.5;
560
- oe.aConstraints.gridx = 0;
561
- JScrollPane jSP;
966
+ cGridBag jSPPanel = new cGridBag();
967
+
968
+ JScrollPane jSP;
562969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
563
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
564971 ResetModel();
565
- oe.aConstraints.weighty = 0.5;
566
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
567
- oe.aConstraints.gridy += 1;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 2;
572
-
573
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
574
- colorCB.addItemListener(this);
575
- oe.aConstraints.gridx += 2;
576
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
577
- materialCB.addItemListener(this);
578
- oe.aConstraints.gridx += 2;
579
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
580
- textureCB.addItemListener(this);
581
-
582
- oe.aConstraints.gridx = 0;
583
- oe.aConstraints.gridy += 1;
584972
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
+
585985 //jList.addListSelectionListener(this);
586986 oe.jTree.addTreeSelectionListener(this);
587987 //jTree.setRootVisible(false);
588988 //jTree.setEditable(true);
589989 oe.jTree.setDragEnabled(true);
590990 //jTree.setPreferredSize(new Dimension(10,10));
591
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
592992
593993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
594994
....@@ -600,97 +1000,160 @@
6001000 dgr.addDragGestureListener(this);
6011001 }catch(Exception e) {}
6021002 */
603
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
6041004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6051005 }
6061006
607
- void AddOptions(JPanel panel, GridBagConstraints constraints)
1007
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6081008 {
609
- constraints.gridx = 0;
610
- constraints.gridy = 0;
611
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), constraints);
612
- fastCB.setToolTipText("Fast mode");
613
- fastCB.addItemListener(this);
614
- constraints.gridy += 1;
615
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), constraints);
616
- supportCB.setToolTipText("Enabled rigging");
617
- supportCB.addItemListener(this);
1009
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1010
+ colorCB.setToolTipText("Copy color when dropped");
1011
+ colorCB.addItemListener(this);
6181012
619
- // constraints.gridy += 1;
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
+
6201041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6211042 // localCB.addItemListener(this);
6221043
623
- constraints.gridy += 1;
624
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), constraints);
1044
+ panel.Return();
1045
+
1046
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6251047 crowdCB.setToolTipText("Used for crowds");
6261048 crowdCB.addItemListener(this);
6271049
628
- constraints.gridy += 1;
629
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), constraints);
1050
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
6301051 smoothCB.setToolTipText("Snapping delay");
6311052 smoothCB.addItemListener(this);
6321053
633
- constraints.gridy += 1;
634
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), constraints);
1054
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
6351055 slowCB.setToolTipText("Smooth interpolation");
6361056 slowCB.addItemListener(this);
637
- constraints.gridy += 1;
638
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), constraints);
639
- boxCB.setToolTipText("Display bounding boxes");
640
- boxCB.addItemListener(this);
641
- constraints.gridy += 1;
642
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), constraints);
643
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
644
- zoomBoxCB.addItemListener(this);
645
-
1057
+
6461058 // constraints.gridy += 1;
6471059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6481060 // speakerMocapCB.addItemListener(this);
6491061
1062
+ panel.Return();
1063
+
6501064 if (false)
6511065 {
6521066 // handled in scripts
653
- constraints.gridy += 1;
654
- panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), constraints);
1067
+ //constraints.gridy += 1;
1068
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
6551069 speakerCameraCB.addItemListener(this);
6561070
657
- constraints.gridy += 1;
658
- panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), constraints);
1071
+ //constraints.gridy += 1;
1072
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
6591073 speakerFocusCB.addItemListener(this);
6601074
661
- constraints.gridy += 1;
662
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), constraints);
1075
+ //constraints.gridy += 1;
1076
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6631077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
6641079 }
6651080
6661081 //constraints.gridx += 1;
6671082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6681083 // debugCB.addItemListener(this);
6691084
670
- constraints.gridy += 1;
671
- panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), constraints);
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");
6721091 oeilCB.addItemListener(this);
6731092
674
- constraints.gridy += 1;
675
- panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), constraints);
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);
6761114 lookAtCB.setToolTipText("Look-at target");
6771115 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);
6781130
6791131 }
6801132
6811133 void EditObject(Object3D obj)
6821134 {
6831135 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
+
6841144 radioButton.SetObject(obj);
685
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
6861146 radioButton.SetCamera(cameraView.renderCamera, false);
6871147 radioButton.addActionListener(this);
6881148 radioPanel.add(radioButton);
6891149 buttonGroup.add(radioButton);
6901150 radioButton.doClick();
6911151 }
1152
+
6921153 void SetupViews(ObjEditor oe)
6931154 {
1155
+ theFrame = this;
1156
+
6941157 oe.SetupViews();
6951158
6961159 System.out.println("SetupViews");
....@@ -699,23 +1162,28 @@
6991162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7001163 }
7011164
702
- JCheckBox liveCB;
703
- JCheckBox supportCB;
704
- JCheckBox localCB;
705
- JCheckBox crowdCB;
706
- JCheckBox smoothCB;
707
- JCheckBox fastCB;
708
- JCheckBox slowCB;
709
- JCheckBox boxCB;
710
- JCheckBox zoomBoxCB;
711
- JCheckBox trackCB;
712
- 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;
7131178 // JCheckBox speakerMocapCB;
714
- JCheckBox speakerCameraCB;
715
- JCheckBox speakerFocusCB;
716
- JCheckBox debugCB;
717
- JCheckBox oeilCB;
718
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
7191187
7201188 // static int COLOR = 1;
7211189 // static int MATERIAL = 2;
....@@ -723,9 +1191,9 @@
7231191
7241192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7251193
726
- JCheckBox colorCB;
727
- JCheckBox materialCB;
728
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
7291197
7301198 public void itemStateChanged(ItemEvent e)
7311199 {
....@@ -753,6 +1221,7 @@
7531221 } else if(e.getSource() == liveCB)
7541222 {
7551223 cameraView.ToggleLive();
1224
+ refreshContents(false);
7561225 }
7571226 else if(e.getSource() == supportCB)
7581227 {
....@@ -817,6 +1286,18 @@
8171286 {
8181287 cameraView.ToggleOeil();
8191288 }
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
+ }
8201301 else if(e.getSource() == lookAtCB)
8211302 {
8221303 cameraView.ToggleLookAt();
....@@ -833,7 +1314,8 @@
8331314
8341315 /**/
8351316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
836
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
8371319 if ((path == null) || (path.getPathCount() <= 1)) {
8381320 // We can't move the root node or an empty selection
8391321 return;
....@@ -896,8 +1378,6 @@
8961378 }
8971379 }
8981380
899
- String string = (String) object;
900
-
9011381 System.out.println("Transfer = " + object + "; drop : " + target);
9021382 // if( object instanceof java.io.File[])
9031383 // {
....@@ -905,7 +1385,11 @@
9051385 // objEditor.DropFile((java.io.File[]) object, true);
9061386 // return;
9071387 // }
908
- 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) == ':')
9091393 {
9101394 // file(s)
9111395 String[] names = string.split("\n");
....@@ -932,7 +1416,7 @@
9321416
9331417 flashIt = false;
9341418 CameraPane pane = (CameraPane) target;
935
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1419
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9361420 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9371421
9381422 if (group.selection.size() == 1)
....@@ -948,23 +1432,33 @@
9481432
9491433 assert target == objEditor.jTree;
9501434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
9511436 try {
952
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9531438 } catch (Exception e) {
9541439 System.out.println("destinationPath : " + destinationPath);
9551440 return;
9561441 }
9571442
958
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
9591444 {
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
+// {
9601454 loadClipboard(true);
9611455 objEditor.jTree.setSelectionPath(destinationPath);
962
- pasteInto(false);
963
- } else {
964
- loadClipboard(false);
965
- objEditor.jTree.setSelectionPath(destinationPath);
966
- pasteInto(false); // true); // ???
967
- }
1456
+ pasteInto(false, false);
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
9681462 }
9691463 public void dropActionChanged(DropTargetDragEvent dtde)
9701464 // Called if the user has modified the current drop gesture
....@@ -1069,85 +1563,107 @@
10691563 {
10701564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10711565 //heightFieldItem.addActionListener(this);
1072
- gridItem = menu.add(new MenuItem("Grid"));
1073
- gridItem.addActionListener(this);
1074
- rectoidItem = menu.add(new MenuItem("Box"));
1075
- rectoidItem.addActionListener(this);
1076
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1077
- ellipsoidItem.addActionListener(this);
1078
- coneItem = menu.add(new MenuItem("Cone"));
1079
- coneItem.addActionListener(this);
1080
- torusItem = menu.add(new MenuItem("Torus"));
1081
- torusItem.addActionListener(this);
1082
- superItem = menu.add(new MenuItem("Superellipsoid"));
1083
- superItem.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
+ {
10841584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10851585 kleinItem.addActionListener(this);
1086
- particleItem = menu.add(new MenuItem("Particle system"));
1087
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
1590
+ if (Globals.ADVANCED)
1591
+ {
10881592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10891593 ragdollItem.addActionListener(this);
10901594 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10911595 ragdoll2Item.addActionListener(this);
1596
+ }
10921597 menu.add("-");
1093
- meshItem = menu.add(new MenuItem("Mesh"));
1598
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10941599 meshItem.addActionListener(this);
10951600 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10961601 // meshGroupItem.addActionListener(this);
1602
+ if (Globals.ADVANCED)
1603
+ {
10971604 springItem = menu.add(new MenuItem("Spring"));
10981605 springItem.addActionListener(this);
10991606 flagItem = menu.add(new MenuItem("Flag"));
11001607 flagItem.addActionListener(this);
1101
- bezierItem = menu.add(new MenuItem("Patch"));
1102
- bezierItem.addActionListener(this);
1103
- checkerItem = menu.add(new MenuItem("Checker"));
1104
- checkerItem.addActionListener(this);
11051608 blobItem = menu.add(new MenuItem("Blob"));
11061609 blobItem.addActionListener(this);
11071610 latheItem = menu.add(new MenuItem("Lathe"));
11081611 latheItem.addActionListener(this);
1109
- lightItem = menu.add(new MenuItem("Light"));
1110
- 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);
11111619 menu.add("-");
11121620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11131621 //superLoopItem.addActionListener(this);
1114
- loopItem = menu.add(new MenuItem("Loop"));
1115
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
11161624 doubleItem = menu.add(new MenuItem("Fork"));
11171625 doubleItem.addActionListener(this);
1626
+ if (Globals.ADVANCED)
1627
+ {
11181628 tripleItem = menu.add(new MenuItem("Trident"));
11191629 tripleItem.addActionListener(this);
1630
+ }
11201631 }
11211632
11221633 void buildToolsMenu(Menu menu)
11231634 {
11241635 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11251636 animationItem.addItemListener(this);
1126
- animationItem.setState(CameraPane.ANIMATION);
1637
+ animationItem.setState(Globals.ANIMATION);
1638
+
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
11271641
11281642 menu.add("-");
11291643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11301644 parseverticesItem.addActionListener(this);
11311645 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11321646 textureFieldItem.addActionListener(this);
1133
- alignItem = menu.add(new MenuItem("Align"));
1647
+ alignItem = menu.add(new MenuItem("Align Objects"));
11341648 alignItem.addActionListener(this);
1135
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1136
- mirrorItem.addActionListener(this);
11371649 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11381650 reduceMorphItem.addActionListener(this);
11391651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11401652 reduce34MorphItem.addActionListener(this);
1141
-
1142
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1143
- computeAOItem.addActionListener(this);
11441653 menu.add("-");
1145
-
11461654 menu.add(memoryItem = new MenuItem("Memory Usage"));
11471655 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("-");
11481664 menu.add(analyzeItem = new MenuItem("Analyze"));
11491665 analyzeItem.addActionListener(this);
1150
- menu.add(dumpItem = new MenuItem("Dump"));
1666
+ menu.add(dumpItem = new MenuItem("Print"));
11511667 dumpItem.addActionListener(this);
11521668 // menu.add(pathItem = new MenuItem("From-to path"));
11531669 // pathItem.addActionListener(this);
....@@ -1165,6 +1681,7 @@
11651681 menu.add("-");
11661682 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11671683 editScriptItem.addActionListener(this);
1684
+ }
11681685 }
11691686
11701687 void ScreenFit()
....@@ -1287,9 +1804,34 @@
12871804 shadow.material = new cMaterial(obj.material);
12881805 shadow.material.diffuse = 0.0001f;
12891806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
12901808
12911809 makeSomething(shadow);
12921810 }
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
+ }
12931835
12941836 /**
12951837 * applyExample
....@@ -1493,9 +2035,9 @@
14932035
14942036 void Overwrite(int mask)
14952037 {
1496
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2038
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14972039 {
1498
- Object3D content = GrafreeD.clipboard.get(0);
2040
+ Object3D content = Grafreed.clipboard.get(0);
14992041
15002042 if (content instanceof cGroup && ((cGroup)content).transientlink )
15012043 content = ((cGroup)content).get(0);
....@@ -1534,7 +2076,7 @@
15342076 {
15352077 ScreenFit();
15362078 } else
1537
- if (source == switchItem)
2079
+ if (source == switchViewItem)
15382080 {
15392081 cVector v1 = new cVector();
15402082 cVector v2 = new cVector();
....@@ -1543,11 +2085,11 @@
15432085 objEditor.cameraView.renderCamera.setAim(v2, v1);
15442086 objEditor.cameraView.repaint();
15452087 } else
1546
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
15472089 {
15482090 makeSomething(new Box());
15492091 } else
1550
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
15512093 {
15522094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15532095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1626,27 +2168,27 @@
16262168
16272169 makeSomething(obj);
16282170 } else
1629
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
16302172 {
16312173 makeSomething(new Grid());
16322174 } else
1633
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
16342176 {
16352177 makeSomething(new Sphere());
16362178 } else
1637
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
16382180 {
16392181 makeSomething(new Cone());
16402182 } else
1641
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
16422184 {
16432185 makeSomething(new Torus());
16442186 } else
1645
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
16462188 {
16472189 makeSomething(new Superellipsoid());
16482190 } else
1649
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
16502192 {
16512193 makeSomething(new Klein());
16522194 } else
....@@ -1666,7 +2208,7 @@
16662208 {
16672209 makeSomething(new BezierSurface());
16682210 } else
1669
- if (source == checkerItem)
2211
+ if (source == overlayItem || source == overlayButton)
16702212 {
16712213 /*
16722214 Object3D obj = new BezierSurface(5,8);
....@@ -1714,10 +2256,27 @@
17142256 s.setup();
17152257 makeSomething(s);
17162258 } else
1717
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
17182260 {
17192261 makeSomething(new Light());
17202262 } else
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
17212280 if (source == csgItem)
17222281 {
17232282 group(new CSG());
....@@ -1764,30 +2323,30 @@
17642323
17652324 group(g);
17662325 } else
1767
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
17682327 {
17692328 Composite csg = new GroupLeaf();
17702329 csg.count = 5;
17712330 group(csg);
1772
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
17732332 csg.addChild(child);
17742333 child.addChild(csg);
17752334 } else
17762335 if (source == doubleItem)
17772336 {
1778
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
17792338 csg.count = 5;
17802339 group(csg);
1781
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
17822341 csg.addChild(child);
17832342 child.addChild(csg);
1784
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
17852344 csg.addChild(child);
17862345 child.addChild(csg);
17872346 } else
17882347 if (source == tripleItem)
17892348 {
1790
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
17912350 csg.count = 4;
17922351 group(csg);
17932352 Composite child = new cGroup();
....@@ -1800,27 +2359,10 @@
18002359 csg.addChild(child);
18012360 child.addChild(csg);
18022361 } else
1803
-
1804
- if (source == importGFDItem)
1805
- {
1806
- ImportGFD();
1807
- } else
1808
- if (source == importVRMLX3DItem)
1809
- {
1810
- ImportVRMLX3D();
1811
- } else
1812
- if (source == import3DSItem)
1813
- {
1814
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1815
- } else
1816
- if (source == importOBJItem)
1817
- {
1818
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1819
- } else
18202362 if (source == computeAOItem)
18212363 {
18222364 Globals.drawMode = CameraPane.OCCLUSION;
1823
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
18242366 } else
18252367 if (source == recompileItem)
18262368 {
....@@ -1835,7 +2377,7 @@
18352377 if (source == invariantsItem)
18362378 {
18372379 System.out.println("Invariants:");
1838
- GrafreeD.grafreeD.universe.invariants();
2380
+ Grafreed.grafreeD.universe.invariants();
18392381 } else
18402382 if (source == memoryItem)
18412383 {
....@@ -1854,19 +2396,61 @@
18542396 {
18552397 DumpObject();
18562398 } else
2399
+ if (source == minButton)
2400
+ {
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
18572444 if (source == screenfitButton)
18582445 {
1859
- //Reload(lastConverter, lastFilename, true);
18602446 ScreenFit();
18612447 } else
18622448 if (source == screenfitpointButton)
18632449 {
1864
- //Reload(lastConverter, lastFilename, true);
18652450 ScreenFitPoint();
18662451 } else
18672452 if (source == snapobjectButton)
18682453 {
1869
- //Reload(lastConverter, lastFilename, true);
18702454 SnapObject();
18712455 } else
18722456 // if (event.getSource() == recompileButton)
....@@ -1903,12 +2487,20 @@
19032487 {
19042488 loadClipboard(true);
19052489 } else
2490
+ if (source == undoItem)
2491
+ {
2492
+ Undo();
2493
+ } else
2494
+ if (source == redoItem)
2495
+ {
2496
+ Redo();
2497
+ } else
19062498 if (source == duplicateItem)
19072499 {
1908
- Object3D keep = GrafreeD.clipboard;
2500
+ Object3D keep = Grafreed.clipboard;
19092501 loadClipboard(false);
19102502 paste(false);
1911
- GrafreeD.clipboard = keep;
2503
+ Grafreed.clipboard = keep;
19122504 } else
19132505 if (source == cloneItem)
19142506 {
....@@ -1926,13 +2518,17 @@
19262518 {
19272519 paste(false);
19282520 } else
2521
+ if (source == pasteIntoItem)
2522
+ {
2523
+ pasteInto(true, false);
2524
+ } else
19292525 if (source == pasteLinkItem)
19302526 {
1931
- pasteInto(false);
2527
+ pasteInto(false, false);
19322528 } else
19332529 if (source == pasteCloneItem)
19342530 {
1935
- pasteInto(true);
2531
+ pasteInto(true, true);
19362532 } else
19372533 if (source == pasteExpandItem)
19382534 {
....@@ -2124,9 +2720,9 @@
21242720 // group.selection.get(0).setMasterThis(content); // should be identity
21252721 // refreshContents();
21262722 // }
2127
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2723
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21282724 {
2129
- Object3D content = GrafreeD.clipboard.get(0);
2725
+ Object3D content = Grafreed.clipboard.get(0);
21302726
21312727 if (content instanceof cGroup && ((cGroup)content).transientlink )
21322728 content = ((cGroup)content).get(0);
....@@ -2134,11 +2730,11 @@
21342730 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21352731 for (int i=0; i<group.selection.size(); i++)
21362732 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2733
+ boolean random = CameraPane.SWITCH;
2734
+ CameraPane.SWITCH = false; // parse all random nodes
21392735 group.selection.get(i).linkVerticesThis(content);
21402736 // group.selection.get(i).setMasterThis(content); // should be identity
2141
- CameraPane.RANDOM = random;
2737
+ CameraPane.SWITCH = random;
21422738 }
21432739 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21442740 refreshContents();
....@@ -2148,20 +2744,20 @@
21482744 {
21492745 for (int i=0; i<group.selection.size(); i++)
21502746 {
2151
- boolean random = CameraPane.RANDOM;
2152
- CameraPane.RANDOM = false; // parse all random nodes
2747
+ boolean random = CameraPane.SWITCH;
2748
+ CameraPane.SWITCH = false; // parse all random nodes
21532749 group.selection.get(i).linkVerticesThis(null);
2154
- CameraPane.RANDOM = random;
2750
+ CameraPane.SWITCH = random;
21552751 }
21562752
21572753 refreshContents();
21582754 } else
21592755 if (source == relinkverticesItem)
21602756 {
2161
- boolean random = CameraPane.RANDOM;
2162
- CameraPane.RANDOM = false; // parse all random nodes
2757
+ boolean random = CameraPane.SWITCH;
2758
+ CameraPane.SWITCH = false; // parse all random nodes
21632759 group.selection.RelinkToSupport();
2164
- CameraPane.RANDOM = random;
2760
+ CameraPane.SWITCH = random;
21652761
21662762 refreshContents();
21672763 } else
....@@ -2176,9 +2772,9 @@
21762772 } else
21772773 if (source == setMasterItem)
21782774 {
2179
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2775
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21802776 {
2181
- Object3D content = GrafreeD.clipboard.get(0);
2777
+ Object3D content = Grafreed.clipboard.get(0);
21822778
21832779 if (content instanceof cGroup && ((cGroup)content).transientlink )
21842780 content = ((cGroup)content).get(0);
....@@ -2191,9 +2787,9 @@
21912787 {
21922788 if (group.selection.size() == 1)
21932789 {
2194
- if (GrafreeD.clipboard.size() == 1)
2790
+ if (Grafreed.clipboard.size() == 1)
21952791 {
2196
- Object3D content = GrafreeD.clipboard.get(0);
2792
+ Object3D content = Grafreed.clipboard.get(0);
21972793
21982794 if (content instanceof cGroup && ((cGroup)content).transientlink )
21992795 content = ((cGroup)content).get(0);
....@@ -2210,7 +2806,7 @@
22102806 {
22112807 RevertMeshes();
22122808 } else
2213
- if (source == resetMeshItem)
2809
+ if (source == resetAllItem)
22142810 {
22152811 ResetAll();
22162812 } else
....@@ -2218,7 +2814,7 @@
22182814 {
22192815 StepAll();
22202816 } else
2221
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
22222818 {
22232819 //int indices[] = jList.getSelectedIndices();
22242820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2230,9 +2826,9 @@
22302826 {
22312827 ClearSelection(true);
22322828 } else
2233
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
22342830 {
2235
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
22362832 } else
22372833 if (source == hideItem)
22382834 {
....@@ -2250,16 +2846,16 @@
22502846 {
22512847 makeSomething(new Camera());
22522848 } else
2253
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
22542850 {
22552851 group(new Composite());
22562852 } else
2257
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
22582854 {
22592855 RandomNode random = new RandomNode();
22602856 group(random);
22612857 if (random.size() > 0)
2262
- random.name = random.get(0).name + "Rnd";
2858
+ random.name = random.get(0).name + "Switch";
22632859 } else
22642860 if (source == physicsItem)
22652861 {
....@@ -2356,7 +2952,7 @@
23562952 {
23572953 group(new cLinker());
23582954 } else
2359
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
23602956 {
23612957 group(new TextureNode());
23622958 } else
....@@ -2376,17 +2972,30 @@
23762972 {
23772973 CastShadow(2);
23782974 } else
2379
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
23802976 {
2381
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
23822979 for (int i=0; i<group.selection.size(); i++)
23832980 {
2384
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
23852986 }
23862987
2387
- ClearSelection(false);
2388
-
2389
- refreshContents();
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
+ }
23902999 } else
23913000 if (source == genUVItem)
23923001 {
....@@ -2398,7 +3007,7 @@
23983007 } else
23993008 if (source == genNormalsMESHItem)
24003009 {
2401
- GenNormals(true); // TODO
3010
+ GenNormalsMESH();
24023011 } else
24033012 if (source == genNormalsORGANItem)
24043013 {
....@@ -2463,6 +3072,22 @@
24633072 if (source == unmarkleavesItem)
24643073 {
24653074 MarkLeaves(false);
3075
+ } else
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);
24663091 } else
24673092 if (source == flipVItem)
24683093 {
....@@ -2548,9 +3173,13 @@
25483173 {
25493174 SmoothMesh();
25503175 } else
2551
- if (source == transformgeometryItem)
3176
+ if (source == transformGeometryItem)
25523177 {
25533178 TransformGeometry();
3179
+ } else
3180
+ if (source == transformChildrenItem)
3181
+ {
3182
+ TransformChildren();
25543183 } else
25553184 if (source == resetTransformItem)
25563185 {
....@@ -2558,7 +3187,11 @@
25583187 } else
25593188 if (source == resetCentroidItem)
25603189 {
2561
- ResetCentroid();
3190
+ ResetCentroid(true);
3191
+ } else
3192
+ if (source == resetCentroidXZItem)
3193
+ {
3194
+ ResetCentroid(false);
25623195 } else
25633196 if (source == resetParentItem)
25643197 {
....@@ -2663,7 +3296,7 @@
26633296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26643297 {
26653298 obj = (Object3D)e.nextElement();
2666
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
26673300 }
26683301
26693302 refreshContents();
....@@ -2679,6 +3312,31 @@
26793312
26803313 refreshContents();
26813314 } else
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
26823340 if (source == flashSelectionButton)
26833341 {
26843342 CameraPane.flash = true;
....@@ -2690,6 +3348,10 @@
26903348 if (source == twoButton)
26913349 {
26923350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
26933355 // bug
26943356 //gridPanel.setDividerLocation(1.0);
26953357 //bigPanel.setDividerLocation(0.0);
....@@ -2722,10 +3384,31 @@
27223384 bigThree.ClearUI();
27233385 bigThree.add(centralPanel);
27243386 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
+
27253405 } else
27263406 if (source == threeButton)
27273407 {
27283408 radio.layout = threeButton;
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
27293412
27303413 // bigThree.remove(scenePanel);
27313414 // bigThree.remove(centralPanel);
....@@ -2755,13 +3438,18 @@
27553438 // centralPanel.setVisible(true);
27563439 // XYZPanel.setVisible(true);
27573440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
27583442 bigThree.add(centralPanel);
2759
- bigThree.add(XYZPanel);
27603443 bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
27613446 } else
27623447 if (source == fourButton)
27633448 {
27643449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
27653453
27663454 // bigThree.remove(scenePanel);
27673455 // bigThree.remove(centralPanel);
....@@ -2793,10 +3481,15 @@
27933481 bigThree.ClearUI();
27943482 bigThree.add(scenePanel);
27953483 bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
27963486 } else
27973487 if (source == sixButton)
27983488 {
27993489 radio.layout = sixButton;
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
28003493
28013494 // bigThree.remove(scenePanel);
28023495 // bigThree.remove(centralPanel);
....@@ -2826,13 +3519,18 @@
28263519 // centralPanel.setVisible(true);
28273520 // XYZPanel.setVisible(false);
28283521 bigThree.ClearUI();
2829
- bigThree.add(scenePanel);
28303522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
28313524 bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
28323527 } else
28333528 if (source == sevenButton)
28343529 {
28353530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
28363534
28373535 // bigThree.remove(scenePanel);
28383536 // bigThree.remove(centralPanel);
....@@ -2866,6 +3564,8 @@
28663564 bigThree.add(centralPanel);
28673565 bigThree.add(XYZPanel);
28683566 bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
28693569 } else
28703570 if (source == rootButton)
28713571 {
....@@ -2877,6 +3577,7 @@
28773577 EditObject(obj);
28783578 }
28793579
3580
+ cameraView.requestFocusInWindow();
28803581 refreshContents(true);
28813582 } else
28823583 if (source == closeButton)
....@@ -2886,22 +3587,37 @@
28863587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28873588 {
28883589 ab = (cRadio)e.nextElement();
2889
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28903591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
28913598 buttonGroup.remove(ab);
28923599 radioPanel.remove(ab);
28933600
2894
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
28953603 // ab.GetObject().objectUI = null; // ?????????
28963604
28973605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28983606 break;
28993607 }
29003608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
29013611 refreshContents(true);
29023612 } else
29033613 if (source == editItem || source == editButton)
29043614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
29053621 EditSelection(false);
29063622 } else
29073623 if (source == uneditButton)
....@@ -2911,12 +3627,13 @@
29113627 Object3D child = (Object3D)e.nextElement();
29123628 if(child.editWindow != null)
29133629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
29143631 child.CloseUI();
29153632 listUI.remove(child);
29163633
2917
- child.editWindow = null; // ???????????
3634
+ //child.editWindow = null; // ???????????
29183635 }
2919
- objEditor.ctrlPanel.revalidate();
3636
+ objEditor.ctrlPanel.FlushUI();
29203637 //objEditor.jTree.clearSelection();
29213638 //objEditor.ResetSliders();
29223639 refreshContents(true);
....@@ -2927,6 +3644,7 @@
29273644 //copy.ClearUI();
29283645 for (Object3D obj : listUI)
29293646 {
3647
+ obj.pinned = false;
29303648 obj.CloseUI();
29313649 }
29323650 listUI.clear();
....@@ -2936,7 +3654,7 @@
29363654 {
29373655 assert(copy == group);
29383656
2939
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29403658
29413659 for (Object3D obj : listUI)
29423660 {
....@@ -2985,6 +3703,9 @@
29853703 }
29863704
29873705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
29883709 //Globals.theRenderer.object = group;
29893710 if(!useclient)
29903711 {
....@@ -3000,20 +3721,46 @@
30003721 frontView.object = group;
30013722 sideView.object = group;
30023723 }
3003
- group.editWindow = this;
3724
+
3725
+// fix "+" issue
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
3728
+
30043729 /*
30053730 currentLayout = radio.layout;
30063731 if (currentLayout == null)
30073732 currentLayout = sevenButton;
30083733 */
30093734 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);
30103742 keepparent = group.parent;
30113743 // PARENT = NULL or not???
30123744 //group.parent = null; // ROOT
30133745 //group.attributes = -1;
30143746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
30153749 refreshContents(true);
3016
- }
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
+ }
30173764 else
30183765 {
30193766 //return super.action(event, arg);
....@@ -3022,7 +3769,6 @@
30223769 }
30233770
30243771 boolean useclient = false;
3025
- cRadio radio;
30263772
30273773 void ToggleRoot()
30283774 {
....@@ -3074,6 +3820,28 @@
30743820 refreshContents();
30753821 }
30763822
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
+ }
30773845
30783846 void ResetTransform()
30793847 {
....@@ -3186,7 +3954,7 @@
31863954 refreshContents();
31873955 }
31883956
3189
- void ResetCentroid()
3957
+ void ResetCentroid(boolean full)
31903958 {
31913959 Object3D obj;
31923960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3201,12 +3969,16 @@
32013969 LA.matIdentity(Object3D.mat);
32023970 obj.getBounds(minima, maxima, false);
32033971 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3204
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3972
+ if (full)
3973
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32053974 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32063975 obj.TransformMesh(Object3D.mat);
3976
+
32073977 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3208
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3978
+ if (full)
3979
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32093980 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3981
+
32103982 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32113983 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32123984 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3235,7 +4007,8 @@
32354007
32364008 int size = obj.MemorySize();
32374009
3238
- 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)");
32394012 }
32404013 }
32414014 catch (Exception e)
....@@ -3272,9 +4045,9 @@
32724045 obj = (Object3D)e.nextElement();
32734046
32744047 System.out.println("Object is: " + obj);
3275
- GrafreeD.AnalyzeObject(obj);
4048
+ Grafreed.AnalyzeObject(obj);
32764049 System.out.println("Boundary rep: " + obj.bRep);
3277
- GrafreeD.AnalyzeObject(obj.bRep);
4050
+ Grafreed.AnalyzeObject(obj.bRep);
32784051
32794052 // System.err.println((size/1024) + " KB is the size of " + obj);
32804053 }
....@@ -3316,6 +4089,13 @@
33164089 void GenNormals(boolean crease)
33174090 {
33184091 group.GenNormalsS(crease);
4092
+
4093
+ refreshContents();
4094
+ }
4095
+
4096
+ void GenNormalsMESH()
4097
+ {
4098
+ group.GenNormalsMeshS();
33194099
33204100 refreshContents();
33214101 }
....@@ -3488,8 +4268,8 @@
34884268
34894269 void ParseVertices()
34904270 {
3491
- boolean epsequal = GrafreeD.epsequal;
3492
- GrafreeD.epsequal = true;
4271
+ boolean epsequal = Grafreed.epsequal;
4272
+ Grafreed.epsequal = true;
34934273
34944274 for (int i=0; i<group.selection.size(); i++)
34954275 {
....@@ -3514,7 +4294,7 @@
35144294 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35154295 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35164296
3517
- g.add(GrafreeD.clipboard);
4297
+ g.add(Grafreed.clipboard);
35184298
35194299 buffer.add(g);
35204300 }
....@@ -3529,7 +4309,7 @@
35294309 makeSomething(buffer, i==group.selection.size()-1);
35304310 }
35314311
3532
- GrafreeD.epsequal = epsequal;
4312
+ Grafreed.epsequal = epsequal;
35334313
35344314 refreshContents();
35354315 }
....@@ -3547,7 +4327,16 @@
35474327 String pigment = Object3D.GetPigment(tex);
35484328 //String bump = Object3D.GetBump(tex);
35494329
3550
- com.sun.opengl.util.texture.TextureData texturedata = Globals.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
+ }
35514340
35524341 double s = v.s;
35534342
....@@ -3635,11 +4424,11 @@
36354424
36364425 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36374426
3638
- boolean random = CameraPane.RANDOM;
3639
- CameraPane.RANDOM = false; // parse all random nodes
4427
+ boolean random = CameraPane.SWITCH;
4428
+ CameraPane.SWITCH = false; // parse all random nodes
36404429 lowres.linkVerticesThis(null);
36414430 lowres.linkVerticesThis(sn);
3642
- CameraPane.RANDOM = random;
4431
+ CameraPane.SWITCH = random;
36434432
36444433 System.err.flush();
36454434
....@@ -3679,7 +4468,7 @@
36794468 return;
36804469
36814470 Object3D poses = group.selection.get(0);
3682
- Object3D ref = GrafreeD.clipboard.get(0);
4471
+ Object3D ref = Grafreed.clipboard.get(0);
36834472
36844473 Object3D newgroup = new Object3D("Po:" + poses.name);
36854474
....@@ -3873,9 +4662,9 @@
38734662
38744663 void ClipMesh()
38754664 {
3876
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4665
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38774666 {
3878
- Object3D content = GrafreeD.clipboard.get(0);
4667
+ Object3D content = Grafreed.clipboard.get(0);
38794668
38804669 if (content instanceof cGroup && ((cGroup)content).transientlink )
38814670 content = ((cGroup)content).get(0);
....@@ -3884,7 +4673,7 @@
38844673 // {
38854674 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38864675 // }
3887
- group.selection.ClipMesh(GrafreeD.clipboard);
4676
+ group.selection.ClipMesh(Grafreed.clipboard);
38884677 }
38894678 // group.selection.ClipMesh(GrafreeD.clipboard);
38904679 System.out.println("DONE.");
....@@ -3931,6 +4720,18 @@
39314720 void MarkLeaves(boolean hide)
39324721 {
39334722 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);
39344735 refreshContents();
39354736 }
39364737
....@@ -4005,28 +4806,25 @@
40054806 // }
40064807 // }
40074808
4008
- static boolean allparams = true;
4009
-
4010
- static Vector<Object3D> listUI = new Vector<Object3D>();
4011
-
40124809 void EditSelection(boolean newWindow)
40134810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
40144817 // aConstraints.gridy = 0;
40154818 for (int i=0; i<group.selection.size(); i++)
40164819 {
40174820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40184821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4019
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40204823
40214824 Object3D elem = (Object3D)group.selection.elementAt(i);
4022
- if(elem != group)
4825
+ if(elem != group || !newWindow)
40234826 {
4024
- // if (!(elem instanceof Composite))
4025
- // newWindow = false;
4026
- listUI.add(elem);
4027
- elem.openEditWindow(this, newWindow); //, false);
4028
- System.out.println("edit : " + elem);
4029
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
40304828 }
40314829 }
40324830 }
....@@ -4101,7 +4899,8 @@
41014899 //new Exception().printStackTrace();
41024900
41034901 freezemodel = true;
4104
-
4902
+ ClearUnpinned();
4903
+
41054904 /**/
41064905 //switch (event.id)
41074906 {
....@@ -4109,7 +4908,6 @@
41094908 //case 702: // Event.LIST_DESELECT
41104909 group.deselectAll();
41114910 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4112
- objEditor.ClearInfo(); // .GetMaterial());
41134911 if (tps != null)
41144912 {
41154913 for (int i=0; i < tps.length; i++)
....@@ -4118,33 +4916,39 @@
41184916
41194917 //if (child.parent != null)
41204918 //child.parent.addSelectee(child);
4919
+ objEditor.SetMaterial(child);
41214920 group.addSelectee(child);
4122
- objEditor.SetMaterial(child); // .GetMaterial());
4123
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4124
- System.err.println("info : " + child.GetPath());
41254921 }
41264922 }
4127
- else
4128
- {
4129
- objEditor.SetMaterial(group); // .GetMaterial());
4130
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4131
- System.err.println("info : " + group.GetPath());
4132
- }
4923
+// else
4924
+// {
4925
+// objEditor.SetMaterial(group); // .GetMaterial());
4926
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4927
+// System.err.println("info : " + group.GetPath());
4928
+// }
41334929
4134
- objEditor.SetText(); // jan 2014
4135
-
4136
- if (flashIt && !Globals.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))
41374931 CameraPane.flash = true;
41384932
4139
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4933
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41404934 // a camera
41414935 {
4142
- CameraPane.camerachangeframe = 0; // don't refuse it
4143
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
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
+ }
41444941 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41454942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41464943 }
41474944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
41484952 refreshContents();
41494953 //return true;
41504954 }
....@@ -4153,6 +4957,35 @@
41534957
41544958 freezemodel = false;
41554959 }
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
+ }
41564989
41574990 void linkSomething(Object3D thing)
41584991 {
....@@ -4224,16 +5057,19 @@
42245057 {
42255058 if (group.selection.isEmpty())
42265059 return;
4227
- GrafreeD.clipboardIsTempGroup = false;
5060
+
5061
+ Grafreed.clipboardIsTempGroup = false;
42285062 Composite tGroup = null;
42295063 if (group.selection.size() > 0) // 1)
42305064 {
42315065 tGroup = new cGroup();
4232
- GrafreeD.clipboardIsTempGroup = true;
5066
+ Grafreed.clipboardIsTempGroup = true;
42335067 }
42345068
42355069 if (cut)
42365070 {
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
42375073 //int indices[] = jList.getSelectedIndices();
42385074 //for (int i = indices.length - 1; i >= 0; i--)
42395075 //jList.remove(indices[i]);
....@@ -4269,16 +5105,16 @@
42695105 //System.out.println("cut " + child);
42705106 //System.out.println("parent = " + child.parent);
42715107 // tmp.addChild(child);
4272
- if (GrafreeD.clipboardIsTempGroup)
5108
+ if (Grafreed.clipboardIsTempGroup)
42735109 tGroup.add/*Child*/(tmp);
42745110 else
4275
- GrafreeD.clipboard = tmp;
5111
+ Grafreed.clipboard = tmp;
42765112 }
42775113 else
4278
- if (GrafreeD.clipboardIsTempGroup)
5114
+ if (Grafreed.clipboardIsTempGroup)
42795115 tGroup.add/*Child*/(child);
42805116 else
4281
- GrafreeD.clipboard = child;
5117
+ Grafreed.clipboard = child;
42825118 }
42835119
42845120 //ResetModel();
....@@ -4310,21 +5146,23 @@
43105146 //System.out.println("cut " + elem);
43115147 //System.out.println("parent = " + elem.parent);
43125148 // tmp.addChild(elem);
4313
- if (GrafreeD.clipboardIsTempGroup)
5149
+ if (Grafreed.clipboardIsTempGroup)
43145150 tGroup.add/*Child*/(tmp);
43155151 else
4316
- GrafreeD.clipboard = tmp;
5152
+ Grafreed.clipboard = tmp;
43175153 }
43185154 else
4319
- if (GrafreeD.clipboardIsTempGroup)
5155
+ if (Grafreed.clipboardIsTempGroup)
43205156 tGroup.add/*Child*/(child);
43215157 else
4322
- GrafreeD.clipboard = child;
5158
+ Grafreed.clipboard = child;
43235159 }
43245160
43255161 }
4326
- if (GrafreeD.clipboardIsTempGroup)
4327
- GrafreeD.clipboard = tGroup;
5162
+
5163
+ if (Grafreed.clipboardIsTempGroup)
5164
+ Grafreed.clipboard = tGroup;
5165
+
43285166 if (cut)
43295167 {
43305168 ResetModel();
....@@ -4334,11 +5172,15 @@
43345172
43355173 void paste(boolean expand)
43365174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
43375179 // if (GrafreeD.clipboard == null)
43385180 // return;
43395181 boolean first = true;
43405182
4341
- if (GrafreeD.clipboardIsTempGroup)
5183
+ if (Grafreed.clipboardIsTempGroup)
43425184 {
43435185 Composite temp;
43445186
....@@ -4349,7 +5191,7 @@
43495191 temp = (Composite)Applet3D.clipboard.deepCopy();
43505192 */
43515193 Object3D elem;
4352
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5194
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43535195 {
43545196 Object3D child = (Object3D)e.nextElement();
43555197
....@@ -4383,21 +5225,22 @@
43835225 //Object3D cb = Applet3D.clipboard;
43845226 //temp.addChild(cb);
43855227 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4386
- assert(GrafreeD.clipboard.parent == null);
4387
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4388
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4389
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4390
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
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());
43915233 else
4392
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4393
- GrafreeD.clipboard.get(0).parent = keepparent;
5234
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5235
+ Grafreed.clipboard.get(0).parent = keepparent;
43945236 }
43955237
5238
+ Globals.REPLACEONMAKE = keep;
43965239 ResetModel();
43975240 refreshContents();
43985241 }
43995242
4400
- void pasteInto(boolean copyit)
5243
+ void pasteInto(boolean copyit, boolean clone)
44015244 {
44025245 // if (GrafreeD.clipboard == null)
44035246 // return;
....@@ -4426,15 +5269,22 @@
44265269 if (copyit)
44275270 {
44285271 // paste(false);
4429
- CloneClipboard(false); // sept 2014
5272
+ if (clone)
5273
+ {
5274
+ CloneClipboard(false); // sept 2014
5275
+ }
5276
+ else
5277
+ {
5278
+ paste(false);
5279
+ }
44305280 }
44315281 else
44325282 {
44335283 boolean first = true;
44345284
4435
- if (GrafreeD.clipboardIsTempGroup)
5285
+ if (Grafreed.clipboardIsTempGroup)
44365286 {
4437
- Composite temp = (Composite)GrafreeD.clipboard;
5287
+ Composite temp = (Composite)Grafreed.clipboard;
44385288 Object3D copy;
44395289 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44405290 {
....@@ -4444,7 +5294,7 @@
44445294 }
44455295 } else
44465296 {
4447
- linkSomething(GrafreeD.clipboard); //.get(0));
5297
+ linkSomething(Grafreed.clipboard); //.get(0));
44485298 }
44495299 }
44505300 }
....@@ -4521,6 +5371,10 @@
45215371
45225372 void group(Object3D csg, boolean grab)
45235373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
45245378 if (//false) // why??
45255379 !group.selection.isEmpty())
45265380 {
....@@ -4634,10 +5488,15 @@
46345488 //node.add(csg);
46355489 //makeSomething(node);
46365490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
46375492 }
46385493
46395494 void Ungroup(Object3D g)
46405495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
46415500 if (g instanceof HiddenObject)
46425501 {
46435502 HiddenObject h = (HiddenObject) g;
....@@ -4654,6 +5513,7 @@
46545513 objEditor.makeSomething(g.get(i), false);
46555514 }
46565515 }
5516
+ Globals.REPLACEONMAKE = keep;
46575517 }
46585518
46595519 void ungroup()
....@@ -4849,21 +5709,6 @@
48495709 }
48505710 */
48515711
4852
- void ImportGFD()
4853
- {
4854
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4855
- browser.show();
4856
- String filename = browser.getFile();
4857
- if (filename != null && filename.length() > 0)
4858
- {
4859
- String fullname = browser.getDirectory() + filename;
4860
-
4861
- //Object3D readobj =
4862
- objEditor.ReadGFD(fullname, objEditor);
4863
- //makeSomething(readobj);
4864
- }
4865
- }
4866
-
48675712 /*
48685713 public void Callback(Object obj)
48695714 {
....@@ -4887,26 +5732,9 @@
48875732 }
48885733 */
48895734
4890
- void ImportVRMLX3D()
4891
- {
4892
- if (GrafreeD.standAlone)
4893
- {
4894
- /**/
4895
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4896
- browser.show();
4897
- String filename = browser.getFile();
4898
- if (filename != null && filename.length() > 0)
4899
- {
4900
- String fullname = browser.getDirectory() + filename;
4901
- LoadVRMLX3D(fullname);
4902
- }
4903
- /**/
4904
- }
4905
- }
4906
-
49075735 String GetFile(String dialogName)
49085736 {
4909
- if (GrafreeD.standAlone)
5737
+ if (Grafreed.standAlone)
49105738 {
49115739 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49125740 browser.show();
....@@ -4970,10 +5798,49 @@
49705798 cButton flashSelectionButton;
49715799 cButton editButton;
49725800 cButton uneditButton;
5801
+ JCheckBox allParamsButton;
49735802 cButton clearpanelButton;
4974
- cButton allParamsButton;
49755803 cButton unselectButton;
49765804
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
+
49775844 cButton screenfitButton;
49785845 cButton screenfitpointButton;
49795846 cButton snapobjectButton;
....@@ -4985,14 +5852,6 @@
49855852
49865853 cButton setsupportButton;
49875854
4988
- cButton twoButton;
4989
- cButton sixButton;
4990
- cButton threeButton;
4991
- cButton sevenButton;
4992
- cButton fourButton; // full panel
4993
- cButton oneButton; // full XYZ
4994
- //cButton currentLayout;
4995
-
49965855 //
49975856 //Composite
49985857 Object3D // to do !!
....@@ -5002,9 +5861,11 @@
50025861 //JTree jTree;
50035862 private MenuItem lookAtItem;
50045863 private MenuItem lookFromItem;
5005
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
50065865 private MenuItem cutItem;
5007
- private MenuItem duplicateItem;
5866
+ private MenuItem undoItem;
5867
+ private MenuItem redoItem;
5868
+ private JMenuItem duplicateItem;
50085869 private MenuItem cloneItem;
50095870 private MenuItem cloneSupportItem;
50105871 private MenuItem overwriteGeoItem;
....@@ -5017,7 +5878,7 @@
50175878 private MenuItem linkverticesItem;
50185879 private MenuItem relinkverticesItem;
50195880 private MenuItem setMasterItem;
5020
- private MenuItem resetMeshItem;
5881
+ private MenuItem resetAllItem;
50215882 private MenuItem stepAllItem;
50225883 private MenuItem revertMeshItem;
50235884 private MenuItem poseMeshItem;
....@@ -5028,10 +5889,11 @@
50285889 private MenuItem mergeGeometriesItem;
50295890 private MenuItem copyItem;
50305891 private MenuItem pasteItem;
5892
+ private MenuItem pasteIntoItem;
50315893 private MenuItem pasteLinkItem;
50325894 private MenuItem pasteCloneItem;
50335895 private MenuItem pasteExpandItem;
5034
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
50355897 private MenuItem clearAllItem;
50365898 private MenuItem genUVItem;
50375899 private MenuItem genNormalsMESHItem;
....@@ -5066,6 +5928,10 @@
50665928 private MenuItem showleavesItem;
50675929 private MenuItem markleavesItem;
50685930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
50695935
50705936 private MenuItem flipVItem;
50715937 private MenuItem unflipVItem;
....@@ -5077,15 +5943,17 @@
50775943 private MenuItem panoTexturesItem;
50785944
50795945 private MenuItem resetCentroidItem;
5080
- private MenuItem transformgeometryItem;
5946
+ private MenuItem resetCentroidXZItem;
50815947 private MenuItem resetTransformItem;
5948
+ private MenuItem transformGeometryItem;
5949
+ private MenuItem transformChildrenItem;
50825950 private MenuItem hideItem;
50835951 private MenuItem grabItem;
50845952 private MenuItem backItem;
50855953 private MenuItem frontItem;
50865954 private MenuItem cameraItem;
50875955 private MenuItem compositeItem;
5088
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
50895957 private MenuItem physicsItem;
50905958 private MenuItem frameselectorItem;
50915959 private MenuItem scriptNodeItem;
....@@ -5109,6 +5977,8 @@
51095977 private MenuItem attachBumpItem;
51105978 private MenuItem detachBumpItem;
51115979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
51125982
51135983 private MenuItem particleItem;
51145984 private MenuItem ragdollItem;
....@@ -5125,7 +5995,7 @@
51255995 private MenuItem blobItem;
51265996 private MenuItem latheItem;
51275997 private MenuItem bezierItem;
5128
- private MenuItem checkerItem;
5998
+ private MenuItem overlayItem;
51295999 private MenuItem meshItem;
51306000 // private MenuItem meshGroupItem;
51316001 private MenuItem springItem;
....@@ -5147,11 +6017,6 @@
51476017 private MenuItem doubleItem;
51486018 private MenuItem tripleItem;
51496019
5150
- private MenuItem importGFDItem;
5151
- private MenuItem importVRMLX3DItem;
5152
- private MenuItem import3DSItem;
5153
- private MenuItem importOBJItem;
5154
-
51556020 private MenuItem computeAOItem;
51566021 private MenuItem recompileItem;
51576022 private MenuItem editScriptItem;
....@@ -5161,4 +6026,8 @@
51616026 private MenuItem analyzeItem;
51626027 private MenuItem dumpItem;
51636028 //boolean freezemodel = false;
6029
+
6030
+ Menu cameraMenu;
6031
+ MenuItem editCameraItem;
6032
+ MenuItem restoreCameraItem;
51646033 }