Normand Briere
2019-05-05 623dc0fa8cbd9473830a1786f6d49fa808a09439
GroupEditor.java
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
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));
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));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -439,14 +439,17 @@
439439 buildCreateMenu(menu);
440440
441441 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..."));
442
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
447443 importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
444
+ menu.add("-");
445
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
449446 import3DSItem.addActionListener(this);
447
+ menu.add("-");
448
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
+ importVRMLX3DItem.addActionListener(this);
450
+ menu.add("-");
451
+ importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
452
+ importGFDItem.addActionListener(this);
450453
451454 oe.menuBar.add(menu = new Menu("Tools"));
452455 buildToolsMenu(menu);
....@@ -488,7 +491,7 @@
488491 liveCB.setToolTipText("Enabled animation");
489492 liveCB.addItemListener(this);
490493
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
494
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492495 oneStepButton.setToolTipText("Animate one step forward");
493496 oneStepButton.addActionListener(this);
494497
....@@ -500,7 +503,7 @@
500503 trackCB.setToolTipText("Enable tracking");
501504 trackCB.addItemListener(this);
502505
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
506
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504507 screenfitButton.setToolTipText("Screen fit");
505508 screenfitButton.addActionListener(this);
506509
....@@ -509,39 +512,39 @@
509512
510513 if (Globals.ADVANCED)
511514 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
515
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513516 snapobjectButton.addActionListener(this);
514517 snapobjectButton.setToolTipText("Snap Object");
515518 }
516519
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
520
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
518521 flashSelectionButton.setToolTipText("Show selection");
519522 flashSelectionButton.addActionListener(this);
520523
521524 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522525
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
526
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
524527 twoButton.setToolTipText("Show center view only");
525528 twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
529
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527530 fourButton.addActionListener(this);
528531 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
532
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530533 sixButton.setToolTipText("2-column layout left");
531534 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
535
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533536 threeButton.setToolTipText("2-column layout right");
534537 threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
538
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536539 sevenButton.setToolTipText("3-column layout");
537540 sevenButton.addActionListener(this);
538541 //
539542
540
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
543
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541544 rootButton.setToolTipText("Edit selection in new tab");
542545 rootButton.addActionListener(this);
543546
544
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
547
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
545548 closeButton.setToolTipText("Close tab");
546549 closeButton.addActionListener(this);
547550 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -549,11 +552,11 @@
549552
550553 cGridBag commandsPanel = new cGridBag();
551554
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
555
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553556 editButton.setToolTipText("Edit selection");
554557 editButton.addActionListener(this);
555558
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
559
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
557560 uneditButton.setToolTipText("Unedit selection");
558561 uneditButton.addActionListener(this);
559562
....@@ -561,11 +564,11 @@
561564 allParamsButton.setToolTipText("Edit all params");
562565 allParamsButton.addActionListener(this);
563566
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
567
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565568 clearPanelButton.setToolTipText("Clear edit panel");
566569 clearPanelButton.addActionListener(this);
567570
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
571
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569572 unselectButton.setToolTipText("Unselect");
570573 unselectButton.addActionListener(this);
571574
....@@ -937,7 +940,9 @@
937940 // objEditor.DropFile((java.io.File[]) object, true);
938941 // return;
939942 // }
940
- if (string.charAt(0) == '/')
943
+
944
+ // File path for Mac and Windows
945
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
941946 {
942947 // file(s)
943948 String[] names = string.split("\n");
....@@ -964,7 +969,7 @@
964969
965970 flashIt = false;
966971 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
972
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
968973 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
969974
970975 if (group.selection.size() == 1)
....@@ -1537,9 +1542,9 @@
15371542
15381543 void Overwrite(int mask)
15391544 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1545
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411546 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1547
+ Object3D content = Grafreed.clipboard.get(0);
15431548
15441549 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451550 content = ((cGroup)content).get(0);
....@@ -1859,7 +1864,15 @@
18591864 } else
18601865 if (source == importOBJItem)
18611866 {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1867
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1868
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1869
+ browser.setVisible(true);
1870
+ String filename = browser.getFile();
1871
+ if (filename != null && filename.length() > 0)
1872
+ {
1873
+ String fullname = browser.getDirectory() + filename;
1874
+ makeSomething(ReadOBJ(fullname), true);
1875
+ }
18631876 } else
18641877 if (source == computeAOItem)
18651878 {
....@@ -1879,7 +1892,7 @@
18791892 if (source == invariantsItem)
18801893 {
18811894 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
1895
+ Grafreed.grafreeD.universe.invariants();
18831896 } else
18841897 if (source == memoryItem)
18851898 {
....@@ -1954,10 +1967,10 @@
19541967 } else
19551968 if (source == duplicateItem)
19561969 {
1957
- Object3D keep = GrafreeD.clipboard;
1970
+ Object3D keep = Grafreed.clipboard;
19581971 loadClipboard(false);
19591972 paste(false);
1960
- GrafreeD.clipboard = keep;
1973
+ Grafreed.clipboard = keep;
19611974 } else
19621975 if (source == cloneItem)
19631976 {
....@@ -2177,9 +2190,9 @@
21772190 // group.selection.get(0).setMasterThis(content); // should be identity
21782191 // refreshContents();
21792192 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2193
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812194 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2195
+ Object3D content = Grafreed.clipboard.get(0);
21832196
21842197 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852198 content = ((cGroup)content).get(0);
....@@ -2229,9 +2242,9 @@
22292242 } else
22302243 if (source == setMasterItem)
22312244 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2245
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332246 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2247
+ Object3D content = Grafreed.clipboard.get(0);
22352248
22362249 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372250 content = ((cGroup)content).get(0);
....@@ -2244,9 +2257,9 @@
22442257 {
22452258 if (group.selection.size() == 1)
22462259 {
2247
- if (GrafreeD.clipboard.size() == 1)
2260
+ if (Grafreed.clipboard.size() == 1)
22482261 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2262
+ Object3D content = Grafreed.clipboard.get(0);
22502263
22512264 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522265 content = ((cGroup)content).get(0);
....@@ -3325,9 +3338,9 @@
33253338 obj = (Object3D)e.nextElement();
33263339
33273340 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3341
+ Grafreed.AnalyzeObject(obj);
33293342 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3343
+ Grafreed.AnalyzeObject(obj.bRep);
33313344
33323345 // System.err.println((size/1024) + " KB is the size of " + obj);
33333346 }
....@@ -3541,8 +3554,8 @@
35413554
35423555 void ParseVertices()
35433556 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
3557
+ boolean epsequal = Grafreed.epsequal;
3558
+ Grafreed.epsequal = true;
35463559
35473560 for (int i=0; i<group.selection.size(); i++)
35483561 {
....@@ -3567,7 +3580,7 @@
35673580 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35683581 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35693582
3570
- g.add(GrafreeD.clipboard);
3583
+ g.add(Grafreed.clipboard);
35713584
35723585 buffer.add(g);
35733586 }
....@@ -3582,7 +3595,7 @@
35823595 makeSomething(buffer, i==group.selection.size()-1);
35833596 }
35843597
3585
- GrafreeD.epsequal = epsequal;
3598
+ Grafreed.epsequal = epsequal;
35863599
35873600 refreshContents();
35883601 }
....@@ -3732,7 +3745,7 @@
37323745 return;
37333746
37343747 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
3748
+ Object3D ref = Grafreed.clipboard.get(0);
37363749
37373750 Object3D newgroup = new Object3D("Po:" + poses.name);
37383751
....@@ -3926,9 +3939,9 @@
39263939
39273940 void ClipMesh()
39283941 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3942
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39303943 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
3944
+ Object3D content = Grafreed.clipboard.get(0);
39323945
39333946 if (content instanceof cGroup && ((cGroup)content).transientlink )
39343947 content = ((cGroup)content).get(0);
....@@ -3937,7 +3950,7 @@
39373950 // {
39383951 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39393952 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
3953
+ group.selection.ClipMesh(Grafreed.clipboard);
39413954 }
39423955 // group.selection.ClipMesh(GrafreeD.clipboard);
39433956 System.out.println("DONE.");
....@@ -4277,12 +4290,12 @@
42774290 {
42784291 if (group.selection.isEmpty())
42794292 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4293
+ Grafreed.clipboardIsTempGroup = false;
42814294 Composite tGroup = null;
42824295 if (group.selection.size() > 0) // 1)
42834296 {
42844297 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4298
+ Grafreed.clipboardIsTempGroup = true;
42864299 }
42874300
42884301 if (cut)
....@@ -4322,16 +4335,16 @@
43224335 //System.out.println("cut " + child);
43234336 //System.out.println("parent = " + child.parent);
43244337 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4338
+ if (Grafreed.clipboardIsTempGroup)
43264339 tGroup.add/*Child*/(tmp);
43274340 else
4328
- GrafreeD.clipboard = tmp;
4341
+ Grafreed.clipboard = tmp;
43294342 }
43304343 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4344
+ if (Grafreed.clipboardIsTempGroup)
43324345 tGroup.add/*Child*/(child);
43334346 else
4334
- GrafreeD.clipboard = child;
4347
+ Grafreed.clipboard = child;
43354348 }
43364349
43374350 //ResetModel();
....@@ -4363,21 +4376,21 @@
43634376 //System.out.println("cut " + elem);
43644377 //System.out.println("parent = " + elem.parent);
43654378 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
4379
+ if (Grafreed.clipboardIsTempGroup)
43674380 tGroup.add/*Child*/(tmp);
43684381 else
4369
- GrafreeD.clipboard = tmp;
4382
+ Grafreed.clipboard = tmp;
43704383 }
43714384 else
4372
- if (GrafreeD.clipboardIsTempGroup)
4385
+ if (Grafreed.clipboardIsTempGroup)
43734386 tGroup.add/*Child*/(child);
43744387 else
4375
- GrafreeD.clipboard = child;
4388
+ Grafreed.clipboard = child;
43764389 }
43774390
43784391 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
4392
+ if (Grafreed.clipboardIsTempGroup)
4393
+ Grafreed.clipboard = tGroup;
43814394 if (cut)
43824395 {
43834396 ResetModel();
....@@ -4391,7 +4404,7 @@
43914404 // return;
43924405 boolean first = true;
43934406
4394
- if (GrafreeD.clipboardIsTempGroup)
4407
+ if (Grafreed.clipboardIsTempGroup)
43954408 {
43964409 Composite temp;
43974410
....@@ -4402,7 +4415,7 @@
44024415 temp = (Composite)Applet3D.clipboard.deepCopy();
44034416 */
44044417 Object3D elem;
4405
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4418
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44064419 {
44074420 Object3D child = (Object3D)e.nextElement();
44084421
....@@ -4436,14 +4449,14 @@
44364449 //Object3D cb = Applet3D.clipboard;
44374450 //temp.addChild(cb);
44384451 //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());
4452
+ assert(Grafreed.clipboard.parent == null);
4453
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4454
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4455
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4456
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44444457 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
4458
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4459
+ Grafreed.clipboard.get(0).parent = keepparent;
44474460 }
44484461
44494462 ResetModel();
....@@ -4492,9 +4505,9 @@
44924505 {
44934506 boolean first = true;
44944507
4495
- if (GrafreeD.clipboardIsTempGroup)
4508
+ if (Grafreed.clipboardIsTempGroup)
44964509 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
4510
+ Composite temp = (Composite)Grafreed.clipboard;
44984511 Object3D copy;
44994512 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45004513 {
....@@ -4504,7 +4517,7 @@
45044517 }
45054518 } else
45064519 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
4520
+ linkSomething(Grafreed.clipboard); //.get(0));
45084521 }
45094522 }
45104523 }
....@@ -4949,7 +4962,7 @@
49494962
49504963 void ImportVRMLX3D()
49514964 {
4952
- if (GrafreeD.standAlone)
4965
+ if (Grafreed.standAlone)
49534966 {
49544967 /**/
49554968 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4966,7 +4979,7 @@
49664979
49674980 String GetFile(String dialogName)
49684981 {
4969
- if (GrafreeD.standAlone)
4982
+ if (Grafreed.standAlone)
49704983 {
49714984 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49724985 browser.show();