Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +98,19 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
100105 {
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));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106111 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
109114 }
110115
111116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +124,7 @@
119124 // obj.support = null;
120125 if (!supports)
121126 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123128 obj.parent = parent;
124129 // obj.support = support;
125130 // clone.support = support; // aout 2013
....@@ -148,30 +153,29 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
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);
158
+ oe.jTree = new cTree();
159
+
164160 Menu menu;
165161 oe.menuBar.add(menu = new Menu("Edit"));
166162 //editItem = menu.add(new MenuItem("Edit"));
167163 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169171 duplicateItem.addActionListener(this);
170
- menu.add("-");
171172 cloneItem = menu.add(new MenuItem("Clone"));
172173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
173176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174177 cloneSupportItem.addActionListener(this);
178
+ }
175179 menu.add("-");
176180 cutItem = menu.add(new MenuItem("Cut"));
177181 cutItem.addActionListener(this);
....@@ -179,27 +183,123 @@
179183 copyItem.addActionListener(this);
180184 pasteItem = menu.add(new MenuItem("Paste"));
181185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
182190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183191 pasteLinkItem.addActionListener(this);
184192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185193 pasteCloneItem.addActionListener(this);
186194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
188197 clearItem = menu.add(new MenuItem("Clear"));
189198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
190203 clearAllItem = menu.add(new MenuItem("Clear All"));
191204 clearAllItem.addActionListener(this);
205
+ }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
192242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
193294 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);
295
+ if (Globals.ADVANCED)
296
+ {
198297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199298 revertMeshItem.addActionListener(this);
200299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201300 resetreferencesItem.addActionListener(this);
202301 menu.add("-");
302
+ }
203303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204304 overwriteGeoItem.addActionListener(this);
205305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +311,104 @@
211311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212312 overwriteUVItem.addActionListener(this);
213313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
214316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215317 generateMeshItem.addActionListener(this);
216318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217319 poseMeshItem.addActionListener(this);
218320 menu.add("-");
321
+ }
219322 resetsupportItem = menu.add(new MenuItem("Reset support"));
220323 resetsupportItem.addActionListener(this);
221324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222325 linkverticesItem.addActionListener(this);
223326 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224327 relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
225331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226332 setMasterItem.addActionListener(this);
333
+ }
227334
228335 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
231338 backItem = menu.add(new MenuItem("Back"));
232339 backItem.addActionListener(this);
233340 frontItem = menu.add(new MenuItem("Front"));
234341 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238348 hideItem.addActionListener(this);
349
+ }
239350 ungroupItem = menu.add(new MenuItem("Ungroup"));
240351 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);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
248359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249360 switchGeoItem.addActionListener(this);
250361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251362 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
253364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
254371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255372 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
373
+ }
258374
259375 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
262378 billboardItem = menu.add(new MenuItem("Billboard"));
263379 billboardItem.addActionListener(this);
264380 csgItem = menu.add(new MenuItem("CSG"));
265381 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267383 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269385 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
272394 linkerItem = menu.add(new MenuItem("Linker"));
273395 linkerItem.addActionListener(this);
274396 templateItem = menu.add(new MenuItem("Template"));
275397 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278398 pointflowItem = menu.add(new MenuItem("Point Flow"));
279399 pointflowItem.addActionListener(this);
400
+ }
280401 menu.add("-");
281402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282403 resetTransformItem.addActionListener(this);
283404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284405 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
287412
288413 oe.menuBar.add(menu = new Menu("Geometry"));
289414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +419,11 @@
294419 genNormalsCADItem.addActionListener(this);
295420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
297424 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298425 genNormalsMINEItem.addActionListener(this);
426
+ }
299427 stripifyItem = menu.add(new MenuItem("Stripify"));
300428 stripifyItem.addActionListener(this);
301429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +445,34 @@
317445 reduce34MeshItem.addActionListener(this);
318446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319447 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
324456
325457 oe.menuBar.add(menu = new Menu("Attributes"));
326458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
328464 menu.add("-");
329465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330466 liveleavesItem.addActionListener(this);
331467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
333471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334472 supportleavesItem.addActionListener(this);
335473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336474 unsupportleavesItem.addActionListener(this);
475
+ }
337476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338477 hideleavesItem.addActionListener(this);
339478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +481,14 @@
342481 markleavesItem.addActionListener(this);
343482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
345492 menu.add("-");
346493 flipVItem = menu.add(new MenuItem("Flip V"));
347494 flipVItem.addActionListener(this);
....@@ -377,35 +524,41 @@
377524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378525 sortbynameItem.addActionListener(this);
379526 menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
380534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381535 extractGeometriesItem.addActionListener(this);
382536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383537 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);
538
+ }
388539
389540 oe.menuBar.add(menu = new Menu("Insert"));
390541 buildCreateMenu(menu);
391542
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
-
403543 oe.menuBar.add(menu = new Menu("Tools"));
404544 buildToolsMenu(menu);
405545 }
406546
547
+
407548 void SetupUI2(ObjEditor oe)
408549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
409562 //new Exception().printStackTrace();
410563
411564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,96 +587,229 @@
434587 oe.radioPanel.add(dummyButton);
435588 oe.buttonGroup.add(dummyButton);
436589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
437594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438595
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
441
- liveCB.addItemListener(this);
442
-
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
444
- fastCB.setToolTipText("Fast mode");
445
- fastCB.addItemListener(this);
446
-
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
599
+
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
452612 screenfitButton.setToolTipText("Screen fit");
453613 screenfitButton.addActionListener(this);
454614
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
648
+ liveCB.addItemListener(this);
649
+
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oneStepButton.setToolTipText("Animate one step forward");
652
+ oneStepButton.addActionListener(this);
653
+
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
655
+ fastCB.setToolTipText("Fast mode");
656
+ fastCB.addItemListener(this);
657
+
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
663
+
455664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456665 // screenfitpointButton.addActionListener(this);
457
-// oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
459
- snapobjectButton.addActionListener(this);
460
- snapobjectButton.setToolTipText("Snap Object");
461
- oe.aConstraints.gridx += 1;
462666
463
- //aConstraints.gridx = 0;
464
- //aConstraints.gridy += 1;
465
- oe.aConstraints.weighty = 0;
466
- oe.aConstraints.gridwidth = 1;
467
-
468
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
469
- flashSelectionButton.setToolTipText("Show selection");
470
- flashSelectionButton.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ snapobjectButton.addActionListener(this);
671
+ snapobjectButton.setToolTipText("Snap Object");
672
+ }
673
+
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
471675
472
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
473
-
474
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
475677 twoButton.setToolTipText("Show center view only");
476678 twoButton.addActionListener(this);
477
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
478682 fourButton.addActionListener(this);
479683 fourButton.setToolTipText("Show left panel only");
480
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
481685 sixButton.setToolTipText("2-column layout left");
482686 sixButton.addActionListener(this);
483
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
484688 threeButton.setToolTipText("2-column layout right");
485689 threeButton.addActionListener(this);
486
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
487691 sevenButton.setToolTipText("3-column layout");
488692 sevenButton.addActionListener(this);
489693 //
490694
491
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492696 rootButton.setToolTipText("Edit selection in new tab");
493697 rootButton.addActionListener(this);
494698
495
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
496700 closeButton.setToolTipText("Close tab");
497701 closeButton.addActionListener(this);
498702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
499703 //clearButton.addActionListener(this);
500
-
501
- cGridBag commandsPanel = new cGridBag();
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
502736
503
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- editButton.setToolTipText("Edit selection");
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
505786 editButton.addActionListener(this);
506787
507
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
508
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
509790 uneditButton.addActionListener(this);
510791
511
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
794
+ allParamsButton.addActionListener(this);
795
+
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512797 clearPanelButton.setToolTipText("Clear edit panel");
513798 clearPanelButton.addActionListener(this);
514799
515
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
516
- allParamsButton.setToolTipText("All params??");
517
- allParamsButton.addActionListener(this);
518
-
519
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520801 unselectButton.setToolTipText("Unselect");
521802 unselectButton.addActionListener(this);
522803
523
- commandsPanel.preferredHeight = 1;
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
524807
525
- oe.treePanel.add(commandsPanel);
526
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
527813
528814 // oe.aConstraints.gridx += 1;
529815 // oe.aConstraints.weighty = 0;
....@@ -540,29 +826,17 @@
540826
541827 JScrollPane jSP;
542828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
543
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
544830 ResetModel();
545831
546832 oe.treePanel.add(jSPPanel);
547833 oe.treePanel.Return();
548834
549
- cGridBag copyOptionsPanel = new cGridBag();
550
-
551
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
552
- colorCB.setToolTipText("Copy color when dropped");
553
- colorCB.addItemListener(this);
554
-
555
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
556
- materialCB.setToolTipText("Copy material when dropped");
557
- materialCB.addItemListener(this);
558
-
559
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
560
- textureCB.setToolTipText("Copy texture when dropped");
561
- textureCB.addItemListener(this);
562
-
563
- copyOptionsPanel.preferredHeight = 1;
564835 oe.treePanel.add(copyOptionsPanel);
565836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
566840
567841 // mainPanel.setDividerLocation(0.5); //1.0);
568842 // mainPanel.setResizeWeight(0.5);
....@@ -591,13 +865,43 @@
591865
592866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
593867 {
594
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
595
- supportCB.setToolTipText("Enabled rigging");
596
- supportCB.addItemListener(this);
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
882
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
883
+ boxCB.setToolTipText("Display bounding boxes");
884
+ boxCB.addItemListener(this);
885
+
886
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
888
+ zoomBoxCB.addItemListener(this);
889
+
890
+ if (true) // Globals.ADVANCED)
891
+ {
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
597899
598900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
599901 // localCB.addItemListener(this);
600902
903
+ panel.Return();
904
+
601905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
602906 crowdCB.setToolTipText("Used for crowds");
603907 crowdCB.addItemListener(this);
....@@ -610,18 +914,12 @@
610914 slowCB.setToolTipText("Smooth interpolation");
611915 slowCB.addItemListener(this);
612916
613
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
614
- boxCB.setToolTipText("Display bounding boxes");
615
- boxCB.addItemListener(this);
616
-
617
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
618
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
619
- zoomBoxCB.addItemListener(this);
620
-
621917 // constraints.gridy += 1;
622918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
623919 // speakerMocapCB.addItemListener(this);
624920
921
+ panel.Return();
922
+
625923 if (false)
626924 {
627925 // handled in scripts
....@@ -636,30 +934,72 @@
636934 //constraints.gridy += 1;
637935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
638936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
639938 }
640939
641940 //constraints.gridx += 1;
642941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
643942 // debugCB.addItemListener(this);
644943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
645948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
646950 oeilCB.addItemListener(this);
647951
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
648972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
649973 lookAtCB.setToolTipText("Look-at target");
650974 lookAtCB.addItemListener(this);
975
+ }
976
+
977
+ }
651978
652979 cGridBag fill = new cGridBag();
653
-
654980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
655985
656986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
657989
658990 }
659991
660992 void EditObject(Object3D obj)
661993 {
662994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
6631003 radioButton.SetObject(obj);
6641004 radioButton.layout = sevenButton;
6651005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -668,8 +1008,11 @@
6681008 buttonGroup.add(radioButton);
6691009 radioButton.doClick();
6701010 }
1011
+
6711012 void SetupViews(ObjEditor oe)
6721013 {
1014
+ theFrame = this;
1015
+
6731016 oe.SetupViews();
6741017
6751018 System.out.println("SetupViews");
....@@ -678,23 +1021,28 @@
6781021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6791022 }
6801023
681
- JCheckBox liveCB;
682
- JCheckBox supportCB;
683
- JCheckBox localCB;
684
- JCheckBox crowdCB;
685
- JCheckBox smoothCB;
686
- JCheckBox fastCB;
687
- JCheckBox slowCB;
688
- JCheckBox boxCB;
689
- JCheckBox zoomBoxCB;
690
- JCheckBox trackCB;
691
- JCheckBox smoothfocusCB;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
6921037 // JCheckBox speakerMocapCB;
693
- JCheckBox speakerCameraCB;
694
- JCheckBox speakerFocusCB;
695
- JCheckBox debugCB;
696
- JCheckBox oeilCB;
697
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
6981046
6991047 // static int COLOR = 1;
7001048 // static int MATERIAL = 2;
....@@ -702,9 +1050,9 @@
7021050
7031051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7041052
705
- JCheckBox colorCB;
706
- JCheckBox materialCB;
707
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7081056
7091057 public void itemStateChanged(ItemEvent e)
7101058 {
....@@ -732,6 +1080,7 @@
7321080 } else if(e.getSource() == liveCB)
7331081 {
7341082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7351084 }
7361085 else if(e.getSource() == supportCB)
7371086 {
....@@ -796,6 +1145,18 @@
7961145 {
7971146 cameraView.ToggleOeil();
7981147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
7991160 else if(e.getSource() == lookAtCB)
8001161 {
8011162 cameraView.ToggleLookAt();
....@@ -812,7 +1173,8 @@
8121173
8131174 /**/
8141175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
815
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8161178 if ((path == null) || (path.getPathCount() <= 1)) {
8171179 // We can't move the root node or an empty selection
8181180 return;
....@@ -875,8 +1237,6 @@
8751237 }
8761238 }
8771239
878
- String string = (String) object;
879
-
8801240 System.out.println("Transfer = " + object + "; drop : " + target);
8811241 // if( object instanceof java.io.File[])
8821242 // {
....@@ -884,7 +1244,11 @@
8841244 // objEditor.DropFile((java.io.File[]) object, true);
8851245 // return;
8861246 // }
887
- if (string.charAt(0) == '/')
1247
+
1248
+ String string = object.toString();
1249
+
1250
+ // File path for Mac and Windows
1251
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8881252 {
8891253 // file(s)
8901254 String[] names = string.split("\n");
....@@ -911,7 +1275,7 @@
9111275
9121276 flashIt = false;
9131277 CameraPane pane = (CameraPane) target;
914
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9151279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9161280
9171281 if (group.selection.size() == 1)
....@@ -927,23 +1291,33 @@
9271291
9281292 assert target == objEditor.jTree;
9291293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9301295 try {
931
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9321297 } catch (Exception e) {
9331298 System.out.println("destinationPath : " + destinationPath);
9341299 return;
9351300 }
9361301
937
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9381303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
9391313 loadClipboard(true);
9401314 objEditor.jTree.setSelectionPath(destinationPath);
941
- pasteInto(false);
942
- } else {
943
- loadClipboard(false);
944
- objEditor.jTree.setSelectionPath(destinationPath);
945
- pasteInto(false); // true); // ???
946
- }
1315
+ pasteInto(false, false);
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
9471321 }
9481322 public void dropActionChanged(DropTargetDragEvent dtde)
9491323 // Called if the user has modified the current drop gesture
....@@ -1048,54 +1422,71 @@
10481422 {
10491423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10501424 //heightFieldItem.addActionListener(this);
1051
- gridItem = menu.add(new MenuItem("Grid"));
1052
- gridItem.addActionListener(this);
1053
- rectoidItem = menu.add(new MenuItem("Box"));
1054
- rectoidItem.addActionListener(this);
1055
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1056
- ellipsoidItem.addActionListener(this);
1057
- coneItem = menu.add(new MenuItem("Cone"));
1058
- coneItem.addActionListener(this);
1059
- torusItem = menu.add(new MenuItem("Torus"));
1060
- torusItem.addActionListener(this);
1061
- superItem = menu.add(new MenuItem("Superellipsoid"));
1062
- superItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
10631443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10641444 kleinItem.addActionListener(this);
1065
- particleItem = menu.add(new MenuItem("Particle system"));
1066
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
1449
+ if (Globals.ADVANCED)
1450
+ {
10671451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10681452 ragdollItem.addActionListener(this);
10691453 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10701454 ragdoll2Item.addActionListener(this);
1455
+ }
10711456 menu.add("-");
1072
- meshItem = menu.add(new MenuItem("Mesh"));
1457
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10731458 meshItem.addActionListener(this);
10741459 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10751460 // meshGroupItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10761463 springItem = menu.add(new MenuItem("Spring"));
10771464 springItem.addActionListener(this);
10781465 flagItem = menu.add(new MenuItem("Flag"));
10791466 flagItem.addActionListener(this);
1080
- bezierItem = menu.add(new MenuItem("Patch"));
1081
- bezierItem.addActionListener(this);
1082
- checkerItem = menu.add(new MenuItem("Checker"));
1083
- checkerItem.addActionListener(this);
10841467 blobItem = menu.add(new MenuItem("Blob"));
10851468 blobItem.addActionListener(this);
10861469 latheItem = menu.add(new MenuItem("Lathe"));
10871470 latheItem.addActionListener(this);
1088
- lightItem = menu.add(new MenuItem("Light"));
1089
- lightItem.addActionListener(this);
1471
+ }
1472
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1473
+ bezierItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
10901478 menu.add("-");
10911479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10921480 //superLoopItem.addActionListener(this);
1093
- loopItem = menu.add(new MenuItem("Loop"));
1094
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
10951483 doubleItem = menu.add(new MenuItem("Fork"));
10961484 doubleItem.addActionListener(this);
1485
+ if (Globals.ADVANCED)
1486
+ {
10971487 tripleItem = menu.add(new MenuItem("Trident"));
10981488 tripleItem.addActionListener(this);
1489
+ }
10991490 }
11001491
11011492 void buildToolsMenu(Menu menu)
....@@ -1104,29 +1495,34 @@
11041495 animationItem.addItemListener(this);
11051496 animationItem.setState(Globals.ANIMATION);
11061497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
11071501 menu.add("-");
11081502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11091503 parseverticesItem.addActionListener(this);
11101504 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11111505 textureFieldItem.addActionListener(this);
1112
- alignItem = menu.add(new MenuItem("Align"));
1506
+ alignItem = menu.add(new MenuItem("Align Objects"));
11131507 alignItem.addActionListener(this);
1114
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1115
- mirrorItem.addActionListener(this);
11161508 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11171509 reduceMorphItem.addActionListener(this);
11181510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11191511 reduce34MorphItem.addActionListener(this);
1120
-
1121
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1122
- computeAOItem.addActionListener(this);
11231512 menu.add("-");
1124
-
11251513 menu.add(memoryItem = new MenuItem("Memory Usage"));
11261514 memoryItem.addActionListener(this);
1515
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1516
+ computeAOItem.addActionListener(this);
1517
+
1518
+ if (Globals.ADVANCED)
1519
+ {
1520
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1521
+ mirrorItem.addActionListener(this);
1522
+ menu.add("-");
11271523 menu.add(analyzeItem = new MenuItem("Analyze"));
11281524 analyzeItem.addActionListener(this);
1129
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11301526 dumpItem.addActionListener(this);
11311527 // menu.add(pathItem = new MenuItem("From-to path"));
11321528 // pathItem.addActionListener(this);
....@@ -1144,6 +1540,7 @@
11441540 menu.add("-");
11451541 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11461542 editScriptItem.addActionListener(this);
1543
+ }
11471544 }
11481545
11491546 void ScreenFit()
....@@ -1266,9 +1663,24 @@
12661663 shadow.material = new cMaterial(obj.material);
12671664 shadow.material.diffuse = 0.0001f;
12681665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
12691667
12701668 makeSomething(shadow);
12711669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
12721684
12731685 /**
12741686 * applyExample
....@@ -1472,9 +1884,9 @@
14721884
14731885 void Overwrite(int mask)
14741886 {
1475
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14761888 {
1477
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
14781890
14791891 if (content instanceof cGroup && ((cGroup)content).transientlink )
14801892 content = ((cGroup)content).get(0);
....@@ -1513,7 +1925,7 @@
15131925 {
15141926 ScreenFit();
15151927 } else
1516
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15171929 {
15181930 cVector v1 = new cVector();
15191931 cVector v2 = new cVector();
....@@ -1522,11 +1934,11 @@
15221934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15231935 objEditor.cameraView.repaint();
15241936 } else
1525
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
15261938 {
15271939 makeSomething(new Box());
15281940 } else
1529
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
15301942 {
15311943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15321944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1605,27 +2017,27 @@
16052017
16062018 makeSomething(obj);
16072019 } else
1608
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16092021 {
16102022 makeSomething(new Grid());
16112023 } else
1612
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16132025 {
16142026 makeSomething(new Sphere());
16152027 } else
1616
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16172029 {
16182030 makeSomething(new Cone());
16192031 } else
1620
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16212033 {
16222034 makeSomething(new Torus());
16232035 } else
1624
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
16252037 {
16262038 makeSomething(new Superellipsoid());
16272039 } else
1628
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
16292041 {
16302042 makeSomething(new Klein());
16312043 } else
....@@ -1645,7 +2057,7 @@
16452057 {
16462058 makeSomething(new BezierSurface());
16472059 } else
1648
- if (source == checkerItem)
2060
+ if (source == overlayItem || source == overlayButton)
16492061 {
16502062 /*
16512063 Object3D obj = new BezierSurface(5,8);
....@@ -1693,7 +2105,7 @@
16932105 s.setup();
16942106 makeSomething(s);
16952107 } else
1696
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
16972109 {
16982110 makeSomething(new Light());
16992111 } else
....@@ -1743,30 +2155,30 @@
17432155
17442156 group(g);
17452157 } else
1746
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
17472159 {
17482160 Composite csg = new GroupLeaf();
17492161 csg.count = 5;
17502162 group(csg);
1751
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
17522164 csg.addChild(child);
17532165 child.addChild(csg);
17542166 } else
17552167 if (source == doubleItem)
17562168 {
1757
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
17582170 csg.count = 5;
17592171 group(csg);
1760
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
17612173 csg.addChild(child);
17622174 child.addChild(csg);
1763
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
17642176 csg.addChild(child);
17652177 child.addChild(csg);
17662178 } else
17672179 if (source == tripleItem)
17682180 {
1769
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
17702182 csg.count = 4;
17712183 group(csg);
17722184 Composite child = new cGroup();
....@@ -1778,23 +2190,6 @@
17782190 child = new cGroup();
17792191 csg.addChild(child);
17802192 child.addChild(csg);
1781
- } else
1782
-
1783
- if (source == importGFDItem)
1784
- {
1785
- ImportGFD();
1786
- } else
1787
- if (source == importVRMLX3DItem)
1788
- {
1789
- ImportVRMLX3D();
1790
- } else
1791
- if (source == import3DSItem)
1792
- {
1793
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1794
- } else
1795
- if (source == importOBJItem)
1796
- {
1797
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
17982193 } else
17992194 if (source == computeAOItem)
18002195 {
....@@ -1814,7 +2209,7 @@
18142209 if (source == invariantsItem)
18152210 {
18162211 System.out.println("Invariants:");
1817
- GrafreeD.grafreeD.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
18182213 } else
18192214 if (source == memoryItem)
18202215 {
....@@ -1833,19 +2228,61 @@
18332228 {
18342229 DumpObject();
18352230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
2271
+ if (source == oneStepButton)
2272
+ {
2273
+ Globals.ONESTEP = true;
2274
+ cameraView.repaint();
2275
+ } else
18362276 if (source == screenfitButton)
18372277 {
1838
- //Reload(lastConverter, lastFilename, true);
18392278 ScreenFit();
18402279 } else
18412280 if (source == screenfitpointButton)
18422281 {
1843
- //Reload(lastConverter, lastFilename, true);
18442282 ScreenFitPoint();
18452283 } else
18462284 if (source == snapobjectButton)
18472285 {
1848
- //Reload(lastConverter, lastFilename, true);
18492286 SnapObject();
18502287 } else
18512288 // if (event.getSource() == recompileButton)
....@@ -1882,12 +2319,20 @@
18822319 {
18832320 loadClipboard(true);
18842321 } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
18852330 if (source == duplicateItem)
18862331 {
1887
- Object3D keep = GrafreeD.clipboard;
2332
+ Object3D keep = Grafreed.clipboard;
18882333 loadClipboard(false);
18892334 paste(false);
1890
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
18912336 } else
18922337 if (source == cloneItem)
18932338 {
....@@ -1905,13 +2350,17 @@
19052350 {
19062351 paste(false);
19072352 } else
2353
+ if (source == pasteIntoItem)
2354
+ {
2355
+ pasteInto(true, false);
2356
+ } else
19082357 if (source == pasteLinkItem)
19092358 {
1910
- pasteInto(false);
2359
+ pasteInto(false, false);
19112360 } else
19122361 if (source == pasteCloneItem)
19132362 {
1914
- pasteInto(true);
2363
+ pasteInto(true, true);
19152364 } else
19162365 if (source == pasteExpandItem)
19172366 {
....@@ -2103,9 +2552,9 @@
21032552 // group.selection.get(0).setMasterThis(content); // should be identity
21042553 // refreshContents();
21052554 // }
2106
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21072556 {
2108
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
21092558
21102559 if (content instanceof cGroup && ((cGroup)content).transientlink )
21112560 content = ((cGroup)content).get(0);
....@@ -2113,11 +2562,11 @@
21132562 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21142563 for (int i=0; i<group.selection.size(); i++)
21152564 {
2116
- boolean random = CameraPane.RANDOM;
2117
- CameraPane.RANDOM = false; // parse all random nodes
2565
+ boolean random = CameraPane.SWITCH;
2566
+ CameraPane.SWITCH = false; // parse all random nodes
21182567 group.selection.get(i).linkVerticesThis(content);
21192568 // group.selection.get(i).setMasterThis(content); // should be identity
2120
- CameraPane.RANDOM = random;
2569
+ CameraPane.SWITCH = random;
21212570 }
21222571 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21232572 refreshContents();
....@@ -2127,20 +2576,20 @@
21272576 {
21282577 for (int i=0; i<group.selection.size(); i++)
21292578 {
2130
- boolean random = CameraPane.RANDOM;
2131
- CameraPane.RANDOM = false; // parse all random nodes
2579
+ boolean random = CameraPane.SWITCH;
2580
+ CameraPane.SWITCH = false; // parse all random nodes
21322581 group.selection.get(i).linkVerticesThis(null);
2133
- CameraPane.RANDOM = random;
2582
+ CameraPane.SWITCH = random;
21342583 }
21352584
21362585 refreshContents();
21372586 } else
21382587 if (source == relinkverticesItem)
21392588 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2589
+ boolean random = CameraPane.SWITCH;
2590
+ CameraPane.SWITCH = false; // parse all random nodes
21422591 group.selection.RelinkToSupport();
2143
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
21442593
21452594 refreshContents();
21462595 } else
....@@ -2155,9 +2604,9 @@
21552604 } else
21562605 if (source == setMasterItem)
21572606 {
2158
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21592608 {
2160
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
21612610
21622611 if (content instanceof cGroup && ((cGroup)content).transientlink )
21632612 content = ((cGroup)content).get(0);
....@@ -2170,9 +2619,9 @@
21702619 {
21712620 if (group.selection.size() == 1)
21722621 {
2173
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
21742623 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
21762625
21772626 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782627 content = ((cGroup)content).get(0);
....@@ -2189,7 +2638,7 @@
21892638 {
21902639 RevertMeshes();
21912640 } else
2192
- if (source == resetMeshItem)
2641
+ if (source == resetAllItem)
21932642 {
21942643 ResetAll();
21952644 } else
....@@ -2209,9 +2658,9 @@
22092658 {
22102659 ClearSelection(true);
22112660 } else
2212
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
22132662 {
2214
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
22152664 } else
22162665 if (source == hideItem)
22172666 {
....@@ -2229,16 +2678,16 @@
22292678 {
22302679 makeSomething(new Camera());
22312680 } else
2232
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
22332682 {
22342683 group(new Composite());
22352684 } else
2236
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
22372686 {
22382687 RandomNode random = new RandomNode();
22392688 group(random);
22402689 if (random.size() > 0)
2241
- random.name = random.get(0).name + "Rnd";
2690
+ random.name = random.get(0).name + "Switch";
22422691 } else
22432692 if (source == physicsItem)
22442693 {
....@@ -2335,7 +2784,7 @@
23352784 {
23362785 group(new cLinker());
23372786 } else
2338
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
23392788 {
23402789 group(new TextureNode());
23412790 } else
....@@ -2355,17 +2804,30 @@
23552804 {
23562805 CastShadow(2);
23572806 } else
2358
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
23592808 {
2360
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
23612811 for (int i=0; i<group.selection.size(); i++)
23622812 {
2363
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
23642818 }
23652819
2366
- ClearSelection(false);
2367
-
2368
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
23692831 } else
23702832 if (source == genUVItem)
23712833 {
....@@ -2377,7 +2839,7 @@
23772839 } else
23782840 if (source == genNormalsMESHItem)
23792841 {
2380
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
23812843 } else
23822844 if (source == genNormalsORGANItem)
23832845 {
....@@ -2442,6 +2904,22 @@
24422904 if (source == unmarkleavesItem)
24432905 {
24442906 MarkLeaves(false);
2907
+ } else
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
24452923 } else
24462924 if (source == flipVItem)
24472925 {
....@@ -2527,9 +3005,13 @@
25273005 {
25283006 SmoothMesh();
25293007 } else
2530
- if (source == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
25313009 {
25323010 TransformGeometry();
3011
+ } else
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
25333015 } else
25343016 if (source == resetTransformItem)
25353017 {
....@@ -2537,7 +3019,11 @@
25373019 } else
25383020 if (source == resetCentroidItem)
25393021 {
2540
- ResetCentroid();
3022
+ ResetCentroid(true);
3023
+ } else
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
25413027 } else
25423028 if (source == resetParentItem)
25433029 {
....@@ -2669,6 +3155,10 @@
26693155 if (source == twoButton)
26703156 {
26713157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
26723162 // bug
26733163 //gridPanel.setDividerLocation(1.0);
26743164 //bigPanel.setDividerLocation(0.0);
....@@ -2701,10 +3191,31 @@
27013191 bigThree.ClearUI();
27023192 bigThree.add(centralPanel);
27033193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
27043212 } else
27053213 if (source == threeButton)
27063214 {
27073215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
27083219
27093220 // bigThree.remove(scenePanel);
27103221 // bigThree.remove(centralPanel);
....@@ -2737,10 +3248,15 @@
27373248 bigThree.add(centralPanel);
27383249 bigThree.add(XYZPanel);
27393250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
27403253 } else
27413254 if (source == fourButton)
27423255 {
27433256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
27443260
27453261 // bigThree.remove(scenePanel);
27463262 // bigThree.remove(centralPanel);
....@@ -2772,10 +3288,15 @@
27723288 bigThree.ClearUI();
27733289 bigThree.add(scenePanel);
27743290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
27753293 } else
27763294 if (source == sixButton)
27773295 {
27783296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
27793300
27803301 // bigThree.remove(scenePanel);
27813302 // bigThree.remove(centralPanel);
....@@ -2808,10 +3329,15 @@
28083329 bigThree.add(scenePanel);
28093330 bigThree.add(centralPanel);
28103331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
28113334 } else
28123335 if (source == sevenButton)
28133336 {
28143337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
28153341
28163342 // bigThree.remove(scenePanel);
28173343 // bigThree.remove(centralPanel);
....@@ -2845,6 +3371,8 @@
28453371 bigThree.add(centralPanel);
28463372 bigThree.add(XYZPanel);
28473373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
28483376 } else
28493377 if (source == rootButton)
28503378 {
....@@ -2856,6 +3384,7 @@
28563384 EditObject(obj);
28573385 }
28583386
3387
+ cameraView.requestFocusInWindow();
28593388 refreshContents(true);
28603389 } else
28613390 if (source == closeButton)
....@@ -2865,22 +3394,37 @@
28653394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28663395 {
28673396 ab = (cRadio)e.nextElement();
2868
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28693398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
28703405 buttonGroup.remove(ab);
28713406 radioPanel.remove(ab);
28723407
2873
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
28743410 // ab.GetObject().objectUI = null; // ?????????
28753411
28763412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28773413 break;
28783414 }
28793415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
28803418 refreshContents(true);
28813419 } else
28823420 if (source == editItem || source == editButton)
28833421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
28843428 EditSelection(false);
28853429 } else
28863430 if (source == uneditButton)
....@@ -2890,12 +3434,13 @@
28903434 Object3D child = (Object3D)e.nextElement();
28913435 if(child.editWindow != null)
28923436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
28933438 child.CloseUI();
28943439 listUI.remove(child);
28953440
2896
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
28973442 }
2898
- objEditor.ctrlPanel.validate();
3443
+ objEditor.ctrlPanel.FlushUI();
28993444 //objEditor.jTree.clearSelection();
29003445 //objEditor.ResetSliders();
29013446 refreshContents(true);
....@@ -2906,6 +3451,7 @@
29063451 //copy.ClearUI();
29073452 for (Object3D obj : listUI)
29083453 {
3454
+ obj.pinned = false;
29093455 obj.CloseUI();
29103456 }
29113457 listUI.clear();
....@@ -2915,7 +3461,7 @@
29153461 {
29163462 assert(copy == group);
29173463
2918
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29193465
29203466 for (Object3D obj : listUI)
29213467 {
....@@ -2964,6 +3510,9 @@
29643510 }
29653511
29663512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
29673516 //Globals.theRenderer.object = group;
29683517 if(!useclient)
29693518 {
....@@ -2979,20 +3528,44 @@
29793528 frontView.object = group;
29803529 sideView.object = group;
29813530 }
2982
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
29833536 /*
29843537 currentLayout = radio.layout;
29853538 if (currentLayout == null)
29863539 currentLayout = sevenButton;
29873540 */
29883541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
29893547 keepparent = group.parent;
29903548 // PARENT = NULL or not???
29913549 //group.parent = null; // ROOT
29923550 //group.attributes = -1;
29933551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
29943554 refreshContents(true);
2995
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
29963569 else
29973570 {
29983571 //return super.action(event, arg);
....@@ -3001,7 +3574,6 @@
30013574 }
30023575
30033576 boolean useclient = false;
3004
- cRadio radio;
30053577
30063578 void ToggleRoot()
30073579 {
....@@ -3053,6 +3625,28 @@
30533625 refreshContents();
30543626 }
30553627
3628
+ void TransformChildren()
3629
+ {
3630
+ Object3D obj;
3631
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3632
+ {
3633
+ obj = (Object3D)e.nextElement();
3634
+ obj.KeepTextureMatrices();
3635
+ obj.TransformChildren();
3636
+ obj.RestoreTextureMatrices();
3637
+
3638
+// if (obj.parent == null)
3639
+// {
3640
+// System.out.println("NULL PARENT!");
3641
+// new Exception().printStackTrace();
3642
+// }
3643
+// else
3644
+// TouchTransform(obj);
3645
+// //obj.parent.Touch();
3646
+ }
3647
+
3648
+ refreshContents();
3649
+ }
30563650
30573651 void ResetTransform()
30583652 {
....@@ -3165,7 +3759,7 @@
31653759 refreshContents();
31663760 }
31673761
3168
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
31693763 {
31703764 Object3D obj;
31713765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3180,12 +3774,16 @@
31803774 LA.matIdentity(Object3D.mat);
31813775 obj.getBounds(minima, maxima, false);
31823776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3183
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31843779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31853780 obj.TransformMesh(Object3D.mat);
3781
+
31863782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3187
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31883785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
31893787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31903788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31913789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3214,7 +3812,8 @@
32143812
32153813 int size = obj.MemorySize();
32163814
3217
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32183817 }
32193818 }
32203819 catch (Exception e)
....@@ -3251,9 +3850,9 @@
32513850 obj = (Object3D)e.nextElement();
32523851
32533852 System.out.println("Object is: " + obj);
3254
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
32553854 System.out.println("Boundary rep: " + obj.bRep);
3256
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
32573856
32583857 // System.err.println((size/1024) + " KB is the size of " + obj);
32593858 }
....@@ -3295,6 +3894,13 @@
32953894 void GenNormals(boolean crease)
32963895 {
32973896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
32983904
32993905 refreshContents();
33003906 }
....@@ -3467,8 +4073,8 @@
34674073
34684074 void ParseVertices()
34694075 {
3470
- boolean epsequal = GrafreeD.epsequal;
3471
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
34724078
34734079 for (int i=0; i<group.selection.size(); i++)
34744080 {
....@@ -3493,7 +4099,7 @@
34934099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34944100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34954101
3496
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
34974103
34984104 buffer.add(g);
34994105 }
....@@ -3508,7 +4114,7 @@
35084114 makeSomething(buffer, i==group.selection.size()-1);
35094115 }
35104116
3511
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
35124118
35134119 refreshContents();
35144120 }
....@@ -3526,7 +4132,16 @@
35264132 String pigment = Object3D.GetPigment(tex);
35274133 //String bump = Object3D.GetBump(tex);
35284134
3529
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4135
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4136
+
4137
+ try
4138
+ {
4139
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4140
+ }
4141
+ catch (Exception e)
4142
+ {
4143
+ System.err.println("FAIL: " + node);
4144
+ }
35304145
35314146 double s = v.s;
35324147
....@@ -3614,11 +4229,11 @@
36144229
36154230 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36164231
3617
- boolean random = CameraPane.RANDOM;
3618
- CameraPane.RANDOM = false; // parse all random nodes
4232
+ boolean random = CameraPane.SWITCH;
4233
+ CameraPane.SWITCH = false; // parse all random nodes
36194234 lowres.linkVerticesThis(null);
36204235 lowres.linkVerticesThis(sn);
3621
- CameraPane.RANDOM = random;
4236
+ CameraPane.SWITCH = random;
36224237
36234238 System.err.flush();
36244239
....@@ -3658,7 +4273,7 @@
36584273 return;
36594274
36604275 Object3D poses = group.selection.get(0);
3661
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
36624277
36634278 Object3D newgroup = new Object3D("Po:" + poses.name);
36644279
....@@ -3852,9 +4467,9 @@
38524467
38534468 void ClipMesh()
38544469 {
3855
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38564471 {
3857
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
38584473
38594474 if (content instanceof cGroup && ((cGroup)content).transientlink )
38604475 content = ((cGroup)content).get(0);
....@@ -3863,7 +4478,7 @@
38634478 // {
38644479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38654480 // }
3866
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
38674482 }
38684483 // group.selection.ClipMesh(GrafreeD.clipboard);
38694484 System.out.println("DONE.");
....@@ -3910,6 +4525,18 @@
39104525 void MarkLeaves(boolean hide)
39114526 {
39124527 group.selection.MarkLeaves(hide);
4528
+ refreshContents();
4529
+ }
4530
+
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
39134540 refreshContents();
39144541 }
39154542
....@@ -3984,10 +4611,6 @@
39844611 // }
39854612 // }
39864613
3987
- static boolean allparams = true;
3988
-
3989
- static Vector<Object3D> listUI = new Vector<Object3D>();
3990
-
39914614 void EditSelection(boolean newWindow)
39924615 {
39934616 // aConstraints.gridy = 0;
....@@ -3995,10 +4618,10 @@
39954618 {
39964619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39974620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3998
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39994622
40004623 Object3D elem = (Object3D)group.selection.elementAt(i);
4001
- if(elem != group)
4624
+ if(elem != group || !newWindow)
40024625 {
40034626 // if (!(elem instanceof Composite))
40044627 // newWindow = false;
....@@ -4080,7 +4703,8 @@
40804703 //new Exception().printStackTrace();
40814704
40824705 freezemodel = true;
4083
-
4706
+ ClearUnpinned();
4707
+
40844708 /**/
40854709 //switch (event.id)
40864710 {
....@@ -4088,7 +4712,6 @@
40884712 //case 702: // Event.LIST_DESELECT
40894713 group.deselectAll();
40904714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4091
- objEditor.ClearInfo(); // .GetMaterial());
40924715 if (tps != null)
40934716 {
40944717 for (int i=0; i < tps.length; i++)
....@@ -4097,10 +4720,8 @@
40974720
40984721 //if (child.parent != null)
40994722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
41004724 group.addSelectee(child);
4101
- objEditor.SetMaterial(child); // .GetMaterial());
4102
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4103
- System.err.println("info : " + child.GetPath());
41044725 }
41054726 }
41064727 // else
....@@ -4110,20 +4731,28 @@
41104731 // System.err.println("info : " + group.GetPath());
41114732 // }
41124733
4113
- objEditor.SetText(); // jan 2014
4114
-
4115
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41164735 CameraPane.flash = true;
41174736
4118
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41194738 // a camera
41204739 {
4121
- CameraPane.camerachangeframe = 0; // don't refuse it
4122
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
41234745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41244746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41254747 }
41264748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
41274756 refreshContents();
41284757 //return true;
41294758 }
....@@ -4132,6 +4761,35 @@
41324761
41334762 freezemodel = false;
41344763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
41354793
41364794 void linkSomething(Object3D thing)
41374795 {
....@@ -4203,16 +4861,19 @@
42034861 {
42044862 if (group.selection.isEmpty())
42054863 return;
4206
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
42074866 Composite tGroup = null;
42084867 if (group.selection.size() > 0) // 1)
42094868 {
42104869 tGroup = new cGroup();
4211
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
42124871 }
42134872
42144873 if (cut)
42154874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
42164877 //int indices[] = jList.getSelectedIndices();
42174878 //for (int i = indices.length - 1; i >= 0; i--)
42184879 //jList.remove(indices[i]);
....@@ -4248,16 +4909,16 @@
42484909 //System.out.println("cut " + child);
42494910 //System.out.println("parent = " + child.parent);
42504911 // tmp.addChild(child);
4251
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
42524913 tGroup.add/*Child*/(tmp);
42534914 else
4254
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
42554916 }
42564917 else
4257
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
42584919 tGroup.add/*Child*/(child);
42594920 else
4260
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
42614922 }
42624923
42634924 //ResetModel();
....@@ -4289,21 +4950,23 @@
42894950 //System.out.println("cut " + elem);
42904951 //System.out.println("parent = " + elem.parent);
42914952 // tmp.addChild(elem);
4292
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
42934954 tGroup.add/*Child*/(tmp);
42944955 else
4295
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
42964957 }
42974958 else
4298
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
42994960 tGroup.add/*Child*/(child);
43004961 else
4301
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
43024963 }
43034964
43044965 }
4305
- if (GrafreeD.clipboardIsTempGroup)
4306
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
43074970 if (cut)
43084971 {
43094972 ResetModel();
....@@ -4313,11 +4976,15 @@
43134976
43144977 void paste(boolean expand)
43154978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
43164983 // if (GrafreeD.clipboard == null)
43174984 // return;
43184985 boolean first = true;
43194986
4320
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
43214988 {
43224989 Composite temp;
43234990
....@@ -4328,7 +4995,7 @@
43284995 temp = (Composite)Applet3D.clipboard.deepCopy();
43294996 */
43304997 Object3D elem;
4331
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4998
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43324999 {
43335000 Object3D child = (Object3D)e.nextElement();
43345001
....@@ -4362,21 +5029,22 @@
43625029 //Object3D cb = Applet3D.clipboard;
43635030 //temp.addChild(cb);
43645031 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4365
- assert(GrafreeD.clipboard.parent == null);
4366
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4367
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4368
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4369
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5032
+ assert(Grafreed.clipboard.parent == null);
5033
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5034
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5035
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5036
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43705037 else
4371
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4372
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
43735040 }
43745041
5042
+ Globals.REPLACEONMAKE = keep;
43755043 ResetModel();
43765044 refreshContents();
43775045 }
43785046
4379
- void pasteInto(boolean copyit)
5047
+ void pasteInto(boolean copyit, boolean clone)
43805048 {
43815049 // if (GrafreeD.clipboard == null)
43825050 // return;
....@@ -4405,15 +5073,22 @@
44055073 if (copyit)
44065074 {
44075075 // paste(false);
4408
- CloneClipboard(false); // sept 2014
5076
+ if (clone)
5077
+ {
5078
+ CloneClipboard(false); // sept 2014
5079
+ }
5080
+ else
5081
+ {
5082
+ paste(false);
5083
+ }
44095084 }
44105085 else
44115086 {
44125087 boolean first = true;
44135088
4414
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
44155090 {
4416
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
44175092 Object3D copy;
44185093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44195094 {
....@@ -4423,7 +5098,7 @@
44235098 }
44245099 } else
44255100 {
4426
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
44275102 }
44285103 }
44295104 }
....@@ -4500,6 +5175,10 @@
45005175
45015176 void group(Object3D csg, boolean grab)
45025177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
45035182 if (//false) // why??
45045183 !group.selection.isEmpty())
45055184 {
....@@ -4613,10 +5292,15 @@
46135292 //node.add(csg);
46145293 //makeSomething(node);
46155294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
46165296 }
46175297
46185298 void Ungroup(Object3D g)
46195299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
46205304 if (g instanceof HiddenObject)
46215305 {
46225306 HiddenObject h = (HiddenObject) g;
....@@ -4633,6 +5317,7 @@
46335317 objEditor.makeSomething(g.get(i), false);
46345318 }
46355319 }
5320
+ Globals.REPLACEONMAKE = keep;
46365321 }
46375322
46385323 void ungroup()
....@@ -4828,21 +5513,6 @@
48285513 }
48295514 */
48305515
4831
- void ImportGFD()
4832
- {
4833
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4834
- browser.show();
4835
- String filename = browser.getFile();
4836
- if (filename != null && filename.length() > 0)
4837
- {
4838
- String fullname = browser.getDirectory() + filename;
4839
-
4840
- //Object3D readobj =
4841
- objEditor.ReadGFD(fullname, objEditor);
4842
- //makeSomething(readobj);
4843
- }
4844
- }
4845
-
48465516 /*
48475517 public void Callback(Object obj)
48485518 {
....@@ -4866,26 +5536,9 @@
48665536 }
48675537 */
48685538
4869
- void ImportVRMLX3D()
4870
- {
4871
- if (GrafreeD.standAlone)
4872
- {
4873
- /**/
4874
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4875
- browser.show();
4876
- String filename = browser.getFile();
4877
- if (filename != null && filename.length() > 0)
4878
- {
4879
- String fullname = browser.getDirectory() + filename;
4880
- LoadVRMLX3D(fullname);
4881
- }
4882
- /**/
4883
- }
4884
- }
4885
-
48865539 String GetFile(String dialogName)
48875540 {
4888
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
48895542 {
48905543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48915544 browser.show();
....@@ -4949,10 +5602,33 @@
49495602 cButton flashSelectionButton;
49505603 cButton editButton;
49515604 cButton uneditButton;
5605
+ JCheckBox allParamsButton;
49525606 cButton clearpanelButton;
4953
- cButton allParamsButton;
49545607 cButton unselectButton;
49555608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
5612
+ cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
5631
+
49565632 cButton screenfitButton;
49575633 cButton screenfitpointButton;
49585634 cButton snapobjectButton;
....@@ -4964,14 +5640,6 @@
49645640
49655641 cButton setsupportButton;
49665642
4967
- cButton twoButton;
4968
- cButton sixButton;
4969
- cButton threeButton;
4970
- cButton sevenButton;
4971
- cButton fourButton; // full panel
4972
- cButton oneButton; // full XYZ
4973
- //cButton currentLayout;
4974
-
49755643 //
49765644 //Composite
49775645 Object3D // to do !!
....@@ -4981,9 +5649,11 @@
49815649 //JTree jTree;
49825650 private MenuItem lookAtItem;
49835651 private MenuItem lookFromItem;
4984
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
49855653 private MenuItem cutItem;
4986
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
49875657 private MenuItem cloneItem;
49885658 private MenuItem cloneSupportItem;
49895659 private MenuItem overwriteGeoItem;
....@@ -4996,7 +5666,7 @@
49965666 private MenuItem linkverticesItem;
49975667 private MenuItem relinkverticesItem;
49985668 private MenuItem setMasterItem;
4999
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
50005670 private MenuItem stepAllItem;
50015671 private MenuItem revertMeshItem;
50025672 private MenuItem poseMeshItem;
....@@ -5007,6 +5677,7 @@
50075677 private MenuItem mergeGeometriesItem;
50085678 private MenuItem copyItem;
50095679 private MenuItem pasteItem;
5680
+ private MenuItem pasteIntoItem;
50105681 private MenuItem pasteLinkItem;
50115682 private MenuItem pasteCloneItem;
50125683 private MenuItem pasteExpandItem;
....@@ -5045,6 +5716,10 @@
50455716 private MenuItem showleavesItem;
50465717 private MenuItem markleavesItem;
50475718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
50485723
50495724 private MenuItem flipVItem;
50505725 private MenuItem unflipVItem;
....@@ -5056,15 +5731,17 @@
50565731 private MenuItem panoTexturesItem;
50575732
50585733 private MenuItem resetCentroidItem;
5059
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
50605735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
50615738 private MenuItem hideItem;
50625739 private MenuItem grabItem;
50635740 private MenuItem backItem;
50645741 private MenuItem frontItem;
50655742 private MenuItem cameraItem;
50665743 private MenuItem compositeItem;
5067
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
50685745 private MenuItem physicsItem;
50695746 private MenuItem frameselectorItem;
50705747 private MenuItem scriptNodeItem;
....@@ -5104,7 +5781,7 @@
51045781 private MenuItem blobItem;
51055782 private MenuItem latheItem;
51065783 private MenuItem bezierItem;
5107
- private MenuItem checkerItem;
5784
+ private MenuItem overlayItem;
51085785 private MenuItem meshItem;
51095786 // private MenuItem meshGroupItem;
51105787 private MenuItem springItem;
....@@ -5126,11 +5803,6 @@
51265803 private MenuItem doubleItem;
51275804 private MenuItem tripleItem;
51285805
5129
- private MenuItem importGFDItem;
5130
- private MenuItem importVRMLX3DItem;
5131
- private MenuItem import3DSItem;
5132
- private MenuItem importOBJItem;
5133
-
51345806 private MenuItem computeAOItem;
51355807 private MenuItem recompileItem;
51365808 private MenuItem editScriptItem;
....@@ -5140,4 +5812,8 @@
51405812 private MenuItem analyzeItem;
51415813 private MenuItem dumpItem;
51425814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
51435819 }