Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +98,19 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
100105 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
106
+ assert(Grafreed.clipboard.parent == null);
107
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
108
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
109
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
110
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106111 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
112
+ makeSomething(CloneObject(Grafreed.clipboard, false));
113
+ Grafreed.clipboard.get(0).parent = keepparent;
109114 }
110115
111116 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +124,7 @@
119124 // obj.support = null;
120125 if (!supports)
121126 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
127
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123128 obj.parent = parent;
124129 // obj.support = support;
125130 // clone.support = support; // aout 2013
....@@ -148,30 +153,29 @@
148153
149154 //JTextField nameField;
150155
151
- void SetupMenu2(ObjEditor oe)
156
+ void SetupMenu2(GroupEditor oe)
152157 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
158
+ oe.jTree = new cTree();
159
+
164160 Menu menu;
165161 oe.menuBar.add(menu = new Menu("Edit"));
166162 //editItem = menu.add(new MenuItem("Edit"));
167163 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
164
+
165
+// undoItem = menu.add(new MenuItem("Undo"));
166
+// undoItem.addActionListener(this);
167
+// redoItem = menu.add(new MenuItem("Redo"));
168
+// redoItem.addActionListener(this);
169
+// menu.add("-");
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169171 duplicateItem.addActionListener(this);
170
- menu.add("-");
171172 cloneItem = menu.add(new MenuItem("Clone"));
172173 cloneItem.addActionListener(this);
174
+ if (Globals.ADVANCED)
175
+ {
173176 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174177 cloneSupportItem.addActionListener(this);
178
+ }
175179 menu.add("-");
176180 cutItem = menu.add(new MenuItem("Cut"));
177181 cutItem.addActionListener(this);
....@@ -179,27 +183,123 @@
179183 copyItem.addActionListener(this);
180184 pasteItem = menu.add(new MenuItem("Paste"));
181185 pasteItem.addActionListener(this);
186
+
187
+ menu.add("-");
188
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
189
+ pasteIntoItem.addActionListener(this);
182190 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183191 pasteLinkItem.addActionListener(this);
184192 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185193 pasteCloneItem.addActionListener(this);
186194 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187195 // pasteExpandItem.addActionListener(this);
196
+ menu.add("-");
188197 clearItem = menu.add(new MenuItem("Clear"));
189198 clearItem.addActionListener(this);
199
+
200
+ if (Globals.ADVANCED)
201
+ {
202
+ // Deletes the cameras...
190203 clearAllItem = menu.add(new MenuItem("Clear All"));
191204 clearAllItem.addActionListener(this);
205
+ }
206
+
207
+ menuBar.add(cameraMenu = new Menu("View"));
208
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
209
+ //zBufferItem.addActionListener(this);
210
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
211
+ //normalLensItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
214
+
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
227
+
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
229
+ toggleHandleItem.addItemListener(this);
230
+ toggleHandleItem.setState(CameraPane.HANDLES);
231
+
232
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
233
+ togglePaintItem.addItemListener(this);
234
+ togglePaintItem.setState(CameraPane.PAINTMODE);
235
+
236
+ if (Globals.ADVANCED)
237
+ {
238
+ cameraMenu.add("-");
239
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
240
+ toggleLiveItem.addItemListener(this);
241
+ toggleLiveItem.setState(Globals.isLIVE());
192242
243
+ cameraMenu.add(stepItem = new MenuItem("Step"));
244
+ stepItem.addActionListener(this);
245
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
246
+ // toggleDLItem.addItemListener(this);
247
+ // toggleDLItem.setState(false);
248
+
249
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
250
+ toggleRenderItem.addItemListener(this);
251
+ toggleRenderItem.setState(!CameraPane.frozen);
252
+
253
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
254
+ toggleDebugItem.addItemListener(this);
255
+ toggleDebugItem.setState(Globals.DEBUG);
256
+
257
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
258
+ toggleFrustumItem.addItemListener(this);
259
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
260
+
261
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
262
+ toggleFootContactItem.addItemListener(this);
263
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
264
+
265
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
266
+ toggleTimelineItem.addItemListener(this);
267
+ }
268
+
269
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
270
+// toggleRootItem.addItemListener(this);
271
+// toggleRootItem.setState(false);
272
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
273
+// animationItem.addItemListener(this);
274
+// animationItem.setState(CameraPane.ANIMATION);
275
+ cameraMenu.add("-");
276
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
277
+ editCameraItem.addActionListener(this);
278
+
279
+ if (Globals.ADVANCED)
280
+ {
281
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
282
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
284
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
285
+ oe.cameraMenu.add("-");
286
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
287
+ openWindowItem.addActionListener(this);
288
+ editLeafItem.addActionListener(this);
289
+ lookAtItem.addActionListener(this);
290
+ //lookFromItem.addActinoListener(this);
291
+ //switchViewItem.addActionListener(this);
292
+ }
293
+
193294 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
295
+ if (Globals.ADVANCED)
296
+ {
198297 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199298 revertMeshItem.addActionListener(this);
200299 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201300 resetreferencesItem.addActionListener(this);
202301 menu.add("-");
302
+ }
203303 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204304 overwriteGeoItem.addActionListener(this);
205305 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +311,104 @@
211311 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212312 overwriteUVItem.addActionListener(this);
213313 menu.add("-");
314
+ if (Globals.ADVANCED)
315
+ {
214316 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215317 generateMeshItem.addActionListener(this);
216318 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217319 poseMeshItem.addActionListener(this);
218320 menu.add("-");
321
+ }
219322 resetsupportItem = menu.add(new MenuItem("Reset support"));
220323 resetsupportItem.addActionListener(this);
221324 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222325 linkverticesItem.addActionListener(this);
223326 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224327 relinkverticesItem.addActionListener(this);
328
+
329
+ if (Globals.ADVANCED)
330
+ {
225331 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226332 setMasterItem.addActionListener(this);
333
+ }
227334
228335 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
231338 backItem = menu.add(new MenuItem("Back"));
232339 backItem.addActionListener(this);
233340 frontItem = menu.add(new MenuItem("Front"));
234341 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
347
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238348 hideItem.addActionListener(this);
349
+ }
239350 ungroupItem = menu.add(new MenuItem("Ungroup"));
240351 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
243
- randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
248359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249360 switchGeoItem.addActionListener(this);
250361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251362 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
363
+ morphItem = menu.add(new MenuItem("Morph Group"));
253364 morphItem.addActionListener(this);
365
+
366
+ menu.add("-");
367
+ physicsItem = menu.add(new MenuItem("Physics"));
368
+ physicsItem.addActionListener(this);
369
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
370
+ frameselectorItem.addActionListener(this);
254371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255372 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
373
+ }
258374
259375 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
262378 billboardItem = menu.add(new MenuItem("Billboard"));
263379 billboardItem.addActionListener(this);
264380 csgItem = menu.add(new MenuItem("CSG"));
265381 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267383 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269385 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
391
+ if (Globals.ADVANCED)
392
+ {
393
+ menu.add("-");
272394 linkerItem = menu.add(new MenuItem("Linker"));
273395 linkerItem.addActionListener(this);
274396 templateItem = menu.add(new MenuItem("Template"));
275397 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278398 pointflowItem = menu.add(new MenuItem("Point Flow"));
279399 pointflowItem.addActionListener(this);
400
+ }
280401 menu.add("-");
281402 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282403 resetTransformItem.addActionListener(this);
283404 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284405 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
406
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
407
+ resetCentroidXZItem.addActionListener(this);
408
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
409
+ transformGeometryItem.addActionListener(this);
410
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
411
+ transformChildrenItem.addActionListener(this);
287412
288413 oe.menuBar.add(menu = new Menu("Geometry"));
289414 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +419,11 @@
294419 genNormalsCADItem.addActionListener(this);
295420 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296421 genNormalsMESHItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
297424 genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298425 genNormalsMINEItem.addActionListener(this);
426
+ }
299427 stripifyItem = menu.add(new MenuItem("Stripify"));
300428 stripifyItem.addActionListener(this);
301429 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +445,34 @@
317445 reduce34MeshItem.addActionListener(this);
318446 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319447 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322448 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323449 clipMeshItem.addActionListener(this);
450
+
451
+ if (Globals.ADVANCED)
452
+ {
453
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
454
+ smoothMeshItem.addActionListener(this);
455
+ }
324456
325457 oe.menuBar.add(menu = new Menu("Attributes"));
326458 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327459 clearMaterialsItem.addActionListener(this);
460
+ resetAllItem = menu.add(new MenuItem("Reset All"));
461
+ resetAllItem.addActionListener(this);
462
+ stepAllItem = menu.add(new MenuItem("Step All"));
463
+ stepAllItem.addActionListener(this);
328464 menu.add("-");
329465 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330466 liveleavesItem.addActionListener(this);
331467 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332468 unliveleavesItem.addActionListener(this);
469
+ if (Globals.ADVANCED)
470
+ {
333471 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334472 supportleavesItem.addActionListener(this);
335473 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336474 unsupportleavesItem.addActionListener(this);
475
+ }
337476 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338477 hideleavesItem.addActionListener(this);
339478 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +481,14 @@
342481 markleavesItem.addActionListener(this);
343482 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344483 unmarkleavesItem.addActionListener(this);
484
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
485
+ rewindleavesItem.addActionListener(this);
486
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
487
+ unrewindleavesItem.addActionListener(this);
488
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
489
+ randomleavesItem.addActionListener(this);
490
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
491
+ unrandomleavesItem.addActionListener(this);
345492 menu.add("-");
346493 flipVItem = menu.add(new MenuItem("Flip V"));
347494 flipVItem.addActionListener(this);
....@@ -377,35 +524,41 @@
377524 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378525 sortbynameItem.addActionListener(this);
379526 menu.add("-");
527
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
528
+ shareGeometriesItem.addActionListener(this);
529
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
530
+ mergeGeometriesItem.addActionListener(this);
531
+ if (Globals.ADVANCED)
532
+ {
533
+ // Pretty much the same as duplicate and clone.
380534 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381535 extractGeometriesItem.addActionListener(this);
382536 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383537 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
538
+ }
388539
389540 oe.menuBar.add(menu = new Menu("Insert"));
390541 buildCreateMenu(menu);
391542
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403543 oe.menuBar.add(menu = new Menu("Tools"));
404544 buildToolsMenu(menu);
405545 }
406546
547
+
407548 void SetupUI2(ObjEditor oe)
408549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
409562 //new Exception().printStackTrace();
410563
411564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,110 +587,230 @@
434587 oe.radioPanel.add(dummyButton);
435588 oe.buttonGroup.add(dummyButton);
436589 */
437
- aConstraints.gridy += 1;
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
438593
439594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440595
441
- oe.aConstraints.gridwidth = 1;
442
- oe.aConstraints.gridx = 0;
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
443599
444
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
- liveCB.setToolTipText("Enabled animation");
446
- liveCB.addItemListener(this);
447
-
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
450
- trackCB.setToolTipText("Enable tracking");
451
- trackCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
606
+
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
455612 screenfitButton.setToolTipText("Screen fit");
456613 screenfitButton.addActionListener(this);
457
- oe.aConstraints.gridx += 1;
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
627
+
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ liveCB.setToolTipText("Enable animation");
648
+ liveCB.addItemListener(this);
649
+
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oneStepButton.setToolTipText("Animate one step forward");
652
+ oneStepButton.addActionListener(this);
653
+
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
655
+ fastCB.setToolTipText("Fast mode");
656
+ fastCB.addItemListener(this);
657
+
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
663
+
458664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459665 // screenfitpointButton.addActionListener(this);
460
-// oe.aConstraints.gridx += 1;
461
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
462
- snapobjectButton.addActionListener(this);
463
- snapobjectButton.setToolTipText("Snap Object");
464
- oe.aConstraints.gridx += 1;
465666
466
- //aConstraints.gridx = 0;
467
- //aConstraints.gridy += 1;
468
- oe.aConstraints.weighty = 0;
469
- oe.aConstraints.gridwidth = 1;
470
-
471
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
- flashSelectionButton.setToolTipText("Show selection");
473
- flashSelectionButton.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
669
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ snapobjectButton.addActionListener(this);
671
+ snapobjectButton.setToolTipText("Snap Object");
672
+ }
673
+
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
474675
475
- oe.toolbarPanel.add(new cButton(" ", false));
476
-
477
- oe.aConstraints.gridx += 1;
478
- oe.aConstraints.weighty = 0;
479
- oe.aConstraints.gridwidth = 1;
480
-
481
- //
482
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
483677 twoButton.setToolTipText("Show center view only");
484678 twoButton.addActionListener(this);
485
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
486682 fourButton.addActionListener(this);
487683 fourButton.setToolTipText("Show left panel only");
488
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
489685 sixButton.setToolTipText("2-column layout left");
490686 sixButton.addActionListener(this);
491
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492688 threeButton.setToolTipText("2-column layout right");
493689 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495691 sevenButton.setToolTipText("3-column layout");
496692 sevenButton.addActionListener(this);
497693 //
498694
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- rootButton.setToolTipText("Edit object in new tab");
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ rootButton.setToolTipText("Edit selection in new tab");
501697 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
698
+
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504700 closeButton.setToolTipText("Close tab");
505701 closeButton.addActionListener(this);
506702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
507703 //clearButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509
-
510
- oe.aConstraints.gridx = 1; //
511
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
512
- editButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516704
517
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
736
+
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
786
+ editButton.addActionListener(this);
787
+
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
518790 uneditButton.addActionListener(this);
519791
520
- oe.aConstraints.gridx += 1;
521
- oe.aConstraints.weighty = 0;
522
- oe.aConstraints.gridwidth = 1;
523
-
524
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
525
- clearPanelButton.addActionListener(this);
526
-
527
- oe.aConstraints.gridx += 1;
528
- oe.aConstraints.weighty = 0;
529
- oe.aConstraints.gridwidth = 1;
530
-
531
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
532794 allParamsButton.addActionListener(this);
533795
534
- oe.aConstraints.gridx += 1;
535
- oe.aConstraints.weighty = 0;
536
- oe.aConstraints.gridwidth = 1;
537
-
538
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ clearPanelButton.setToolTipText("Clear edit panel");
798
+ clearPanelButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ unselectButton.setToolTipText("Unselect");
539802 unselectButton.addActionListener(this);
540803
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
807
+
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
813
+
541814 // oe.aConstraints.gridx += 1;
542815 // oe.aConstraints.weighty = 0;
543816 // oe.aConstraints.gridwidth = 1;
....@@ -549,40 +822,25 @@
549822 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
550823 // gcButton.addActionListener(this);
551824
552
- oe.aConstraints.gridx = 0;
553
- oe.aConstraints.gridy += 1;
554
-
555
- //ctrlPanel.add(objList = new List(5, true));
556
- oe.aConstraints.gridwidth = 100;
557
- // oe.aConstraints.gridheight = 100;
558
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
559
- oe.aConstraints.gridheight = 1;
560
- oe.aConstraints.weighty = 0.5;
561
- oe.aConstraints.gridx = 0;
562
- JScrollPane jSP;
825
+ cGridBag jSPPanel = new cGridBag();
826
+
827
+ JScrollPane jSP;
563828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
564
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
565830 ResetModel();
566
- oe.aConstraints.weighty = 0.5;
567
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
568
- oe.aConstraints.gridy += 1;
569
- oe.aConstraints.gridwidth = 1;
570
-
571
- oe.aConstraints.weighty = 0;
572
- oe.aConstraints.gridwidth = 2;
573
-
574
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
575
- colorCB.addItemListener(this);
576
- oe.aConstraints.gridx += 2;
577
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
578
- materialCB.addItemListener(this);
579
- oe.aConstraints.gridx += 2;
580
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
581
- textureCB.addItemListener(this);
582
-
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585831
832
+ oe.treePanel.add(jSPPanel);
833
+ oe.treePanel.Return();
834
+
835
+ oe.treePanel.add(copyOptionsPanel);
836
+ oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
840
+
841
+// mainPanel.setDividerLocation(0.5); //1.0);
842
+// mainPanel.setResizeWeight(0.5);
843
+
586844 //jList.addListSelectionListener(this);
587845 oe.jTree.addTreeSelectionListener(this);
588846 //jTree.setRootVisible(false);
....@@ -607,47 +865,61 @@
607865
608866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
609867 {
610
- //constraints.gridx = 0;
611
- //constraints.gridy = 0;
612
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
- fastCB.setToolTipText("Fast mode");
614
- fastCB.addItemListener(this);
615
- //constraints.gridy += 1;
616
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
- supportCB.setToolTipText("Enabled rigging");
618
- supportCB.addItemListener(this);
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
619871
620
- // constraints.gridy += 1;
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
882
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
883
+ boxCB.setToolTipText("Display bounding boxes");
884
+ boxCB.addItemListener(this);
885
+
886
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
888
+ zoomBoxCB.addItemListener(this);
889
+
890
+ if (true) // Globals.ADVANCED)
891
+ {
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
899
+
621900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
622901 // localCB.addItemListener(this);
623902
624
- //constraints.gridy += 1;
903
+ panel.Return();
904
+
625905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
626906 crowdCB.setToolTipText("Used for crowds");
627907 crowdCB.addItemListener(this);
628908
629
- //constraints.gridy += 1;
630909 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
631910 smoothCB.setToolTipText("Snapping delay");
632911 smoothCB.addItemListener(this);
633912
634
- //constraints.gridy += 1;
635913 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
636914 slowCB.setToolTipText("Smooth interpolation");
637915 slowCB.addItemListener(this);
638
- //constraints.gridy += 1;
639
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640
- boxCB.setToolTipText("Display bounding boxes");
641
- boxCB.addItemListener(this);
642
- //constraints.gridy += 1;
643
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645
- zoomBoxCB.addItemListener(this);
646
-
916
+
647917 // constraints.gridy += 1;
648918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
649919 // speakerMocapCB.addItemListener(this);
650920
921
+ panel.Return();
922
+
651923 if (false)
652924 {
653925 // handled in scripts
....@@ -662,26 +934,72 @@
662934 //constraints.gridy += 1;
663935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
664936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
665938 }
666939
667940 //constraints.gridx += 1;
668941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
669942 // debugCB.addItemListener(this);
670943
671
- //constraints.gridy += 1;
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
672948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
673950 oeilCB.addItemListener(this);
674951
675
- //constraints.gridy += 1;
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ if (Globals.ADVANCED)
971
+ {
676972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
677973 lookAtCB.setToolTipText("Look-at target");
678974 lookAtCB.addItemListener(this);
975
+ }
976
+
977
+ }
978
+
979
+ cGridBag fill = new cGridBag();
980
+ fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
985
+
986
+ panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
679989
680990 }
681991
682992 void EditObject(Object3D obj)
683993 {
684994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
6851003 radioButton.SetObject(obj);
6861004 radioButton.layout = sevenButton;
6871005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -690,8 +1008,11 @@
6901008 buttonGroup.add(radioButton);
6911009 radioButton.doClick();
6921010 }
1011
+
6931012 void SetupViews(ObjEditor oe)
6941013 {
1014
+ theFrame = this;
1015
+
6951016 oe.SetupViews();
6961017
6971018 System.out.println("SetupViews");
....@@ -700,23 +1021,28 @@
7001021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7011022 }
7021023
703
- JCheckBox liveCB;
704
- JCheckBox supportCB;
705
- JCheckBox localCB;
706
- JCheckBox crowdCB;
707
- JCheckBox smoothCB;
708
- JCheckBox fastCB;
709
- JCheckBox slowCB;
710
- JCheckBox boxCB;
711
- JCheckBox zoomBoxCB;
712
- JCheckBox trackCB;
713
- JCheckBox smoothfocusCB;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
7141037 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
7201046
7211047 // static int COLOR = 1;
7221048 // static int MATERIAL = 2;
....@@ -724,9 +1050,9 @@
7241050
7251051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7261052
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
7301056
7311057 public void itemStateChanged(ItemEvent e)
7321058 {
....@@ -754,6 +1080,7 @@
7541080 } else if(e.getSource() == liveCB)
7551081 {
7561082 cameraView.ToggleLive();
1083
+ refreshContents(false);
7571084 }
7581085 else if(e.getSource() == supportCB)
7591086 {
....@@ -818,6 +1145,18 @@
8181145 {
8191146 cameraView.ToggleOeil();
8201147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
8211160 else if(e.getSource() == lookAtCB)
8221161 {
8231162 cameraView.ToggleLookAt();
....@@ -834,7 +1173,8 @@
8341173
8351174 /**/
8361175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
837
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
8381178 if ((path == null) || (path.getPathCount() <= 1)) {
8391179 // We can't move the root node or an empty selection
8401180 return;
....@@ -897,8 +1237,6 @@
8971237 }
8981238 }
8991239
900
- String string = (String) object;
901
-
9021240 System.out.println("Transfer = " + object + "; drop : " + target);
9031241 // if( object instanceof java.io.File[])
9041242 // {
....@@ -906,7 +1244,11 @@
9061244 // objEditor.DropFile((java.io.File[]) object, true);
9071245 // return;
9081246 // }
909
- if (string.charAt(0) == '/')
1247
+
1248
+ String string = object.toString();
1249
+
1250
+ // File path for Mac and Windows
1251
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9101252 {
9111253 // file(s)
9121254 String[] names = string.split("\n");
....@@ -933,7 +1275,7 @@
9331275
9341276 flashIt = false;
9351277 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1278
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371279 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381280
9391281 if (group.selection.size() == 1)
....@@ -949,23 +1291,33 @@
9491291
9501292 assert target == objEditor.jTree;
9511293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
9521295 try {
953
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9541297 } catch (Exception e) {
9551298 System.out.println("destinationPath : " + destinationPath);
9561299 return;
9571300 }
9581301
959
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
9601303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
9611313 loadClipboard(true);
9621314 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
964
- } else {
965
- loadClipboard(false);
966
- objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
968
- }
1315
+ pasteInto(false, false);
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
9691321 }
9701322 public void dropActionChanged(DropTargetDragEvent dtde)
9711323 // Called if the user has modified the current drop gesture
....@@ -1070,85 +1422,107 @@
10701422 {
10711423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10721424 //heightFieldItem.addActionListener(this);
1073
- gridItem = menu.add(new MenuItem("Grid"));
1074
- gridItem.addActionListener(this);
1075
- rectoidItem = menu.add(new MenuItem("Box"));
1076
- rectoidItem.addActionListener(this);
1077
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1078
- ellipsoidItem.addActionListener(this);
1079
- coneItem = menu.add(new MenuItem("Cone"));
1080
- coneItem.addActionListener(this);
1081
- torusItem = menu.add(new MenuItem("Torus"));
1082
- torusItem.addActionListener(this);
1083
- superItem = menu.add(new MenuItem("Superellipsoid"));
1084
- superItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
10851443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10861444 kleinItem.addActionListener(this);
1087
- particleItem = menu.add(new MenuItem("Particle system"));
1088
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
1449
+ if (Globals.ADVANCED)
1450
+ {
10891451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901452 ragdollItem.addActionListener(this);
10911453 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921454 ragdoll2Item.addActionListener(this);
1455
+ }
10931456 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1457
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951458 meshItem.addActionListener(this);
10961459 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971460 // meshGroupItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10981463 springItem = menu.add(new MenuItem("Spring"));
10991464 springItem.addActionListener(this);
11001465 flagItem = menu.add(new MenuItem("Flag"));
11011466 flagItem.addActionListener(this);
1102
- bezierItem = menu.add(new MenuItem("Patch"));
1103
- bezierItem.addActionListener(this);
1104
- checkerItem = menu.add(new MenuItem("Checker"));
1105
- checkerItem.addActionListener(this);
11061467 blobItem = menu.add(new MenuItem("Blob"));
11071468 blobItem.addActionListener(this);
11081469 latheItem = menu.add(new MenuItem("Lathe"));
11091470 latheItem.addActionListener(this);
1110
- lightItem = menu.add(new MenuItem("Light"));
1111
- lightItem.addActionListener(this);
1471
+ }
1472
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1473
+ bezierItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
11121478 menu.add("-");
11131479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11141480 //superLoopItem.addActionListener(this);
1115
- loopItem = menu.add(new MenuItem("Loop"));
1116
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
11171483 doubleItem = menu.add(new MenuItem("Fork"));
11181484 doubleItem.addActionListener(this);
1485
+ if (Globals.ADVANCED)
1486
+ {
11191487 tripleItem = menu.add(new MenuItem("Trident"));
11201488 tripleItem.addActionListener(this);
1489
+ }
11211490 }
11221491
11231492 void buildToolsMenu(Menu menu)
11241493 {
11251494 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261495 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1496
+ animationItem.setState(Globals.ANIMATION);
1497
+
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
11281500
11291501 menu.add("-");
11301502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311503 parseverticesItem.addActionListener(this);
11321504 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331505 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1506
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351507 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381508 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391509 reduceMorphItem.addActionListener(this);
11401510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411511 reduce34MorphItem.addActionListener(this);
1142
-
1143
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1144
- computeAOItem.addActionListener(this);
11451512 menu.add("-");
1146
-
11471513 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481514 memoryItem.addActionListener(this);
1515
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1516
+ computeAOItem.addActionListener(this);
1517
+
1518
+ if (Globals.ADVANCED)
1519
+ {
1520
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1521
+ mirrorItem.addActionListener(this);
1522
+ menu.add("-");
11491523 menu.add(analyzeItem = new MenuItem("Analyze"));
11501524 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1525
+ menu.add(dumpItem = new MenuItem("Print"));
11521526 dumpItem.addActionListener(this);
11531527 // menu.add(pathItem = new MenuItem("From-to path"));
11541528 // pathItem.addActionListener(this);
....@@ -1166,6 +1540,7 @@
11661540 menu.add("-");
11671541 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681542 editScriptItem.addActionListener(this);
1543
+ }
11691544 }
11701545
11711546 void ScreenFit()
....@@ -1288,9 +1663,24 @@
12881663 shadow.material = new cMaterial(obj.material);
12891664 shadow.material.diffuse = 0.0001f;
12901665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
12911667
12921668 makeSomething(shadow);
12931669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
12941684
12951685 /**
12961686 * applyExample
....@@ -1494,9 +1884,9 @@
14941884
14951885 void Overwrite(int mask)
14961886 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14981888 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
1889
+ Object3D content = Grafreed.clipboard.get(0);
15001890
15011891 if (content instanceof cGroup && ((cGroup)content).transientlink )
15021892 content = ((cGroup)content).get(0);
....@@ -1535,7 +1925,7 @@
15351925 {
15361926 ScreenFit();
15371927 } else
1538
- if (source == switchItem)
1928
+ if (source == switchViewItem)
15391929 {
15401930 cVector v1 = new cVector();
15411931 cVector v2 = new cVector();
....@@ -1544,11 +1934,11 @@
15441934 objEditor.cameraView.renderCamera.setAim(v2, v1);
15451935 objEditor.cameraView.repaint();
15461936 } else
1547
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
15481938 {
15491939 makeSomething(new Box());
15501940 } else
1551
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
15521942 {
15531943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15541944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1627,27 +2017,27 @@
16272017
16282018 makeSomething(obj);
16292019 } else
1630
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
16312021 {
16322022 makeSomething(new Grid());
16332023 } else
1634
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
16352025 {
16362026 makeSomething(new Sphere());
16372027 } else
1638
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
16392029 {
16402030 makeSomething(new Cone());
16412031 } else
1642
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
16432033 {
16442034 makeSomething(new Torus());
16452035 } else
1646
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
16472037 {
16482038 makeSomething(new Superellipsoid());
16492039 } else
1650
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
16512041 {
16522042 makeSomething(new Klein());
16532043 } else
....@@ -1667,7 +2057,7 @@
16672057 {
16682058 makeSomething(new BezierSurface());
16692059 } else
1670
- if (source == checkerItem)
2060
+ if (source == overlayItem || source == overlayButton)
16712061 {
16722062 /*
16732063 Object3D obj = new BezierSurface(5,8);
....@@ -1715,7 +2105,7 @@
17152105 s.setup();
17162106 makeSomething(s);
17172107 } else
1718
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
17192109 {
17202110 makeSomething(new Light());
17212111 } else
....@@ -1765,30 +2155,30 @@
17652155
17662156 group(g);
17672157 } else
1768
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
17692159 {
17702160 Composite csg = new GroupLeaf();
17712161 csg.count = 5;
17722162 group(csg);
1773
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
17742164 csg.addChild(child);
17752165 child.addChild(csg);
17762166 } else
17772167 if (source == doubleItem)
17782168 {
1779
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
17802170 csg.count = 5;
17812171 group(csg);
1782
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
17832173 csg.addChild(child);
17842174 child.addChild(csg);
1785
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
17862176 csg.addChild(child);
17872177 child.addChild(csg);
17882178 } else
17892179 if (source == tripleItem)
17902180 {
1791
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
17922182 csg.count = 4;
17932183 group(csg);
17942184 Composite child = new cGroup();
....@@ -1800,23 +2190,6 @@
18002190 child = new cGroup();
18012191 csg.addChild(child);
18022192 child.addChild(csg);
1803
- } else
1804
-
1805
- if (source == importGFDItem)
1806
- {
1807
- ImportGFD();
1808
- } else
1809
- if (source == importVRMLX3DItem)
1810
- {
1811
- ImportVRMLX3D();
1812
- } else
1813
- if (source == import3DSItem)
1814
- {
1815
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1816
- } else
1817
- if (source == importOBJItem)
1818
- {
1819
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
18202193 } else
18212194 if (source == computeAOItem)
18222195 {
....@@ -1836,7 +2209,7 @@
18362209 if (source == invariantsItem)
18372210 {
18382211 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2212
+ Grafreed.grafreeD.universe.invariants();
18402213 } else
18412214 if (source == memoryItem)
18422215 {
....@@ -1855,19 +2228,61 @@
18552228 {
18562229 DumpObject();
18572230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
2243
+ if (source == undoButton)
2244
+ {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
2259
+ } else
2260
+ if (source == redoButton)
2261
+ {
2262
+ // Go to next version
2263
+ Redo();
2264
+ } else
2265
+ if (source == saveButton)
2266
+ {
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
2270
+ } else
2271
+ if (source == oneStepButton)
2272
+ {
2273
+ Globals.ONESTEP = true;
2274
+ cameraView.repaint();
2275
+ } else
18582276 if (source == screenfitButton)
18592277 {
1860
- //Reload(lastConverter, lastFilename, true);
18612278 ScreenFit();
18622279 } else
18632280 if (source == screenfitpointButton)
18642281 {
1865
- //Reload(lastConverter, lastFilename, true);
18662282 ScreenFitPoint();
18672283 } else
18682284 if (source == snapobjectButton)
18692285 {
1870
- //Reload(lastConverter, lastFilename, true);
18712286 SnapObject();
18722287 } else
18732288 // if (event.getSource() == recompileButton)
....@@ -1904,12 +2319,20 @@
19042319 {
19052320 loadClipboard(true);
19062321 } else
2322
+ if (source == undoItem)
2323
+ {
2324
+ Undo();
2325
+ } else
2326
+ if (source == redoItem)
2327
+ {
2328
+ Redo();
2329
+ } else
19072330 if (source == duplicateItem)
19082331 {
1909
- Object3D keep = GrafreeD.clipboard;
2332
+ Object3D keep = Grafreed.clipboard;
19102333 loadClipboard(false);
19112334 paste(false);
1912
- GrafreeD.clipboard = keep;
2335
+ Grafreed.clipboard = keep;
19132336 } else
19142337 if (source == cloneItem)
19152338 {
....@@ -1927,13 +2350,17 @@
19272350 {
19282351 paste(false);
19292352 } else
2353
+ if (source == pasteIntoItem)
2354
+ {
2355
+ pasteInto(true, false);
2356
+ } else
19302357 if (source == pasteLinkItem)
19312358 {
1932
- pasteInto(false);
2359
+ pasteInto(false, false);
19332360 } else
19342361 if (source == pasteCloneItem)
19352362 {
1936
- pasteInto(true);
2363
+ pasteInto(true, true);
19372364 } else
19382365 if (source == pasteExpandItem)
19392366 {
....@@ -2125,9 +2552,9 @@
21252552 // group.selection.get(0).setMasterThis(content); // should be identity
21262553 // refreshContents();
21272554 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2555
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292556 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2557
+ Object3D content = Grafreed.clipboard.get(0);
21312558
21322559 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332560 content = ((cGroup)content).get(0);
....@@ -2135,11 +2562,11 @@
21352562 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362563 for (int i=0; i<group.selection.size(); i++)
21372564 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2565
+ boolean random = CameraPane.SWITCH;
2566
+ CameraPane.SWITCH = false; // parse all random nodes
21402567 group.selection.get(i).linkVerticesThis(content);
21412568 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2569
+ CameraPane.SWITCH = random;
21432570 }
21442571 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452572 refreshContents();
....@@ -2149,20 +2576,20 @@
21492576 {
21502577 for (int i=0; i<group.selection.size(); i++)
21512578 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2579
+ boolean random = CameraPane.SWITCH;
2580
+ CameraPane.SWITCH = false; // parse all random nodes
21542581 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2582
+ CameraPane.SWITCH = random;
21562583 }
21572584
21582585 refreshContents();
21592586 } else
21602587 if (source == relinkverticesItem)
21612588 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2589
+ boolean random = CameraPane.SWITCH;
2590
+ CameraPane.SWITCH = false; // parse all random nodes
21642591 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
21662593
21672594 refreshContents();
21682595 } else
....@@ -2177,9 +2604,9 @@
21772604 } else
21782605 if (source == setMasterItem)
21792606 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2607
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812608 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2609
+ Object3D content = Grafreed.clipboard.get(0);
21832610
21842611 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852612 content = ((cGroup)content).get(0);
....@@ -2192,9 +2619,9 @@
21922619 {
21932620 if (group.selection.size() == 1)
21942621 {
2195
- if (GrafreeD.clipboard.size() == 1)
2622
+ if (Grafreed.clipboard.size() == 1)
21962623 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2624
+ Object3D content = Grafreed.clipboard.get(0);
21982625
21992626 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002627 content = ((cGroup)content).get(0);
....@@ -2211,7 +2638,7 @@
22112638 {
22122639 RevertMeshes();
22132640 } else
2214
- if (source == resetMeshItem)
2641
+ if (source == resetAllItem)
22152642 {
22162643 ResetAll();
22172644 } else
....@@ -2231,9 +2658,9 @@
22312658 {
22322659 ClearSelection(true);
22332660 } else
2234
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
22352662 {
2236
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
22372664 } else
22382665 if (source == hideItem)
22392666 {
....@@ -2251,16 +2678,16 @@
22512678 {
22522679 makeSomething(new Camera());
22532680 } else
2254
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
22552682 {
22562683 group(new Composite());
22572684 } else
2258
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
22592686 {
22602687 RandomNode random = new RandomNode();
22612688 group(random);
22622689 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
2690
+ random.name = random.get(0).name + "Switch";
22642691 } else
22652692 if (source == physicsItem)
22662693 {
....@@ -2357,7 +2784,7 @@
23572784 {
23582785 group(new cLinker());
23592786 } else
2360
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
23612788 {
23622789 group(new TextureNode());
23632790 } else
....@@ -2377,17 +2804,30 @@
23772804 {
23782805 CastShadow(2);
23792806 } else
2380
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
23812808 {
2382
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
23832811 for (int i=0; i<group.selection.size(); i++)
23842812 {
2385
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
23862818 }
23872819
2388
- ClearSelection(false);
2389
-
2390
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
23912831 } else
23922832 if (source == genUVItem)
23932833 {
....@@ -2399,7 +2839,7 @@
23992839 } else
24002840 if (source == genNormalsMESHItem)
24012841 {
2402
- GenNormals(true); // TODO
2842
+ GenNormalsMESH();
24032843 } else
24042844 if (source == genNormalsORGANItem)
24052845 {
....@@ -2464,6 +2904,22 @@
24642904 if (source == unmarkleavesItem)
24652905 {
24662906 MarkLeaves(false);
2907
+ } else
2908
+ if (source == rewindleavesItem)
2909
+ {
2910
+ RewindLeaves(true);
2911
+ } else
2912
+ if (source == unrewindleavesItem)
2913
+ {
2914
+ RewindLeaves(false);
2915
+ } else
2916
+ if (source == randomleavesItem)
2917
+ {
2918
+ RandomLeaves(true);
2919
+ } else
2920
+ if (source == unrandomleavesItem)
2921
+ {
2922
+ RandomLeaves(false);
24672923 } else
24682924 if (source == flipVItem)
24692925 {
....@@ -2549,9 +3005,13 @@
25493005 {
25503006 SmoothMesh();
25513007 } else
2552
- if (source == transformgeometryItem)
3008
+ if (source == transformGeometryItem)
25533009 {
25543010 TransformGeometry();
3011
+ } else
3012
+ if (source == transformChildrenItem)
3013
+ {
3014
+ TransformChildren();
25553015 } else
25563016 if (source == resetTransformItem)
25573017 {
....@@ -2559,7 +3019,11 @@
25593019 } else
25603020 if (source == resetCentroidItem)
25613021 {
2562
- ResetCentroid();
3022
+ ResetCentroid(true);
3023
+ } else
3024
+ if (source == resetCentroidXZItem)
3025
+ {
3026
+ ResetCentroid(false);
25633027 } else
25643028 if (source == resetParentItem)
25653029 {
....@@ -2691,6 +3155,10 @@
26913155 if (source == twoButton)
26923156 {
26933157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
26943162 // bug
26953163 //gridPanel.setDividerLocation(1.0);
26963164 //bigPanel.setDividerLocation(0.0);
....@@ -2723,10 +3191,31 @@
27233191 bigThree.ClearUI();
27243192 bigThree.add(centralPanel);
27253193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
27263212 } else
27273213 if (source == threeButton)
27283214 {
27293215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
27303219
27313220 // bigThree.remove(scenePanel);
27323221 // bigThree.remove(centralPanel);
....@@ -2759,10 +3248,15 @@
27593248 bigThree.add(centralPanel);
27603249 bigThree.add(XYZPanel);
27613250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
27623253 } else
27633254 if (source == fourButton)
27643255 {
27653256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
27663260
27673261 // bigThree.remove(scenePanel);
27683262 // bigThree.remove(centralPanel);
....@@ -2794,10 +3288,15 @@
27943288 bigThree.ClearUI();
27953289 bigThree.add(scenePanel);
27963290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
27973293 } else
27983294 if (source == sixButton)
27993295 {
28003296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
28013300
28023301 // bigThree.remove(scenePanel);
28033302 // bigThree.remove(centralPanel);
....@@ -2830,10 +3329,15 @@
28303329 bigThree.add(scenePanel);
28313330 bigThree.add(centralPanel);
28323331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
28333334 } else
28343335 if (source == sevenButton)
28353336 {
28363337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
28373341
28383342 // bigThree.remove(scenePanel);
28393343 // bigThree.remove(centralPanel);
....@@ -2867,6 +3371,8 @@
28673371 bigThree.add(centralPanel);
28683372 bigThree.add(XYZPanel);
28693373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
28703376 } else
28713377 if (source == rootButton)
28723378 {
....@@ -2878,6 +3384,7 @@
28783384 EditObject(obj);
28793385 }
28803386
3387
+ cameraView.requestFocusInWindow();
28813388 refreshContents(true);
28823389 } else
28833390 if (source == closeButton)
....@@ -2887,22 +3394,37 @@
28873394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883395 {
28893396 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
28923405 buttonGroup.remove(ab);
28933406 radioPanel.remove(ab);
28943407
2895
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
28963410 // ab.GetObject().objectUI = null; // ?????????
28973411
28983412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993413 break;
29003414 }
29013415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
29023418 refreshContents(true);
29033419 } else
29043420 if (source == editItem || source == editButton)
29053421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
29063428 EditSelection(false);
29073429 } else
29083430 if (source == uneditButton)
....@@ -2912,12 +3434,13 @@
29123434 Object3D child = (Object3D)e.nextElement();
29133435 if(child.editWindow != null)
29143436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
29153438 child.CloseUI();
29163439 listUI.remove(child);
29173440
2918
- child.editWindow = null; // ???????????
3441
+ //child.editWindow = null; // ???????????
29193442 }
2920
- objEditor.ctrlPanel.validate();
3443
+ objEditor.ctrlPanel.FlushUI();
29213444 //objEditor.jTree.clearSelection();
29223445 //objEditor.ResetSliders();
29233446 refreshContents(true);
....@@ -2928,6 +3451,7 @@
29283451 //copy.ClearUI();
29293452 for (Object3D obj : listUI)
29303453 {
3454
+ obj.pinned = false;
29313455 obj.CloseUI();
29323456 }
29333457 listUI.clear();
....@@ -2937,7 +3461,7 @@
29373461 {
29383462 assert(copy == group);
29393463
2940
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29413465
29423466 for (Object3D obj : listUI)
29433467 {
....@@ -2986,6 +3510,9 @@
29863510 }
29873511
29883512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
29893516 //Globals.theRenderer.object = group;
29903517 if(!useclient)
29913518 {
....@@ -3001,20 +3528,44 @@
30013528 frontView.object = group;
30023529 sideView.object = group;
30033530 }
3004
- group.editWindow = this;
3531
+
3532
+// fix "+" issue
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
3535
+
30053536 /*
30063537 currentLayout = radio.layout;
30073538 if (currentLayout == null)
30083539 currentLayout = sevenButton;
30093540 */
30103541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
30113547 keepparent = group.parent;
30123548 // PARENT = NULL or not???
30133549 //group.parent = null; // ROOT
30143550 //group.attributes = -1;
30153551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
30163554 refreshContents(true);
3017
- }
3555
+ } else if (event.getSource() == editCameraItem)
3556
+ {
3557
+ cameraView.ProtectCamera();
3558
+ cameraView.repaint();
3559
+ return;
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3561
+ {
3562
+ cameraView.RevertCamera();
3563
+ cameraView.repaint();
3564
+ return;
3565
+ // } else if (event.getSource() == textureButton)
3566
+ // {
3567
+ // return; // true;
3568
+ }
30183569 else
30193570 {
30203571 //return super.action(event, arg);
....@@ -3023,7 +3574,6 @@
30233574 }
30243575
30253576 boolean useclient = false;
3026
- cRadio radio;
30273577
30283578 void ToggleRoot()
30293579 {
....@@ -3075,6 +3625,28 @@
30753625 refreshContents();
30763626 }
30773627
3628
+ void TransformChildren()
3629
+ {
3630
+ Object3D obj;
3631
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3632
+ {
3633
+ obj = (Object3D)e.nextElement();
3634
+ obj.KeepTextureMatrices();
3635
+ obj.TransformChildren();
3636
+ obj.RestoreTextureMatrices();
3637
+
3638
+// if (obj.parent == null)
3639
+// {
3640
+// System.out.println("NULL PARENT!");
3641
+// new Exception().printStackTrace();
3642
+// }
3643
+// else
3644
+// TouchTransform(obj);
3645
+// //obj.parent.Touch();
3646
+ }
3647
+
3648
+ refreshContents();
3649
+ }
30783650
30793651 void ResetTransform()
30803652 {
....@@ -3187,7 +3759,7 @@
31873759 refreshContents();
31883760 }
31893761
3190
- void ResetCentroid()
3762
+ void ResetCentroid(boolean full)
31913763 {
31923764 Object3D obj;
31933765 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +3774,16 @@
32023774 LA.matIdentity(Object3D.mat);
32033775 obj.getBounds(minima, maxima, false);
32043776 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3777
+ if (full)
3778
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32063779 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32073780 obj.TransformMesh(Object3D.mat);
3781
+
32083782 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3783
+ if (full)
3784
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32103785 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3786
+
32113787 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32123788 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32133789 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +3812,8 @@
32363812
32373813 int size = obj.MemorySize();
32383814
3239
- System.err.println((size/1024) + " KB is the size of " + obj);
3815
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3816
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32403817 }
32413818 }
32423819 catch (Exception e)
....@@ -3273,9 +3850,9 @@
32733850 obj = (Object3D)e.nextElement();
32743851
32753852 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
3853
+ Grafreed.AnalyzeObject(obj);
32773854 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
3855
+ Grafreed.AnalyzeObject(obj.bRep);
32793856
32803857 // System.err.println((size/1024) + " KB is the size of " + obj);
32813858 }
....@@ -3317,6 +3894,13 @@
33173894 void GenNormals(boolean crease)
33183895 {
33193896 group.GenNormalsS(crease);
3897
+
3898
+ refreshContents();
3899
+ }
3900
+
3901
+ void GenNormalsMESH()
3902
+ {
3903
+ group.GenNormalsMeshS();
33203904
33213905 refreshContents();
33223906 }
....@@ -3489,8 +4073,8 @@
34894073
34904074 void ParseVertices()
34914075 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
4076
+ boolean epsequal = Grafreed.epsequal;
4077
+ Grafreed.epsequal = true;
34944078
34954079 for (int i=0; i<group.selection.size(); i++)
34964080 {
....@@ -3515,7 +4099,7 @@
35154099 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35164100 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35174101
3518
- g.add(GrafreeD.clipboard);
4102
+ g.add(Grafreed.clipboard);
35194103
35204104 buffer.add(g);
35214105 }
....@@ -3530,7 +4114,7 @@
35304114 makeSomething(buffer, i==group.selection.size()-1);
35314115 }
35324116
3533
- GrafreeD.epsequal = epsequal;
4117
+ Grafreed.epsequal = epsequal;
35344118
35354119 refreshContents();
35364120 }
....@@ -3548,7 +4132,16 @@
35484132 String pigment = Object3D.GetPigment(tex);
35494133 //String bump = Object3D.GetBump(tex);
35504134
3551
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4135
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4136
+
4137
+ try
4138
+ {
4139
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4140
+ }
4141
+ catch (Exception e)
4142
+ {
4143
+ System.err.println("FAIL: " + node);
4144
+ }
35524145
35534146 double s = v.s;
35544147
....@@ -3636,11 +4229,11 @@
36364229
36374230 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36384231
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
4232
+ boolean random = CameraPane.SWITCH;
4233
+ CameraPane.SWITCH = false; // parse all random nodes
36414234 lowres.linkVerticesThis(null);
36424235 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
4236
+ CameraPane.SWITCH = random;
36444237
36454238 System.err.flush();
36464239
....@@ -3680,7 +4273,7 @@
36804273 return;
36814274
36824275 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4276
+ Object3D ref = Grafreed.clipboard.get(0);
36844277
36854278 Object3D newgroup = new Object3D("Po:" + poses.name);
36864279
....@@ -3874,9 +4467,9 @@
38744467
38754468 void ClipMesh()
38764469 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4470
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784471 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4472
+ Object3D content = Grafreed.clipboard.get(0);
38804473
38814474 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824475 content = ((cGroup)content).get(0);
....@@ -3885,7 +4478,7 @@
38854478 // {
38864479 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874480 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4481
+ group.selection.ClipMesh(Grafreed.clipboard);
38894482 }
38904483 // group.selection.ClipMesh(GrafreeD.clipboard);
38914484 System.out.println("DONE.");
....@@ -3932,6 +4525,18 @@
39324525 void MarkLeaves(boolean hide)
39334526 {
39344527 group.selection.MarkLeaves(hide);
4528
+ refreshContents();
4529
+ }
4530
+
4531
+ void RewindLeaves(boolean hide)
4532
+ {
4533
+ group.selection.RewindLeaves(hide);
4534
+ refreshContents();
4535
+ }
4536
+
4537
+ void RandomLeaves(boolean hide)
4538
+ {
4539
+ group.selection.RandomLeaves(hide);
39354540 refreshContents();
39364541 }
39374542
....@@ -4006,10 +4611,6 @@
40064611 // }
40074612 // }
40084613
4009
- static boolean allparams = true;
4010
-
4011
- static Vector<Object3D> listUI = new Vector<Object3D>();
4012
-
40134614 void EditSelection(boolean newWindow)
40144615 {
40154616 // aConstraints.gridy = 0;
....@@ -4017,10 +4618,10 @@
40174618 {
40184619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40194620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4020
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40214622
40224623 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
4624
+ if(elem != group || !newWindow)
40244625 {
40254626 // if (!(elem instanceof Composite))
40264627 // newWindow = false;
....@@ -4102,7 +4703,8 @@
41024703 //new Exception().printStackTrace();
41034704
41044705 freezemodel = true;
4105
-
4706
+ ClearUnpinned();
4707
+
41064708 /**/
41074709 //switch (event.id)
41084710 {
....@@ -4110,7 +4712,6 @@
41104712 //case 702: // Event.LIST_DESELECT
41114713 group.deselectAll();
41124714 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41144715 if (tps != null)
41154716 {
41164717 for (int i=0; i < tps.length; i++)
....@@ -4119,33 +4720,39 @@
41194720
41204721 //if (child.parent != null)
41214722 //child.parent.addSelectee(child);
4723
+ objEditor.SetMaterial(child);
41224724 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41264725 }
41274726 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
4727
+// else
4728
+// {
4729
+// objEditor.SetMaterial(group); // .GetMaterial());
4730
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4731
+// System.err.println("info : " + group.GetPath());
4732
+// }
41344733
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4734
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41384735 CameraPane.flash = true;
41394736
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4737
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41414738 // a camera
41424739 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4741
+ {
4742
+ CameraPane.camerachangeframe = 0; // don't refuse it
4743
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4744
+ }
41454745 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41464746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41474747 }
41484748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
41494756 refreshContents();
41504757 //return true;
41514758 }
....@@ -4154,6 +4761,35 @@
41544761
41554762 freezemodel = false;
41564763 }
4764
+
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
4773
+ void refreshContents(boolean cp)
4774
+ {
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4777
+ {
4778
+ objEditor.ClearInfo(); // .GetMaterial());
4779
+
4780
+ for (int i=0; i < group.selection.Size(); i++)
4781
+ {
4782
+ Object3D child = (Object3D) group.selection.get(i);
4783
+
4784
+ objEditor.AddInfo(child, this, true);
4785
+ System.err.println("info : " + child.GetPath());
4786
+ }
4787
+
4788
+ objEditor.SetText(); // jan 2014
4789
+ }
4790
+
4791
+ super.refreshContents(cp);
4792
+ }
41574793
41584794 void linkSomething(Object3D thing)
41594795 {
....@@ -4225,16 +4861,19 @@
42254861 {
42264862 if (group.selection.isEmpty())
42274863 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
4864
+
4865
+ Grafreed.clipboardIsTempGroup = false;
42294866 Composite tGroup = null;
42304867 if (group.selection.size() > 0) // 1)
42314868 {
42324869 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
4870
+ Grafreed.clipboardIsTempGroup = true;
42344871 }
42354872
42364873 if (cut)
42374874 {
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
42384877 //int indices[] = jList.getSelectedIndices();
42394878 //for (int i = indices.length - 1; i >= 0; i--)
42404879 //jList.remove(indices[i]);
....@@ -4270,16 +4909,16 @@
42704909 //System.out.println("cut " + child);
42714910 //System.out.println("parent = " + child.parent);
42724911 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
4912
+ if (Grafreed.clipboardIsTempGroup)
42744913 tGroup.add/*Child*/(tmp);
42754914 else
4276
- GrafreeD.clipboard = tmp;
4915
+ Grafreed.clipboard = tmp;
42774916 }
42784917 else
4279
- if (GrafreeD.clipboardIsTempGroup)
4918
+ if (Grafreed.clipboardIsTempGroup)
42804919 tGroup.add/*Child*/(child);
42814920 else
4282
- GrafreeD.clipboard = child;
4921
+ Grafreed.clipboard = child;
42834922 }
42844923
42854924 //ResetModel();
....@@ -4311,21 +4950,23 @@
43114950 //System.out.println("cut " + elem);
43124951 //System.out.println("parent = " + elem.parent);
43134952 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
4953
+ if (Grafreed.clipboardIsTempGroup)
43154954 tGroup.add/*Child*/(tmp);
43164955 else
4317
- GrafreeD.clipboard = tmp;
4956
+ Grafreed.clipboard = tmp;
43184957 }
43194958 else
4320
- if (GrafreeD.clipboardIsTempGroup)
4959
+ if (Grafreed.clipboardIsTempGroup)
43214960 tGroup.add/*Child*/(child);
43224961 else
4323
- GrafreeD.clipboard = child;
4962
+ Grafreed.clipboard = child;
43244963 }
43254964
43264965 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
4966
+
4967
+ if (Grafreed.clipboardIsTempGroup)
4968
+ Grafreed.clipboard = tGroup;
4969
+
43294970 if (cut)
43304971 {
43314972 ResetModel();
....@@ -4335,11 +4976,15 @@
43354976
43364977 void paste(boolean expand)
43374978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
43384983 // if (GrafreeD.clipboard == null)
43394984 // return;
43404985 boolean first = true;
43414986
4342
- if (GrafreeD.clipboardIsTempGroup)
4987
+ if (Grafreed.clipboardIsTempGroup)
43434988 {
43444989 Composite temp;
43454990
....@@ -4350,7 +4995,7 @@
43504995 temp = (Composite)Applet3D.clipboard.deepCopy();
43514996 */
43524997 Object3D elem;
4353
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4998
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43544999 {
43555000 Object3D child = (Object3D)e.nextElement();
43565001
....@@ -4384,21 +5029,22 @@
43845029 //Object3D cb = Applet3D.clipboard;
43855030 //temp.addChild(cb);
43865031 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4387
- assert(GrafreeD.clipboard.parent == null);
4388
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5032
+ assert(Grafreed.clipboard.parent == null);
5033
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5034
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5035
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5036
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43925037 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
5038
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5039
+ Grafreed.clipboard.get(0).parent = keepparent;
43955040 }
43965041
5042
+ Globals.REPLACEONMAKE = keep;
43975043 ResetModel();
43985044 refreshContents();
43995045 }
44005046
4401
- void pasteInto(boolean copyit)
5047
+ void pasteInto(boolean copyit, boolean clone)
44025048 {
44035049 // if (GrafreeD.clipboard == null)
44045050 // return;
....@@ -4427,15 +5073,22 @@
44275073 if (copyit)
44285074 {
44295075 // paste(false);
4430
- CloneClipboard(false); // sept 2014
5076
+ if (clone)
5077
+ {
5078
+ CloneClipboard(false); // sept 2014
5079
+ }
5080
+ else
5081
+ {
5082
+ paste(false);
5083
+ }
44315084 }
44325085 else
44335086 {
44345087 boolean first = true;
44355088
4436
- if (GrafreeD.clipboardIsTempGroup)
5089
+ if (Grafreed.clipboardIsTempGroup)
44375090 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
5091
+ Composite temp = (Composite)Grafreed.clipboard;
44395092 Object3D copy;
44405093 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44415094 {
....@@ -4445,7 +5098,7 @@
44455098 }
44465099 } else
44475100 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
5101
+ linkSomething(Grafreed.clipboard); //.get(0));
44495102 }
44505103 }
44515104 }
....@@ -4522,6 +5175,10 @@
45225175
45235176 void group(Object3D csg, boolean grab)
45245177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
45255182 if (//false) // why??
45265183 !group.selection.isEmpty())
45275184 {
....@@ -4635,10 +5292,15 @@
46355292 //node.add(csg);
46365293 //makeSomething(node);
46375294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
46385296 }
46395297
46405298 void Ungroup(Object3D g)
46415299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
46425304 if (g instanceof HiddenObject)
46435305 {
46445306 HiddenObject h = (HiddenObject) g;
....@@ -4655,6 +5317,7 @@
46555317 objEditor.makeSomething(g.get(i), false);
46565318 }
46575319 }
5320
+ Globals.REPLACEONMAKE = keep;
46585321 }
46595322
46605323 void ungroup()
....@@ -4850,21 +5513,6 @@
48505513 }
48515514 */
48525515
4853
- void ImportGFD()
4854
- {
4855
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4856
- browser.show();
4857
- String filename = browser.getFile();
4858
- if (filename != null && filename.length() > 0)
4859
- {
4860
- String fullname = browser.getDirectory() + filename;
4861
-
4862
- //Object3D readobj =
4863
- objEditor.ReadGFD(fullname, objEditor);
4864
- //makeSomething(readobj);
4865
- }
4866
- }
4867
-
48685516 /*
48695517 public void Callback(Object obj)
48705518 {
....@@ -4888,26 +5536,9 @@
48885536 }
48895537 */
48905538
4891
- void ImportVRMLX3D()
4892
- {
4893
- if (GrafreeD.standAlone)
4894
- {
4895
- /**/
4896
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4897
- browser.show();
4898
- String filename = browser.getFile();
4899
- if (filename != null && filename.length() > 0)
4900
- {
4901
- String fullname = browser.getDirectory() + filename;
4902
- LoadVRMLX3D(fullname);
4903
- }
4904
- /**/
4905
- }
4906
- }
4907
-
49085539 String GetFile(String dialogName)
49095540 {
4910
- if (GrafreeD.standAlone)
5541
+ if (Grafreed.standAlone)
49115542 {
49125543 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135544 browser.show();
....@@ -4971,10 +5602,33 @@
49715602 cButton flashSelectionButton;
49725603 cButton editButton;
49735604 cButton uneditButton;
5605
+ JCheckBox allParamsButton;
49745606 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765607 cButton unselectButton;
49775608
5609
+ cButton restoreCameraButton;
5610
+
5611
+ cButton saveButton;
5612
+ cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
5631
+
49785632 cButton screenfitButton;
49795633 cButton screenfitpointButton;
49805634 cButton snapobjectButton;
....@@ -4986,14 +5640,6 @@
49865640
49875641 cButton setsupportButton;
49885642
4989
- cButton twoButton;
4990
- cButton sixButton;
4991
- cButton threeButton;
4992
- cButton sevenButton;
4993
- cButton fourButton; // full panel
4994
- cButton oneButton; // full XYZ
4995
- //cButton currentLayout;
4996
-
49975643 //
49985644 //Composite
49995645 Object3D // to do !!
....@@ -5003,9 +5649,11 @@
50035649 //JTree jTree;
50045650 private MenuItem lookAtItem;
50055651 private MenuItem lookFromItem;
5006
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
50075653 private MenuItem cutItem;
5008
- private MenuItem duplicateItem;
5654
+ private MenuItem undoItem;
5655
+ private MenuItem redoItem;
5656
+ private JMenuItem duplicateItem;
50095657 private MenuItem cloneItem;
50105658 private MenuItem cloneSupportItem;
50115659 private MenuItem overwriteGeoItem;
....@@ -5018,7 +5666,7 @@
50185666 private MenuItem linkverticesItem;
50195667 private MenuItem relinkverticesItem;
50205668 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
5669
+ private MenuItem resetAllItem;
50225670 private MenuItem stepAllItem;
50235671 private MenuItem revertMeshItem;
50245672 private MenuItem poseMeshItem;
....@@ -5029,6 +5677,7 @@
50295677 private MenuItem mergeGeometriesItem;
50305678 private MenuItem copyItem;
50315679 private MenuItem pasteItem;
5680
+ private MenuItem pasteIntoItem;
50325681 private MenuItem pasteLinkItem;
50335682 private MenuItem pasteCloneItem;
50345683 private MenuItem pasteExpandItem;
....@@ -5067,6 +5716,10 @@
50675716 private MenuItem showleavesItem;
50685717 private MenuItem markleavesItem;
50695718 private MenuItem unmarkleavesItem;
5719
+ private MenuItem rewindleavesItem;
5720
+ private MenuItem unrewindleavesItem;
5721
+ private MenuItem randomleavesItem;
5722
+ private MenuItem unrandomleavesItem;
50705723
50715724 private MenuItem flipVItem;
50725725 private MenuItem unflipVItem;
....@@ -5078,15 +5731,17 @@
50785731 private MenuItem panoTexturesItem;
50795732
50805733 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
5734
+ private MenuItem resetCentroidXZItem;
50825735 private MenuItem resetTransformItem;
5736
+ private MenuItem transformGeometryItem;
5737
+ private MenuItem transformChildrenItem;
50835738 private MenuItem hideItem;
50845739 private MenuItem grabItem;
50855740 private MenuItem backItem;
50865741 private MenuItem frontItem;
50875742 private MenuItem cameraItem;
50885743 private MenuItem compositeItem;
5089
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
50905745 private MenuItem physicsItem;
50915746 private MenuItem frameselectorItem;
50925747 private MenuItem scriptNodeItem;
....@@ -5126,7 +5781,7 @@
51265781 private MenuItem blobItem;
51275782 private MenuItem latheItem;
51285783 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
5784
+ private MenuItem overlayItem;
51305785 private MenuItem meshItem;
51315786 // private MenuItem meshGroupItem;
51325787 private MenuItem springItem;
....@@ -5148,11 +5803,6 @@
51485803 private MenuItem doubleItem;
51495804 private MenuItem tripleItem;
51505805
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51565806 private MenuItem computeAOItem;
51575807 private MenuItem recompileItem;
51585808 private MenuItem editScriptItem;
....@@ -5162,4 +5812,8 @@
51625812 private MenuItem analyzeItem;
51635813 private MenuItem dumpItem;
51645814 //boolean freezemodel = false;
5815
+
5816
+ Menu cameraMenu;
5817
+ MenuItem editCameraItem;
5818
+ MenuItem restoreCameraItem;
51655819 }