Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
GroupEditor.java
....@@ -23,6 +23,31 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ skyboxButton.setToolTipText(s);
33
+ skyboxButton.addActionListener(new ActionListener()
34
+ {
35
+ @Override
36
+ public void actionPerformed(ActionEvent e)
37
+ {
38
+ ChangeSkybox(path);
39
+ }
40
+ });
41
+ }
42
+
43
+ public void ChangeSkybox(String name)
44
+ {
45
+ cameraView.envyoff = false;
46
+ cameraView.skyboxname = name;
47
+ cameraView.skyboxext = "jpg";
48
+ cameraView.repaint();
49
+ }
50
+
2651 //ObjEditor objEditor;
2752 public void closeUI2()
2853 {
....@@ -60,6 +85,12 @@
6085 this.copy = this.group = group;
6186 //selectees = this.group.selectees;
6287
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6394 if(ui)
6495 SetupUI(objEditor);
6596 }
....@@ -74,16 +105,28 @@
74105 this.copy = this.group = copy;
75106 //selectees = this.group.selectees;
76107
77
- SetupMenu2(objEditor);
108
+ SetupMenu2(this); //objEditor);
78109 SetupUI2(objEditor);
79110 objEditor.SetupUI(true);
80111 SetupViews(objEditor);
81112
82113 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114
+
115
+ if (copy.versions == null)
116
+ {
117
+ copy.versions = new byte[100][];
118
+ copy.versionindex = -1;
119
+
120
+ Save(true);
121
+ }
83122 }
84123
85124 void CloneSelection(boolean supports)
86125 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
87130 // Object3D keep = GrafreeD.clipboard;
88131 //Object3D obj;
89132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +137,19 @@
94137
95138 makeSomething(clone, i==group.selection.size()-1);
96139 }
140
+ Globals.REPLACEONMAKE = keep;
97141 }
98142
99143 void CloneClipboard(boolean supports)
100144 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
145
+ assert(Grafreed.clipboard.parent == null);
146
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
147
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
148
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
149
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106150 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
151
+ makeSomething(CloneObject(Grafreed.clipboard, false));
152
+ Grafreed.clipboard.get(0).parent = keepparent;
109153 }
110154
111155 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +163,7 @@
119163 // obj.support = null;
120164 if (!supports)
121165 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
166
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123167 obj.parent = parent;
124168 // obj.support = support;
125169 // clone.support = support; // aout 2013
....@@ -148,28 +192,21 @@
148192
149193 //JTextField nameField;
150194
151
- void SetupMenu2(ObjEditor oe)
195
+ void SetupMenu2(GroupEditor oe)
152196 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
197
+ oe.jTree = new cTree();
198
+
168199 Menu menu;
169200 oe.menuBar.add(menu = new Menu("Edit"));
170201 //editItem = menu.add(new MenuItem("Edit"));
171202 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
203
+
204
+// undoItem = menu.add(new MenuItem("Undo"));
205
+// undoItem.addActionListener(this);
206
+// redoItem = menu.add(new MenuItem("Redo"));
207
+// redoItem.addActionListener(this);
208
+// menu.add("-");
209
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173210 duplicateItem.addActionListener(this);
174211 cloneItem = menu.add(new MenuItem("Clone"));
175212 cloneItem.addActionListener(this);
....@@ -185,7 +222,6 @@
185222 copyItem.addActionListener(this);
186223 pasteItem = menu.add(new MenuItem("Paste"));
187224 pasteItem.addActionListener(this);
188
- menu.add("-");
189225
190226 menu.add("-");
191227 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +233,8 @@
197233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198234 // pasteExpandItem.addActionListener(this);
199235 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
202238
203239 if (Globals.ADVANCED)
204240 {
....@@ -206,14 +242,97 @@
206242 clearAllItem = menu.add(new MenuItem("Clear All"));
207243 clearAllItem.addActionListener(this);
208244 }
245
+
246
+ menuBar.add(cameraMenu = new Menu("View"));
247
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
248
+ //zBufferItem.addActionListener(this);
249
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
250
+ //normalLensItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
253
+
254
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
255
+// toggleFullScreenItem.addItemListener(this);
256
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
257
+// cameraMenu.add("-");
258
+//
259
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
260
+// toggleTextureItem.addItemListener(this);
261
+// toggleTextureItem.setState(CameraPane.textureon);
262
+//
263
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
264
+// toggleSwitchItem.addItemListener(this);
265
+// toggleSwitchItem.setState(CameraPane.SWITCH);
266
+
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
268
+ toggleHandleItem.addItemListener(this);
269
+ toggleHandleItem.setState(CameraPane.HANDLES);
270
+
271
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
272
+ togglePaintItem.addItemListener(this);
273
+ togglePaintItem.setState(CameraPane.PAINTMODE);
274
+
275
+ if (Globals.ADVANCED)
276
+ {
277
+ cameraMenu.add("-");
278
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
279
+ toggleLiveItem.addItemListener(this);
280
+ toggleLiveItem.setState(Globals.isLIVE());
209281
282
+ cameraMenu.add(stepItem = new MenuItem("Step"));
283
+ stepItem.addActionListener(this);
284
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
285
+ // toggleDLItem.addItemListener(this);
286
+ // toggleDLItem.setState(false);
287
+
288
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
289
+ toggleRenderItem.addItemListener(this);
290
+ toggleRenderItem.setState(!CameraPane.frozen);
291
+
292
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
293
+ toggleDebugItem.addItemListener(this);
294
+ toggleDebugItem.setState(Globals.DEBUG);
295
+
296
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
297
+ toggleFrustumItem.addItemListener(this);
298
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
299
+
300
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
301
+ toggleFootContactItem.addItemListener(this);
302
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
303
+
304
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
305
+ toggleTimelineItem.addItemListener(this);
306
+ }
307
+
308
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
309
+// toggleRootItem.addItemListener(this);
310
+// toggleRootItem.setState(false);
311
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
312
+// animationItem.addItemListener(this);
313
+// animationItem.setState(CameraPane.ANIMATION);
314
+ cameraMenu.add("-");
315
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
316
+ editCameraItem.addActionListener(this);
317
+
318
+ if (Globals.ADVANCED)
319
+ {
320
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
321
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
323
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
324
+ oe.cameraMenu.add("-");
325
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
326
+ openWindowItem.addActionListener(this);
327
+ editLeafItem.addActionListener(this);
328
+ lookAtItem.addActionListener(this);
329
+ //lookFromItem.addActinoListener(this);
330
+ //switchViewItem.addActionListener(this);
331
+ }
332
+
210333 oe.menuBar.add(menu = new Menu("Setting"));
211334 if (Globals.ADVANCED)
212335 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217336 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218337 revertMeshItem.addActionListener(this);
219338 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +372,29 @@
253372 }
254373
255374 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
258377 backItem = menu.add(new MenuItem("Back"));
259378 backItem.addActionListener(this);
260379 frontItem = menu.add(new MenuItem("Front"));
261380 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
264386 hideItem = menu.add(new MenuItem("Hidden Group"));
265387 hideItem.addActionListener(this);
388
+ }
266389 ungroupItem = menu.add(new MenuItem("Ungroup"));
267390 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
271398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272399 switchGeoItem.addActionListener(this);
273400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +402,6 @@
275402 morphItem = menu.add(new MenuItem("Morph Group"));
276403 morphItem.addActionListener(this);
277404
278
- if (Globals.ADVANCED)
279
- {
280405 menu.add("-");
281406 physicsItem = menu.add(new MenuItem("Physics"));
282407 physicsItem.addActionListener(this);
....@@ -284,30 +409,29 @@
284409 frameselectorItem.addActionListener(this);
285410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286411 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289412 }
290413
291414 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
294417 billboardItem = menu.add(new MenuItem("Billboard"));
295418 billboardItem.addActionListener(this);
296419 csgItem = menu.add(new MenuItem("CSG"));
297420 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299422 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301424 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
304430 if (Globals.ADVANCED)
305431 {
306432 menu.add("-");
307433 linkerItem = menu.add(new MenuItem("Linker"));
308434 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311435 templateItem = menu.add(new MenuItem("Template"));
312436 templateItem.addActionListener(this);
313437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -318,8 +442,12 @@
318442 resetTransformItem.addActionListener(this);
319443 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320444 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
445
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
446
+ resetCentroidXZItem.addActionListener(this);
447
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
448
+ transformGeometryItem.addActionListener(this);
449
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
450
+ transformChildrenItem.addActionListener(this);
323451
324452 oe.menuBar.add(menu = new Menu("Geometry"));
325453 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -332,7 +460,7 @@
332460 genNormalsMESHItem.addActionListener(this);
333461 if (Globals.ADVANCED)
334462 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336464 genNormalsMINEItem.addActionListener(this);
337465 }
338466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -368,6 +496,10 @@
368496 oe.menuBar.add(menu = new Menu("Attributes"));
369497 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370498 clearMaterialsItem.addActionListener(this);
499
+ resetAllItem = menu.add(new MenuItem("Reset All"));
500
+ resetAllItem.addActionListener(this);
501
+ stepAllItem = menu.add(new MenuItem("Step All"));
502
+ stepAllItem.addActionListener(this);
371503 menu.add("-");
372504 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373505 liveleavesItem.addActionListener(this);
....@@ -388,6 +520,14 @@
388520 markleavesItem.addActionListener(this);
389521 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390522 unmarkleavesItem.addActionListener(this);
523
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
524
+ rewindleavesItem.addActionListener(this);
525
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
526
+ unrewindleavesItem.addActionListener(this);
527
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
528
+ randomleavesItem.addActionListener(this);
529
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
530
+ unrandomleavesItem.addActionListener(this);
391531 menu.add("-");
392532 flipVItem = menu.add(new MenuItem("Flip V"));
393533 flipVItem.addActionListener(this);
....@@ -413,47 +553,56 @@
413553 attachBumpItem.addActionListener(this);
414554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
415555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
416557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
417558 detachPigmentItem.addActionListener(this);
418559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
419560 detachBumpItem.addActionListener(this);
561
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
562
+ embedTexturesItem.addActionListener(this);
563
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
564
+ deEmbedTexturesItem.addActionListener(this);
420565 menu.add("-");
421566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
422567 sortbysizeItem.addActionListener(this);
423568 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424569 sortbynameItem.addActionListener(this);
570
+ menu.add("-");
571
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
572
+ shareGeometriesItem.addActionListener(this);
573
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
574
+ mergeGeometriesItem.addActionListener(this);
425575 if (Globals.ADVANCED)
426576 {
427
- menu.add("-");
577
+ // Pretty much the same as duplicate and clone.
428578 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429579 extractGeometriesItem.addActionListener(this);
430580 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431581 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436582 }
437583
438584 oe.menuBar.add(menu = new Menu("Insert"));
439585 buildCreateMenu(menu);
440586
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
443
- importGFDItem.addActionListener(this);
444
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
445
- importVRMLX3DItem.addActionListener(this);
446
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
- importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
- import3DSItem.addActionListener(this);
450
-
451587 oe.menuBar.add(menu = new Menu("Tools"));
452588 buildToolsMenu(menu);
453589 }
454590
591
+
455592 void SetupUI2(ObjEditor oe)
456593 {
594
+ // June 2019
595
+ if (oe == null)
596
+ {
597
+ //super.SetupUI2(this);
598
+ //return;
599
+ }
600
+
601
+ if (copy != group)
602
+ {
603
+ //super.SetupUI2(this);
604
+ }
605
+
457606 //new Exception().printStackTrace();
458607
459608 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -482,97 +631,326 @@
482631 oe.radioPanel.add(dummyButton);
483632 oe.buttonGroup.add(dummyButton);
484633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
485638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486639
487
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- liveCB.setToolTipText("Enabled animation");
640
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
+ //minButton.setToolTipText("Minimize window");
642
+ //minButton.addActionListener(this);
643
+
644
+ if (Globals.ADVANCED)
645
+ {
646
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ maxButton.setToolTipText("Maximize window");
648
+ maxButton.addActionListener(this);
649
+ }
650
+
651
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ fullButton.setToolTipText("Full-screen window");
653
+ fullButton.addActionListener(this);
654
+
655
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ screenfitButton.setToolTipText("Screen fit");
657
+ screenfitButton.addActionListener(this);
658
+
659
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ restoreCameraButton.setToolTipText("Restore viewpoint");
661
+ restoreCameraButton.addActionListener(this);
662
+
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
665
+ saveButton.addActionListener(this);
666
+
667
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ undoButton.setToolTipText("Previous version");
669
+ undoButton.addActionListener(this);
670
+ undoButton.setEnabled(false);
671
+
672
+ cGridBag updown = new cGridBag().setVertical(true);
673
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ restoreButton.setToolTipText("Restore current");
675
+ restoreButton.addActionListener(this);
676
+ restoreButton.setEnabled(false);
677
+
678
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ replaceButton.setToolTipText("Replace current");
680
+ replaceButton.addActionListener(this);
681
+ replaceButton.setEnabled(false);
682
+
683
+ copyOptionsPanel.add(updown);
684
+
685
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ redoButton.setToolTipText("Next version");
687
+ redoButton.addActionListener(this);
688
+ redoButton.setEnabled(false);
689
+
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
691
+ liveCB.setToolTipText("Enable animation");
489692 liveCB.addItemListener(this);
490693
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492695 oneStepButton.setToolTipText("Animate one step forward");
493696 oneStepButton.addActionListener(this);
494697
495
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
496699 fastCB.setToolTipText("Fast mode");
497700 fastCB.addItemListener(this);
498701
499
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
500
- trackCB.setToolTipText("Enable tracking");
501
- trackCB.addItemListener(this);
502
-
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- screenfitButton.setToolTipText("Screen fit");
505
- screenfitButton.addActionListener(this);
702
+ //oe.toolboxPanel.Return();
703
+
704
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
705
+// trackCB.setToolTipText("Enable tracking");
706
+// trackCB.addItemListener(this);
506707
507708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
508709 // screenfitpointButton.addActionListener(this);
509710
510711 if (Globals.ADVANCED)
511712 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
713
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513714 snapobjectButton.addActionListener(this);
514715 snapobjectButton.setToolTipText("Snap Object");
716
+
717
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ fourButton.addActionListener(this);
719
+ fourButton.setToolTipText("Show control panel only");
515720 }
516721
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
518
- flashSelectionButton.setToolTipText("Show selection");
519
- flashSelectionButton.addActionListener(this);
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
520723
521
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522
-
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
524
- twoButton.setToolTipText("Show center view only");
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
525726 twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
527
- fourButton.addActionListener(this);
528
- fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
530
- sixButton.setToolTipText("2-column layout left");
531
- sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
533
- threeButton.setToolTipText("2-column layout right");
727
+ this.fullscreenLayout = twoButton;
728
+
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
534731 threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
536
- sevenButton.setToolTipText("3-column layout");
537
- sevenButton.addActionListener(this);
732
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ sixButton.setToolTipText("Show 3D view and controls");
734
+ sixButton.addActionListener(this);
735
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+// sevenButton.setToolTipText("3-column layout");
737
+// sevenButton.addActionListener(this);
538738 //
539739
540
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
541
- rootButton.setToolTipText("Edit selection in new tab");
740
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ rootButton.setToolTipText("Open selection in new tab");
542742 rootButton.addActionListener(this);
543743
544
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
545745 closeButton.setToolTipText("Close tab");
546746 closeButton.addActionListener(this);
547747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
548748 //clearButton.addActionListener(this);
549
-
550
- cGridBag commandsPanel = new cGridBag();
749
+
750
+ cGridBag row1 = new cGridBag();
551751
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
553
- editButton.setToolTipText("Edit selection");
752
+ // INSERT
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ gridButton.setToolTipText("Create grid");
755
+ gridButton.addActionListener(this);
756
+
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ boxButton.setToolTipText("Create box");
759
+ boxButton.addActionListener(this);
760
+
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ sphereButton.setToolTipText("Create sphere");
763
+ sphereButton.addActionListener(this);
764
+
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ coneButton.setToolTipText("Create cone");
767
+ coneButton.addActionListener(this);
768
+
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ torusButton.setToolTipText("Create torus");
771
+ torusButton.addActionListener(this);
772
+
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
774
+ superButton.setToolTipText("Create superellipsoid");
775
+ superButton.addActionListener(this);
776
+
777
+ if (Globals.ADVANCED)
778
+ {
779
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ kleinButton.setToolTipText("Create Klein bottle");
781
+ kleinButton.addActionListener(this);
782
+ }
783
+
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ particlesButton.setToolTipText("Create particle system");
786
+ particlesButton.addActionListener(this);
787
+
788
+ oe.toolboxPanel.add(row1);
789
+
790
+ cGridBag row2 = new cGridBag();
791
+
792
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
793
+ groupButton.setToolTipText("Create group");
794
+ groupButton.addActionListener(this);
795
+
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ compositeButton.setToolTipText("Create composite");
798
+ compositeButton.addActionListener(this);
799
+
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ switchButton.setToolTipText("Create item switcher");
802
+ switchButton.addActionListener(this);
803
+
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ loopButton.setToolTipText("Create loop");
806
+ loopButton.addActionListener(this);
807
+
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ textureButton.setToolTipText("Create texture");
810
+ textureButton.addActionListener(this);
811
+
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ overlayButton.setToolTipText("Create overlay");
814
+ overlayButton.addActionListener(this);
815
+
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ lightButton.setToolTipText("Create light");
818
+ lightButton.addActionListener(this);
819
+
820
+ oe.toolboxPanel.add(row2);
821
+
822
+ // ENVYMAPS
823
+ cGridBag row3 = new cGridBag();
824
+ row3.preferredHeight = 20;
825
+
826
+ AddSkyboxButton("default", "rgb", row3);
827
+ AddSkyboxButton("default", "cornell", row3);
828
+ AddSkyboxButton("default", "uffizi", row3);
829
+ AddSkyboxButton("default", "CloudyHills", row3);
830
+ AddSkyboxButton("default", "skycube", row3);
831
+
832
+ oe.toolboxPanel.add(row3);
833
+
834
+ cGridBag row4 = new cGridBag();
835
+ row4.preferredHeight = 20;
836
+
837
+ AddSkyboxButton("bridge", "Bridge2", row4);
838
+ AddSkyboxButton("urban", "GamlaStan2", row4);
839
+ AddSkyboxButton("urban", "Parliament", row4);
840
+ AddSkyboxButton("urban", "Roundabout", row4);
841
+
842
+ oe.toolboxPanel.add(row4);
843
+
844
+ cGridBag row5 = new cGridBag();
845
+ row5.preferredHeight = 20;
846
+
847
+ AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
+ AddSkyboxButton("urban", "UnionSquare", row5);
851
+
852
+ oe.toolboxPanel.add(row5);
853
+
854
+ cGridBag row6 = new cGridBag();
855
+ row6.preferredHeight = 20;
856
+
857
+ AddSkyboxButton("park", "BerzeliiPark", row6);
858
+ AddSkyboxButton("park", "Buddha", row6);
859
+ AddSkyboxButton("park", "CNTower2", row6);
860
+ //AddSkyboxButton("park", "Fatbursparken", row6);
861
+ AddSkyboxButton("park", "NiagaraFalls1", row6);
862
+
863
+ oe.toolboxPanel.add(row6);
864
+
865
+ cGridBag row7 = new cGridBag();
866
+ row7.preferredHeight = 20;
867
+
868
+ AddSkyboxButton("park", "NiagaraFalls3", row7);
869
+ AddSkyboxButton("park", "Park", row7);
870
+ //AddSkyboxButton("park", "Park2", row6);
871
+ //AddSkyboxButton("park", "Path", row6);
872
+ AddSkyboxButton("park", "Pond", row7);
873
+ AddSkyboxButton("park", "Skansen", row7);
874
+
875
+ oe.toolboxPanel.add(row7);
876
+
877
+ cGridBag row8 = new cGridBag();
878
+ row8.preferredHeight = 20;
879
+
880
+ AddSkyboxButton("park", "Skansen2", row8);
881
+ AddSkyboxButton("park", "Skansen3", row8);
882
+ AddSkyboxButton("park", "Skansen4", row8);
883
+ AddSkyboxButton("park", "Skansen5", row8);
884
+
885
+ oe.toolboxPanel.add(row8);
886
+
887
+ cGridBag row9 = new cGridBag();
888
+ row9.preferredHeight = 20;
889
+
890
+ AddSkyboxButton("park", "Stairs", row9);
891
+ //AddSkyboxButton("park", "Tantolunden", row6);
892
+ //AddSkyboxButton("park", "Tantolunden3", row6);
893
+ AddSkyboxButton("park", "Tantolunden4", row9);
894
+
895
+ oe.toolboxPanel.add(row9);
896
+/*
897
+BerzeliiPark
898
+Buddha
899
+CNTower2
900
+Fatbursparken
901
+NiagaraFalls1
902
+NiagaraFalls3
903
+Park
904
+Park2
905
+Path
906
+Pond
907
+Skansen
908
+Skansen2
909
+Skansen3
910
+Skansen4
911
+Skansen5
912
+Stairs
913
+Tantolunden
914
+Tantolunden3
915
+Tantolunden4
916
+ */
917
+
918
+ for (int i=1; --i>=0;)
919
+ {
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
922
+ }
923
+
924
+ // EDIT panel
925
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
926
+ editButton.setToolTipText("Pin selection controls");
554927 editButton.addActionListener(this);
555928
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
557
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
558931 uneditButton.addActionListener(this);
559932
560
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
561
- allParamsButton.setToolTipText("Edit all params");
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
562935 allParamsButton.addActionListener(this);
563936
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
937
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565938 clearPanelButton.setToolTipText("Clear edit panel");
566939 clearPanelButton.addActionListener(this);
567940
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
941
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569942 unselectButton.setToolTipText("Unselect");
570943 unselectButton.addActionListener(this);
571944
572
- commandsPanel.preferredHeight = 1;
945
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
946
+ flashSelectionButton.setToolTipText("Highlight selection");
947
+ flashSelectionButton.addActionListener(this);
573948
574
- oe.treePanel.add(commandsPanel);
575
- oe.treePanel.Return();
949
+ editCommandsPanel.preferredHeight = 1;
950
+
951
+ SetPinStates(false);
952
+// oe.treePanel.add(commandsPanel);
953
+// oe.treePanel.Return();
576954
577955 // oe.aConstraints.gridx += 1;
578956 // oe.aConstraints.weighty = 0;
....@@ -589,32 +967,20 @@
589967
590968 JScrollPane jSP;
591969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
592
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
593971 ResetModel();
594972
595973 oe.treePanel.add(jSPPanel);
596974 oe.treePanel.Return();
597975
598
- cGridBag copyOptionsPanel = new cGridBag();
599
-
600
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
601
- colorCB.setToolTipText("Copy color when dropped");
602
- colorCB.addItemListener(this);
603
-
604
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
605
- materialCB.setToolTipText("Copy material when dropped");
606
- materialCB.addItemListener(this);
607
-
608
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
609
- textureCB.setToolTipText("Copy texture when dropped");
610
- textureCB.addItemListener(this);
611
-
612
- copyOptionsPanel.preferredHeight = 1;
613976 oe.treePanel.add(copyOptionsPanel);
614977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
615981
616
-// mainPanel.setDividerLocation(0.5); //1.0);
617
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
618984
619985 //jList.addListSelectionListener(this);
620986 oe.jTree.addTreeSelectionListener(this);
....@@ -622,7 +988,7 @@
622988 //jTree.setEditable(true);
623989 oe.jTree.setDragEnabled(true);
624990 //jTree.setPreferredSize(new Dimension(10,10));
625
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
626992
627993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
628994
....@@ -634,29 +1000,49 @@
6341000 dgr.addDragGestureListener(this);
6351001 }catch(Exception e) {}
6361002 */
637
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
6381004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6391005 }
6401006
6411007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6421008 {
1009
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1010
+ colorCB.setToolTipText("Copy color when dropped");
1011
+ colorCB.addItemListener(this);
1012
+
1013
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1014
+ materialCB.setToolTipText("Copy material when dropped");
1015
+ materialCB.addItemListener(this);
1016
+
1017
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1018
+ textureCB.setToolTipText("Copy texture when dropped");
1019
+ textureCB.addItemListener(this);
1020
+
1021
+ panel.Return();
1022
+
6431023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6441024 boxCB.setToolTipText("Display bounding boxes");
6451025 boxCB.addItemListener(this);
6461026
6471027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
648
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
6491029 zoomBoxCB.addItemListener(this);
6501030
651
- if (Globals.ADVANCED)
1031
+ if (true) // Globals.ADVANCED)
6521032 {
653
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654
- supportCB.setToolTipText("Enable rigging");
655
- supportCB.addItemListener(this);
1033
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1034
+// supportCB.setToolTipText("Enable rigging");
1035
+// supportCB.addItemListener(this);
1036
+
1037
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1038
+ freezeCB.setToolTipText("Fast moving camera");
1039
+ freezeCB.addItemListener(this);
6561040
6571041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6581042 // localCB.addItemListener(this);
6591043
1044
+ panel.Return();
1045
+
6601046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6611047 crowdCB.setToolTipText("Used for crowds");
6621048 crowdCB.addItemListener(this);
....@@ -673,6 +1059,8 @@
6731059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6741060 // speakerMocapCB.addItemListener(this);
6751061
1062
+ panel.Return();
1063
+
6761064 if (false)
6771065 {
6781066 // handled in scripts
....@@ -687,42 +1075,85 @@
6871075 //constraints.gridy += 1;
6881076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6891077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
6901079 }
6911080
6921081 //constraints.gridx += 1;
6931082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6941083 // debugCB.addItemListener(this);
6951084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
6961089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
6971091 oeilCB.addItemListener(this);
6981092
1093
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1094
+ shadowCB.setToolTipText("When live compute shadows");
1095
+ shadowCB.addItemListener(this);
1096
+
1097
+ panel.Return();
1098
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1099
+ toggleTextureCB.setToolTipText("Load textures");
1100
+ toggleTextureCB.addItemListener(this);
1101
+
1102
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1103
+ toggleSwitchCB.setToolTipText("Choose a single item");
1104
+ toggleSwitchCB.addItemListener(this);
1105
+
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
1109
+
1110
+ panel.Return();
1111
+ if (Globals.ADVANCED)
1112
+ {
6991113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7001114 lookAtCB.setToolTipText("Look-at target");
7011115 lookAtCB.addItemListener(this);
1116
+ }
7021117
7031118 }
7041119
7051120 cGridBag fill = new cGridBag();
706
-
7071121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
7081126
7091127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
7101130
7111131 }
7121132
7131133 void EditObject(Object3D obj)
7141134 {
7151135 cRadio radioButton = new cRadio(obj.name);
1136
+
1137
+ // June 2019. Patch to avoid bug with transparency.
1138
+ radioButton.hadMaterial = obj.material != null;
1139
+ if (!radioButton.hadMaterial)
1140
+ {
1141
+ obj.material = new cMaterial();
1142
+ }
1143
+
7161144 radioButton.SetObject(obj);
717
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
7181146 radioButton.SetCamera(cameraView.renderCamera, false);
7191147 radioButton.addActionListener(this);
7201148 radioPanel.add(radioButton);
7211149 buttonGroup.add(radioButton);
7221150 radioButton.doClick();
7231151 }
1152
+
7241153 void SetupViews(ObjEditor oe)
7251154 {
1155
+ theFrame = this;
1156
+
7261157 oe.SetupViews();
7271158
7281159 System.out.println("SetupViews");
....@@ -731,23 +1162,28 @@
7311162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7321163 }
7331164
734
- JCheckBox liveCB;
735
- JCheckBox supportCB;
736
- JCheckBox localCB;
737
- JCheckBox crowdCB;
738
- JCheckBox smoothCB;
739
- JCheckBox fastCB;
740
- JCheckBox slowCB;
741
- JCheckBox boxCB;
742
- JCheckBox zoomBoxCB;
743
- JCheckBox trackCB;
744
- JCheckBox smoothfocusCB;
1165
+ cToggleButton liveCB;
1166
+ cCheckBox supportCB;
1167
+ cCheckBox localCB;
1168
+ cCheckBox crowdCB;
1169
+ cCheckBox smoothCB;
1170
+ cToggleButton fastCB;
1171
+ cCheckBox slowCB;
1172
+ cCheckBox boxCB;
1173
+ cCheckBox zoomBoxCB;
1174
+ cCheckBox freezeCB;
1175
+ //cToggleButton trackCB;
1176
+ cCheckBox trackCB;
1177
+ cCheckBox smoothfocusCB;
7451178 // JCheckBox speakerMocapCB;
746
- JCheckBox speakerCameraCB;
747
- JCheckBox speakerFocusCB;
748
- JCheckBox debugCB;
749
- JCheckBox oeilCB;
750
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
7511187
7521188 // static int COLOR = 1;
7531189 // static int MATERIAL = 2;
....@@ -755,9 +1191,9 @@
7551191
7561192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7571193
758
- JCheckBox colorCB;
759
- JCheckBox materialCB;
760
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
7611197
7621198 public void itemStateChanged(ItemEvent e)
7631199 {
....@@ -785,6 +1221,7 @@
7851221 } else if(e.getSource() == liveCB)
7861222 {
7871223 cameraView.ToggleLive();
1224
+ refreshContents(false);
7881225 }
7891226 else if(e.getSource() == supportCB)
7901227 {
....@@ -849,6 +1286,18 @@
8491286 {
8501287 cameraView.ToggleOeil();
8511288 }
1289
+ else if(e.getSource() == shadowCB)
1290
+ {
1291
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1292
+ }
1293
+ else if(e.getSource() == freezeCB)
1294
+ {
1295
+ Globals.FREEZEONMOVE ^= true;
1296
+ }
1297
+ else if(e.getSource() == autokeepCB)
1298
+ {
1299
+ Globals.REPLACEONMAKE ^= true;
1300
+ }
8521301 else if(e.getSource() == lookAtCB)
8531302 {
8541303 cameraView.ToggleLookAt();
....@@ -865,7 +1314,8 @@
8651314
8661315 /**/
8671316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
868
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
8691319 if ((path == null) || (path.getPathCount() <= 1)) {
8701320 // We can't move the root node or an empty selection
8711321 return;
....@@ -928,8 +1378,6 @@
9281378 }
9291379 }
9301380
931
- String string = (String) object;
932
-
9331381 System.out.println("Transfer = " + object + "; drop : " + target);
9341382 // if( object instanceof java.io.File[])
9351383 // {
....@@ -937,7 +1385,11 @@
9371385 // objEditor.DropFile((java.io.File[]) object, true);
9381386 // return;
9391387 // }
940
- if (string.charAt(0) == '/')
1388
+
1389
+ String string = object.toString();
1390
+
1391
+ // File path for Mac and Windows
1392
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9411393 {
9421394 // file(s)
9431395 String[] names = string.split("\n");
....@@ -964,7 +1416,7 @@
9641416
9651417 flashIt = false;
9661418 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1419
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681420 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691421
9701422 if (group.selection.size() == 1)
....@@ -980,23 +1432,33 @@
9801432
9811433 assert target == objEditor.jTree;
9821434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
9831436 try {
984
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9851438 } catch (Exception e) {
9861439 System.out.println("destinationPath : " + destinationPath);
9871440 return;
9881441 }
9891442
990
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
9911444 {
1445
+ Object3D child = (Object3D)group.selection.elementAt(i);
1446
+
1447
+ // Cannot move into itself
1448
+ if (child == destinationLeaf)
1449
+ return;
1450
+ }
1451
+
1452
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1453
+// {
9921454 loadClipboard(true);
9931455 objEditor.jTree.setSelectionPath(destinationPath);
9941456 pasteInto(false, false);
995
- } else {
996
- loadClipboard(false);
997
- objEditor.jTree.setSelectionPath(destinationPath);
998
- pasteInto(false, false); // true); // ???
999
- }
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
10001462 }
10011463 public void dropActionChanged(DropTargetDragEvent dtde)
10021464 // Called if the user has modified the current drop gesture
....@@ -1101,22 +1563,30 @@
11011563 {
11021564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11031565 //heightFieldItem.addActionListener(this);
1104
- gridItem = menu.add(new MenuItem("Grid"));
1105
- gridItem.addActionListener(this);
1106
- rectoidItem = menu.add(new MenuItem("Box"));
1107
- rectoidItem.addActionListener(this);
1108
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1109
- ellipsoidItem.addActionListener(this);
1110
- coneItem = menu.add(new MenuItem("Cone"));
1111
- coneItem.addActionListener(this);
1112
- torusItem = menu.add(new MenuItem("Torus"));
1113
- torusItem.addActionListener(this);
1114
- superItem = menu.add(new MenuItem("Superellipsoid"));
1115
- superItem.addActionListener(this);
1566
+// gridItem = menu.add(new MenuItem("Grid"));
1567
+// gridItem.addActionListener(this);
1568
+// rectoidItem = menu.add(new MenuItem("Box"));
1569
+// rectoidItem.addActionListener(this);
1570
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1571
+// ellipsoidItem.addActionListener(this);
1572
+// coneItem = menu.add(new MenuItem("Cone"));
1573
+// coneItem.addActionListener(this);
1574
+// torusItem = menu.add(new MenuItem("Torus"));
1575
+// torusItem.addActionListener(this);
1576
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1577
+// superItem.addActionListener(this);
1578
+
1579
+ cameraItem = menu.add(new MenuItem("Camera"));
1580
+ cameraItem.addActionListener(this);
1581
+
1582
+ if (!Globals.ADVANCED)
1583
+ {
11161584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11171585 kleinItem.addActionListener(this);
1118
- particleItem = menu.add(new MenuItem("Particle system"));
1119
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
11201590 if (Globals.ADVANCED)
11211591 {
11221592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1142,15 +1612,15 @@
11421612 }
11431613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11441614 bezierItem.addActionListener(this);
1145
- overlayItem = menu.add(new MenuItem("Overlay"));
1146
- overlayItem.addActionListener(this);
1147
- lightItem = menu.add(new MenuItem("Light"));
1148
- lightItem.addActionListener(this);
1615
+// overlayItem = menu.add(new MenuItem("Overlay"));
1616
+// overlayItem.addActionListener(this);
1617
+// lightItem = menu.add(new MenuItem("Light"));
1618
+// lightItem.addActionListener(this);
11491619 menu.add("-");
11501620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11511621 //superLoopItem.addActionListener(this);
1152
- loopItem = menu.add(new MenuItem("Loop"));
1153
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
11541624 doubleItem = menu.add(new MenuItem("Fork"));
11551625 doubleItem.addActionListener(this);
11561626 if (Globals.ADVANCED)
....@@ -1166,6 +1636,9 @@
11661636 animationItem.addItemListener(this);
11671637 animationItem.setState(Globals.ANIMATION);
11681638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
11691642 menu.add("-");
11701643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11711644 parseverticesItem.addActionListener(this);
....@@ -1178,6 +1651,8 @@
11781651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11791652 reduce34MorphItem.addActionListener(this);
11801653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
11811656 menu.add(computeAOItem = new MenuItem("Compute AO"));
11821657 computeAOItem.addActionListener(this);
11831658
....@@ -1186,11 +1661,9 @@
11861661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11871662 mirrorItem.addActionListener(this);
11881663 menu.add("-");
1189
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1190
- memoryItem.addActionListener(this);
11911664 menu.add(analyzeItem = new MenuItem("Analyze"));
11921665 analyzeItem.addActionListener(this);
1193
- menu.add(dumpItem = new MenuItem("Dump"));
1666
+ menu.add(dumpItem = new MenuItem("Print"));
11941667 dumpItem.addActionListener(this);
11951668 // menu.add(pathItem = new MenuItem("From-to path"));
11961669 // pathItem.addActionListener(this);
....@@ -1331,9 +1804,34 @@
13311804 shadow.material = new cMaterial(obj.material);
13321805 shadow.material.diffuse = 0.0001f;
13331806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
13341808
13351809 makeSomething(shadow);
13361810 }
1811
+
1812
+ private void ClearUnpinned()
1813
+ {
1814
+ //for (Object3D obj : listUI)
1815
+ for (int i=listUI.size(); --i>=0;)
1816
+ {
1817
+ Object3D obj = listUI.elementAt(i);
1818
+ if (!obj.pinned)
1819
+ {
1820
+ obj.CloseUI();
1821
+ listUI.remove(i);
1822
+ }
1823
+ }
1824
+ }
1825
+
1826
+ private void EditElement(Object3D elem, boolean newWindow)
1827
+ {
1828
+ // if (!(elem instanceof Composite))
1829
+ // newWindow = false;
1830
+ listUI.add(elem);
1831
+ elem.openEditWindow(this, newWindow); //, false);
1832
+ System.out.println("edit : " + elem);
1833
+ elem.editWindow.refreshContents(true); // ? new
1834
+ }
13371835
13381836 /**
13391837 * applyExample
....@@ -1537,9 +2035,9 @@
15372035
15382036 void Overwrite(int mask)
15392037 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2038
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15412039 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
2040
+ Object3D content = Grafreed.clipboard.get(0);
15432041
15442042 if (content instanceof cGroup && ((cGroup)content).transientlink )
15452043 content = ((cGroup)content).get(0);
....@@ -1578,7 +2076,7 @@
15782076 {
15792077 ScreenFit();
15802078 } else
1581
- if (source == switchItem)
2079
+ if (source == switchViewItem)
15822080 {
15832081 cVector v1 = new cVector();
15842082 cVector v2 = new cVector();
....@@ -1587,11 +2085,11 @@
15872085 objEditor.cameraView.renderCamera.setAim(v2, v1);
15882086 objEditor.cameraView.repaint();
15892087 } else
1590
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
15912089 {
15922090 makeSomething(new Box());
15932091 } else
1594
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
15952093 {
15962094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15972095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1670,27 +2168,27 @@
16702168
16712169 makeSomething(obj);
16722170 } else
1673
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
16742172 {
16752173 makeSomething(new Grid());
16762174 } else
1677
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
16782176 {
16792177 makeSomething(new Sphere());
16802178 } else
1681
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
16822180 {
16832181 makeSomething(new Cone());
16842182 } else
1685
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
16862184 {
16872185 makeSomething(new Torus());
16882186 } else
1689
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
16902188 {
16912189 makeSomething(new Superellipsoid());
16922190 } else
1693
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
16942192 {
16952193 makeSomething(new Klein());
16962194 } else
....@@ -1710,7 +2208,7 @@
17102208 {
17112209 makeSomething(new BezierSurface());
17122210 } else
1713
- if (source == overlayItem)
2211
+ if (source == overlayItem || source == overlayButton)
17142212 {
17152213 /*
17162214 Object3D obj = new BezierSurface(5,8);
....@@ -1758,10 +2256,27 @@
17582256 s.setup();
17592257 makeSomething(s);
17602258 } else
1761
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
17622260 {
17632261 makeSomething(new Light());
17642262 } else
2263
+// if (source == skybox1Button ||
2264
+// source == skybox2Button ||
2265
+// source == skybox3Button ||
2266
+// source == skybox4Button ||
2267
+// source == skybox5Button ||
2268
+// source == skybox6Button ||
2269
+// source == skybox7Button ||
2270
+// source == skybox11Button ||
2271
+// source == skybox12Button ||
2272
+// source == skybox13Button ||
2273
+// source == skybox14Button ||
2274
+// source == skybox15Button ||
2275
+// source == skybox16Button ||
2276
+// source == skybox17Button)
2277
+// {
2278
+// ChangeSkybox(source);
2279
+// } else
17652280 if (source == csgItem)
17662281 {
17672282 group(new CSG());
....@@ -1808,30 +2323,30 @@
18082323
18092324 group(g);
18102325 } else
1811
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
18122327 {
18132328 Composite csg = new GroupLeaf();
18142329 csg.count = 5;
18152330 group(csg);
1816
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
18172332 csg.addChild(child);
18182333 child.addChild(csg);
18192334 } else
18202335 if (source == doubleItem)
18212336 {
1822
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
18232338 csg.count = 5;
18242339 group(csg);
1825
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
18262341 csg.addChild(child);
18272342 child.addChild(csg);
1828
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
18292344 csg.addChild(child);
18302345 child.addChild(csg);
18312346 } else
18322347 if (source == tripleItem)
18332348 {
1834
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
18352350 csg.count = 4;
18362351 group(csg);
18372352 Composite child = new cGroup();
....@@ -1844,27 +2359,10 @@
18442359 csg.addChild(child);
18452360 child.addChild(csg);
18462361 } else
1847
-
1848
- if (source == importGFDItem)
1849
- {
1850
- ImportGFD();
1851
- } else
1852
- if (source == importVRMLX3DItem)
1853
- {
1854
- ImportVRMLX3D();
1855
- } else
1856
- if (source == import3DSItem)
1857
- {
1858
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1859
- } else
1860
- if (source == importOBJItem)
1861
- {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1863
- } else
18642362 if (source == computeAOItem)
18652363 {
18662364 Globals.drawMode = CameraPane.OCCLUSION;
1867
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
18682366 } else
18692367 if (source == recompileItem)
18702368 {
....@@ -1879,7 +2377,7 @@
18792377 if (source == invariantsItem)
18802378 {
18812379 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
2380
+ Grafreed.grafreeD.universe.invariants();
18832381 } else
18842382 if (source == memoryItem)
18852383 {
....@@ -1898,6 +2396,46 @@
18982396 {
18992397 DumpObject();
19002398 } else
2399
+ if (source == minButton)
2400
+ {
2401
+ Minimize();
2402
+ } else
2403
+ if (source == maxButton)
2404
+ {
2405
+ Maximize();
2406
+ } else
2407
+ if (source == fullButton)
2408
+ {
2409
+ ToggleFullScreen();
2410
+ } else
2411
+ if (source == undoButton)
2412
+ {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2416
+ Undo();
2417
+ } else
2418
+ if (source == restoreButton)
2419
+ {
2420
+ // Restore current version
2421
+ Restore();
2422
+ } else
2423
+ if (source == replaceButton)
2424
+ {
2425
+ // Overwrite current version
2426
+ Replace();
2427
+ } else
2428
+ if (source == redoButton)
2429
+ {
2430
+ // Go to next version
2431
+ Redo();
2432
+ } else
2433
+ if (source == saveButton)
2434
+ {
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
2438
+ } else
19012439 if (source == oneStepButton)
19022440 {
19032441 Globals.ONESTEP = true;
....@@ -1905,17 +2443,14 @@
19052443 } else
19062444 if (source == screenfitButton)
19072445 {
1908
- //Reload(lastConverter, lastFilename, true);
19092446 ScreenFit();
19102447 } else
19112448 if (source == screenfitpointButton)
19122449 {
1913
- //Reload(lastConverter, lastFilename, true);
19142450 ScreenFitPoint();
19152451 } else
19162452 if (source == snapobjectButton)
19172453 {
1918
- //Reload(lastConverter, lastFilename, true);
19192454 SnapObject();
19202455 } else
19212456 // if (event.getSource() == recompileButton)
....@@ -1952,12 +2487,20 @@
19522487 {
19532488 loadClipboard(true);
19542489 } else
2490
+ if (source == undoItem)
2491
+ {
2492
+ Undo();
2493
+ } else
2494
+ if (source == redoItem)
2495
+ {
2496
+ Redo();
2497
+ } else
19552498 if (source == duplicateItem)
19562499 {
1957
- Object3D keep = GrafreeD.clipboard;
2500
+ Object3D keep = Grafreed.clipboard;
19582501 loadClipboard(false);
19592502 paste(false);
1960
- GrafreeD.clipboard = keep;
2503
+ Grafreed.clipboard = keep;
19612504 } else
19622505 if (source == cloneItem)
19632506 {
....@@ -2177,9 +2720,9 @@
21772720 // group.selection.get(0).setMasterThis(content); // should be identity
21782721 // refreshContents();
21792722 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2723
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812724 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2725
+ Object3D content = Grafreed.clipboard.get(0);
21832726
21842727 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852728 content = ((cGroup)content).get(0);
....@@ -2229,9 +2772,9 @@
22292772 } else
22302773 if (source == setMasterItem)
22312774 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2775
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332776 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2777
+ Object3D content = Grafreed.clipboard.get(0);
22352778
22362779 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372780 content = ((cGroup)content).get(0);
....@@ -2244,9 +2787,9 @@
22442787 {
22452788 if (group.selection.size() == 1)
22462789 {
2247
- if (GrafreeD.clipboard.size() == 1)
2790
+ if (Grafreed.clipboard.size() == 1)
22482791 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2792
+ Object3D content = Grafreed.clipboard.get(0);
22502793
22512794 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522795 content = ((cGroup)content).get(0);
....@@ -2263,7 +2806,7 @@
22632806 {
22642807 RevertMeshes();
22652808 } else
2266
- if (source == resetMeshItem)
2809
+ if (source == resetAllItem)
22672810 {
22682811 ResetAll();
22692812 } else
....@@ -2271,7 +2814,7 @@
22712814 {
22722815 StepAll();
22732816 } else
2274
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
22752818 {
22762819 //int indices[] = jList.getSelectedIndices();
22772820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2283,9 +2826,9 @@
22832826 {
22842827 ClearSelection(true);
22852828 } else
2286
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
22872830 {
2288
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
22892832 } else
22902833 if (source == hideItem)
22912834 {
....@@ -2303,11 +2846,11 @@
23032846 {
23042847 makeSomething(new Camera());
23052848 } else
2306
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
23072850 {
23082851 group(new Composite());
23092852 } else
2310
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
23112854 {
23122855 RandomNode random = new RandomNode();
23132856 group(random);
....@@ -2409,7 +2952,7 @@
24092952 {
24102953 group(new cLinker());
24112954 } else
2412
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
24132956 {
24142957 group(new TextureNode());
24152958 } else
....@@ -2429,17 +2972,30 @@
24292972 {
24302973 CastShadow(2);
24312974 } else
2432
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
24332976 {
2434
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
24352979 for (int i=0; i<group.selection.size(); i++)
24362980 {
2437
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
24382986 }
24392987
2440
- ClearSelection(false);
2441
-
2442
- refreshContents();
2988
+ if (!hasRoot)
2989
+ {
2990
+ for (int i=0; i<group.selection.size(); i++)
2991
+ {
2992
+ Ungroup(group.selection.get(i));
2993
+ }
2994
+
2995
+ ClearSelection(false);
2996
+
2997
+ refreshContents();
2998
+ }
24432999 } else
24443000 if (source == genUVItem)
24453001 {
....@@ -2451,7 +3007,7 @@
24513007 } else
24523008 if (source == genNormalsMESHItem)
24533009 {
2454
- GenNormals(true); // TODO
3010
+ GenNormalsMESH();
24553011 } else
24563012 if (source == genNormalsORGANItem)
24573013 {
....@@ -2516,6 +3072,22 @@
25163072 if (source == unmarkleavesItem)
25173073 {
25183074 MarkLeaves(false);
3075
+ } else
3076
+ if (source == rewindleavesItem)
3077
+ {
3078
+ RewindLeaves(true);
3079
+ } else
3080
+ if (source == unrewindleavesItem)
3081
+ {
3082
+ RewindLeaves(false);
3083
+ } else
3084
+ if (source == randomleavesItem)
3085
+ {
3086
+ RandomLeaves(true);
3087
+ } else
3088
+ if (source == unrandomleavesItem)
3089
+ {
3090
+ RandomLeaves(false);
25193091 } else
25203092 if (source == flipVItem)
25213093 {
....@@ -2601,9 +3173,13 @@
26013173 {
26023174 SmoothMesh();
26033175 } else
2604
- if (source == transformgeometryItem)
3176
+ if (source == transformGeometryItem)
26053177 {
26063178 TransformGeometry();
3179
+ } else
3180
+ if (source == transformChildrenItem)
3181
+ {
3182
+ TransformChildren();
26073183 } else
26083184 if (source == resetTransformItem)
26093185 {
....@@ -2611,7 +3187,11 @@
26113187 } else
26123188 if (source == resetCentroidItem)
26133189 {
2614
- ResetCentroid();
3190
+ ResetCentroid(true);
3191
+ } else
3192
+ if (source == resetCentroidXZItem)
3193
+ {
3194
+ ResetCentroid(false);
26153195 } else
26163196 if (source == resetParentItem)
26173197 {
....@@ -2716,7 +3296,7 @@
27163296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27173297 {
27183298 obj = (Object3D)e.nextElement();
2719
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
27203300 }
27213301
27223302 refreshContents();
....@@ -2732,6 +3312,31 @@
27323312
27333313 refreshContents();
27343314 } else
3315
+ if (source == embedTexturesItem)
3316
+ {
3317
+ Object3D obj;
3318
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3319
+ {
3320
+ obj = (Object3D)e.nextElement();
3321
+ obj.EmbedTextures(true);
3322
+ }
3323
+
3324
+ refreshContents();
3325
+ } else
3326
+ if (source == deEmbedTexturesItem)
3327
+ {
3328
+ Object3D obj;
3329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3330
+ {
3331
+ obj = (Object3D)e.nextElement();
3332
+ obj.EmbedTextures(false);
3333
+ }
3334
+
3335
+ CameraPane.texturepigment.clear();
3336
+ CameraPane.texturebump.clear();
3337
+
3338
+ refreshContents();
3339
+ } else
27353340 if (source == flashSelectionButton)
27363341 {
27373342 CameraPane.flash = true;
....@@ -2743,6 +3348,10 @@
27433348 if (source == twoButton)
27443349 {
27453350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
27463355 // bug
27473356 //gridPanel.setDividerLocation(1.0);
27483357 //bigPanel.setDividerLocation(0.0);
....@@ -2775,10 +3384,31 @@
27753384 bigThree.ClearUI();
27763385 bigThree.add(centralPanel);
27773386 bigThree.FlushUI();
3387
+
3388
+ cameraView.requestFocusInWindow();
3389
+
3390
+// refreshContents(true);
3391
+//
3392
+// try
3393
+// {
3394
+// java.awt.Robot bot = new java.awt.Robot();
3395
+// int mask = InputEvent.BUTTON1_MASK;
3396
+// bot.mouseMove(100, 100);
3397
+// bot.mousePress(mask);
3398
+// bot.mouseRelease(mask);
3399
+// }
3400
+// catch (Exception e)
3401
+// {
3402
+//
3403
+// }
3404
+
27783405 } else
27793406 if (source == threeButton)
27803407 {
27813408 radio.layout = threeButton;
3409
+
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
27823412
27833413 // bigThree.remove(scenePanel);
27843414 // bigThree.remove(centralPanel);
....@@ -2808,13 +3438,18 @@
28083438 // centralPanel.setVisible(true);
28093439 // XYZPanel.setVisible(true);
28103440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
28113442 bigThree.add(centralPanel);
2812
- bigThree.add(XYZPanel);
28133443 bigThree.FlushUI();
3444
+
3445
+ cameraView.requestFocusInWindow();
28143446 } else
28153447 if (source == fourButton)
28163448 {
28173449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
28183453
28193454 // bigThree.remove(scenePanel);
28203455 // bigThree.remove(centralPanel);
....@@ -2846,10 +3481,15 @@
28463481 bigThree.ClearUI();
28473482 bigThree.add(scenePanel);
28483483 bigThree.FlushUI();
3484
+
3485
+ cameraView.requestFocusInWindow();
28493486 } else
28503487 if (source == sixButton)
28513488 {
28523489 radio.layout = sixButton;
3490
+
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
28533493
28543494 // bigThree.remove(scenePanel);
28553495 // bigThree.remove(centralPanel);
....@@ -2879,13 +3519,18 @@
28793519 // centralPanel.setVisible(true);
28803520 // XYZPanel.setVisible(false);
28813521 bigThree.ClearUI();
2882
- bigThree.add(scenePanel);
28833522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
28843524 bigThree.FlushUI();
3525
+
3526
+ cameraView.requestFocusInWindow();
28853527 } else
28863528 if (source == sevenButton)
28873529 {
28883530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
28893534
28903535 // bigThree.remove(scenePanel);
28913536 // bigThree.remove(centralPanel);
....@@ -2919,6 +3564,8 @@
29193564 bigThree.add(centralPanel);
29203565 bigThree.add(XYZPanel);
29213566 bigThree.FlushUI();
3567
+
3568
+ cameraView.requestFocusInWindow();
29223569 } else
29233570 if (source == rootButton)
29243571 {
....@@ -2930,6 +3577,7 @@
29303577 EditObject(obj);
29313578 }
29323579
3580
+ cameraView.requestFocusInWindow();
29333581 refreshContents(true);
29343582 } else
29353583 if (source == closeButton)
....@@ -2939,22 +3587,37 @@
29393587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29403588 {
29413589 ab = (cRadio)e.nextElement();
2942
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29433591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
29443598 buttonGroup.remove(ab);
29453599 radioPanel.remove(ab);
29463600
2947
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
29483603 // ab.GetObject().objectUI = null; // ?????????
29493604
29503605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29513606 break;
29523607 }
29533608 }
3609
+
3610
+ cameraView.requestFocusInWindow();
29543611 refreshContents(true);
29553612 } else
29563613 if (source == editItem || source == editButton)
29573614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
29583621 EditSelection(false);
29593622 } else
29603623 if (source == uneditButton)
....@@ -2964,10 +3627,11 @@
29643627 Object3D child = (Object3D)e.nextElement();
29653628 if(child.editWindow != null)
29663629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
29673631 child.CloseUI();
29683632 listUI.remove(child);
29693633
2970
- child.editWindow = null; // ???????????
3634
+ //child.editWindow = null; // ???????????
29713635 }
29723636 objEditor.ctrlPanel.FlushUI();
29733637 //objEditor.jTree.clearSelection();
....@@ -2980,6 +3644,7 @@
29803644 //copy.ClearUI();
29813645 for (Object3D obj : listUI)
29823646 {
3647
+ obj.pinned = false;
29833648 obj.CloseUI();
29843649 }
29853650 listUI.clear();
....@@ -2989,7 +3654,7 @@
29893654 {
29903655 assert(copy == group);
29913656
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29933658
29943659 for (Object3D obj : listUI)
29953660 {
....@@ -3038,6 +3703,9 @@
30383703 }
30393704
30403705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
30413709 //Globals.theRenderer.object = group;
30423710 if(!useclient)
30433711 {
....@@ -3053,20 +3721,46 @@
30533721 frontView.object = group;
30543722 sideView.object = group;
30553723 }
3056
- group.editWindow = this;
3724
+
3725
+// fix "+" issue
3726
+ //group.editWindow = this;
3727
+ group.manipWindow = this;
3728
+
30573729 /*
30583730 currentLayout = radio.layout;
30593731 if (currentLayout == null)
30603732 currentLayout = sevenButton;
30613733 */
30623734 radio.layout.doClick();
3735
+
3736
+ ClearUnpinned();
3737
+ //Grafreed.Assert(group != null);
3738
+ //Grafreed.Assert(group.selection != null);
3739
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3740
+ if (group.selection == null || group.selection.size() == 1)
3741
+ EditSelection(false);
30633742 keepparent = group.parent;
30643743 // PARENT = NULL or not???
30653744 //group.parent = null; // ROOT
30663745 //group.attributes = -1;
30673746 ResetModel();
3747
+
3748
+ cameraView.requestFocusInWindow();
30683749 refreshContents(true);
3069
- }
3750
+ } else if (event.getSource() == editCameraItem)
3751
+ {
3752
+ cameraView.ProtectCamera();
3753
+ cameraView.repaint();
3754
+ return;
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3756
+ {
3757
+ cameraView.RevertCamera();
3758
+ cameraView.repaint();
3759
+ return;
3760
+ // } else if (event.getSource() == textureButton)
3761
+ // {
3762
+ // return; // true;
3763
+ }
30703764 else
30713765 {
30723766 //return super.action(event, arg);
....@@ -3075,7 +3769,6 @@
30753769 }
30763770
30773771 boolean useclient = false;
3078
- cRadio radio;
30793772
30803773 void ToggleRoot()
30813774 {
....@@ -3127,6 +3820,28 @@
31273820 refreshContents();
31283821 }
31293822
3823
+ void TransformChildren()
3824
+ {
3825
+ Object3D obj;
3826
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3827
+ {
3828
+ obj = (Object3D)e.nextElement();
3829
+ obj.KeepTextureMatrices();
3830
+ obj.TransformChildren();
3831
+ obj.RestoreTextureMatrices();
3832
+
3833
+// if (obj.parent == null)
3834
+// {
3835
+// System.out.println("NULL PARENT!");
3836
+// new Exception().printStackTrace();
3837
+// }
3838
+// else
3839
+// TouchTransform(obj);
3840
+// //obj.parent.Touch();
3841
+ }
3842
+
3843
+ refreshContents();
3844
+ }
31303845
31313846 void ResetTransform()
31323847 {
....@@ -3239,7 +3954,7 @@
32393954 refreshContents();
32403955 }
32413956
3242
- void ResetCentroid()
3957
+ void ResetCentroid(boolean full)
32433958 {
32443959 Object3D obj;
32453960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3969,16 @@
32543969 LA.matIdentity(Object3D.mat);
32553970 obj.getBounds(minima, maxima, false);
32563971 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3972
+ if (full)
3973
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583974 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593975 obj.TransformMesh(Object3D.mat);
3976
+
32603977 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3978
+ if (full)
3979
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623980 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3981
+
32633982 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643983 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653984 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3288,7 +4007,8 @@
32884007
32894008 int size = obj.MemorySize();
32904009
3291
- System.err.println((size/1024) + " KB is the size of " + obj);
4010
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4011
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32924012 }
32934013 }
32944014 catch (Exception e)
....@@ -3325,9 +4045,9 @@
33254045 obj = (Object3D)e.nextElement();
33264046
33274047 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
4048
+ Grafreed.AnalyzeObject(obj);
33294049 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
4050
+ Grafreed.AnalyzeObject(obj.bRep);
33314051
33324052 // System.err.println((size/1024) + " KB is the size of " + obj);
33334053 }
....@@ -3369,6 +4089,13 @@
33694089 void GenNormals(boolean crease)
33704090 {
33714091 group.GenNormalsS(crease);
4092
+
4093
+ refreshContents();
4094
+ }
4095
+
4096
+ void GenNormalsMESH()
4097
+ {
4098
+ group.GenNormalsMeshS();
33724099
33734100 refreshContents();
33744101 }
....@@ -3541,8 +4268,8 @@
35414268
35424269 void ParseVertices()
35434270 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
4271
+ boolean epsequal = Grafreed.epsequal;
4272
+ Grafreed.epsequal = true;
35464273
35474274 for (int i=0; i<group.selection.size(); i++)
35484275 {
....@@ -3567,7 +4294,7 @@
35674294 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35684295 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35694296
3570
- g.add(GrafreeD.clipboard);
4297
+ g.add(Grafreed.clipboard);
35714298
35724299 buffer.add(g);
35734300 }
....@@ -3582,7 +4309,7 @@
35824309 makeSomething(buffer, i==group.selection.size()-1);
35834310 }
35844311
3585
- GrafreeD.epsequal = epsequal;
4312
+ Grafreed.epsequal = epsequal;
35864313
35874314 refreshContents();
35884315 }
....@@ -3600,7 +4327,16 @@
36004327 String pigment = Object3D.GetPigment(tex);
36014328 //String bump = Object3D.GetBump(tex);
36024329
3603
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4330
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4331
+
4332
+ try
4333
+ {
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4335
+ }
4336
+ catch (Exception e)
4337
+ {
4338
+ System.err.println("FAIL: " + node);
4339
+ }
36044340
36054341 double s = v.s;
36064342
....@@ -3732,7 +4468,7 @@
37324468 return;
37334469
37344470 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
4471
+ Object3D ref = Grafreed.clipboard.get(0);
37364472
37374473 Object3D newgroup = new Object3D("Po:" + poses.name);
37384474
....@@ -3926,9 +4662,9 @@
39264662
39274663 void ClipMesh()
39284664 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4665
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304666 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4667
+ Object3D content = Grafreed.clipboard.get(0);
39324668
39334669 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344670 content = ((cGroup)content).get(0);
....@@ -3937,7 +4673,7 @@
39374673 // {
39384674 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394675 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4676
+ group.selection.ClipMesh(Grafreed.clipboard);
39414677 }
39424678 // group.selection.ClipMesh(GrafreeD.clipboard);
39434679 System.out.println("DONE.");
....@@ -3984,6 +4720,18 @@
39844720 void MarkLeaves(boolean hide)
39854721 {
39864722 group.selection.MarkLeaves(hide);
4723
+ refreshContents();
4724
+ }
4725
+
4726
+ void RewindLeaves(boolean hide)
4727
+ {
4728
+ group.selection.RewindLeaves(hide);
4729
+ refreshContents();
4730
+ }
4731
+
4732
+ void RandomLeaves(boolean hide)
4733
+ {
4734
+ group.selection.RandomLeaves(hide);
39874735 refreshContents();
39884736 }
39894737
....@@ -4058,28 +4806,25 @@
40584806 // }
40594807 // }
40604808
4061
- static boolean allparams = true;
4062
-
4063
- static Vector<Object3D> listUI = new Vector<Object3D>();
4064
-
40654809 void EditSelection(boolean newWindow)
40664810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
40674817 // aConstraints.gridy = 0;
40684818 for (int i=0; i<group.selection.size(); i++)
40694819 {
40704820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40714821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4072
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734823
40744824 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4825
+ if(elem != group || !newWindow)
40764826 {
4077
- // if (!(elem instanceof Composite))
4078
- // newWindow = false;
4079
- listUI.add(elem);
4080
- elem.openEditWindow(this, newWindow); //, false);
4081
- System.out.println("edit : " + elem);
4082
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
40834828 }
40844829 }
40854830 }
....@@ -4154,7 +4899,8 @@
41544899 //new Exception().printStackTrace();
41554900
41564901 freezemodel = true;
4157
-
4902
+ ClearUnpinned();
4903
+
41584904 /**/
41594905 //switch (event.id)
41604906 {
....@@ -4162,7 +4908,6 @@
41624908 //case 702: // Event.LIST_DESELECT
41634909 group.deselectAll();
41644910 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4165
- objEditor.ClearInfo(); // .GetMaterial());
41664911 if (tps != null)
41674912 {
41684913 for (int i=0; i < tps.length; i++)
....@@ -4171,10 +4916,8 @@
41714916
41724917 //if (child.parent != null)
41734918 //child.parent.addSelectee(child);
4919
+ objEditor.SetMaterial(child);
41744920 group.addSelectee(child);
4175
- objEditor.SetMaterial(child); // .GetMaterial());
4176
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4177
- System.err.println("info : " + child.GetPath());
41784921 }
41794922 }
41804923 // else
....@@ -4184,20 +4927,28 @@
41844927 // System.err.println("info : " + group.GetPath());
41854928 // }
41864929
4187
- objEditor.SetText(); // jan 2014
4188
-
4189
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4930
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41904931 CameraPane.flash = true;
41914932
4192
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4933
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41934934 // a camera
41944935 {
4195
- CameraPane.camerachangeframe = 0; // don't refuse it
4196
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4937
+ {
4938
+ CameraPane.camerachangeframe = 0; // don't refuse it
4939
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4940
+ }
41974941 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41984942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41994943 }
42004944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
42014952 refreshContents();
42024953 //return true;
42034954 }
....@@ -4206,6 +4957,35 @@
42064957
42074958 freezemodel = false;
42084959 }
4960
+
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
4969
+ void refreshContents(boolean cp)
4970
+ {
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4973
+ {
4974
+ objEditor.ClearInfo(); // .GetMaterial());
4975
+
4976
+ for (int i=0; i < group.selection.Size(); i++)
4977
+ {
4978
+ Object3D child = (Object3D) group.selection.get(i);
4979
+
4980
+ objEditor.AddInfo(child, this, true);
4981
+ System.err.println("info : " + child.GetPath());
4982
+ }
4983
+
4984
+ objEditor.SetText(); // jan 2014
4985
+ }
4986
+
4987
+ super.refreshContents(cp);
4988
+ }
42094989
42104990 void linkSomething(Object3D thing)
42114991 {
....@@ -4277,16 +5057,19 @@
42775057 {
42785058 if (group.selection.isEmpty())
42795059 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
5060
+
5061
+ Grafreed.clipboardIsTempGroup = false;
42815062 Composite tGroup = null;
42825063 if (group.selection.size() > 0) // 1)
42835064 {
42845065 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
5066
+ Grafreed.clipboardIsTempGroup = true;
42865067 }
42875068
42885069 if (cut)
42895070 {
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
42905073 //int indices[] = jList.getSelectedIndices();
42915074 //for (int i = indices.length - 1; i >= 0; i--)
42925075 //jList.remove(indices[i]);
....@@ -4322,16 +5105,16 @@
43225105 //System.out.println("cut " + child);
43235106 //System.out.println("parent = " + child.parent);
43245107 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
5108
+ if (Grafreed.clipboardIsTempGroup)
43265109 tGroup.add/*Child*/(tmp);
43275110 else
4328
- GrafreeD.clipboard = tmp;
5111
+ Grafreed.clipboard = tmp;
43295112 }
43305113 else
4331
- if (GrafreeD.clipboardIsTempGroup)
5114
+ if (Grafreed.clipboardIsTempGroup)
43325115 tGroup.add/*Child*/(child);
43335116 else
4334
- GrafreeD.clipboard = child;
5117
+ Grafreed.clipboard = child;
43355118 }
43365119
43375120 //ResetModel();
....@@ -4363,21 +5146,23 @@
43635146 //System.out.println("cut " + elem);
43645147 //System.out.println("parent = " + elem.parent);
43655148 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
5149
+ if (Grafreed.clipboardIsTempGroup)
43675150 tGroup.add/*Child*/(tmp);
43685151 else
4369
- GrafreeD.clipboard = tmp;
5152
+ Grafreed.clipboard = tmp;
43705153 }
43715154 else
4372
- if (GrafreeD.clipboardIsTempGroup)
5155
+ if (Grafreed.clipboardIsTempGroup)
43735156 tGroup.add/*Child*/(child);
43745157 else
4375
- GrafreeD.clipboard = child;
5158
+ Grafreed.clipboard = child;
43765159 }
43775160
43785161 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
5162
+
5163
+ if (Grafreed.clipboardIsTempGroup)
5164
+ Grafreed.clipboard = tGroup;
5165
+
43815166 if (cut)
43825167 {
43835168 ResetModel();
....@@ -4387,11 +5172,15 @@
43875172
43885173 void paste(boolean expand)
43895174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
43905179 // if (GrafreeD.clipboard == null)
43915180 // return;
43925181 boolean first = true;
43935182
4394
- if (GrafreeD.clipboardIsTempGroup)
5183
+ if (Grafreed.clipboardIsTempGroup)
43955184 {
43965185 Composite temp;
43975186
....@@ -4402,7 +5191,7 @@
44025191 temp = (Composite)Applet3D.clipboard.deepCopy();
44035192 */
44045193 Object3D elem;
4405
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5194
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44065195 {
44075196 Object3D child = (Object3D)e.nextElement();
44085197
....@@ -4436,16 +5225,17 @@
44365225 //Object3D cb = Applet3D.clipboard;
44375226 //temp.addChild(cb);
44385227 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4439
- assert(GrafreeD.clipboard.parent == null);
4440
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4441
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4442
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4443
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5228
+ assert(Grafreed.clipboard.parent == null);
5229
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5230
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5231
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5232
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44445233 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
5234
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5235
+ Grafreed.clipboard.get(0).parent = keepparent;
44475236 }
44485237
5238
+ Globals.REPLACEONMAKE = keep;
44495239 ResetModel();
44505240 refreshContents();
44515241 }
....@@ -4492,9 +5282,9 @@
44925282 {
44935283 boolean first = true;
44945284
4495
- if (GrafreeD.clipboardIsTempGroup)
5285
+ if (Grafreed.clipboardIsTempGroup)
44965286 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
5287
+ Composite temp = (Composite)Grafreed.clipboard;
44985288 Object3D copy;
44995289 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45005290 {
....@@ -4504,7 +5294,7 @@
45045294 }
45055295 } else
45065296 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
5297
+ linkSomething(Grafreed.clipboard); //.get(0));
45085298 }
45095299 }
45105300 }
....@@ -4581,6 +5371,10 @@
45815371
45825372 void group(Object3D csg, boolean grab)
45835373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
45845378 if (//false) // why??
45855379 !group.selection.isEmpty())
45865380 {
....@@ -4694,10 +5488,15 @@
46945488 //node.add(csg);
46955489 //makeSomething(node);
46965490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
46975492 }
46985493
46995494 void Ungroup(Object3D g)
47005495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
47015500 if (g instanceof HiddenObject)
47025501 {
47035502 HiddenObject h = (HiddenObject) g;
....@@ -4714,6 +5513,7 @@
47145513 objEditor.makeSomething(g.get(i), false);
47155514 }
47165515 }
5516
+ Globals.REPLACEONMAKE = keep;
47175517 }
47185518
47195519 void ungroup()
....@@ -4909,21 +5709,6 @@
49095709 }
49105710 */
49115711
4912
- void ImportGFD()
4913
- {
4914
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4915
- browser.show();
4916
- String filename = browser.getFile();
4917
- if (filename != null && filename.length() > 0)
4918
- {
4919
- String fullname = browser.getDirectory() + filename;
4920
-
4921
- //Object3D readobj =
4922
- objEditor.ReadGFD(fullname, objEditor);
4923
- //makeSomething(readobj);
4924
- }
4925
- }
4926
-
49275712 /*
49285713 public void Callback(Object obj)
49295714 {
....@@ -4947,26 +5732,9 @@
49475732 }
49485733 */
49495734
4950
- void ImportVRMLX3D()
4951
- {
4952
- if (GrafreeD.standAlone)
4953
- {
4954
- /**/
4955
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4956
- browser.show();
4957
- String filename = browser.getFile();
4958
- if (filename != null && filename.length() > 0)
4959
- {
4960
- String fullname = browser.getDirectory() + filename;
4961
- LoadVRMLX3D(fullname);
4962
- }
4963
- /**/
4964
- }
4965
- }
4966
-
49675735 String GetFile(String dialogName)
49685736 {
4969
- if (GrafreeD.standAlone)
5737
+ if (Grafreed.standAlone)
49705738 {
49715739 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725740 browser.show();
....@@ -5034,7 +5802,44 @@
50345802 cButton clearpanelButton;
50355803 cButton unselectButton;
50365804
5805
+ cButton restoreCameraButton;
5806
+
5807
+ cButton saveButton;
50375808 cButton oneStepButton;
5809
+
5810
+ cButton groupButton;
5811
+ cButton ungroupButton;
5812
+ cButton compositeButton;
5813
+ cButton switchButton;
5814
+ cButton loopButton;
5815
+ cButton textureButton;
5816
+
5817
+ cButton skybox1Button;
5818
+ cButton skybox2Button;
5819
+ cButton skybox3Button;
5820
+ cButton skybox4Button;
5821
+ cButton skybox5Button;
5822
+ cButton skybox6Button;
5823
+ cButton skybox7Button;
5824
+
5825
+ cButton skybox11Button;
5826
+ cButton skybox12Button;
5827
+ cButton skybox13Button;
5828
+ cButton skybox14Button;
5829
+ cButton skybox15Button;
5830
+ cButton skybox16Button;
5831
+ cButton skybox17Button;
5832
+
5833
+ cButton gridButton;
5834
+ cButton boxButton;
5835
+ cButton sphereButton;
5836
+ cButton coneButton;
5837
+ cButton torusButton;
5838
+ cButton superButton;
5839
+ cButton kleinButton;
5840
+ cButton particlesButton;
5841
+ cButton overlayButton;
5842
+ cButton lightButton;
50385843
50395844 cButton screenfitButton;
50405845 cButton screenfitpointButton;
....@@ -5047,14 +5852,6 @@
50475852
50485853 cButton setsupportButton;
50495854
5050
- cButton twoButton;
5051
- cButton sixButton;
5052
- cButton threeButton;
5053
- cButton sevenButton;
5054
- cButton fourButton; // full panel
5055
- cButton oneButton; // full XYZ
5056
- //cButton currentLayout;
5057
-
50585855 //
50595856 //Composite
50605857 Object3D // to do !!
....@@ -5064,9 +5861,11 @@
50645861 //JTree jTree;
50655862 private MenuItem lookAtItem;
50665863 private MenuItem lookFromItem;
5067
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
50685865 private MenuItem cutItem;
5069
- private MenuItem duplicateItem;
5866
+ private MenuItem undoItem;
5867
+ private MenuItem redoItem;
5868
+ private JMenuItem duplicateItem;
50705869 private MenuItem cloneItem;
50715870 private MenuItem cloneSupportItem;
50725871 private MenuItem overwriteGeoItem;
....@@ -5079,7 +5878,7 @@
50795878 private MenuItem linkverticesItem;
50805879 private MenuItem relinkverticesItem;
50815880 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5881
+ private MenuItem resetAllItem;
50835882 private MenuItem stepAllItem;
50845883 private MenuItem revertMeshItem;
50855884 private MenuItem poseMeshItem;
....@@ -5094,7 +5893,7 @@
50945893 private MenuItem pasteLinkItem;
50955894 private MenuItem pasteCloneItem;
50965895 private MenuItem pasteExpandItem;
5097
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
50985897 private MenuItem clearAllItem;
50995898 private MenuItem genUVItem;
51005899 private MenuItem genNormalsMESHItem;
....@@ -5129,6 +5928,10 @@
51295928 private MenuItem showleavesItem;
51305929 private MenuItem markleavesItem;
51315930 private MenuItem unmarkleavesItem;
5931
+ private MenuItem rewindleavesItem;
5932
+ private MenuItem unrewindleavesItem;
5933
+ private MenuItem randomleavesItem;
5934
+ private MenuItem unrandomleavesItem;
51325935
51335936 private MenuItem flipVItem;
51345937 private MenuItem unflipVItem;
....@@ -5140,15 +5943,17 @@
51405943 private MenuItem panoTexturesItem;
51415944
51425945 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5946
+ private MenuItem resetCentroidXZItem;
51445947 private MenuItem resetTransformItem;
5948
+ private MenuItem transformGeometryItem;
5949
+ private MenuItem transformChildrenItem;
51455950 private MenuItem hideItem;
51465951 private MenuItem grabItem;
51475952 private MenuItem backItem;
51485953 private MenuItem frontItem;
51495954 private MenuItem cameraItem;
51505955 private MenuItem compositeItem;
5151
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
51525957 private MenuItem physicsItem;
51535958 private MenuItem frameselectorItem;
51545959 private MenuItem scriptNodeItem;
....@@ -5172,6 +5977,8 @@
51725977 private MenuItem attachBumpItem;
51735978 private MenuItem detachBumpItem;
51745979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
51755982
51765983 private MenuItem particleItem;
51775984 private MenuItem ragdollItem;
....@@ -5210,11 +6017,6 @@
52106017 private MenuItem doubleItem;
52116018 private MenuItem tripleItem;
52126019
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52186020 private MenuItem computeAOItem;
52196021 private MenuItem recompileItem;
52206022 private MenuItem editScriptItem;
....@@ -5224,4 +6026,8 @@
52246026 private MenuItem analyzeItem;
52256027 private MenuItem dumpItem;
52266028 //boolean freezemodel = false;
6029
+
6030
+ Menu cameraMenu;
6031
+ MenuItem editCameraItem;
6032
+ MenuItem restoreCameraItem;
52276033 }