Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
GroupEditor.java
....@@ -23,6 +23,31 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
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
+
2651 //ObjEditor objEditor;
2752 public void closeUI2()
2853 {
....@@ -60,6 +85,12 @@
6085 this.copy = this.group = group;
6186 //selectees = this.group.selectees;
6287
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6394 if(ui)
6495 SetupUI(objEditor);
6596 }
....@@ -74,16 +105,28 @@
74105 this.copy = this.group = copy;
75106 //selectees = this.group.selectees;
76107
77
- SetupMenu2(objEditor);
108
+ SetupMenu2(this); //objEditor);
78109 SetupUI2(objEditor);
79110 objEditor.SetupUI(true);
80111 SetupViews(objEditor);
81112
82113 ((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
+ }
83122 }
84123
85124 void CloneSelection(boolean supports)
86125 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
87130 // Object3D keep = GrafreeD.clipboard;
88131 //Object3D obj;
89132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +137,19 @@
94137
95138 makeSomething(clone, i==group.selection.size()-1);
96139 }
140
+ Globals.REPLACEONMAKE = keep;
97141 }
98142
99143 void CloneClipboard(boolean supports)
100144 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
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));
106150 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
151
+ makeSomething(CloneObject(Grafreed.clipboard, false));
152
+ Grafreed.clipboard.get(0).parent = keepparent;
109153 }
110154
111155 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +163,7 @@
119163 // obj.support = null;
120164 if (!supports)
121165 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
166
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123167 obj.parent = parent;
124168 // obj.support = support;
125169 // clone.support = support; // aout 2013
....@@ -148,30 +192,29 @@
148192
149193 //JTextField nameField;
150194
151
- void SetupMenu2(ObjEditor oe)
195
+ void SetupMenu2(GroupEditor oe)
152196 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
197
+ oe.jTree = new cTree();
198
+
164199 Menu menu;
165200 oe.menuBar.add(menu = new Menu("Edit"));
166201 //editItem = menu.add(new MenuItem("Edit"));
167202 //editItem.addActionListener(this);
168
- 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"));
169210 duplicateItem.addActionListener(this);
170
- menu.add("-");
171211 cloneItem = menu.add(new MenuItem("Clone"));
172212 cloneItem.addActionListener(this);
213
+ if (Globals.ADVANCED)
214
+ {
173215 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174216 cloneSupportItem.addActionListener(this);
217
+ }
175218 menu.add("-");
176219 cutItem = menu.add(new MenuItem("Cut"));
177220 cutItem.addActionListener(this);
....@@ -179,27 +222,123 @@
179222 copyItem.addActionListener(this);
180223 pasteItem = menu.add(new MenuItem("Paste"));
181224 pasteItem.addActionListener(this);
225
+
226
+ menu.add("-");
227
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
228
+ pasteIntoItem.addActionListener(this);
182229 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183230 pasteLinkItem.addActionListener(this);
184231 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185232 pasteCloneItem.addActionListener(this);
186233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187234 // pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- 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...
190242 clearAllItem = menu.add(new MenuItem("Clear All"));
191243 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());
192281
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
+
193333 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
334
+ if (Globals.ADVANCED)
335
+ {
198336 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199337 revertMeshItem.addActionListener(this);
200338 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201339 resetreferencesItem.addActionListener(this);
202340 menu.add("-");
341
+ }
203342 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204343 overwriteGeoItem.addActionListener(this);
205344 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +350,104 @@
211350 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212351 overwriteUVItem.addActionListener(this);
213352 menu.add("-");
353
+ if (Globals.ADVANCED)
354
+ {
214355 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215356 generateMeshItem.addActionListener(this);
216357 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217358 poseMeshItem.addActionListener(this);
218359 menu.add("-");
360
+ }
219361 resetsupportItem = menu.add(new MenuItem("Reset support"));
220362 resetsupportItem.addActionListener(this);
221363 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222364 linkverticesItem.addActionListener(this);
223365 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224366 relinkverticesItem.addActionListener(this);
367
+
368
+ if (Globals.ADVANCED)
369
+ {
225370 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226371 setMasterItem.addActionListener(this);
372
+ }
227373
228374 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
231377 backItem = menu.add(new MenuItem("Back"));
232378 backItem.addActionListener(this);
233379 frontItem = menu.add(new MenuItem("Front"));
234380 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- 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"));
238387 hideItem.addActionListener(this);
388
+ }
239389 ungroupItem = menu.add(new MenuItem("Ungroup"));
240390 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
243
- randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
248398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249399 switchGeoItem.addActionListener(this);
250400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251401 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
402
+ morphItem = menu.add(new MenuItem("Morph Group"));
253403 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);
254410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255411 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
412
+ }
258413
259414 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
262417 billboardItem = menu.add(new MenuItem("Billboard"));
263418 billboardItem.addActionListener(this);
264419 csgItem = menu.add(new MenuItem("CSG"));
265420 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267422 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269424 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
430
+ if (Globals.ADVANCED)
431
+ {
432
+ menu.add("-");
272433 linkerItem = menu.add(new MenuItem("Linker"));
273434 linkerItem.addActionListener(this);
274435 templateItem = menu.add(new MenuItem("Template"));
275436 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278437 pointflowItem = menu.add(new MenuItem("Point Flow"));
279438 pointflowItem.addActionListener(this);
439
+ }
280440 menu.add("-");
281441 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282442 resetTransformItem.addActionListener(this);
283443 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284444 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- 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);
287451
288452 oe.menuBar.add(menu = new Menu("Geometry"));
289453 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +458,11 @@
294458 genNormalsCADItem.addActionListener(this);
295459 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296460 genNormalsMESHItem.addActionListener(this);
297
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
461
+ if (Globals.ADVANCED)
462
+ {
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
298464 genNormalsMINEItem.addActionListener(this);
465
+ }
299466 stripifyItem = menu.add(new MenuItem("Stripify"));
300467 stripifyItem.addActionListener(this);
301468 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +484,34 @@
317484 reduce34MeshItem.addActionListener(this);
318485 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319486 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322487 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323488 clipMeshItem.addActionListener(this);
489
+
490
+ if (Globals.ADVANCED)
491
+ {
492
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
493
+ smoothMeshItem.addActionListener(this);
494
+ }
324495
325496 oe.menuBar.add(menu = new Menu("Attributes"));
326497 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327498 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);
328503 menu.add("-");
329504 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330505 liveleavesItem.addActionListener(this);
331506 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332507 unliveleavesItem.addActionListener(this);
508
+ if (Globals.ADVANCED)
509
+ {
333510 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334511 supportleavesItem.addActionListener(this);
335512 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336513 unsupportleavesItem.addActionListener(this);
514
+ }
337515 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338516 hideleavesItem.addActionListener(this);
339517 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +520,14 @@
342520 markleavesItem.addActionListener(this);
343521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344522 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);
345531 menu.add("-");
346532 flipVItem = menu.add(new MenuItem("Flip V"));
347533 flipVItem.addActionListener(this);
....@@ -367,45 +553,56 @@
367553 attachBumpItem.addActionListener(this);
368554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
369555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
370557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
371558 detachPigmentItem.addActionListener(this);
372559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
373560 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);
374565 menu.add("-");
375566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
376567 sortbysizeItem.addActionListener(this);
377568 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378569 sortbynameItem.addActionListener(this);
379570 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.
380578 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381579 extractGeometriesItem.addActionListener(this);
382580 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383581 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
582
+ }
388583
389584 oe.menuBar.add(menu = new Menu("Insert"));
390585 buildCreateMenu(menu);
391586
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403587 oe.menuBar.add(menu = new Menu("Tools"));
404588 buildToolsMenu(menu);
405589 }
406590
591
+
407592 void SetupUI2(ObjEditor oe)
408593 {
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
+
409606 //new Exception().printStackTrace();
410607
411608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,110 +631,327 @@
434631 oe.radioPanel.add(dummyButton);
435632 oe.buttonGroup.add(dummyButton);
436633 */
437
- aConstraints.gridy += 1;
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
438637
439638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440639
441
- oe.aConstraints.gridwidth = 1;
442
- 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);
443643
444
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
- liveCB.setToolTipText("Enabled animation");
446
- liveCB.addItemListener(this);
447
-
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
450
- trackCB.setToolTipText("Enable tracking");
451
- trackCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- 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);
455656 screenfitButton.setToolTipText("Screen fit");
456657 screenfitButton.addActionListener(this);
457
- 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
+
458708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459709 // screenfitpointButton.addActionListener(this);
460
-// oe.aConstraints.gridx += 1;
461
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
462
- snapobjectButton.addActionListener(this);
463
- snapobjectButton.setToolTipText("Snap Object");
464
- oe.aConstraints.gridx += 1;
465710
466
- //aConstraints.gridx = 0;
467
- //aConstraints.gridy += 1;
468
- oe.aConstraints.weighty = 0;
469
- oe.aConstraints.gridwidth = 1;
470
-
471
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
- flashSelectionButton.setToolTipText("Show selection");
473
- flashSelectionButton.addActionListener(this);
474
-
475
- oe.toolbarPanel.add(new cButton(" ", false));
476
-
477
- oe.aConstraints.gridx += 1;
478
- oe.aConstraints.weighty = 0;
479
- oe.aConstraints.gridwidth = 1;
480
-
481
- //
482
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
483
- twoButton.setToolTipText("Show center view only");
484
- twoButton.addActionListener(this);
485
- 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);
486718 fourButton.addActionListener(this);
487
- fourButton.setToolTipText("Show left panel only");
488
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
489
- sixButton.setToolTipText("2-column layout left");
490
- sixButton.addActionListener(this);
491
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
492
- 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");
493731 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
495
- sevenButton.setToolTipText("3-column layout");
496
- 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);
497738 //
498739
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- 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");
501742 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
743
+
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504745 closeButton.setToolTipText("Close tab");
505746 closeButton.addActionListener(this);
506747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
507748 //clearButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509
-
510
- oe.aConstraints.gridx = 1; //
511
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
512
- editButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516749
517
- 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");
518931 uneditButton.addActionListener(this);
519932
520
- oe.aConstraints.gridx += 1;
521
- oe.aConstraints.weighty = 0;
522
- oe.aConstraints.gridwidth = 1;
523
-
524
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
525
- clearPanelButton.addActionListener(this);
526
-
527
- oe.aConstraints.gridx += 1;
528
- oe.aConstraints.weighty = 0;
529
- oe.aConstraints.gridwidth = 1;
530
-
531
- 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");
532935 allParamsButton.addActionListener(this);
533936
534
- oe.aConstraints.gridx += 1;
535
- oe.aConstraints.weighty = 0;
536
- oe.aConstraints.gridwidth = 1;
537
-
538
- 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");
539943 unselectButton.addActionListener(this);
540944
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
+
541955 // oe.aConstraints.gridx += 1;
542956 // oe.aConstraints.weighty = 0;
543957 // oe.aConstraints.gridwidth = 1;
....@@ -549,47 +963,32 @@
549963 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
550964 // gcButton.addActionListener(this);
551965
552
- oe.aConstraints.gridx = 0;
553
- oe.aConstraints.gridy += 1;
554
-
555
- //ctrlPanel.add(objList = new List(5, true));
556
- oe.aConstraints.gridwidth = 100;
557
- // oe.aConstraints.gridheight = 100;
558
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
559
- oe.aConstraints.gridheight = 1;
560
- oe.aConstraints.weighty = 0.5;
561
- oe.aConstraints.gridx = 0;
562
- JScrollPane jSP;
966
+ cGridBag jSPPanel = new cGridBag();
967
+
968
+ JScrollPane jSP;
563969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
564
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
565971 ResetModel();
566
- oe.aConstraints.weighty = 0.5;
567
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
568
- oe.aConstraints.gridy += 1;
569
- oe.aConstraints.gridwidth = 1;
570
-
571
- oe.aConstraints.weighty = 0;
572
- oe.aConstraints.gridwidth = 2;
573
-
574
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
575
- colorCB.addItemListener(this);
576
- oe.aConstraints.gridx += 2;
577
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
578
- materialCB.addItemListener(this);
579
- oe.aConstraints.gridx += 2;
580
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
581
- textureCB.addItemListener(this);
582
-
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585972
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
+
586985 //jList.addListSelectionListener(this);
587986 oe.jTree.addTreeSelectionListener(this);
588987 //jTree.setRootVisible(false);
589988 //jTree.setEditable(true);
590989 oe.jTree.setDragEnabled(true);
591990 //jTree.setPreferredSize(new Dimension(10,10));
592
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
593992
594993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
595994
....@@ -601,53 +1000,67 @@
6011000 dgr.addDragGestureListener(this);
6021001 }catch(Exception e) {}
6031002 */
604
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
6051004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6061005 }
6071006
6081007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6091008 {
610
- //constraints.gridx = 0;
611
- //constraints.gridy = 0;
612
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
- fastCB.setToolTipText("Fast mode");
614
- fastCB.addItemListener(this);
615
- //constraints.gridy += 1;
616
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
- supportCB.setToolTipText("Enabled rigging");
618
- 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);
6191012
620
- // 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
+
6211041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6221042 // localCB.addItemListener(this);
6231043
624
- //constraints.gridy += 1;
1044
+ panel.Return();
1045
+
6251046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6261047 crowdCB.setToolTipText("Used for crowds");
6271048 crowdCB.addItemListener(this);
6281049
629
- //constraints.gridy += 1;
6301050 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
6311051 smoothCB.setToolTipText("Snapping delay");
6321052 smoothCB.addItemListener(this);
6331053
634
- //constraints.gridy += 1;
6351054 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
6361055 slowCB.setToolTipText("Smooth interpolation");
6371056 slowCB.addItemListener(this);
638
- //constraints.gridy += 1;
639
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640
- boxCB.setToolTipText("Display bounding boxes");
641
- boxCB.addItemListener(this);
642
- //constraints.gridy += 1;
643
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645
- zoomBoxCB.addItemListener(this);
646
-
1057
+
6471058 // constraints.gridy += 1;
6481059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6491060 // speakerMocapCB.addItemListener(this);
6501061
1062
+ panel.Return();
1063
+
6511064 if (false)
6521065 {
6531066 // handled in scripts
....@@ -662,36 +1075,85 @@
6621075 //constraints.gridy += 1;
6631076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6641077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
6651079 }
6661080
6671081 //constraints.gridx += 1;
6681082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6691083 // debugCB.addItemListener(this);
6701084
671
- //constraints.gridy += 1;
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
6721089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
6731091 oeilCB.addItemListener(this);
6741092
675
- //constraints.gridy += 1;
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
+ {
6761113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6771114 lookAtCB.setToolTipText("Look-at target");
6781115 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);
6791130
6801131 }
6811132
6821133 void EditObject(Object3D obj)
6831134 {
6841135 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
+
6851144 radioButton.SetObject(obj);
686
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
6871146 radioButton.SetCamera(cameraView.renderCamera, false);
6881147 radioButton.addActionListener(this);
6891148 radioPanel.add(radioButton);
6901149 buttonGroup.add(radioButton);
6911150 radioButton.doClick();
6921151 }
1152
+
6931153 void SetupViews(ObjEditor oe)
6941154 {
1155
+ theFrame = this;
1156
+
6951157 oe.SetupViews();
6961158
6971159 System.out.println("SetupViews");
....@@ -700,23 +1162,28 @@
7001162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7011163 }
7021164
703
- JCheckBox liveCB;
704
- JCheckBox supportCB;
705
- JCheckBox localCB;
706
- JCheckBox crowdCB;
707
- JCheckBox smoothCB;
708
- JCheckBox fastCB;
709
- JCheckBox slowCB;
710
- JCheckBox boxCB;
711
- JCheckBox zoomBoxCB;
712
- JCheckBox trackCB;
713
- 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;
7141178 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
7201187
7211188 // static int COLOR = 1;
7221189 // static int MATERIAL = 2;
....@@ -724,9 +1191,9 @@
7241191
7251192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7261193
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
7301197
7311198 public void itemStateChanged(ItemEvent e)
7321199 {
....@@ -754,6 +1221,7 @@
7541221 } else if(e.getSource() == liveCB)
7551222 {
7561223 cameraView.ToggleLive();
1224
+ refreshContents(false);
7571225 }
7581226 else if(e.getSource() == supportCB)
7591227 {
....@@ -818,6 +1286,18 @@
8181286 {
8191287 cameraView.ToggleOeil();
8201288 }
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
+ }
8211301 else if(e.getSource() == lookAtCB)
8221302 {
8231303 cameraView.ToggleLookAt();
....@@ -834,7 +1314,8 @@
8341314
8351315 /**/
8361316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
837
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
8381319 if ((path == null) || (path.getPathCount() <= 1)) {
8391320 // We can't move the root node or an empty selection
8401321 return;
....@@ -897,8 +1378,6 @@
8971378 }
8981379 }
8991380
900
- String string = (String) object;
901
-
9021381 System.out.println("Transfer = " + object + "; drop : " + target);
9031382 // if( object instanceof java.io.File[])
9041383 // {
....@@ -906,7 +1385,11 @@
9061385 // objEditor.DropFile((java.io.File[]) object, true);
9071386 // return;
9081387 // }
909
- 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) == ':')
9101393 {
9111394 // file(s)
9121395 String[] names = string.split("\n");
....@@ -933,7 +1416,7 @@
9331416
9341417 flashIt = false;
9351418 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1419
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371420 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381421
9391422 if (group.selection.size() == 1)
....@@ -949,23 +1432,33 @@
9491432
9501433 assert target == objEditor.jTree;
9511434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
9521436 try {
953
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9541438 } catch (Exception e) {
9551439 System.out.println("destinationPath : " + destinationPath);
9561440 return;
9571441 }
9581442
959
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
9601444 {
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
+// {
9611454 loadClipboard(true);
9621455 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
964
- } else {
965
- loadClipboard(false);
966
- objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
968
- }
1456
+ pasteInto(false, false);
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
9691462 }
9701463 public void dropActionChanged(DropTargetDragEvent dtde)
9711464 // Called if the user has modified the current drop gesture
....@@ -1070,85 +1563,107 @@
10701563 {
10711564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10721565 //heightFieldItem.addActionListener(this);
1073
- gridItem = menu.add(new MenuItem("Grid"));
1074
- gridItem.addActionListener(this);
1075
- rectoidItem = menu.add(new MenuItem("Box"));
1076
- rectoidItem.addActionListener(this);
1077
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1078
- ellipsoidItem.addActionListener(this);
1079
- coneItem = menu.add(new MenuItem("Cone"));
1080
- coneItem.addActionListener(this);
1081
- torusItem = menu.add(new MenuItem("Torus"));
1082
- torusItem.addActionListener(this);
1083
- superItem = menu.add(new MenuItem("Superellipsoid"));
1084
- 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
+ {
10851584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10861585 kleinItem.addActionListener(this);
1087
- particleItem = menu.add(new MenuItem("Particle system"));
1088
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
1590
+ if (Globals.ADVANCED)
1591
+ {
10891592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901593 ragdollItem.addActionListener(this);
10911594 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921595 ragdoll2Item.addActionListener(this);
1596
+ }
10931597 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1598
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951599 meshItem.addActionListener(this);
10961600 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971601 // meshGroupItem.addActionListener(this);
1602
+ if (Globals.ADVANCED)
1603
+ {
10981604 springItem = menu.add(new MenuItem("Spring"));
10991605 springItem.addActionListener(this);
11001606 flagItem = menu.add(new MenuItem("Flag"));
11011607 flagItem.addActionListener(this);
1102
- bezierItem = menu.add(new MenuItem("Patch"));
1103
- bezierItem.addActionListener(this);
1104
- checkerItem = menu.add(new MenuItem("Checker"));
1105
- checkerItem.addActionListener(this);
11061608 blobItem = menu.add(new MenuItem("Blob"));
11071609 blobItem.addActionListener(this);
11081610 latheItem = menu.add(new MenuItem("Lathe"));
11091611 latheItem.addActionListener(this);
1110
- lightItem = menu.add(new MenuItem("Light"));
1111
- 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);
11121619 menu.add("-");
11131620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11141621 //superLoopItem.addActionListener(this);
1115
- loopItem = menu.add(new MenuItem("Loop"));
1116
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
11171624 doubleItem = menu.add(new MenuItem("Fork"));
11181625 doubleItem.addActionListener(this);
1626
+ if (Globals.ADVANCED)
1627
+ {
11191628 tripleItem = menu.add(new MenuItem("Trident"));
11201629 tripleItem.addActionListener(this);
1630
+ }
11211631 }
11221632
11231633 void buildToolsMenu(Menu menu)
11241634 {
11251635 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261636 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1637
+ animationItem.setState(Globals.ANIMATION);
1638
+
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
11281641
11291642 menu.add("-");
11301643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311644 parseverticesItem.addActionListener(this);
11321645 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331646 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1647
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351648 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381649 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391650 reduceMorphItem.addActionListener(this);
11401651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411652 reduce34MorphItem.addActionListener(this);
1142
-
1143
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1144
- computeAOItem.addActionListener(this);
11451653 menu.add("-");
1146
-
11471654 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481655 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("-");
11491664 menu.add(analyzeItem = new MenuItem("Analyze"));
11501665 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1666
+ menu.add(dumpItem = new MenuItem("Print"));
11521667 dumpItem.addActionListener(this);
11531668 // menu.add(pathItem = new MenuItem("From-to path"));
11541669 // pathItem.addActionListener(this);
....@@ -1166,6 +1681,7 @@
11661681 menu.add("-");
11671682 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681683 editScriptItem.addActionListener(this);
1684
+ }
11691685 }
11701686
11711687 void ScreenFit()
....@@ -1288,9 +1804,34 @@
12881804 shadow.material = new cMaterial(obj.material);
12891805 shadow.material.diffuse = 0.0001f;
12901806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
12911808
12921809 makeSomething(shadow);
12931810 }
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
+ }
12941835
12951836 /**
12961837 * applyExample
....@@ -1494,9 +2035,9 @@
14942035
14952036 void Overwrite(int mask)
14962037 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2038
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14982039 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
2040
+ Object3D content = Grafreed.clipboard.get(0);
15002041
15012042 if (content instanceof cGroup && ((cGroup)content).transientlink )
15022043 content = ((cGroup)content).get(0);
....@@ -1535,7 +2076,7 @@
15352076 {
15362077 ScreenFit();
15372078 } else
1538
- if (source == switchItem)
2079
+ if (source == switchViewItem)
15392080 {
15402081 cVector v1 = new cVector();
15412082 cVector v2 = new cVector();
....@@ -1544,11 +2085,11 @@
15442085 objEditor.cameraView.renderCamera.setAim(v2, v1);
15452086 objEditor.cameraView.repaint();
15462087 } else
1547
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
15482089 {
15492090 makeSomething(new Box());
15502091 } else
1551
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
15522093 {
15532094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15542095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1627,27 +2168,27 @@
16272168
16282169 makeSomething(obj);
16292170 } else
1630
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
16312172 {
16322173 makeSomething(new Grid());
16332174 } else
1634
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
16352176 {
16362177 makeSomething(new Sphere());
16372178 } else
1638
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
16392180 {
16402181 makeSomething(new Cone());
16412182 } else
1642
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
16432184 {
16442185 makeSomething(new Torus());
16452186 } else
1646
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
16472188 {
16482189 makeSomething(new Superellipsoid());
16492190 } else
1650
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
16512192 {
16522193 makeSomething(new Klein());
16532194 } else
....@@ -1667,7 +2208,7 @@
16672208 {
16682209 makeSomething(new BezierSurface());
16692210 } else
1670
- if (source == checkerItem)
2211
+ if (source == overlayItem || source == overlayButton)
16712212 {
16722213 /*
16732214 Object3D obj = new BezierSurface(5,8);
....@@ -1715,10 +2256,27 @@
17152256 s.setup();
17162257 makeSomething(s);
17172258 } else
1718
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
17192260 {
17202261 makeSomething(new Light());
17212262 } 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
17222280 if (source == csgItem)
17232281 {
17242282 group(new CSG());
....@@ -1765,30 +2323,30 @@
17652323
17662324 group(g);
17672325 } else
1768
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
17692327 {
17702328 Composite csg = new GroupLeaf();
17712329 csg.count = 5;
17722330 group(csg);
1773
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
17742332 csg.addChild(child);
17752333 child.addChild(csg);
17762334 } else
17772335 if (source == doubleItem)
17782336 {
1779
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
17802338 csg.count = 5;
17812339 group(csg);
1782
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
17832341 csg.addChild(child);
17842342 child.addChild(csg);
1785
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
17862344 csg.addChild(child);
17872345 child.addChild(csg);
17882346 } else
17892347 if (source == tripleItem)
17902348 {
1791
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
17922350 csg.count = 4;
17932351 group(csg);
17942352 Composite child = new cGroup();
....@@ -1801,27 +2359,10 @@
18012359 csg.addChild(child);
18022360 child.addChild(csg);
18032361 } else
1804
-
1805
- if (source == importGFDItem)
1806
- {
1807
- ImportGFD();
1808
- } else
1809
- if (source == importVRMLX3DItem)
1810
- {
1811
- ImportVRMLX3D();
1812
- } else
1813
- if (source == import3DSItem)
1814
- {
1815
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1816
- } else
1817
- if (source == importOBJItem)
1818
- {
1819
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1820
- } else
18212362 if (source == computeAOItem)
18222363 {
18232364 Globals.drawMode = CameraPane.OCCLUSION;
1824
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
18252366 } else
18262367 if (source == recompileItem)
18272368 {
....@@ -1836,7 +2377,7 @@
18362377 if (source == invariantsItem)
18372378 {
18382379 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2380
+ Grafreed.grafreeD.universe.invariants();
18402381 } else
18412382 if (source == memoryItem)
18422383 {
....@@ -1855,19 +2396,61 @@
18552396 {
18562397 DumpObject();
18572398 } 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
18582444 if (source == screenfitButton)
18592445 {
1860
- //Reload(lastConverter, lastFilename, true);
18612446 ScreenFit();
18622447 } else
18632448 if (source == screenfitpointButton)
18642449 {
1865
- //Reload(lastConverter, lastFilename, true);
18662450 ScreenFitPoint();
18672451 } else
18682452 if (source == snapobjectButton)
18692453 {
1870
- //Reload(lastConverter, lastFilename, true);
18712454 SnapObject();
18722455 } else
18732456 // if (event.getSource() == recompileButton)
....@@ -1904,12 +2487,20 @@
19042487 {
19052488 loadClipboard(true);
19062489 } else
2490
+ if (source == undoItem)
2491
+ {
2492
+ Undo();
2493
+ } else
2494
+ if (source == redoItem)
2495
+ {
2496
+ Redo();
2497
+ } else
19072498 if (source == duplicateItem)
19082499 {
1909
- Object3D keep = GrafreeD.clipboard;
2500
+ Object3D keep = Grafreed.clipboard;
19102501 loadClipboard(false);
19112502 paste(false);
1912
- GrafreeD.clipboard = keep;
2503
+ Grafreed.clipboard = keep;
19132504 } else
19142505 if (source == cloneItem)
19152506 {
....@@ -1927,13 +2518,17 @@
19272518 {
19282519 paste(false);
19292520 } else
2521
+ if (source == pasteIntoItem)
2522
+ {
2523
+ pasteInto(true, false);
2524
+ } else
19302525 if (source == pasteLinkItem)
19312526 {
1932
- pasteInto(false);
2527
+ pasteInto(false, false);
19332528 } else
19342529 if (source == pasteCloneItem)
19352530 {
1936
- pasteInto(true);
2531
+ pasteInto(true, true);
19372532 } else
19382533 if (source == pasteExpandItem)
19392534 {
....@@ -2125,9 +2720,9 @@
21252720 // group.selection.get(0).setMasterThis(content); // should be identity
21262721 // refreshContents();
21272722 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2723
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292724 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2725
+ Object3D content = Grafreed.clipboard.get(0);
21312726
21322727 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332728 content = ((cGroup)content).get(0);
....@@ -2135,11 +2730,11 @@
21352730 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362731 for (int i=0; i<group.selection.size(); i++)
21372732 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2733
+ boolean random = CameraPane.SWITCH;
2734
+ CameraPane.SWITCH = false; // parse all random nodes
21402735 group.selection.get(i).linkVerticesThis(content);
21412736 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2737
+ CameraPane.SWITCH = random;
21432738 }
21442739 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452740 refreshContents();
....@@ -2149,20 +2744,20 @@
21492744 {
21502745 for (int i=0; i<group.selection.size(); i++)
21512746 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2747
+ boolean random = CameraPane.SWITCH;
2748
+ CameraPane.SWITCH = false; // parse all random nodes
21542749 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2750
+ CameraPane.SWITCH = random;
21562751 }
21572752
21582753 refreshContents();
21592754 } else
21602755 if (source == relinkverticesItem)
21612756 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2757
+ boolean random = CameraPane.SWITCH;
2758
+ CameraPane.SWITCH = false; // parse all random nodes
21642759 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2760
+ CameraPane.SWITCH = random;
21662761
21672762 refreshContents();
21682763 } else
....@@ -2177,9 +2772,9 @@
21772772 } else
21782773 if (source == setMasterItem)
21792774 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2775
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812776 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2777
+ Object3D content = Grafreed.clipboard.get(0);
21832778
21842779 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852780 content = ((cGroup)content).get(0);
....@@ -2192,9 +2787,9 @@
21922787 {
21932788 if (group.selection.size() == 1)
21942789 {
2195
- if (GrafreeD.clipboard.size() == 1)
2790
+ if (Grafreed.clipboard.size() == 1)
21962791 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2792
+ Object3D content = Grafreed.clipboard.get(0);
21982793
21992794 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002795 content = ((cGroup)content).get(0);
....@@ -2211,7 +2806,7 @@
22112806 {
22122807 RevertMeshes();
22132808 } else
2214
- if (source == resetMeshItem)
2809
+ if (source == resetAllItem)
22152810 {
22162811 ResetAll();
22172812 } else
....@@ -2219,7 +2814,7 @@
22192814 {
22202815 StepAll();
22212816 } else
2222
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
22232818 {
22242819 //int indices[] = jList.getSelectedIndices();
22252820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2231,9 +2826,9 @@
22312826 {
22322827 ClearSelection(true);
22332828 } else
2234
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
22352830 {
2236
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
22372832 } else
22382833 if (source == hideItem)
22392834 {
....@@ -2251,16 +2846,16 @@
22512846 {
22522847 makeSomething(new Camera());
22532848 } else
2254
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
22552850 {
22562851 group(new Composite());
22572852 } else
2258
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
22592854 {
22602855 RandomNode random = new RandomNode();
22612856 group(random);
22622857 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
2858
+ random.name = random.get(0).name + "Switch";
22642859 } else
22652860 if (source == physicsItem)
22662861 {
....@@ -2357,7 +2952,7 @@
23572952 {
23582953 group(new cLinker());
23592954 } else
2360
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
23612956 {
23622957 group(new TextureNode());
23632958 } else
....@@ -2377,17 +2972,30 @@
23772972 {
23782973 CastShadow(2);
23792974 } else
2380
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
23812976 {
2382
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
23832979 for (int i=0; i<group.selection.size(); i++)
23842980 {
2385
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
23862986 }
23872987
2388
- ClearSelection(false);
2389
-
2390
- 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
+ }
23912999 } else
23923000 if (source == genUVItem)
23933001 {
....@@ -2399,7 +3007,7 @@
23993007 } else
24003008 if (source == genNormalsMESHItem)
24013009 {
2402
- GenNormals(true); // TODO
3010
+ GenNormalsMESH();
24033011 } else
24043012 if (source == genNormalsORGANItem)
24053013 {
....@@ -2464,6 +3072,22 @@
24643072 if (source == unmarkleavesItem)
24653073 {
24663074 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);
24673091 } else
24683092 if (source == flipVItem)
24693093 {
....@@ -2549,9 +3173,13 @@
25493173 {
25503174 SmoothMesh();
25513175 } else
2552
- if (source == transformgeometryItem)
3176
+ if (source == transformGeometryItem)
25533177 {
25543178 TransformGeometry();
3179
+ } else
3180
+ if (source == transformChildrenItem)
3181
+ {
3182
+ TransformChildren();
25553183 } else
25563184 if (source == resetTransformItem)
25573185 {
....@@ -2559,7 +3187,11 @@
25593187 } else
25603188 if (source == resetCentroidItem)
25613189 {
2562
- ResetCentroid();
3190
+ ResetCentroid(true);
3191
+ } else
3192
+ if (source == resetCentroidXZItem)
3193
+ {
3194
+ ResetCentroid(false);
25633195 } else
25643196 if (source == resetParentItem)
25653197 {
....@@ -2664,7 +3296,7 @@
26643296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26653297 {
26663298 obj = (Object3D)e.nextElement();
2667
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
26683300 }
26693301
26703302 refreshContents();
....@@ -2680,6 +3312,31 @@
26803312
26813313 refreshContents();
26823314 } 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
26833340 if (source == flashSelectionButton)
26843341 {
26853342 CameraPane.flash = true;
....@@ -2691,6 +3348,10 @@
26913348 if (source == twoButton)
26923349 {
26933350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
26943355 // bug
26953356 //gridPanel.setDividerLocation(1.0);
26963357 //bigPanel.setDividerLocation(0.0);
....@@ -2723,10 +3384,31 @@
27233384 bigThree.ClearUI();
27243385 bigThree.add(centralPanel);
27253386 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
+
27263405 } else
27273406 if (source == threeButton)
27283407 {
27293408 radio.layout = threeButton;
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
27303412
27313413 // bigThree.remove(scenePanel);
27323414 // bigThree.remove(centralPanel);
....@@ -2756,13 +3438,18 @@
27563438 // centralPanel.setVisible(true);
27573439 // XYZPanel.setVisible(true);
27583440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
27593442 bigThree.add(centralPanel);
2760
- bigThree.add(XYZPanel);
27613443 bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
27623446 } else
27633447 if (source == fourButton)
27643448 {
27653449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
27663453
27673454 // bigThree.remove(scenePanel);
27683455 // bigThree.remove(centralPanel);
....@@ -2794,10 +3481,15 @@
27943481 bigThree.ClearUI();
27953482 bigThree.add(scenePanel);
27963483 bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
27973486 } else
27983487 if (source == sixButton)
27993488 {
28003489 radio.layout = sixButton;
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
28013493
28023494 // bigThree.remove(scenePanel);
28033495 // bigThree.remove(centralPanel);
....@@ -2827,13 +3519,18 @@
28273519 // centralPanel.setVisible(true);
28283520 // XYZPanel.setVisible(false);
28293521 bigThree.ClearUI();
2830
- bigThree.add(scenePanel);
28313522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
28323524 bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
28333527 } else
28343528 if (source == sevenButton)
28353529 {
28363530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
28373534
28383535 // bigThree.remove(scenePanel);
28393536 // bigThree.remove(centralPanel);
....@@ -2867,6 +3564,8 @@
28673564 bigThree.add(centralPanel);
28683565 bigThree.add(XYZPanel);
28693566 bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
28703569 } else
28713570 if (source == rootButton)
28723571 {
....@@ -2878,6 +3577,7 @@
28783577 EditObject(obj);
28793578 }
28803579
3580
+ cameraView.requestFocusInWindow();
28813581 refreshContents(true);
28823582 } else
28833583 if (source == closeButton)
....@@ -2887,22 +3587,37 @@
28873587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883588 {
28893589 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
28923598 buttonGroup.remove(ab);
28933599 radioPanel.remove(ab);
28943600
2895
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
28963603 // ab.GetObject().objectUI = null; // ?????????
28973604
28983605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993606 break;
29003607 }
29013608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
29023611 refreshContents(true);
29033612 } else
29043613 if (source == editItem || source == editButton)
29053614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
29063621 EditSelection(false);
29073622 } else
29083623 if (source == uneditButton)
....@@ -2912,12 +3627,13 @@
29123627 Object3D child = (Object3D)e.nextElement();
29133628 if(child.editWindow != null)
29143629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
29153631 child.CloseUI();
29163632 listUI.remove(child);
29173633
2918
- child.editWindow = null; // ???????????
3634
+ //child.editWindow = null; // ???????????
29193635 }
2920
- objEditor.ctrlPanel.validate();
3636
+ objEditor.ctrlPanel.FlushUI();
29213637 //objEditor.jTree.clearSelection();
29223638 //objEditor.ResetSliders();
29233639 refreshContents(true);
....@@ -2928,6 +3644,7 @@
29283644 //copy.ClearUI();
29293645 for (Object3D obj : listUI)
29303646 {
3647
+ obj.pinned = false;
29313648 obj.CloseUI();
29323649 }
29333650 listUI.clear();
....@@ -2937,7 +3654,7 @@
29373654 {
29383655 assert(copy == group);
29393656
2940
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29413658
29423659 for (Object3D obj : listUI)
29433660 {
....@@ -2986,6 +3703,9 @@
29863703 }
29873704
29883705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
29893709 //Globals.theRenderer.object = group;
29903710 if(!useclient)
29913711 {
....@@ -3001,20 +3721,46 @@
30013721 frontView.object = group;
30023722 sideView.object = group;
30033723 }
3004
- group.editWindow = this;
3724
+
3725
+// fix "+" issue
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
3728
+
30053729 /*
30063730 currentLayout = radio.layout;
30073731 if (currentLayout == null)
30083732 currentLayout = sevenButton;
30093733 */
30103734 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);
30113742 keepparent = group.parent;
30123743 // PARENT = NULL or not???
30133744 //group.parent = null; // ROOT
30143745 //group.attributes = -1;
30153746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
30163749 refreshContents(true);
3017
- }
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
+ }
30183764 else
30193765 {
30203766 //return super.action(event, arg);
....@@ -3023,7 +3769,6 @@
30233769 }
30243770
30253771 boolean useclient = false;
3026
- cRadio radio;
30273772
30283773 void ToggleRoot()
30293774 {
....@@ -3075,6 +3820,28 @@
30753820 refreshContents();
30763821 }
30773822
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
+ }
30783845
30793846 void ResetTransform()
30803847 {
....@@ -3187,7 +3954,7 @@
31873954 refreshContents();
31883955 }
31893956
3190
- void ResetCentroid()
3957
+ void ResetCentroid(boolean full)
31913958 {
31923959 Object3D obj;
31933960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +3969,16 @@
32023969 LA.matIdentity(Object3D.mat);
32033970 obj.getBounds(minima, maxima, false);
32043971 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3972
+ if (full)
3973
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32063974 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32073975 obj.TransformMesh(Object3D.mat);
3976
+
32083977 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3978
+ if (full)
3979
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32103980 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3981
+
32113982 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32123983 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32133984 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +4007,8 @@
32364007
32374008 int size = obj.MemorySize();
32384009
3239
- 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)");
32404012 }
32414013 }
32424014 catch (Exception e)
....@@ -3273,9 +4045,9 @@
32734045 obj = (Object3D)e.nextElement();
32744046
32754047 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
4048
+ Grafreed.AnalyzeObject(obj);
32774049 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
4050
+ Grafreed.AnalyzeObject(obj.bRep);
32794051
32804052 // System.err.println((size/1024) + " KB is the size of " + obj);
32814053 }
....@@ -3317,6 +4089,13 @@
33174089 void GenNormals(boolean crease)
33184090 {
33194091 group.GenNormalsS(crease);
4092
+
4093
+ refreshContents();
4094
+ }
4095
+
4096
+ void GenNormalsMESH()
4097
+ {
4098
+ group.GenNormalsMeshS();
33204099
33214100 refreshContents();
33224101 }
....@@ -3489,8 +4268,8 @@
34894268
34904269 void ParseVertices()
34914270 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
4271
+ boolean epsequal = Grafreed.epsequal;
4272
+ Grafreed.epsequal = true;
34944273
34954274 for (int i=0; i<group.selection.size(); i++)
34964275 {
....@@ -3515,7 +4294,7 @@
35154294 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35164295 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35174296
3518
- g.add(GrafreeD.clipboard);
4297
+ g.add(Grafreed.clipboard);
35194298
35204299 buffer.add(g);
35214300 }
....@@ -3530,7 +4309,7 @@
35304309 makeSomething(buffer, i==group.selection.size()-1);
35314310 }
35324311
3533
- GrafreeD.epsequal = epsequal;
4312
+ Grafreed.epsequal = epsequal;
35344313
35354314 refreshContents();
35364315 }
....@@ -3548,7 +4327,16 @@
35484327 String pigment = Object3D.GetPigment(tex);
35494328 //String bump = Object3D.GetBump(tex);
35504329
3551
- 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
+ }
35524340
35534341 double s = v.s;
35544342
....@@ -3636,11 +4424,11 @@
36364424
36374425 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36384426
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
4427
+ boolean random = CameraPane.SWITCH;
4428
+ CameraPane.SWITCH = false; // parse all random nodes
36414429 lowres.linkVerticesThis(null);
36424430 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
4431
+ CameraPane.SWITCH = random;
36444432
36454433 System.err.flush();
36464434
....@@ -3680,7 +4468,7 @@
36804468 return;
36814469
36824470 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4471
+ Object3D ref = Grafreed.clipboard.get(0);
36844472
36854473 Object3D newgroup = new Object3D("Po:" + poses.name);
36864474
....@@ -3874,9 +4662,9 @@
38744662
38754663 void ClipMesh()
38764664 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4665
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784666 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4667
+ Object3D content = Grafreed.clipboard.get(0);
38804668
38814669 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824670 content = ((cGroup)content).get(0);
....@@ -3885,7 +4673,7 @@
38854673 // {
38864674 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874675 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4676
+ group.selection.ClipMesh(Grafreed.clipboard);
38894677 }
38904678 // group.selection.ClipMesh(GrafreeD.clipboard);
38914679 System.out.println("DONE.");
....@@ -3932,6 +4720,18 @@
39324720 void MarkLeaves(boolean hide)
39334721 {
39344722 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);
39354735 refreshContents();
39364736 }
39374737
....@@ -4006,28 +4806,25 @@
40064806 // }
40074807 // }
40084808
4009
- static boolean allparams = true;
4010
-
4011
- static Vector<Object3D> listUI = new Vector<Object3D>();
4012
-
40134809 void EditSelection(boolean newWindow)
40144810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
40154817 // aConstraints.gridy = 0;
40164818 for (int i=0; i<group.selection.size(); i++)
40174819 {
40184820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40194821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4020
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40214823
40224824 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
4825
+ if(elem != group || !newWindow)
40244826 {
4025
- // if (!(elem instanceof Composite))
4026
- // newWindow = false;
4027
- listUI.add(elem);
4028
- elem.openEditWindow(this, newWindow); //, false);
4029
- System.out.println("edit : " + elem);
4030
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
40314828 }
40324829 }
40334830 }
....@@ -4102,7 +4899,8 @@
41024899 //new Exception().printStackTrace();
41034900
41044901 freezemodel = true;
4105
-
4902
+ ClearUnpinned();
4903
+
41064904 /**/
41074905 //switch (event.id)
41084906 {
....@@ -4110,7 +4908,6 @@
41104908 //case 702: // Event.LIST_DESELECT
41114909 group.deselectAll();
41124910 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41144911 if (tps != null)
41154912 {
41164913 for (int i=0; i < tps.length; i++)
....@@ -4119,33 +4916,39 @@
41194916
41204917 //if (child.parent != null)
41214918 //child.parent.addSelectee(child);
4919
+ objEditor.SetMaterial(child);
41224920 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41264921 }
41274922 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
4923
+// else
4924
+// {
4925
+// objEditor.SetMaterial(group); // .GetMaterial());
4926
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4927
+// System.err.println("info : " + group.GetPath());
4928
+// }
41344929
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- 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))
41384931 CameraPane.flash = true;
41394932
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4933
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41414934 // a camera
41424935 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- 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
+ }
41454941 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41464942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41474943 }
41484944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
41494952 refreshContents();
41504953 //return true;
41514954 }
....@@ -4154,6 +4957,35 @@
41544957
41554958 freezemodel = false;
41564959 }
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
+ }
41574989
41584990 void linkSomething(Object3D thing)
41594991 {
....@@ -4225,16 +5057,19 @@
42255057 {
42265058 if (group.selection.isEmpty())
42275059 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
5060
+
5061
+ Grafreed.clipboardIsTempGroup = false;
42295062 Composite tGroup = null;
42305063 if (group.selection.size() > 0) // 1)
42315064 {
42325065 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
5066
+ Grafreed.clipboardIsTempGroup = true;
42345067 }
42355068
42365069 if (cut)
42375070 {
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
42385073 //int indices[] = jList.getSelectedIndices();
42395074 //for (int i = indices.length - 1; i >= 0; i--)
42405075 //jList.remove(indices[i]);
....@@ -4270,16 +5105,16 @@
42705105 //System.out.println("cut " + child);
42715106 //System.out.println("parent = " + child.parent);
42725107 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
5108
+ if (Grafreed.clipboardIsTempGroup)
42745109 tGroup.add/*Child*/(tmp);
42755110 else
4276
- GrafreeD.clipboard = tmp;
5111
+ Grafreed.clipboard = tmp;
42775112 }
42785113 else
4279
- if (GrafreeD.clipboardIsTempGroup)
5114
+ if (Grafreed.clipboardIsTempGroup)
42805115 tGroup.add/*Child*/(child);
42815116 else
4282
- GrafreeD.clipboard = child;
5117
+ Grafreed.clipboard = child;
42835118 }
42845119
42855120 //ResetModel();
....@@ -4311,21 +5146,23 @@
43115146 //System.out.println("cut " + elem);
43125147 //System.out.println("parent = " + elem.parent);
43135148 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
5149
+ if (Grafreed.clipboardIsTempGroup)
43155150 tGroup.add/*Child*/(tmp);
43165151 else
4317
- GrafreeD.clipboard = tmp;
5152
+ Grafreed.clipboard = tmp;
43185153 }
43195154 else
4320
- if (GrafreeD.clipboardIsTempGroup)
5155
+ if (Grafreed.clipboardIsTempGroup)
43215156 tGroup.add/*Child*/(child);
43225157 else
4323
- GrafreeD.clipboard = child;
5158
+ Grafreed.clipboard = child;
43245159 }
43255160
43265161 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
5162
+
5163
+ if (Grafreed.clipboardIsTempGroup)
5164
+ Grafreed.clipboard = tGroup;
5165
+
43295166 if (cut)
43305167 {
43315168 ResetModel();
....@@ -4335,11 +5172,15 @@
43355172
43365173 void paste(boolean expand)
43375174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
43385179 // if (GrafreeD.clipboard == null)
43395180 // return;
43405181 boolean first = true;
43415182
4342
- if (GrafreeD.clipboardIsTempGroup)
5183
+ if (Grafreed.clipboardIsTempGroup)
43435184 {
43445185 Composite temp;
43455186
....@@ -4350,7 +5191,7 @@
43505191 temp = (Composite)Applet3D.clipboard.deepCopy();
43515192 */
43525193 Object3D elem;
4353
- 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))
43545195 {
43555196 Object3D child = (Object3D)e.nextElement();
43565197
....@@ -4384,21 +5225,22 @@
43845225 //Object3D cb = Applet3D.clipboard;
43855226 //temp.addChild(cb);
43865227 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4387
- assert(GrafreeD.clipboard.parent == null);
4388
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
- 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());
43925233 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
5234
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5235
+ Grafreed.clipboard.get(0).parent = keepparent;
43955236 }
43965237
5238
+ Globals.REPLACEONMAKE = keep;
43975239 ResetModel();
43985240 refreshContents();
43995241 }
44005242
4401
- void pasteInto(boolean copyit)
5243
+ void pasteInto(boolean copyit, boolean clone)
44025244 {
44035245 // if (GrafreeD.clipboard == null)
44045246 // return;
....@@ -4427,15 +5269,22 @@
44275269 if (copyit)
44285270 {
44295271 // paste(false);
4430
- CloneClipboard(false); // sept 2014
5272
+ if (clone)
5273
+ {
5274
+ CloneClipboard(false); // sept 2014
5275
+ }
5276
+ else
5277
+ {
5278
+ paste(false);
5279
+ }
44315280 }
44325281 else
44335282 {
44345283 boolean first = true;
44355284
4436
- if (GrafreeD.clipboardIsTempGroup)
5285
+ if (Grafreed.clipboardIsTempGroup)
44375286 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
5287
+ Composite temp = (Composite)Grafreed.clipboard;
44395288 Object3D copy;
44405289 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44415290 {
....@@ -4445,7 +5294,7 @@
44455294 }
44465295 } else
44475296 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
5297
+ linkSomething(Grafreed.clipboard); //.get(0));
44495298 }
44505299 }
44515300 }
....@@ -4522,6 +5371,10 @@
45225371
45235372 void group(Object3D csg, boolean grab)
45245373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
45255378 if (//false) // why??
45265379 !group.selection.isEmpty())
45275380 {
....@@ -4635,10 +5488,15 @@
46355488 //node.add(csg);
46365489 //makeSomething(node);
46375490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
46385492 }
46395493
46405494 void Ungroup(Object3D g)
46415495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
46425500 if (g instanceof HiddenObject)
46435501 {
46445502 HiddenObject h = (HiddenObject) g;
....@@ -4655,6 +5513,7 @@
46555513 objEditor.makeSomething(g.get(i), false);
46565514 }
46575515 }
5516
+ Globals.REPLACEONMAKE = keep;
46585517 }
46595518
46605519 void ungroup()
....@@ -4850,21 +5709,6 @@
48505709 }
48515710 */
48525711
4853
- void ImportGFD()
4854
- {
4855
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4856
- browser.show();
4857
- String filename = browser.getFile();
4858
- if (filename != null && filename.length() > 0)
4859
- {
4860
- String fullname = browser.getDirectory() + filename;
4861
-
4862
- //Object3D readobj =
4863
- objEditor.ReadGFD(fullname, objEditor);
4864
- //makeSomething(readobj);
4865
- }
4866
- }
4867
-
48685712 /*
48695713 public void Callback(Object obj)
48705714 {
....@@ -4888,26 +5732,9 @@
48885732 }
48895733 */
48905734
4891
- void ImportVRMLX3D()
4892
- {
4893
- if (GrafreeD.standAlone)
4894
- {
4895
- /**/
4896
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4897
- browser.show();
4898
- String filename = browser.getFile();
4899
- if (filename != null && filename.length() > 0)
4900
- {
4901
- String fullname = browser.getDirectory() + filename;
4902
- LoadVRMLX3D(fullname);
4903
- }
4904
- /**/
4905
- }
4906
- }
4907
-
49085735 String GetFile(String dialogName)
49095736 {
4910
- if (GrafreeD.standAlone)
5737
+ if (Grafreed.standAlone)
49115738 {
49125739 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135740 browser.show();
....@@ -4971,10 +5798,49 @@
49715798 cButton flashSelectionButton;
49725799 cButton editButton;
49735800 cButton uneditButton;
5801
+ JCheckBox allParamsButton;
49745802 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765803 cButton unselectButton;
49775804
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
+
49785844 cButton screenfitButton;
49795845 cButton screenfitpointButton;
49805846 cButton snapobjectButton;
....@@ -4986,14 +5852,6 @@
49865852
49875853 cButton setsupportButton;
49885854
4989
- cButton twoButton;
4990
- cButton sixButton;
4991
- cButton threeButton;
4992
- cButton sevenButton;
4993
- cButton fourButton; // full panel
4994
- cButton oneButton; // full XYZ
4995
- //cButton currentLayout;
4996
-
49975855 //
49985856 //Composite
49995857 Object3D // to do !!
....@@ -5003,9 +5861,11 @@
50035861 //JTree jTree;
50045862 private MenuItem lookAtItem;
50055863 private MenuItem lookFromItem;
5006
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
50075865 private MenuItem cutItem;
5008
- private MenuItem duplicateItem;
5866
+ private MenuItem undoItem;
5867
+ private MenuItem redoItem;
5868
+ private JMenuItem duplicateItem;
50095869 private MenuItem cloneItem;
50105870 private MenuItem cloneSupportItem;
50115871 private MenuItem overwriteGeoItem;
....@@ -5018,7 +5878,7 @@
50185878 private MenuItem linkverticesItem;
50195879 private MenuItem relinkverticesItem;
50205880 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
5881
+ private MenuItem resetAllItem;
50225882 private MenuItem stepAllItem;
50235883 private MenuItem revertMeshItem;
50245884 private MenuItem poseMeshItem;
....@@ -5029,10 +5889,11 @@
50295889 private MenuItem mergeGeometriesItem;
50305890 private MenuItem copyItem;
50315891 private MenuItem pasteItem;
5892
+ private MenuItem pasteIntoItem;
50325893 private MenuItem pasteLinkItem;
50335894 private MenuItem pasteCloneItem;
50345895 private MenuItem pasteExpandItem;
5035
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
50365897 private MenuItem clearAllItem;
50375898 private MenuItem genUVItem;
50385899 private MenuItem genNormalsMESHItem;
....@@ -5067,6 +5928,10 @@
50675928 private MenuItem showleavesItem;
50685929 private MenuItem markleavesItem;
50695930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
50705935
50715936 private MenuItem flipVItem;
50725937 private MenuItem unflipVItem;
....@@ -5078,15 +5943,17 @@
50785943 private MenuItem panoTexturesItem;
50795944
50805945 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
5946
+ private MenuItem resetCentroidXZItem;
50825947 private MenuItem resetTransformItem;
5948
+ private MenuItem transformGeometryItem;
5949
+ private MenuItem transformChildrenItem;
50835950 private MenuItem hideItem;
50845951 private MenuItem grabItem;
50855952 private MenuItem backItem;
50865953 private MenuItem frontItem;
50875954 private MenuItem cameraItem;
50885955 private MenuItem compositeItem;
5089
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
50905957 private MenuItem physicsItem;
50915958 private MenuItem frameselectorItem;
50925959 private MenuItem scriptNodeItem;
....@@ -5110,6 +5977,8 @@
51105977 private MenuItem attachBumpItem;
51115978 private MenuItem detachBumpItem;
51125979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
51135982
51145983 private MenuItem particleItem;
51155984 private MenuItem ragdollItem;
....@@ -5126,7 +5995,7 @@
51265995 private MenuItem blobItem;
51275996 private MenuItem latheItem;
51285997 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
5998
+ private MenuItem overlayItem;
51305999 private MenuItem meshItem;
51316000 // private MenuItem meshGroupItem;
51326001 private MenuItem springItem;
....@@ -5148,11 +6017,6 @@
51486017 private MenuItem doubleItem;
51496018 private MenuItem tripleItem;
51506019
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51566020 private MenuItem computeAOItem;
51576021 private MenuItem recompileItem;
51586022 private MenuItem editScriptItem;
....@@ -5162,4 +6026,8 @@
51626026 private MenuItem analyzeItem;
51636027 private MenuItem dumpItem;
51646028 //boolean freezemodel = false;
6029
+
6030
+ Menu cameraMenu;
6031
+ MenuItem editCameraItem;
6032
+ MenuItem restoreCameraItem;
51656033 }