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("Switch node"));
243
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
244359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
245360 switchGeoItem.addActionListener(this);
246361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
247362 switchTransfoItem.addActionListener(this);
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
364
+ morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
248367 physicsItem = menu.add(new MenuItem("Physics"));
249368 physicsItem.addActionListener(this);
250369 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
251370 frameselectorItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
253
- morphItem.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,93 +586,216 @@
434586 oe.radioPanel.add(dummyButton);
435587 oe.buttonGroup.add(dummyButton);
436588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
437593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438594
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
595
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ //minButton.setToolTipText("Minimize window");
597
+ //minButton.addActionListener(this);
598
+
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);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
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");
441634 liveCB.addItemListener(this);
442635
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
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);
444641 fastCB.setToolTipText("Fast mode");
445642 fastCB.addItemListener(this);
446643
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
452
- screenfitButton.setToolTipText("Screen fit");
453
- screenfitButton.addActionListener(this);
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);
454649
455650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456651 // screenfitpointButton.addActionListener(this);
457652
458653 if (Globals.ADVANCED)
459654 {
460
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
655
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
461656 snapobjectButton.addActionListener(this);
462657 snapobjectButton.setToolTipText("Snap Object");
463658 }
464659
465
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
466
- flashSelectionButton.setToolTipText("Show selection");
467
- flashSelectionButton.addActionListener(this);
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
468661
469
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
470
-
471
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
472663 twoButton.setToolTipText("Show center view only");
473664 twoButton.addActionListener(this);
474
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
475668 fourButton.addActionListener(this);
476669 fourButton.setToolTipText("Show left panel only");
477
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
478671 sixButton.setToolTipText("2-column layout left");
479672 sixButton.addActionListener(this);
480
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
481674 threeButton.setToolTipText("2-column layout right");
482675 threeButton.addActionListener(this);
483
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
484677 sevenButton.setToolTipText("3-column layout");
485678 sevenButton.addActionListener(this);
486679 //
487680
488
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
489682 rootButton.setToolTipText("Edit selection in new tab");
490683 rootButton.addActionListener(this);
491684
492
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
493686 closeButton.setToolTipText("Close tab");
494687 closeButton.addActionListener(this);
495688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
496689 //clearButton.addActionListener(this);
497
-
498
- cGridBag commandsPanel = new cGridBag();
690
+
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
+ }
499722
500
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
501
- editButton.setToolTipText("Edit selection");
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");
502772 editButton.addActionListener(this);
503773
504
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
505
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
506776 uneditButton.addActionListener(this);
507777
508
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
780
+ allParamsButton.addActionListener(this);
781
+
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
509783 clearPanelButton.setToolTipText("Clear edit panel");
510784 clearPanelButton.addActionListener(this);
511785
512
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
513
- allParamsButton.setToolTipText("All params??");
514
- allParamsButton.addActionListener(this);
515
-
516
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
517787 unselectButton.setToolTipText("Unselect");
518788 unselectButton.addActionListener(this);
519789
520
- commandsPanel.preferredHeight = 1;
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
521793
522
- oe.treePanel.add(commandsPanel);
523
- oe.treePanel.Return();
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
524799
525800 // oe.aConstraints.gridx += 1;
526801 // oe.aConstraints.weighty = 0;
....@@ -537,27 +812,12 @@
537812
538813 JScrollPane jSP;
539814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
540
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
541816 ResetModel();
542817
543818 oe.treePanel.add(jSPPanel);
544819 oe.treePanel.Return();
545820
546
- cGridBag copyOptionsPanel = new cGridBag();
547
-
548
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
549
- colorCB.setToolTipText("Copy color when dropped");
550
- colorCB.addItemListener(this);
551
-
552
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
553
- materialCB.setToolTipText("Copy material when dropped");
554
- materialCB.addItemListener(this);
555
-
556
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
557
- textureCB.setToolTipText("Copy texture when dropped");
558
- textureCB.addItemListener(this);
559
-
560
- copyOptionsPanel.preferredHeight = 1;
561821 oe.treePanel.add(copyOptionsPanel);
562822 oe.treePanel.Return();
563823
....@@ -588,13 +848,43 @@
588848
589849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
590850 {
591
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
592
- supportCB.setToolTipText("Enabled rigging");
593
- 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);
854
+
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);
594882
595883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
596884 // localCB.addItemListener(this);
597885
886
+ panel.Return();
887
+
598888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
599889 crowdCB.setToolTipText("Used for crowds");
600890 crowdCB.addItemListener(this);
....@@ -607,18 +897,12 @@
607897 slowCB.setToolTipText("Smooth interpolation");
608898 slowCB.addItemListener(this);
609899
610
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
611
- boxCB.setToolTipText("Display bounding boxes");
612
- boxCB.addItemListener(this);
613
-
614
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
615
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
616
- zoomBoxCB.addItemListener(this);
617
-
618900 // constraints.gridy += 1;
619901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
620902 // speakerMocapCB.addItemListener(this);
621903
904
+ panel.Return();
905
+
622906 if (false)
623907 {
624908 // handled in scripts
....@@ -633,30 +917,72 @@
633917 //constraints.gridy += 1;
634918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
635919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
636921 }
637922
638923 //constraints.gridx += 1;
639924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
640925 // debugCB.addItemListener(this);
641926
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
642931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
643933 oeilCB.addItemListener(this);
644934
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
+ {
645955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
646956 lookAtCB.setToolTipText("Look-at target");
647957 lookAtCB.addItemListener(this);
958
+ }
959
+
960
+ }
648961
649962 cGridBag fill = new cGridBag();
650
-
651963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
652968
653969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
654972
655973 }
656974
657975 void EditObject(Object3D obj)
658976 {
659977 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
+
660986 radioButton.SetObject(obj);
661987 radioButton.layout = sevenButton;
662988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -665,8 +991,11 @@
665991 buttonGroup.add(radioButton);
666992 radioButton.doClick();
667993 }
994
+
668995 void SetupViews(ObjEditor oe)
669996 {
997
+ theFrame = this;
998
+
670999 oe.SetupViews();
6711000
6721001 System.out.println("SetupViews");
....@@ -675,23 +1004,28 @@
6751004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6761005 }
6771006
678
- JCheckBox liveCB;
679
- JCheckBox supportCB;
680
- JCheckBox localCB;
681
- JCheckBox crowdCB;
682
- JCheckBox smoothCB;
683
- JCheckBox fastCB;
684
- JCheckBox slowCB;
685
- JCheckBox boxCB;
686
- JCheckBox zoomBoxCB;
687
- JCheckBox trackCB;
688
- 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;
6891020 // JCheckBox speakerMocapCB;
690
- JCheckBox speakerCameraCB;
691
- JCheckBox speakerFocusCB;
692
- JCheckBox debugCB;
693
- JCheckBox oeilCB;
694
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
6951029
6961030 // static int COLOR = 1;
6971031 // static int MATERIAL = 2;
....@@ -699,9 +1033,9 @@
6991033
7001034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7011035
702
- JCheckBox colorCB;
703
- JCheckBox materialCB;
704
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
7051039
7061040 public void itemStateChanged(ItemEvent e)
7071041 {
....@@ -729,6 +1063,7 @@
7291063 } else if(e.getSource() == liveCB)
7301064 {
7311065 cameraView.ToggleLive();
1066
+ refreshContents(false);
7321067 }
7331068 else if(e.getSource() == supportCB)
7341069 {
....@@ -793,6 +1128,18 @@
7931128 {
7941129 cameraView.ToggleOeil();
7951130 }
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
+ }
7961143 else if(e.getSource() == lookAtCB)
7971144 {
7981145 cameraView.ToggleLookAt();
....@@ -809,7 +1156,8 @@
8091156
8101157 /**/
8111158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
812
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
8131161 if ((path == null) || (path.getPathCount() <= 1)) {
8141162 // We can't move the root node or an empty selection
8151163 return;
....@@ -872,8 +1220,6 @@
8721220 }
8731221 }
8741222
875
- String string = (String) object;
876
-
8771223 System.out.println("Transfer = " + object + "; drop : " + target);
8781224 // if( object instanceof java.io.File[])
8791225 // {
....@@ -881,7 +1227,11 @@
8811227 // objEditor.DropFile((java.io.File[]) object, true);
8821228 // return;
8831229 // }
884
- 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) == ':')
8851235 {
8861236 // file(s)
8871237 String[] names = string.split("\n");
....@@ -908,7 +1258,7 @@
9081258
9091259 flashIt = false;
9101260 CameraPane pane = (CameraPane) target;
911
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1261
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9121262 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9131263
9141264 if (group.selection.size() == 1)
....@@ -924,23 +1274,33 @@
9241274
9251275 assert target == objEditor.jTree;
9261276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
9271278 try {
928
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9291280 } catch (Exception e) {
9301281 System.out.println("destinationPath : " + destinationPath);
9311282 return;
9321283 }
9331284
934
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
9351286 {
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
+// {
9361296 loadClipboard(true);
9371297 objEditor.jTree.setSelectionPath(destinationPath);
938
- pasteInto(false);
939
- } else {
940
- loadClipboard(false);
941
- objEditor.jTree.setSelectionPath(destinationPath);
942
- pasteInto(false); // true); // ???
943
- }
1298
+ pasteInto(false, false);
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
9441304 }
9451305 public void dropActionChanged(DropTargetDragEvent dtde)
9461306 // Called if the user has modified the current drop gesture
....@@ -1045,54 +1405,71 @@
10451405 {
10461406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10471407 //heightFieldItem.addActionListener(this);
1048
- gridItem = menu.add(new MenuItem("Grid"));
1049
- gridItem.addActionListener(this);
1050
- rectoidItem = menu.add(new MenuItem("Box"));
1051
- rectoidItem.addActionListener(this);
1052
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1053
- ellipsoidItem.addActionListener(this);
1054
- coneItem = menu.add(new MenuItem("Cone"));
1055
- coneItem.addActionListener(this);
1056
- torusItem = menu.add(new MenuItem("Torus"));
1057
- torusItem.addActionListener(this);
1058
- superItem = menu.add(new MenuItem("Superellipsoid"));
1059
- 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
+ {
10601426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10611427 kleinItem.addActionListener(this);
1062
- particleItem = menu.add(new MenuItem("Particle system"));
1063
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
1432
+ if (Globals.ADVANCED)
1433
+ {
10641434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10651435 ragdollItem.addActionListener(this);
10661436 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10671437 ragdoll2Item.addActionListener(this);
1438
+ }
10681439 menu.add("-");
1069
- meshItem = menu.add(new MenuItem("Mesh"));
1440
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10701441 meshItem.addActionListener(this);
10711442 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10721443 // meshGroupItem.addActionListener(this);
1444
+ if (Globals.ADVANCED)
1445
+ {
10731446 springItem = menu.add(new MenuItem("Spring"));
10741447 springItem.addActionListener(this);
10751448 flagItem = menu.add(new MenuItem("Flag"));
10761449 flagItem.addActionListener(this);
1077
- bezierItem = menu.add(new MenuItem("Patch"));
1078
- bezierItem.addActionListener(this);
1079
- checkerItem = menu.add(new MenuItem("Checker"));
1080
- checkerItem.addActionListener(this);
10811450 blobItem = menu.add(new MenuItem("Blob"));
10821451 blobItem.addActionListener(this);
10831452 latheItem = menu.add(new MenuItem("Lathe"));
10841453 latheItem.addActionListener(this);
1085
- lightItem = menu.add(new MenuItem("Light"));
1086
- 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);
10871461 menu.add("-");
10881462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10891463 //superLoopItem.addActionListener(this);
1090
- loopItem = menu.add(new MenuItem("Loop"));
1091
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
10921466 doubleItem = menu.add(new MenuItem("Fork"));
10931467 doubleItem.addActionListener(this);
1468
+ if (Globals.ADVANCED)
1469
+ {
10941470 tripleItem = menu.add(new MenuItem("Trident"));
10951471 tripleItem.addActionListener(this);
1472
+ }
10961473 }
10971474
10981475 void buildToolsMenu(Menu menu)
....@@ -1101,29 +1478,34 @@
11011478 animationItem.addItemListener(this);
11021479 animationItem.setState(Globals.ANIMATION);
11031480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
11041484 menu.add("-");
11051485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11061486 parseverticesItem.addActionListener(this);
11071487 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11081488 textureFieldItem.addActionListener(this);
1109
- alignItem = menu.add(new MenuItem("Align"));
1489
+ alignItem = menu.add(new MenuItem("Align Objects"));
11101490 alignItem.addActionListener(this);
1111
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1112
- mirrorItem.addActionListener(this);
11131491 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11141492 reduceMorphItem.addActionListener(this);
11151493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11161494 reduce34MorphItem.addActionListener(this);
1117
-
1118
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1119
- computeAOItem.addActionListener(this);
11201495 menu.add("-");
1121
-
11221496 menu.add(memoryItem = new MenuItem("Memory Usage"));
11231497 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("-");
11241506 menu.add(analyzeItem = new MenuItem("Analyze"));
11251507 analyzeItem.addActionListener(this);
1126
- menu.add(dumpItem = new MenuItem("Dump"));
1508
+ menu.add(dumpItem = new MenuItem("Print"));
11271509 dumpItem.addActionListener(this);
11281510 // menu.add(pathItem = new MenuItem("From-to path"));
11291511 // pathItem.addActionListener(this);
....@@ -1141,6 +1523,7 @@
11411523 menu.add("-");
11421524 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11431525 editScriptItem.addActionListener(this);
1526
+ }
11441527 }
11451528
11461529 void ScreenFit()
....@@ -1263,9 +1646,24 @@
12631646 shadow.material = new cMaterial(obj.material);
12641647 shadow.material.diffuse = 0.0001f;
12651648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
12661650
12671651 makeSomething(shadow);
12681652 }
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
+ }
12691667
12701668 /**
12711669 * applyExample
....@@ -1469,9 +1867,9 @@
14691867
14701868 void Overwrite(int mask)
14711869 {
1472
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1870
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14731871 {
1474
- Object3D content = GrafreeD.clipboard.get(0);
1872
+ Object3D content = Grafreed.clipboard.get(0);
14751873
14761874 if (content instanceof cGroup && ((cGroup)content).transientlink )
14771875 content = ((cGroup)content).get(0);
....@@ -1510,7 +1908,7 @@
15101908 {
15111909 ScreenFit();
15121910 } else
1513
- if (source == switchItem)
1911
+ if (source == switchViewItem)
15141912 {
15151913 cVector v1 = new cVector();
15161914 cVector v2 = new cVector();
....@@ -1519,11 +1917,11 @@
15191917 objEditor.cameraView.renderCamera.setAim(v2, v1);
15201918 objEditor.cameraView.repaint();
15211919 } else
1522
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
15231921 {
15241922 makeSomething(new Box());
15251923 } else
1526
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
15271925 {
15281926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15291927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1602,27 +2000,27 @@
16022000
16032001 makeSomething(obj);
16042002 } else
1605
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
16062004 {
16072005 makeSomething(new Grid());
16082006 } else
1609
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
16102008 {
16112009 makeSomething(new Sphere());
16122010 } else
1613
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
16142012 {
16152013 makeSomething(new Cone());
16162014 } else
1617
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
16182016 {
16192017 makeSomething(new Torus());
16202018 } else
1621
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
16222020 {
16232021 makeSomething(new Superellipsoid());
16242022 } else
1625
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
16262024 {
16272025 makeSomething(new Klein());
16282026 } else
....@@ -1642,7 +2040,7 @@
16422040 {
16432041 makeSomething(new BezierSurface());
16442042 } else
1645
- if (source == checkerItem)
2043
+ if (source == overlayItem || source == overlayButton)
16462044 {
16472045 /*
16482046 Object3D obj = new BezierSurface(5,8);
....@@ -1690,7 +2088,7 @@
16902088 s.setup();
16912089 makeSomething(s);
16922090 } else
1693
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
16942092 {
16952093 makeSomething(new Light());
16962094 } else
....@@ -1740,30 +2138,30 @@
17402138
17412139 group(g);
17422140 } else
1743
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
17442142 {
17452143 Composite csg = new GroupLeaf();
17462144 csg.count = 5;
17472145 group(csg);
1748
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
17492147 csg.addChild(child);
17502148 child.addChild(csg);
17512149 } else
17522150 if (source == doubleItem)
17532151 {
1754
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
17552153 csg.count = 5;
17562154 group(csg);
1757
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
17582156 csg.addChild(child);
17592157 child.addChild(csg);
1760
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
17612159 csg.addChild(child);
17622160 child.addChild(csg);
17632161 } else
17642162 if (source == tripleItem)
17652163 {
1766
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
17672165 csg.count = 4;
17682166 group(csg);
17692167 Composite child = new cGroup();
....@@ -1775,23 +2173,6 @@
17752173 child = new cGroup();
17762174 csg.addChild(child);
17772175 child.addChild(csg);
1778
- } else
1779
-
1780
- if (source == importGFDItem)
1781
- {
1782
- ImportGFD();
1783
- } else
1784
- if (source == importVRMLX3DItem)
1785
- {
1786
- ImportVRMLX3D();
1787
- } else
1788
- if (source == import3DSItem)
1789
- {
1790
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1791
- } else
1792
- if (source == importOBJItem)
1793
- {
1794
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
17952176 } else
17962177 if (source == computeAOItem)
17972178 {
....@@ -1811,7 +2192,7 @@
18112192 if (source == invariantsItem)
18122193 {
18132194 System.out.println("Invariants:");
1814
- GrafreeD.grafreeD.universe.invariants();
2195
+ Grafreed.grafreeD.universe.invariants();
18152196 } else
18162197 if (source == memoryItem)
18172198 {
....@@ -1830,19 +2211,47 @@
18302211 {
18312212 DumpObject();
18322213 } 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
18332245 if (source == screenfitButton)
18342246 {
1835
- //Reload(lastConverter, lastFilename, true);
18362247 ScreenFit();
18372248 } else
18382249 if (source == screenfitpointButton)
18392250 {
1840
- //Reload(lastConverter, lastFilename, true);
18412251 ScreenFitPoint();
18422252 } else
18432253 if (source == snapobjectButton)
18442254 {
1845
- //Reload(lastConverter, lastFilename, true);
18462255 SnapObject();
18472256 } else
18482257 // if (event.getSource() == recompileButton)
....@@ -1879,12 +2288,20 @@
18792288 {
18802289 loadClipboard(true);
18812290 } else
2291
+ if (source == undoItem)
2292
+ {
2293
+ Undo();
2294
+ } else
2295
+ if (source == redoItem)
2296
+ {
2297
+ Redo();
2298
+ } else
18822299 if (source == duplicateItem)
18832300 {
1884
- Object3D keep = GrafreeD.clipboard;
2301
+ Object3D keep = Grafreed.clipboard;
18852302 loadClipboard(false);
18862303 paste(false);
1887
- GrafreeD.clipboard = keep;
2304
+ Grafreed.clipboard = keep;
18882305 } else
18892306 if (source == cloneItem)
18902307 {
....@@ -1902,13 +2319,17 @@
19022319 {
19032320 paste(false);
19042321 } else
2322
+ if (source == pasteIntoItem)
2323
+ {
2324
+ pasteInto(true, false);
2325
+ } else
19052326 if (source == pasteLinkItem)
19062327 {
1907
- pasteInto(false);
2328
+ pasteInto(false, false);
19082329 } else
19092330 if (source == pasteCloneItem)
19102331 {
1911
- pasteInto(true);
2332
+ pasteInto(true, true);
19122333 } else
19132334 if (source == pasteExpandItem)
19142335 {
....@@ -2100,9 +2521,9 @@
21002521 // group.selection.get(0).setMasterThis(content); // should be identity
21012522 // refreshContents();
21022523 // }
2103
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2524
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21042525 {
2105
- Object3D content = GrafreeD.clipboard.get(0);
2526
+ Object3D content = Grafreed.clipboard.get(0);
21062527
21072528 if (content instanceof cGroup && ((cGroup)content).transientlink )
21082529 content = ((cGroup)content).get(0);
....@@ -2110,11 +2531,11 @@
21102531 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21112532 for (int i=0; i<group.selection.size(); i++)
21122533 {
2113
- boolean random = CameraPane.RANDOM;
2114
- CameraPane.RANDOM = false; // parse all random nodes
2534
+ boolean random = CameraPane.SWITCH;
2535
+ CameraPane.SWITCH = false; // parse all random nodes
21152536 group.selection.get(i).linkVerticesThis(content);
21162537 // group.selection.get(i).setMasterThis(content); // should be identity
2117
- CameraPane.RANDOM = random;
2538
+ CameraPane.SWITCH = random;
21182539 }
21192540 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21202541 refreshContents();
....@@ -2124,20 +2545,20 @@
21242545 {
21252546 for (int i=0; i<group.selection.size(); i++)
21262547 {
2127
- boolean random = CameraPane.RANDOM;
2128
- CameraPane.RANDOM = false; // parse all random nodes
2548
+ boolean random = CameraPane.SWITCH;
2549
+ CameraPane.SWITCH = false; // parse all random nodes
21292550 group.selection.get(i).linkVerticesThis(null);
2130
- CameraPane.RANDOM = random;
2551
+ CameraPane.SWITCH = random;
21312552 }
21322553
21332554 refreshContents();
21342555 } else
21352556 if (source == relinkverticesItem)
21362557 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2558
+ boolean random = CameraPane.SWITCH;
2559
+ CameraPane.SWITCH = false; // parse all random nodes
21392560 group.selection.RelinkToSupport();
2140
- CameraPane.RANDOM = random;
2561
+ CameraPane.SWITCH = random;
21412562
21422563 refreshContents();
21432564 } else
....@@ -2152,9 +2573,9 @@
21522573 } else
21532574 if (source == setMasterItem)
21542575 {
2155
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2576
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21562577 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2578
+ Object3D content = Grafreed.clipboard.get(0);
21582579
21592580 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602581 content = ((cGroup)content).get(0);
....@@ -2167,9 +2588,9 @@
21672588 {
21682589 if (group.selection.size() == 1)
21692590 {
2170
- if (GrafreeD.clipboard.size() == 1)
2591
+ if (Grafreed.clipboard.size() == 1)
21712592 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
2593
+ Object3D content = Grafreed.clipboard.get(0);
21732594
21742595 if (content instanceof cGroup && ((cGroup)content).transientlink )
21752596 content = ((cGroup)content).get(0);
....@@ -2186,7 +2607,7 @@
21862607 {
21872608 RevertMeshes();
21882609 } else
2189
- if (source == resetMeshItem)
2610
+ if (source == resetAllItem)
21902611 {
21912612 ResetAll();
21922613 } else
....@@ -2206,9 +2627,9 @@
22062627 {
22072628 ClearSelection(true);
22082629 } else
2209
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
22102631 {
2211
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
22122633 } else
22132634 if (source == hideItem)
22142635 {
....@@ -2226,11 +2647,11 @@
22262647 {
22272648 makeSomething(new Camera());
22282649 } else
2229
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
22302651 {
22312652 group(new Composite());
22322653 } else
2233
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
22342655 {
22352656 RandomNode random = new RandomNode();
22362657 group(random);
....@@ -2332,7 +2753,7 @@
23322753 {
23332754 group(new cLinker());
23342755 } else
2335
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
23362757 {
23372758 group(new TextureNode());
23382759 } else
....@@ -2352,17 +2773,30 @@
23522773 {
23532774 CastShadow(2);
23542775 } else
2355
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
23562777 {
2357
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
23582780 for (int i=0; i<group.selection.size(); i++)
23592781 {
2360
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
23612787 }
23622788
2363
- ClearSelection(false);
2364
-
2365
- 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
+ }
23662800 } else
23672801 if (source == genUVItem)
23682802 {
....@@ -2374,7 +2808,7 @@
23742808 } else
23752809 if (source == genNormalsMESHItem)
23762810 {
2377
- GenNormals(true); // TODO
2811
+ GenNormalsMESH();
23782812 } else
23792813 if (source == genNormalsORGANItem)
23802814 {
....@@ -2439,6 +2873,22 @@
24392873 if (source == unmarkleavesItem)
24402874 {
24412875 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);
24422892 } else
24432893 if (source == flipVItem)
24442894 {
....@@ -2524,9 +2974,13 @@
25242974 {
25252975 SmoothMesh();
25262976 } else
2527
- if (source == transformgeometryItem)
2977
+ if (source == transformGeometryItem)
25282978 {
25292979 TransformGeometry();
2980
+ } else
2981
+ if (source == transformChildrenItem)
2982
+ {
2983
+ TransformChildren();
25302984 } else
25312985 if (source == resetTransformItem)
25322986 {
....@@ -2534,7 +2988,11 @@
25342988 } else
25352989 if (source == resetCentroidItem)
25362990 {
2537
- ResetCentroid();
2991
+ ResetCentroid(true);
2992
+ } else
2993
+ if (source == resetCentroidXZItem)
2994
+ {
2995
+ ResetCentroid(false);
25382996 } else
25392997 if (source == resetParentItem)
25402998 {
....@@ -2666,6 +3124,10 @@
26663124 if (source == twoButton)
26673125 {
26683126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
26693131 // bug
26703132 //gridPanel.setDividerLocation(1.0);
26713133 //bigPanel.setDividerLocation(0.0);
....@@ -2698,10 +3160,31 @@
26983160 bigThree.ClearUI();
26993161 bigThree.add(centralPanel);
27003162 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
+
27013181 } else
27023182 if (source == threeButton)
27033183 {
27043184 radio.layout = threeButton;
3185
+
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
27053188
27063189 // bigThree.remove(scenePanel);
27073190 // bigThree.remove(centralPanel);
....@@ -2734,10 +3217,15 @@
27343217 bigThree.add(centralPanel);
27353218 bigThree.add(XYZPanel);
27363219 bigThree.FlushUI();
3220
+
3221
+ cameraView.requestFocusInWindow();
27373222 } else
27383223 if (source == fourButton)
27393224 {
27403225 radio.layout = fourButton;
3226
+
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
27413229
27423230 // bigThree.remove(scenePanel);
27433231 // bigThree.remove(centralPanel);
....@@ -2769,10 +3257,15 @@
27693257 bigThree.ClearUI();
27703258 bigThree.add(scenePanel);
27713259 bigThree.FlushUI();
3260
+
3261
+ cameraView.requestFocusInWindow();
27723262 } else
27733263 if (source == sixButton)
27743264 {
27753265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
27763269
27773270 // bigThree.remove(scenePanel);
27783271 // bigThree.remove(centralPanel);
....@@ -2805,10 +3298,15 @@
28053298 bigThree.add(scenePanel);
28063299 bigThree.add(centralPanel);
28073300 bigThree.FlushUI();
3301
+
3302
+ cameraView.requestFocusInWindow();
28083303 } else
28093304 if (source == sevenButton)
28103305 {
28113306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
28123310
28133311 // bigThree.remove(scenePanel);
28143312 // bigThree.remove(centralPanel);
....@@ -2842,6 +3340,8 @@
28423340 bigThree.add(centralPanel);
28433341 bigThree.add(XYZPanel);
28443342 bigThree.FlushUI();
3343
+
3344
+ cameraView.requestFocusInWindow();
28453345 } else
28463346 if (source == rootButton)
28473347 {
....@@ -2853,6 +3353,7 @@
28533353 EditObject(obj);
28543354 }
28553355
3356
+ cameraView.requestFocusInWindow();
28563357 refreshContents(true);
28573358 } else
28583359 if (source == closeButton)
....@@ -2862,22 +3363,37 @@
28623363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28633364 {
28643365 ab = (cRadio)e.nextElement();
2865
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28663367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
28673374 buttonGroup.remove(ab);
28683375 radioPanel.remove(ab);
28693376
2870
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
28713379 // ab.GetObject().objectUI = null; // ?????????
28723380
28733381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28743382 break;
28753383 }
28763384 }
3385
+
3386
+ cameraView.requestFocusInWindow();
28773387 refreshContents(true);
28783388 } else
28793389 if (source == editItem || source == editButton)
28803390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
28813397 EditSelection(false);
28823398 } else
28833399 if (source == uneditButton)
....@@ -2887,12 +3403,13 @@
28873403 Object3D child = (Object3D)e.nextElement();
28883404 if(child.editWindow != null)
28893405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
28903407 child.CloseUI();
28913408 listUI.remove(child);
28923409
2893
- child.editWindow = null; // ???????????
3410
+ //child.editWindow = null; // ???????????
28943411 }
2895
- objEditor.ctrlPanel.validate();
3412
+ objEditor.ctrlPanel.FlushUI();
28963413 //objEditor.jTree.clearSelection();
28973414 //objEditor.ResetSliders();
28983415 refreshContents(true);
....@@ -2903,6 +3420,7 @@
29033420 //copy.ClearUI();
29043421 for (Object3D obj : listUI)
29053422 {
3423
+ obj.pinned = false;
29063424 obj.CloseUI();
29073425 }
29083426 listUI.clear();
....@@ -2912,7 +3430,7 @@
29123430 {
29133431 assert(copy == group);
29143432
2915
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29163434
29173435 for (Object3D obj : listUI)
29183436 {
....@@ -2976,20 +3494,44 @@
29763494 frontView.object = group;
29773495 sideView.object = group;
29783496 }
2979
- group.editWindow = this;
3497
+
3498
+// fix "+" issue
3499
+ //group.editWindow = this;
3500
+ group.manipWindow = this;
3501
+
29803502 /*
29813503 currentLayout = radio.layout;
29823504 if (currentLayout == null)
29833505 currentLayout = sevenButton;
29843506 */
29853507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
29863513 keepparent = group.parent;
29873514 // PARENT = NULL or not???
29883515 //group.parent = null; // ROOT
29893516 //group.attributes = -1;
29903517 ResetModel();
3518
+
3519
+ cameraView.requestFocusInWindow();
29913520 refreshContents(true);
2992
- }
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
+ }
29933535 else
29943536 {
29953537 //return super.action(event, arg);
....@@ -2998,7 +3540,6 @@
29983540 }
29993541
30003542 boolean useclient = false;
3001
- cRadio radio;
30023543
30033544 void ToggleRoot()
30043545 {
....@@ -3050,6 +3591,28 @@
30503591 refreshContents();
30513592 }
30523593
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
+ }
30533616
30543617 void ResetTransform()
30553618 {
....@@ -3162,7 +3725,7 @@
31623725 refreshContents();
31633726 }
31643727
3165
- void ResetCentroid()
3728
+ void ResetCentroid(boolean full)
31663729 {
31673730 Object3D obj;
31683731 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3177,12 +3740,16 @@
31773740 LA.matIdentity(Object3D.mat);
31783741 obj.getBounds(minima, maxima, false);
31793742 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3180
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3743
+ if (full)
3744
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31813745 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31823746 obj.TransformMesh(Object3D.mat);
3747
+
31833748 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3184
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3749
+ if (full)
3750
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31853751 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3752
+
31863753 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31873754 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31883755 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3211,7 +3778,8 @@
32113778
32123779 int size = obj.MemorySize();
32133780
3214
- 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)");
32153783 }
32163784 }
32173785 catch (Exception e)
....@@ -3248,9 +3816,9 @@
32483816 obj = (Object3D)e.nextElement();
32493817
32503818 System.out.println("Object is: " + obj);
3251
- GrafreeD.AnalyzeObject(obj);
3819
+ Grafreed.AnalyzeObject(obj);
32523820 System.out.println("Boundary rep: " + obj.bRep);
3253
- GrafreeD.AnalyzeObject(obj.bRep);
3821
+ Grafreed.AnalyzeObject(obj.bRep);
32543822
32553823 // System.err.println((size/1024) + " KB is the size of " + obj);
32563824 }
....@@ -3292,6 +3860,13 @@
32923860 void GenNormals(boolean crease)
32933861 {
32943862 group.GenNormalsS(crease);
3863
+
3864
+ refreshContents();
3865
+ }
3866
+
3867
+ void GenNormalsMESH()
3868
+ {
3869
+ group.GenNormalsMeshS();
32953870
32963871 refreshContents();
32973872 }
....@@ -3464,8 +4039,8 @@
34644039
34654040 void ParseVertices()
34664041 {
3467
- boolean epsequal = GrafreeD.epsequal;
3468
- GrafreeD.epsequal = true;
4042
+ boolean epsequal = Grafreed.epsequal;
4043
+ Grafreed.epsequal = true;
34694044
34704045 for (int i=0; i<group.selection.size(); i++)
34714046 {
....@@ -3490,7 +4065,7 @@
34904065 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34914066 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34924067
3493
- g.add(GrafreeD.clipboard);
4068
+ g.add(Grafreed.clipboard);
34944069
34954070 buffer.add(g);
34964071 }
....@@ -3505,7 +4080,7 @@
35054080 makeSomething(buffer, i==group.selection.size()-1);
35064081 }
35074082
3508
- GrafreeD.epsequal = epsequal;
4083
+ Grafreed.epsequal = epsequal;
35094084
35104085 refreshContents();
35114086 }
....@@ -3523,7 +4098,16 @@
35234098 String pigment = Object3D.GetPigment(tex);
35244099 //String bump = Object3D.GetBump(tex);
35254100
3526
- 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
+ }
35274111
35284112 double s = v.s;
35294113
....@@ -3611,11 +4195,11 @@
36114195
36124196 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36134197
3614
- boolean random = CameraPane.RANDOM;
3615
- CameraPane.RANDOM = false; // parse all random nodes
4198
+ boolean random = CameraPane.SWITCH;
4199
+ CameraPane.SWITCH = false; // parse all random nodes
36164200 lowres.linkVerticesThis(null);
36174201 lowres.linkVerticesThis(sn);
3618
- CameraPane.RANDOM = random;
4202
+ CameraPane.SWITCH = random;
36194203
36204204 System.err.flush();
36214205
....@@ -3655,7 +4239,7 @@
36554239 return;
36564240
36574241 Object3D poses = group.selection.get(0);
3658
- Object3D ref = GrafreeD.clipboard.get(0);
4242
+ Object3D ref = Grafreed.clipboard.get(0);
36594243
36604244 Object3D newgroup = new Object3D("Po:" + poses.name);
36614245
....@@ -3849,9 +4433,9 @@
38494433
38504434 void ClipMesh()
38514435 {
3852
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4436
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38534437 {
3854
- Object3D content = GrafreeD.clipboard.get(0);
4438
+ Object3D content = Grafreed.clipboard.get(0);
38554439
38564440 if (content instanceof cGroup && ((cGroup)content).transientlink )
38574441 content = ((cGroup)content).get(0);
....@@ -3860,7 +4444,7 @@
38604444 // {
38614445 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38624446 // }
3863
- group.selection.ClipMesh(GrafreeD.clipboard);
4447
+ group.selection.ClipMesh(Grafreed.clipboard);
38644448 }
38654449 // group.selection.ClipMesh(GrafreeD.clipboard);
38664450 System.out.println("DONE.");
....@@ -3907,6 +4491,18 @@
39074491 void MarkLeaves(boolean hide)
39084492 {
39094493 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);
39104506 refreshContents();
39114507 }
39124508
....@@ -3981,10 +4577,6 @@
39814577 // }
39824578 // }
39834579
3984
- static boolean allparams = true;
3985
-
3986
- static Vector<Object3D> listUI = new Vector<Object3D>();
3987
-
39884580 void EditSelection(boolean newWindow)
39894581 {
39904582 // aConstraints.gridy = 0;
....@@ -3992,10 +4584,10 @@
39924584 {
39934585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39944586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3995
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39964588
39974589 Object3D elem = (Object3D)group.selection.elementAt(i);
3998
- if(elem != group)
4590
+ if(elem != group || !newWindow)
39994591 {
40004592 // if (!(elem instanceof Composite))
40014593 // newWindow = false;
....@@ -4077,7 +4669,8 @@
40774669 //new Exception().printStackTrace();
40784670
40794671 freezemodel = true;
4080
-
4672
+ ClearUnpinned();
4673
+
40814674 /**/
40824675 //switch (event.id)
40834676 {
....@@ -4085,7 +4678,6 @@
40854678 //case 702: // Event.LIST_DESELECT
40864679 group.deselectAll();
40874680 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4088
- objEditor.ClearInfo(); // .GetMaterial());
40894681 if (tps != null)
40904682 {
40914683 for (int i=0; i < tps.length; i++)
....@@ -4094,10 +4686,8 @@
40944686
40954687 //if (child.parent != null)
40964688 //child.parent.addSelectee(child);
4689
+ objEditor.SetMaterial(child);
40974690 group.addSelectee(child);
4098
- objEditor.SetMaterial(child); // .GetMaterial());
4099
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4100
- System.err.println("info : " + child.GetPath());
41014691 }
41024692 }
41034693 // else
....@@ -4107,20 +4697,28 @@
41074697 // System.err.println("info : " + group.GetPath());
41084698 // }
41094699
4110
- objEditor.SetText(); // jan 2014
4111
-
4112
- 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))
41134701 CameraPane.flash = true;
41144702
4115
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4703
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41164704 // a camera
41174705 {
4118
- CameraPane.camerachangeframe = 0; // don't refuse it
4119
- 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
+ }
41204711 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41214712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41224713 }
41234714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
41244722 refreshContents();
41254723 //return true;
41264724 }
....@@ -4129,6 +4727,35 @@
41294727
41304728 freezemodel = false;
41314729 }
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
+ }
41324759
41334760 void linkSomething(Object3D thing)
41344761 {
....@@ -4200,16 +4827,19 @@
42004827 {
42014828 if (group.selection.isEmpty())
42024829 return;
4203
- GrafreeD.clipboardIsTempGroup = false;
4830
+
4831
+ Grafreed.clipboardIsTempGroup = false;
42044832 Composite tGroup = null;
42054833 if (group.selection.size() > 0) // 1)
42064834 {
42074835 tGroup = new cGroup();
4208
- GrafreeD.clipboardIsTempGroup = true;
4836
+ Grafreed.clipboardIsTempGroup = true;
42094837 }
42104838
42114839 if (cut)
42124840 {
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
42134843 //int indices[] = jList.getSelectedIndices();
42144844 //for (int i = indices.length - 1; i >= 0; i--)
42154845 //jList.remove(indices[i]);
....@@ -4245,16 +4875,16 @@
42454875 //System.out.println("cut " + child);
42464876 //System.out.println("parent = " + child.parent);
42474877 // tmp.addChild(child);
4248
- if (GrafreeD.clipboardIsTempGroup)
4878
+ if (Grafreed.clipboardIsTempGroup)
42494879 tGroup.add/*Child*/(tmp);
42504880 else
4251
- GrafreeD.clipboard = tmp;
4881
+ Grafreed.clipboard = tmp;
42524882 }
42534883 else
4254
- if (GrafreeD.clipboardIsTempGroup)
4884
+ if (Grafreed.clipboardIsTempGroup)
42554885 tGroup.add/*Child*/(child);
42564886 else
4257
- GrafreeD.clipboard = child;
4887
+ Grafreed.clipboard = child;
42584888 }
42594889
42604890 //ResetModel();
....@@ -4286,21 +4916,23 @@
42864916 //System.out.println("cut " + elem);
42874917 //System.out.println("parent = " + elem.parent);
42884918 // tmp.addChild(elem);
4289
- if (GrafreeD.clipboardIsTempGroup)
4919
+ if (Grafreed.clipboardIsTempGroup)
42904920 tGroup.add/*Child*/(tmp);
42914921 else
4292
- GrafreeD.clipboard = tmp;
4922
+ Grafreed.clipboard = tmp;
42934923 }
42944924 else
4295
- if (GrafreeD.clipboardIsTempGroup)
4925
+ if (Grafreed.clipboardIsTempGroup)
42964926 tGroup.add/*Child*/(child);
42974927 else
4298
- GrafreeD.clipboard = child;
4928
+ Grafreed.clipboard = child;
42994929 }
43004930
43014931 }
4302
- if (GrafreeD.clipboardIsTempGroup)
4303
- GrafreeD.clipboard = tGroup;
4932
+
4933
+ if (Grafreed.clipboardIsTempGroup)
4934
+ Grafreed.clipboard = tGroup;
4935
+
43044936 if (cut)
43054937 {
43064938 ResetModel();
....@@ -4310,11 +4942,15 @@
43104942
43114943 void paste(boolean expand)
43124944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
43134949 // if (GrafreeD.clipboard == null)
43144950 // return;
43154951 boolean first = true;
43164952
4317
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43184954 {
43194955 Composite temp;
43204956
....@@ -4325,7 +4961,7 @@
43254961 temp = (Composite)Applet3D.clipboard.deepCopy();
43264962 */
43274963 Object3D elem;
4328
- 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))
43294965 {
43304966 Object3D child = (Object3D)e.nextElement();
43314967
....@@ -4359,21 +4995,22 @@
43594995 //Object3D cb = Applet3D.clipboard;
43604996 //temp.addChild(cb);
43614997 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4362
- assert(GrafreeD.clipboard.parent == null);
4363
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4364
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4365
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4366
- 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());
43675003 else
4368
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4369
- GrafreeD.clipboard.get(0).parent = keepparent;
5004
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5005
+ Grafreed.clipboard.get(0).parent = keepparent;
43705006 }
43715007
5008
+ Globals.SAVEONMAKE = keep;
43725009 ResetModel();
43735010 refreshContents();
43745011 }
43755012
4376
- void pasteInto(boolean copyit)
5013
+ void pasteInto(boolean copyit, boolean clone)
43775014 {
43785015 // if (GrafreeD.clipboard == null)
43795016 // return;
....@@ -4402,15 +5039,22 @@
44025039 if (copyit)
44035040 {
44045041 // paste(false);
4405
- CloneClipboard(false); // sept 2014
5042
+ if (clone)
5043
+ {
5044
+ CloneClipboard(false); // sept 2014
5045
+ }
5046
+ else
5047
+ {
5048
+ paste(false);
5049
+ }
44065050 }
44075051 else
44085052 {
44095053 boolean first = true;
44105054
4411
- if (GrafreeD.clipboardIsTempGroup)
5055
+ if (Grafreed.clipboardIsTempGroup)
44125056 {
4413
- Composite temp = (Composite)GrafreeD.clipboard;
5057
+ Composite temp = (Composite)Grafreed.clipboard;
44145058 Object3D copy;
44155059 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44165060 {
....@@ -4420,7 +5064,7 @@
44205064 }
44215065 } else
44225066 {
4423
- linkSomething(GrafreeD.clipboard); //.get(0));
5067
+ linkSomething(Grafreed.clipboard); //.get(0));
44245068 }
44255069 }
44265070 }
....@@ -4497,6 +5141,10 @@
44975141
44985142 void group(Object3D csg, boolean grab)
44995143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
45005148 if (//false) // why??
45015149 !group.selection.isEmpty())
45025150 {
....@@ -4610,10 +5258,15 @@
46105258 //node.add(csg);
46115259 //makeSomething(node);
46125260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
46135262 }
46145263
46155264 void Ungroup(Object3D g)
46165265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
46175270 if (g instanceof HiddenObject)
46185271 {
46195272 HiddenObject h = (HiddenObject) g;
....@@ -4630,6 +5283,7 @@
46305283 objEditor.makeSomething(g.get(i), false);
46315284 }
46325285 }
5286
+ Globals.SAVEONMAKE = keep;
46335287 }
46345288
46355289 void ungroup()
....@@ -4825,21 +5479,6 @@
48255479 }
48265480 */
48275481
4828
- void ImportGFD()
4829
- {
4830
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4831
- browser.show();
4832
- String filename = browser.getFile();
4833
- if (filename != null && filename.length() > 0)
4834
- {
4835
- String fullname = browser.getDirectory() + filename;
4836
-
4837
- //Object3D readobj =
4838
- objEditor.ReadGFD(fullname, objEditor);
4839
- //makeSomething(readobj);
4840
- }
4841
- }
4842
-
48435482 /*
48445483 public void Callback(Object obj)
48455484 {
....@@ -4863,26 +5502,9 @@
48635502 }
48645503 */
48655504
4866
- void ImportVRMLX3D()
4867
- {
4868
- if (GrafreeD.standAlone)
4869
- {
4870
- /**/
4871
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4872
- browser.show();
4873
- String filename = browser.getFile();
4874
- if (filename != null && filename.length() > 0)
4875
- {
4876
- String fullname = browser.getDirectory() + filename;
4877
- LoadVRMLX3D(fullname);
4878
- }
4879
- /**/
4880
- }
4881
- }
4882
-
48835505 String GetFile(String dialogName)
48845506 {
4885
- if (GrafreeD.standAlone)
5507
+ if (Grafreed.standAlone)
48865508 {
48875509 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48885510 browser.show();
....@@ -4946,10 +5568,33 @@
49465568 cButton flashSelectionButton;
49475569 cButton editButton;
49485570 cButton uneditButton;
5571
+ JCheckBox allParamsButton;
49495572 cButton clearpanelButton;
4950
- cButton allParamsButton;
49515573 cButton unselectButton;
49525574
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
+
49535598 cButton screenfitButton;
49545599 cButton screenfitpointButton;
49555600 cButton snapobjectButton;
....@@ -4961,14 +5606,6 @@
49615606
49625607 cButton setsupportButton;
49635608
4964
- cButton twoButton;
4965
- cButton sixButton;
4966
- cButton threeButton;
4967
- cButton sevenButton;
4968
- cButton fourButton; // full panel
4969
- cButton oneButton; // full XYZ
4970
- //cButton currentLayout;
4971
-
49725609 //
49735610 //Composite
49745611 Object3D // to do !!
....@@ -4978,9 +5615,11 @@
49785615 //JTree jTree;
49795616 private MenuItem lookAtItem;
49805617 private MenuItem lookFromItem;
4981
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
49825619 private MenuItem cutItem;
4983
- private MenuItem duplicateItem;
5620
+ private MenuItem undoItem;
5621
+ private MenuItem redoItem;
5622
+ private JMenuItem duplicateItem;
49845623 private MenuItem cloneItem;
49855624 private MenuItem cloneSupportItem;
49865625 private MenuItem overwriteGeoItem;
....@@ -4993,7 +5632,7 @@
49935632 private MenuItem linkverticesItem;
49945633 private MenuItem relinkverticesItem;
49955634 private MenuItem setMasterItem;
4996
- private MenuItem resetMeshItem;
5635
+ private MenuItem resetAllItem;
49975636 private MenuItem stepAllItem;
49985637 private MenuItem revertMeshItem;
49995638 private MenuItem poseMeshItem;
....@@ -5004,6 +5643,7 @@
50045643 private MenuItem mergeGeometriesItem;
50055644 private MenuItem copyItem;
50065645 private MenuItem pasteItem;
5646
+ private MenuItem pasteIntoItem;
50075647 private MenuItem pasteLinkItem;
50085648 private MenuItem pasteCloneItem;
50095649 private MenuItem pasteExpandItem;
....@@ -5042,6 +5682,10 @@
50425682 private MenuItem showleavesItem;
50435683 private MenuItem markleavesItem;
50445684 private MenuItem unmarkleavesItem;
5685
+ private MenuItem rewindleavesItem;
5686
+ private MenuItem unrewindleavesItem;
5687
+ private MenuItem randomleavesItem;
5688
+ private MenuItem unrandomleavesItem;
50455689
50465690 private MenuItem flipVItem;
50475691 private MenuItem unflipVItem;
....@@ -5053,15 +5697,17 @@
50535697 private MenuItem panoTexturesItem;
50545698
50555699 private MenuItem resetCentroidItem;
5056
- private MenuItem transformgeometryItem;
5700
+ private MenuItem resetCentroidXZItem;
50575701 private MenuItem resetTransformItem;
5702
+ private MenuItem transformGeometryItem;
5703
+ private MenuItem transformChildrenItem;
50585704 private MenuItem hideItem;
50595705 private MenuItem grabItem;
50605706 private MenuItem backItem;
50615707 private MenuItem frontItem;
50625708 private MenuItem cameraItem;
50635709 private MenuItem compositeItem;
5064
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
50655711 private MenuItem physicsItem;
50665712 private MenuItem frameselectorItem;
50675713 private MenuItem scriptNodeItem;
....@@ -5101,7 +5747,7 @@
51015747 private MenuItem blobItem;
51025748 private MenuItem latheItem;
51035749 private MenuItem bezierItem;
5104
- private MenuItem checkerItem;
5750
+ private MenuItem overlayItem;
51055751 private MenuItem meshItem;
51065752 // private MenuItem meshGroupItem;
51075753 private MenuItem springItem;
....@@ -5123,11 +5769,6 @@
51235769 private MenuItem doubleItem;
51245770 private MenuItem tripleItem;
51255771
5126
- private MenuItem importGFDItem;
5127
- private MenuItem importVRMLX3DItem;
5128
- private MenuItem import3DSItem;
5129
- private MenuItem importOBJItem;
5130
-
51315772 private MenuItem computeAOItem;
51325773 private MenuItem recompileItem;
51335774 private MenuItem editScriptItem;
....@@ -5137,4 +5778,8 @@
51375778 private MenuItem analyzeItem;
51385779 private MenuItem dumpItem;
51395780 //boolean freezemodel = false;
5781
+
5782
+ Menu cameraMenu;
5783
+ MenuItem editCameraItem;
5784
+ MenuItem restoreCameraItem;
51405785 }