Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
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.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = 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.SAVEONMAKE = 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,40 @@
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
407547 void SetupUI2(ObjEditor oe)
408548 {
549
+ // June 2019
550
+ if (oe == null)
551
+ {
552
+ //super.SetupUI2(this);
553
+ //return;
554
+ }
555
+
556
+ if (copy != group)
557
+ {
558
+ //super.SetupUI2(this);
559
+ }
560
+
409561 //new Exception().printStackTrace();
410562
411563 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,110 +586,217 @@
434586 oe.radioPanel.add(dummyButton);
435587 oe.buttonGroup.add(dummyButton);
436588 */
437
- aConstraints.gridy += 1;
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
438592
439593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440594
441
- oe.aConstraints.gridwidth = 1;
442
- oe.aConstraints.gridx = 0;
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
443598
444
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
- liveCB.setToolTipText("Enabled animation");
446
- liveCB.addItemListener(this);
447
-
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
450
- trackCB.setToolTipText("Enable tracking");
451
- trackCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
605
+
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ fullButton.setToolTipText("Full-screen window");
608
+ fullButton.addActionListener(this);
609
+
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
455611 screenfitButton.setToolTipText("Screen fit");
456612 screenfitButton.addActionListener(this);
457
- oe.aConstraints.gridx += 1;
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ undoButton.setToolTipText("Undo changes");
620
+ undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
622
+
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ redoButton.setToolTipText("Redo changes");
625
+ redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
627
+
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ saveButton.setToolTipText("Save changes");
630
+ saveButton.addActionListener(this);
631
+
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633
+ liveCB.setToolTipText("Enable animation");
634
+ liveCB.addItemListener(this);
635
+
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ oneStepButton.setToolTipText("Animate one step forward");
638
+ oneStepButton.addActionListener(this);
639
+
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641
+ fastCB.setToolTipText("Fast mode");
642
+ fastCB.addItemListener(this);
643
+
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
649
+
458650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459651 // screenfitpointButton.addActionListener(this);
460
-// oe.aConstraints.gridx += 1;
461
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
462
- snapobjectButton.addActionListener(this);
463
- snapobjectButton.setToolTipText("Snap Object");
464
- oe.aConstraints.gridx += 1;
465652
466
- //aConstraints.gridx = 0;
467
- //aConstraints.gridy += 1;
468
- oe.aConstraints.weighty = 0;
469
- oe.aConstraints.gridwidth = 1;
470
-
471
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
- flashSelectionButton.setToolTipText("Show selection");
473
- flashSelectionButton.addActionListener(this);
653
+ if (Globals.ADVANCED)
654
+ {
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ snapobjectButton.addActionListener(this);
657
+ snapobjectButton.setToolTipText("Snap Object");
658
+ }
659
+
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
474661
475
- oe.toolbarPanel.add(new cButton(" ", false));
476
-
477
- oe.aConstraints.gridx += 1;
478
- oe.aConstraints.weighty = 0;
479
- oe.aConstraints.gridwidth = 1;
480
-
481
- //
482
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483663 twoButton.setToolTipText("Show center view only");
484664 twoButton.addActionListener(this);
485
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
486668 fourButton.addActionListener(this);
487669 fourButton.setToolTipText("Show left panel only");
488
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
489671 sixButton.setToolTipText("2-column layout left");
490672 sixButton.addActionListener(this);
491
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492674 threeButton.setToolTipText("2-column layout right");
493675 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495677 sevenButton.setToolTipText("3-column layout");
496678 sevenButton.addActionListener(this);
497679 //
498680
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- rootButton.setToolTipText("Edit object in new tab");
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ rootButton.setToolTipText("Edit selection in new tab");
501683 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
684
+
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504686 closeButton.setToolTipText("Close tab");
505687 closeButton.addActionListener(this);
506688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
507689 //clearButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509
-
510
- oe.aConstraints.gridx = 1; //
511
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
512
- editButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516690
517
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
722
+
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
772
+ editButton.addActionListener(this);
773
+
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
518776 uneditButton.addActionListener(this);
519777
520
- oe.aConstraints.gridx += 1;
521
- oe.aConstraints.weighty = 0;
522
- oe.aConstraints.gridwidth = 1;
523
-
524
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
525
- clearPanelButton.addActionListener(this);
526
-
527
- oe.aConstraints.gridx += 1;
528
- oe.aConstraints.weighty = 0;
529
- oe.aConstraints.gridwidth = 1;
530
-
531
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
532780 allParamsButton.addActionListener(this);
533781
534
- oe.aConstraints.gridx += 1;
535
- oe.aConstraints.weighty = 0;
536
- oe.aConstraints.gridwidth = 1;
537
-
538
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ clearPanelButton.setToolTipText("Clear edit panel");
784
+ clearPanelButton.addActionListener(this);
785
+
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
787
+ unselectButton.setToolTipText("Unselect");
539788 unselectButton.addActionListener(this);
540789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
799
+
541800 // oe.aConstraints.gridx += 1;
542801 // oe.aConstraints.weighty = 0;
543802 // oe.aConstraints.gridwidth = 1;
....@@ -549,40 +808,22 @@
549808 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
550809 // gcButton.addActionListener(this);
551810
552
- oe.aConstraints.gridx = 0;
553
- oe.aConstraints.gridy += 1;
554
-
555
- //ctrlPanel.add(objList = new List(5, true));
556
- oe.aConstraints.gridwidth = 100;
557
- // oe.aConstraints.gridheight = 100;
558
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
559
- oe.aConstraints.gridheight = 1;
560
- oe.aConstraints.weighty = 0.5;
561
- oe.aConstraints.gridx = 0;
562
- JScrollPane jSP;
811
+ cGridBag jSPPanel = new cGridBag();
812
+
813
+ JScrollPane jSP;
563814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
564
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
565816 ResetModel();
566
- oe.aConstraints.weighty = 0.5;
567
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
568
- oe.aConstraints.gridy += 1;
569
- oe.aConstraints.gridwidth = 1;
570
-
571
- oe.aConstraints.weighty = 0;
572
- oe.aConstraints.gridwidth = 2;
573
-
574
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
575
- colorCB.addItemListener(this);
576
- oe.aConstraints.gridx += 2;
577
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
578
- materialCB.addItemListener(this);
579
- oe.aConstraints.gridx += 2;
580
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
581
- textureCB.addItemListener(this);
582
-
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585817
818
+ oe.treePanel.add(jSPPanel);
819
+ oe.treePanel.Return();
820
+
821
+ oe.treePanel.add(copyOptionsPanel);
822
+ oe.treePanel.Return();
823
+
824
+// mainPanel.setDividerLocation(0.5); //1.0);
825
+// mainPanel.setResizeWeight(0.5);
826
+
586827 //jList.addListSelectionListener(this);
587828 oe.jTree.addTreeSelectionListener(this);
588829 //jTree.setRootVisible(false);
....@@ -607,47 +848,61 @@
607848
608849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
609850 {
610
- //constraints.gridx = 0;
611
- //constraints.gridy = 0;
612
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
- fastCB.setToolTipText("Fast mode");
614
- fastCB.addItemListener(this);
615
- //constraints.gridy += 1;
616
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
- supportCB.setToolTipText("Enabled rigging");
618
- supportCB.addItemListener(this);
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
619854
620
- // constraints.gridy += 1;
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
865
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
866
+ boxCB.setToolTipText("Display bounding boxes");
867
+ boxCB.addItemListener(this);
868
+
869
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
871
+ zoomBoxCB.addItemListener(this);
872
+
873
+ if (true) // Globals.ADVANCED)
874
+ {
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
882
+
621883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
622884 // localCB.addItemListener(this);
623885
624
- //constraints.gridy += 1;
886
+ panel.Return();
887
+
625888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
626889 crowdCB.setToolTipText("Used for crowds");
627890 crowdCB.addItemListener(this);
628891
629
- //constraints.gridy += 1;
630892 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
631893 smoothCB.setToolTipText("Snapping delay");
632894 smoothCB.addItemListener(this);
633895
634
- //constraints.gridy += 1;
635896 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
636897 slowCB.setToolTipText("Smooth interpolation");
637898 slowCB.addItemListener(this);
638
- //constraints.gridy += 1;
639
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640
- boxCB.setToolTipText("Display bounding boxes");
641
- boxCB.addItemListener(this);
642
- //constraints.gridy += 1;
643
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645
- zoomBoxCB.addItemListener(this);
646
-
899
+
647900 // constraints.gridy += 1;
648901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
649902 // speakerMocapCB.addItemListener(this);
650903
904
+ panel.Return();
905
+
651906 if (false)
652907 {
653908 // handled in scripts
....@@ -662,26 +917,72 @@
662917 //constraints.gridy += 1;
663918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
664919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
665921 }
666922
667923 //constraints.gridx += 1;
668924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
669925 // debugCB.addItemListener(this);
670926
671
- //constraints.gridy += 1;
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
672931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
673933 oeilCB.addItemListener(this);
674934
675
- //constraints.gridy += 1;
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
676955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
677956 lookAtCB.setToolTipText("Look-at target");
678957 lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
961
+
962
+ cGridBag fill = new cGridBag();
963
+ fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
968
+
969
+ panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
679972
680973 }
681974
682975 void EditObject(Object3D obj)
683976 {
684977 cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
685986 radioButton.SetObject(obj);
686987 radioButton.layout = sevenButton;
687988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -690,8 +991,11 @@
690991 buttonGroup.add(radioButton);
691992 radioButton.doClick();
692993 }
994
+
693995 void SetupViews(ObjEditor oe)
694996 {
997
+ theFrame = this;
998
+
695999 oe.SetupViews();
6961000
6971001 System.out.println("SetupViews");
....@@ -700,23 +1004,28 @@
7001004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7011005 }
7021006
703
- JCheckBox liveCB;
704
- JCheckBox supportCB;
705
- JCheckBox localCB;
706
- JCheckBox crowdCB;
707
- JCheckBox smoothCB;
708
- JCheckBox fastCB;
709
- JCheckBox slowCB;
710
- JCheckBox boxCB;
711
- JCheckBox zoomBoxCB;
712
- JCheckBox trackCB;
713
- JCheckBox smoothfocusCB;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
7141020 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
7201029
7211030 // static int COLOR = 1;
7221031 // static int MATERIAL = 2;
....@@ -724,9 +1033,9 @@
7241033
7251034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7261035
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7301039
7311040 public void itemStateChanged(ItemEvent e)
7321041 {
....@@ -754,6 +1063,7 @@
7541063 } else if(e.getSource() == liveCB)
7551064 {
7561065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7571067 }
7581068 else if(e.getSource() == supportCB)
7591069 {
....@@ -818,6 +1128,18 @@
8181128 {
8191129 cameraView.ToggleOeil();
8201130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
8211143 else if(e.getSource() == lookAtCB)
8221144 {
8231145 cameraView.ToggleLookAt();
....@@ -834,7 +1156,8 @@
8341156
8351157 /**/
8361158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
837
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8381161 if ((path == null) || (path.getPathCount() <= 1)) {
8391162 // We can't move the root node or an empty selection
8401163 return;
....@@ -897,8 +1220,6 @@
8971220 }
8981221 }
8991222
900
- String string = (String) object;
901
-
9021223 System.out.println("Transfer = " + object + "; drop : " + target);
9031224 // if( object instanceof java.io.File[])
9041225 // {
....@@ -906,7 +1227,11 @@
9061227 // objEditor.DropFile((java.io.File[]) object, true);
9071228 // return;
9081229 // }
909
- if (string.charAt(0) == '/')
1230
+
1231
+ String string = object.toString();
1232
+
1233
+ // File path for Mac and Windows
1234
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9101235 {
9111236 // file(s)
9121237 String[] names = string.split("\n");
....@@ -933,7 +1258,7 @@
9331258
9341259 flashIt = false;
9351260 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381263
9391264 if (group.selection.size() == 1)
....@@ -949,23 +1274,33 @@
9491274
9501275 assert target == objEditor.jTree;
9511276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9521278 try {
953
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9541280 } catch (Exception e) {
9551281 System.out.println("destinationPath : " + destinationPath);
9561282 return;
9571283 }
9581284
959
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9601286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
9611296 loadClipboard(true);
9621297 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
964
- } else {
965
- loadClipboard(false);
966
- objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
968
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9691304 }
9701305 public void dropActionChanged(DropTargetDragEvent dtde)
9711306 // Called if the user has modified the current drop gesture
....@@ -1070,85 +1405,107 @@
10701405 {
10711406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10721407 //heightFieldItem.addActionListener(this);
1073
- gridItem = menu.add(new MenuItem("Grid"));
1074
- gridItem.addActionListener(this);
1075
- rectoidItem = menu.add(new MenuItem("Box"));
1076
- rectoidItem.addActionListener(this);
1077
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1078
- ellipsoidItem.addActionListener(this);
1079
- coneItem = menu.add(new MenuItem("Cone"));
1080
- coneItem.addActionListener(this);
1081
- torusItem = menu.add(new MenuItem("Torus"));
1082
- torusItem.addActionListener(this);
1083
- superItem = menu.add(new MenuItem("Superellipsoid"));
1084
- superItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
10851426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10861427 kleinItem.addActionListener(this);
1087
- particleItem = menu.add(new MenuItem("Particle system"));
1088
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10891434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901435 ragdollItem.addActionListener(this);
10911436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921437 ragdoll2Item.addActionListener(this);
1438
+ }
10931439 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951441 meshItem.addActionListener(this);
10961442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10981446 springItem = menu.add(new MenuItem("Spring"));
10991447 springItem.addActionListener(this);
11001448 flagItem = menu.add(new MenuItem("Flag"));
11011449 flagItem.addActionListener(this);
1102
- bezierItem = menu.add(new MenuItem("Patch"));
1103
- bezierItem.addActionListener(this);
1104
- checkerItem = menu.add(new MenuItem("Checker"));
1105
- checkerItem.addActionListener(this);
11061450 blobItem = menu.add(new MenuItem("Blob"));
11071451 blobItem.addActionListener(this);
11081452 latheItem = menu.add(new MenuItem("Lathe"));
11091453 latheItem.addActionListener(this);
1110
- lightItem = menu.add(new MenuItem("Light"));
1111
- lightItem.addActionListener(this);
1454
+ }
1455
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1456
+ bezierItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
11121461 menu.add("-");
11131462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11141463 //superLoopItem.addActionListener(this);
1115
- loopItem = menu.add(new MenuItem("Loop"));
1116
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
11171466 doubleItem = menu.add(new MenuItem("Fork"));
11181467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
11191470 tripleItem = menu.add(new MenuItem("Trident"));
11201471 tripleItem.addActionListener(this);
1472
+ }
11211473 }
11221474
11231475 void buildToolsMenu(Menu menu)
11241476 {
11251477 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261478 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1479
+ animationItem.setState(Globals.ANIMATION);
1480
+
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
11281483
11291484 menu.add("-");
11301485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311486 parseverticesItem.addActionListener(this);
11321487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331488 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351490 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391492 reduceMorphItem.addActionListener(this);
11401493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411494 reduce34MorphItem.addActionListener(this);
1142
-
1143
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1144
- computeAOItem.addActionListener(this);
11451495 menu.add("-");
1146
-
11471496 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481497 memoryItem.addActionListener(this);
1498
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1499
+ computeAOItem.addActionListener(this);
1500
+
1501
+ if (Globals.ADVANCED)
1502
+ {
1503
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1504
+ mirrorItem.addActionListener(this);
1505
+ menu.add("-");
11491506 menu.add(analyzeItem = new MenuItem("Analyze"));
11501507 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11521509 dumpItem.addActionListener(this);
11531510 // menu.add(pathItem = new MenuItem("From-to path"));
11541511 // pathItem.addActionListener(this);
....@@ -1166,6 +1523,7 @@
11661523 menu.add("-");
11671524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681525 editScriptItem.addActionListener(this);
1526
+ }
11691527 }
11701528
11711529 void ScreenFit()
....@@ -1288,9 +1646,24 @@
12881646 shadow.material = new cMaterial(obj.material);
12891647 shadow.material.diffuse = 0.0001f;
12901648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12911650
12921651 makeSomething(shadow);
12931652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
12941667
12951668 /**
12961669 * applyExample
....@@ -1494,9 +1867,9 @@
14941867
14951868 void Overwrite(int mask)
14961869 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14981871 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
15001873
15011874 if (content instanceof cGroup && ((cGroup)content).transientlink )
15021875 content = ((cGroup)content).get(0);
....@@ -1535,7 +1908,7 @@
15351908 {
15361909 ScreenFit();
15371910 } else
1538
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15391912 {
15401913 cVector v1 = new cVector();
15411914 cVector v2 = new cVector();
....@@ -1544,11 +1917,11 @@
15441917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15451918 objEditor.cameraView.repaint();
15461919 } else
1547
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
15481921 {
15491922 makeSomething(new Box());
15501923 } else
1551
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15521925 {
15531926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15541927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1627,27 +2000,27 @@
16272000
16282001 makeSomething(obj);
16292002 } else
1630
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16312004 {
16322005 makeSomething(new Grid());
16332006 } else
1634
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16352008 {
16362009 makeSomething(new Sphere());
16372010 } else
1638
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16392012 {
16402013 makeSomething(new Cone());
16412014 } else
1642
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16432016 {
16442017 makeSomething(new Torus());
16452018 } else
1646
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
16472020 {
16482021 makeSomething(new Superellipsoid());
16492022 } else
1650
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
16512024 {
16522025 makeSomething(new Klein());
16532026 } else
....@@ -1667,7 +2040,7 @@
16672040 {
16682041 makeSomething(new BezierSurface());
16692042 } else
1670
- if (source == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16712044 {
16722045 /*
16732046 Object3D obj = new BezierSurface(5,8);
....@@ -1715,7 +2088,7 @@
17152088 s.setup();
17162089 makeSomething(s);
17172090 } else
1718
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
17192092 {
17202093 makeSomething(new Light());
17212094 } else
....@@ -1765,30 +2138,30 @@
17652138
17662139 group(g);
17672140 } else
1768
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17692142 {
17702143 Composite csg = new GroupLeaf();
17712144 csg.count = 5;
17722145 group(csg);
1773
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17742147 csg.addChild(child);
17752148 child.addChild(csg);
17762149 } else
17772150 if (source == doubleItem)
17782151 {
1779
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17802153 csg.count = 5;
17812154 group(csg);
1782
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17832156 csg.addChild(child);
17842157 child.addChild(csg);
1785
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17862159 csg.addChild(child);
17872160 child.addChild(csg);
17882161 } else
17892162 if (source == tripleItem)
17902163 {
1791
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17922165 csg.count = 4;
17932166 group(csg);
17942167 Composite child = new cGroup();
....@@ -1800,23 +2173,6 @@
18002173 child = new cGroup();
18012174 csg.addChild(child);
18022175 child.addChild(csg);
1803
- } else
1804
-
1805
- if (source == importGFDItem)
1806
- {
1807
- ImportGFD();
1808
- } else
1809
- if (source == importVRMLX3DItem)
1810
- {
1811
- ImportVRMLX3D();
1812
- } else
1813
- if (source == import3DSItem)
1814
- {
1815
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1816
- } else
1817
- if (source == importOBJItem)
1818
- {
1819
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18202176 } else
18212177 if (source == computeAOItem)
18222178 {
....@@ -1836,7 +2192,7 @@
18362192 if (source == invariantsItem)
18372193 {
18382194 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
18402196 } else
18412197 if (source == memoryItem)
18422198 {
....@@ -1855,19 +2211,47 @@
18552211 {
18562212 DumpObject();
18572213 } else
2214
+ if (source == minButton)
2215
+ {
2216
+ Minimize();
2217
+ } else
2218
+ if (source == maxButton)
2219
+ {
2220
+ Maximize();
2221
+ } else
2222
+ if (source == fullButton)
2223
+ {
2224
+ ToggleFullScreen();
2225
+ } else
2226
+ if (source == undoButton)
2227
+ {
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
2230
+ } else
2231
+ if (source == redoButton)
2232
+ {
2233
+ Redo();
2234
+ } else
2235
+ if (source == saveButton)
2236
+ {
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
2239
+ } else
2240
+ if (source == oneStepButton)
2241
+ {
2242
+ Globals.ONESTEP = true;
2243
+ cameraView.repaint();
2244
+ } else
18582245 if (source == screenfitButton)
18592246 {
1860
- //Reload(lastConverter, lastFilename, true);
18612247 ScreenFit();
18622248 } else
18632249 if (source == screenfitpointButton)
18642250 {
1865
- //Reload(lastConverter, lastFilename, true);
18662251 ScreenFitPoint();
18672252 } else
18682253 if (source == snapobjectButton)
18692254 {
1870
- //Reload(lastConverter, lastFilename, true);
18712255 SnapObject();
18722256 } else
18732257 // if (event.getSource() == recompileButton)
....@@ -1904,12 +2288,20 @@
19042288 {
19052289 loadClipboard(true);
19062290 } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
19072299 if (source == duplicateItem)
19082300 {
1909
- Object3D keep = GrafreeD.clipboard;
2301
+ Object3D keep = Grafreed.clipboard;
19102302 loadClipboard(false);
19112303 paste(false);
1912
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
19132305 } else
19142306 if (source == cloneItem)
19152307 {
....@@ -1927,13 +2319,17 @@
19272319 {
19282320 paste(false);
19292321 } else
2322
+ if (source == pasteIntoItem)
2323
+ {
2324
+ pasteInto(true, false);
2325
+ } else
19302326 if (source == pasteLinkItem)
19312327 {
1932
- pasteInto(false);
2328
+ pasteInto(false, false);
19332329 } else
19342330 if (source == pasteCloneItem)
19352331 {
1936
- pasteInto(true);
2332
+ pasteInto(true, true);
19372333 } else
19382334 if (source == pasteExpandItem)
19392335 {
....@@ -2125,9 +2521,9 @@
21252521 // group.selection.get(0).setMasterThis(content); // should be identity
21262522 // refreshContents();
21272523 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292525 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
21312527
21322528 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332529 content = ((cGroup)content).get(0);
....@@ -2135,11 +2531,11 @@
21352531 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362532 for (int i=0; i<group.selection.size(); i++)
21372533 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
21402536 group.selection.get(i).linkVerticesThis(content);
21412537 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
21432539 }
21442540 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452541 refreshContents();
....@@ -2149,20 +2545,20 @@
21492545 {
21502546 for (int i=0; i<group.selection.size(); i++)
21512547 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
21542550 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
21562552 }
21572553
21582554 refreshContents();
21592555 } else
21602556 if (source == relinkverticesItem)
21612557 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
21642560 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2561
+ CameraPane.SWITCH = random;
21662562
21672563 refreshContents();
21682564 } else
....@@ -2177,9 +2573,9 @@
21772573 } else
21782574 if (source == setMasterItem)
21792575 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812577 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21832579
21842580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852581 content = ((cGroup)content).get(0);
....@@ -2192,9 +2588,9 @@
21922588 {
21932589 if (group.selection.size() == 1)
21942590 {
2195
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21962592 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21982594
21992595 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002596 content = ((cGroup)content).get(0);
....@@ -2211,7 +2607,7 @@
22112607 {
22122608 RevertMeshes();
22132609 } else
2214
- if (source == resetMeshItem)
2610
+ if (source == resetAllItem)
22152611 {
22162612 ResetAll();
22172613 } else
....@@ -2231,9 +2627,9 @@
22312627 {
22322628 ClearSelection(true);
22332629 } else
2234
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
22352631 {
2236
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
22372633 } else
22382634 if (source == hideItem)
22392635 {
....@@ -2251,16 +2647,16 @@
22512647 {
22522648 makeSomething(new Camera());
22532649 } else
2254
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
22552651 {
22562652 group(new Composite());
22572653 } else
2258
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
22592655 {
22602656 RandomNode random = new RandomNode();
22612657 group(random);
22622658 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
2659
+ random.name = random.get(0).name + "Switch";
22642660 } else
22652661 if (source == physicsItem)
22662662 {
....@@ -2357,7 +2753,7 @@
23572753 {
23582754 group(new cLinker());
23592755 } else
2360
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
23612757 {
23622758 group(new TextureNode());
23632759 } else
....@@ -2377,17 +2773,30 @@
23772773 {
23782774 CastShadow(2);
23792775 } else
2380
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23812777 {
2382
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
23832780 for (int i=0; i<group.selection.size(); i++)
23842781 {
2385
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
23862787 }
23872788
2388
- ClearSelection(false);
2389
-
2390
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
23912800 } else
23922801 if (source == genUVItem)
23932802 {
....@@ -2399,7 +2808,7 @@
23992808 } else
24002809 if (source == genNormalsMESHItem)
24012810 {
2402
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
24032812 } else
24042813 if (source == genNormalsORGANItem)
24052814 {
....@@ -2464,6 +2873,22 @@
24642873 if (source == unmarkleavesItem)
24652874 {
24662875 MarkLeaves(false);
2876
+ } else
2877
+ if (source == rewindleavesItem)
2878
+ {
2879
+ RewindLeaves(true);
2880
+ } else
2881
+ if (source == unrewindleavesItem)
2882
+ {
2883
+ RewindLeaves(false);
2884
+ } else
2885
+ if (source == randomleavesItem)
2886
+ {
2887
+ RandomLeaves(true);
2888
+ } else
2889
+ if (source == unrandomleavesItem)
2890
+ {
2891
+ RandomLeaves(false);
24672892 } else
24682893 if (source == flipVItem)
24692894 {
....@@ -2549,9 +2974,13 @@
25492974 {
25502975 SmoothMesh();
25512976 } else
2552
- if (source == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
25532978 {
25542979 TransformGeometry();
2980
+ } else
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
25552984 } else
25562985 if (source == resetTransformItem)
25572986 {
....@@ -2559,7 +2988,11 @@
25592988 } else
25602989 if (source == resetCentroidItem)
25612990 {
2562
- ResetCentroid();
2991
+ ResetCentroid(true);
2992
+ } else
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
25632996 } else
25642997 if (source == resetParentItem)
25652998 {
....@@ -2691,6 +3124,10 @@
26913124 if (source == twoButton)
26923125 {
26933126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
26943131 // bug
26953132 //gridPanel.setDividerLocation(1.0);
26963133 //bigPanel.setDividerLocation(0.0);
....@@ -2723,10 +3160,31 @@
27233160 bigThree.ClearUI();
27243161 bigThree.add(centralPanel);
27253162 bigThree.FlushUI();
3163
+
3164
+ cameraView.requestFocusInWindow();
3165
+
3166
+// refreshContents(true);
3167
+//
3168
+// try
3169
+// {
3170
+// java.awt.Robot bot = new java.awt.Robot();
3171
+// int mask = InputEvent.BUTTON1_MASK;
3172
+// bot.mouseMove(100, 100);
3173
+// bot.mousePress(mask);
3174
+// bot.mouseRelease(mask);
3175
+// }
3176
+// catch (Exception e)
3177
+// {
3178
+//
3179
+// }
3180
+
27263181 } else
27273182 if (source == threeButton)
27283183 {
27293184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
27303188
27313189 // bigThree.remove(scenePanel);
27323190 // bigThree.remove(centralPanel);
....@@ -2759,10 +3217,15 @@
27593217 bigThree.add(centralPanel);
27603218 bigThree.add(XYZPanel);
27613219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
27623222 } else
27633223 if (source == fourButton)
27643224 {
27653225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
27663229
27673230 // bigThree.remove(scenePanel);
27683231 // bigThree.remove(centralPanel);
....@@ -2794,10 +3257,15 @@
27943257 bigThree.ClearUI();
27953258 bigThree.add(scenePanel);
27963259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
27973262 } else
27983263 if (source == sixButton)
27993264 {
28003265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
28013269
28023270 // bigThree.remove(scenePanel);
28033271 // bigThree.remove(centralPanel);
....@@ -2830,10 +3298,15 @@
28303298 bigThree.add(scenePanel);
28313299 bigThree.add(centralPanel);
28323300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
28333303 } else
28343304 if (source == sevenButton)
28353305 {
28363306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
28373310
28383311 // bigThree.remove(scenePanel);
28393312 // bigThree.remove(centralPanel);
....@@ -2867,6 +3340,8 @@
28673340 bigThree.add(centralPanel);
28683341 bigThree.add(XYZPanel);
28693342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
28703345 } else
28713346 if (source == rootButton)
28723347 {
....@@ -2878,6 +3353,7 @@
28783353 EditObject(obj);
28793354 }
28803355
3356
+ cameraView.requestFocusInWindow();
28813357 refreshContents(true);
28823358 } else
28833359 if (source == closeButton)
....@@ -2887,22 +3363,37 @@
28873363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883364 {
28893365 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
28923374 buttonGroup.remove(ab);
28933375 radioPanel.remove(ab);
28943376
2895
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
28963379 // ab.GetObject().objectUI = null; // ?????????
28973380
28983381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993382 break;
29003383 }
29013384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
29023387 refreshContents(true);
29033388 } else
29043389 if (source == editItem || source == editButton)
29053390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
29063397 EditSelection(false);
29073398 } else
29083399 if (source == uneditButton)
....@@ -2912,12 +3403,13 @@
29123403 Object3D child = (Object3D)e.nextElement();
29133404 if(child.editWindow != null)
29143405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
29153407 child.CloseUI();
29163408 listUI.remove(child);
29173409
2918
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
29193411 }
2920
- objEditor.ctrlPanel.validate();
3412
+ objEditor.ctrlPanel.FlushUI();
29213413 //objEditor.jTree.clearSelection();
29223414 //objEditor.ResetSliders();
29233415 refreshContents(true);
....@@ -2928,6 +3420,7 @@
29283420 //copy.ClearUI();
29293421 for (Object3D obj : listUI)
29303422 {
3423
+ obj.pinned = false;
29313424 obj.CloseUI();
29323425 }
29333426 listUI.clear();
....@@ -2937,7 +3430,7 @@
29373430 {
29383431 assert(copy == group);
29393432
2940
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29413434
29423435 for (Object3D obj : listUI)
29433436 {
....@@ -3001,20 +3494,44 @@
30013494 frontView.object = group;
30023495 sideView.object = group;
30033496 }
3004
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
30053502 /*
30063503 currentLayout = radio.layout;
30073504 if (currentLayout == null)
30083505 currentLayout = sevenButton;
30093506 */
30103507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
30113513 keepparent = group.parent;
30123514 // PARENT = NULL or not???
30133515 //group.parent = null; // ROOT
30143516 //group.attributes = -1;
30153517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
30163520 refreshContents(true);
3017
- }
3521
+ } else if (event.getSource() == editCameraItem)
3522
+ {
3523
+ cameraView.ProtectCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3527
+ {
3528
+ cameraView.RevertCamera();
3529
+ cameraView.repaint();
3530
+ return;
3531
+ // } else if (event.getSource() == textureButton)
3532
+ // {
3533
+ // return; // true;
3534
+ }
30183535 else
30193536 {
30203537 //return super.action(event, arg);
....@@ -3023,7 +3540,6 @@
30233540 }
30243541
30253542 boolean useclient = false;
3026
- cRadio radio;
30273543
30283544 void ToggleRoot()
30293545 {
....@@ -3075,6 +3591,28 @@
30753591 refreshContents();
30763592 }
30773593
3594
+ void TransformChildren()
3595
+ {
3596
+ Object3D obj;
3597
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3598
+ {
3599
+ obj = (Object3D)e.nextElement();
3600
+ obj.KeepTextureMatrices();
3601
+ obj.TransformChildren();
3602
+ obj.RestoreTextureMatrices();
3603
+
3604
+// if (obj.parent == null)
3605
+// {
3606
+// System.out.println("NULL PARENT!");
3607
+// new Exception().printStackTrace();
3608
+// }
3609
+// else
3610
+// TouchTransform(obj);
3611
+// //obj.parent.Touch();
3612
+ }
3613
+
3614
+ refreshContents();
3615
+ }
30783616
30793617 void ResetTransform()
30803618 {
....@@ -3187,7 +3725,7 @@
31873725 refreshContents();
31883726 }
31893727
3190
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
31913729 {
31923730 Object3D obj;
31933731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +3740,16 @@
32023740 LA.matIdentity(Object3D.mat);
32033741 obj.getBounds(minima, maxima, false);
32043742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32063745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32073746 obj.TransformMesh(Object3D.mat);
3747
+
32083748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32103751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
32113753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32123754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32133755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +3778,8 @@
32363778
32373779 int size = obj.MemorySize();
32383780
3239
- System.err.println((size/1024) + " KB is the size of " + obj);
3781
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3782
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32403783 }
32413784 }
32423785 catch (Exception e)
....@@ -3273,9 +3816,9 @@
32733816 obj = (Object3D)e.nextElement();
32743817
32753818 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
32773820 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
32793822
32803823 // System.err.println((size/1024) + " KB is the size of " + obj);
32813824 }
....@@ -3317,6 +3860,13 @@
33173860 void GenNormals(boolean crease)
33183861 {
33193862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
33203870
33213871 refreshContents();
33223872 }
....@@ -3489,8 +4039,8 @@
34894039
34904040 void ParseVertices()
34914041 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
34944044
34954045 for (int i=0; i<group.selection.size(); i++)
34964046 {
....@@ -3515,7 +4065,7 @@
35154065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35164066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35174067
3518
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
35194069
35204070 buffer.add(g);
35214071 }
....@@ -3530,7 +4080,7 @@
35304080 makeSomething(buffer, i==group.selection.size()-1);
35314081 }
35324082
3533
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
35344084
35354085 refreshContents();
35364086 }
....@@ -3548,7 +4098,16 @@
35484098 String pigment = Object3D.GetPigment(tex);
35494099 //String bump = Object3D.GetBump(tex);
35504100
3551
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4102
+
4103
+ try
4104
+ {
4105
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4106
+ }
4107
+ catch (Exception e)
4108
+ {
4109
+ System.err.println("FAIL: " + node);
4110
+ }
35524111
35534112 double s = v.s;
35544113
....@@ -3636,11 +4195,11 @@
36364195
36374196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36384197
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
36414200 lowres.linkVerticesThis(null);
36424201 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
36444203
36454204 System.err.flush();
36464205
....@@ -3680,7 +4239,7 @@
36804239 return;
36814240
36824241 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
36844243
36854244 Object3D newgroup = new Object3D("Po:" + poses.name);
36864245
....@@ -3874,9 +4433,9 @@
38744433
38754434 void ClipMesh()
38764435 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784437 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
38804439
38814440 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824441 content = ((cGroup)content).get(0);
....@@ -3885,7 +4444,7 @@
38854444 // {
38864445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874446 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
38894448 }
38904449 // group.selection.ClipMesh(GrafreeD.clipboard);
38914450 System.out.println("DONE.");
....@@ -3932,6 +4491,18 @@
39324491 void MarkLeaves(boolean hide)
39334492 {
39344493 group.selection.MarkLeaves(hide);
4494
+ refreshContents();
4495
+ }
4496
+
4497
+ void RewindLeaves(boolean hide)
4498
+ {
4499
+ group.selection.RewindLeaves(hide);
4500
+ refreshContents();
4501
+ }
4502
+
4503
+ void RandomLeaves(boolean hide)
4504
+ {
4505
+ group.selection.RandomLeaves(hide);
39354506 refreshContents();
39364507 }
39374508
....@@ -4006,10 +4577,6 @@
40064577 // }
40074578 // }
40084579
4009
- static boolean allparams = true;
4010
-
4011
- static Vector<Object3D> listUI = new Vector<Object3D>();
4012
-
40134580 void EditSelection(boolean newWindow)
40144581 {
40154582 // aConstraints.gridy = 0;
....@@ -4017,10 +4584,10 @@
40174584 {
40184585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40194586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4020
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40214588
40224589 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
4590
+ if(elem != group || !newWindow)
40244591 {
40254592 // if (!(elem instanceof Composite))
40264593 // newWindow = false;
....@@ -4102,7 +4669,8 @@
41024669 //new Exception().printStackTrace();
41034670
41044671 freezemodel = true;
4105
-
4672
+ ClearUnpinned();
4673
+
41064674 /**/
41074675 //switch (event.id)
41084676 {
....@@ -4110,7 +4678,6 @@
41104678 //case 702: // Event.LIST_DESELECT
41114679 group.deselectAll();
41124680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41144681 if (tps != null)
41154682 {
41164683 for (int i=0; i < tps.length; i++)
....@@ -4119,33 +4686,39 @@
41194686
41204687 //if (child.parent != null)
41214688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
41224690 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41264691 }
41274692 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
4693
+// else
4694
+// {
4695
+// objEditor.SetMaterial(group); // .GetMaterial());
4696
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4697
+// System.err.println("info : " + group.GetPath());
4698
+// }
41344699
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4700
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41384701 CameraPane.flash = true;
41394702
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41414704 // a camera
41424705 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4707
+ {
4708
+ CameraPane.camerachangeframe = 0; // don't refuse it
4709
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4710
+ }
41454711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41464712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41474713 }
41484714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
41494722 refreshContents();
41504723 //return true;
41514724 }
....@@ -4154,6 +4727,35 @@
41544727
41554728 freezemodel = false;
41564729 }
4730
+
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
4739
+ void refreshContents(boolean cp)
4740
+ {
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4743
+ {
4744
+ objEditor.ClearInfo(); // .GetMaterial());
4745
+
4746
+ for (int i=0; i < group.selection.Size(); i++)
4747
+ {
4748
+ Object3D child = (Object3D) group.selection.get(i);
4749
+
4750
+ objEditor.AddInfo(child, this, true);
4751
+ System.err.println("info : " + child.GetPath());
4752
+ }
4753
+
4754
+ objEditor.SetText(); // jan 2014
4755
+ }
4756
+
4757
+ super.refreshContents(cp);
4758
+ }
41574759
41584760 void linkSomething(Object3D thing)
41594761 {
....@@ -4225,16 +4827,19 @@
42254827 {
42264828 if (group.selection.isEmpty())
42274829 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
42294832 Composite tGroup = null;
42304833 if (group.selection.size() > 0) // 1)
42314834 {
42324835 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
42344837 }
42354838
42364839 if (cut)
42374840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
42384843 //int indices[] = jList.getSelectedIndices();
42394844 //for (int i = indices.length - 1; i >= 0; i--)
42404845 //jList.remove(indices[i]);
....@@ -4270,16 +4875,16 @@
42704875 //System.out.println("cut " + child);
42714876 //System.out.println("parent = " + child.parent);
42724877 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
42744879 tGroup.add/*Child*/(tmp);
42754880 else
4276
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
42774882 }
42784883 else
4279
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
42804885 tGroup.add/*Child*/(child);
42814886 else
4282
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
42834888 }
42844889
42854890 //ResetModel();
....@@ -4311,21 +4916,23 @@
43114916 //System.out.println("cut " + elem);
43124917 //System.out.println("parent = " + elem.parent);
43134918 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
43154920 tGroup.add/*Child*/(tmp);
43164921 else
4317
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
43184923 }
43194924 else
4320
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
43214926 tGroup.add/*Child*/(child);
43224927 else
4323
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
43244929 }
43254930
43264931 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
43294936 if (cut)
43304937 {
43314938 ResetModel();
....@@ -4335,11 +4942,15 @@
43354942
43364943 void paste(boolean expand)
43374944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
43384949 // if (GrafreeD.clipboard == null)
43394950 // return;
43404951 boolean first = true;
43414952
4342
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43434954 {
43444955 Composite temp;
43454956
....@@ -4350,7 +4961,7 @@
43504961 temp = (Composite)Applet3D.clipboard.deepCopy();
43514962 */
43524963 Object3D elem;
4353
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4964
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43544965 {
43554966 Object3D child = (Object3D)e.nextElement();
43564967
....@@ -4384,21 +4995,22 @@
43844995 //Object3D cb = Applet3D.clipboard;
43854996 //temp.addChild(cb);
43864997 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4387
- assert(GrafreeD.clipboard.parent == null);
4388
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4998
+ assert(Grafreed.clipboard.parent == null);
4999
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5000
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5001
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5002
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43925003 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
43955006 }
43965007
5008
+ Globals.SAVEONMAKE = keep;
43975009 ResetModel();
43985010 refreshContents();
43995011 }
44005012
4401
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
44025014 {
44035015 // if (GrafreeD.clipboard == null)
44045016 // return;
....@@ -4427,15 +5039,22 @@
44275039 if (copyit)
44285040 {
44295041 // paste(false);
4430
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
44315050 }
44325051 else
44335052 {
44345053 boolean first = true;
44355054
4436
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
44375056 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
44395058 Object3D copy;
44405059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44415060 {
....@@ -4445,7 +5064,7 @@
44455064 }
44465065 } else
44475066 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
44495068 }
44505069 }
44515070 }
....@@ -4522,6 +5141,10 @@
45225141
45235142 void group(Object3D csg, boolean grab)
45245143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
45255148 if (//false) // why??
45265149 !group.selection.isEmpty())
45275150 {
....@@ -4635,10 +5258,15 @@
46355258 //node.add(csg);
46365259 //makeSomething(node);
46375260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
46385262 }
46395263
46405264 void Ungroup(Object3D g)
46415265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
46425270 if (g instanceof HiddenObject)
46435271 {
46445272 HiddenObject h = (HiddenObject) g;
....@@ -4655,6 +5283,7 @@
46555283 objEditor.makeSomething(g.get(i), false);
46565284 }
46575285 }
5286
+ Globals.SAVEONMAKE = keep;
46585287 }
46595288
46605289 void ungroup()
....@@ -4850,21 +5479,6 @@
48505479 }
48515480 */
48525481
4853
- void ImportGFD()
4854
- {
4855
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4856
- browser.show();
4857
- String filename = browser.getFile();
4858
- if (filename != null && filename.length() > 0)
4859
- {
4860
- String fullname = browser.getDirectory() + filename;
4861
-
4862
- //Object3D readobj =
4863
- objEditor.ReadGFD(fullname, objEditor);
4864
- //makeSomething(readobj);
4865
- }
4866
- }
4867
-
48685482 /*
48695483 public void Callback(Object obj)
48705484 {
....@@ -4888,26 +5502,9 @@
48885502 }
48895503 */
48905504
4891
- void ImportVRMLX3D()
4892
- {
4893
- if (GrafreeD.standAlone)
4894
- {
4895
- /**/
4896
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4897
- browser.show();
4898
- String filename = browser.getFile();
4899
- if (filename != null && filename.length() > 0)
4900
- {
4901
- String fullname = browser.getDirectory() + filename;
4902
- LoadVRMLX3D(fullname);
4903
- }
4904
- /**/
4905
- }
4906
- }
4907
-
49085505 String GetFile(String dialogName)
49095506 {
4910
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
49115508 {
49125509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135510 browser.show();
....@@ -4971,10 +5568,33 @@
49715568 cButton flashSelectionButton;
49725569 cButton editButton;
49735570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
49745572 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765573 cButton unselectButton;
49775574
5575
+ cButton restoreCameraButton;
5576
+
5577
+ cButton saveButton;
5578
+ cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
5597
+
49785598 cButton screenfitButton;
49795599 cButton screenfitpointButton;
49805600 cButton snapobjectButton;
....@@ -4986,14 +5606,6 @@
49865606
49875607 cButton setsupportButton;
49885608
4989
- cButton twoButton;
4990
- cButton sixButton;
4991
- cButton threeButton;
4992
- cButton sevenButton;
4993
- cButton fourButton; // full panel
4994
- cButton oneButton; // full XYZ
4995
- //cButton currentLayout;
4996
-
49975609 //
49985610 //Composite
49995611 Object3D // to do !!
....@@ -5003,9 +5615,11 @@
50035615 //JTree jTree;
50045616 private MenuItem lookAtItem;
50055617 private MenuItem lookFromItem;
5006
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
50075619 private MenuItem cutItem;
5008
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
50095623 private MenuItem cloneItem;
50105624 private MenuItem cloneSupportItem;
50115625 private MenuItem overwriteGeoItem;
....@@ -5018,7 +5632,7 @@
50185632 private MenuItem linkverticesItem;
50195633 private MenuItem relinkverticesItem;
50205634 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
50225636 private MenuItem stepAllItem;
50235637 private MenuItem revertMeshItem;
50245638 private MenuItem poseMeshItem;
....@@ -5029,6 +5643,7 @@
50295643 private MenuItem mergeGeometriesItem;
50305644 private MenuItem copyItem;
50315645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
50325647 private MenuItem pasteLinkItem;
50335648 private MenuItem pasteCloneItem;
50345649 private MenuItem pasteExpandItem;
....@@ -5067,6 +5682,10 @@
50675682 private MenuItem showleavesItem;
50685683 private MenuItem markleavesItem;
50695684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
50705689
50715690 private MenuItem flipVItem;
50725691 private MenuItem unflipVItem;
....@@ -5078,15 +5697,17 @@
50785697 private MenuItem panoTexturesItem;
50795698
50805699 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
50825701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
50835704 private MenuItem hideItem;
50845705 private MenuItem grabItem;
50855706 private MenuItem backItem;
50865707 private MenuItem frontItem;
50875708 private MenuItem cameraItem;
50885709 private MenuItem compositeItem;
5089
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
50905711 private MenuItem physicsItem;
50915712 private MenuItem frameselectorItem;
50925713 private MenuItem scriptNodeItem;
....@@ -5126,7 +5747,7 @@
51265747 private MenuItem blobItem;
51275748 private MenuItem latheItem;
51285749 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
51305751 private MenuItem meshItem;
51315752 // private MenuItem meshGroupItem;
51325753 private MenuItem springItem;
....@@ -5148,11 +5769,6 @@
51485769 private MenuItem doubleItem;
51495770 private MenuItem tripleItem;
51505771
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51565772 private MenuItem computeAOItem;
51575773 private MenuItem recompileItem;
51585774 private MenuItem editScriptItem;
....@@ -5162,4 +5778,8 @@
51625778 private MenuItem analyzeItem;
51635779 private MenuItem dumpItem;
51645780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
51655785 }