Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
Fix manip window + new icons.
10 files modified
11 files added
260 ■■■■ changed files
Camera.java 2 ●●● patch | view | raw | blame | history
CameraPane.java 13 ●●●●● patch | view | raw | blame | history
Globals.java 2 ●●●●● patch | view | raw | blame | history
GroupEditor.java 84 ●●●●● patch | view | raw | blame | history
Mocap.java 1 ●●●● patch | view | raw | blame | history
ObjEditor.java 55 ●●●●● patch | view | raw | blame | history
Object3D.java 39 ●●●● patch | view | raw | blame | history
cButton.java 21 ●●●●● patch | view | raw | blame | history
cCheckBox.java 41 ●●●● patch | view | raw | blame | history
cFileSystemPane.java 2 ●●● patch | view | raw | blame | history
icons/add-128.png patch | view | raw | blame | history
icons/down_arrow.png patch | view | raw | blame | history
icons/fit.png patch | view | raw | blame | history
icons/fullscreen.png patch | view | raw | blame | history
icons/light-bulb.png patch | view | raw | blame | history
icons/redo.png patch | view | raw | blame | history
icons/run.png patch | view | raw | blame | history
icons/runfast.png patch | view | raw | blame | history
icons/step.png patch | view | raw | blame | history
icons/track.png patch | view | raw | blame | history
icons/undo.png patch | view | raw | blame | history
Camera.java
....@@ -20,7 +20,7 @@
2020 //<-2.2,0.7,-2> and pointed it at <-0.61,0.3,-0.6>
2121 // location = LA.newVector(2,0.7,-2);
2222 // lookAt = new cVector(0.6,0.3,-0.6);
23
- location = LA.newVector(3,2,2);
23
+ location = LA.newVector(6,4,4);
2424 lookAt = new cVector(0.0,0.5,0);
2525 direction = new cVector();
2626 toParent = LA.newMatrix();
CameraPane.java
....@@ -11459,7 +11459,7 @@
1145911459
1146011460 static boolean zoomonce = false;
1146111461
11462
- void CreateSelectedPoint()
11462
+ static void CreateSelectedPoint()
1146311463 {
1146411464 if (selectedpoint == null)
1146511465 {
....@@ -14377,7 +14377,8 @@
1437714377 info.camera = renderCamera;
1437814378 info.x = x;
1437914379 info.y = y;
14380
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14380
+ object.manipWindow.copy
14381
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1438114382 } else
1438214383 {
1438314384 if (x < startX)
....@@ -14541,9 +14542,9 @@
1454114542 ci.camera = renderCamera;
1454214543 if (!isRenderer)
1454314544 {
14544
- ObjEditor editWindow = object.editWindow;
14545
- Object3D copy = editWindow.copy;
14546
- if (copy.doEditClick(ci, 0))
14545
+ //ObjEditor editWindow = object.editWindow;
14546
+ //Object3D copy = editWindow.copy;
14547
+ if (object.doEditClick(ci, 0))
1454714548 {
1454814549 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1454914550 } else
....@@ -16622,6 +16623,8 @@
1662216623 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1662316624 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1662416625
16626
+ CreateSelectedPoint();
16627
+
1662516628 // Will fit the mesh !!!
1662616629 selectedpoint.toParent[0][0] = 0.0001;
1662716630 selectedpoint.toParent[1][1] = 0.0001;
Globals.java
....@@ -10,6 +10,8 @@
1010 public static boolean COMPUTESHADOWWHENLIVE = true;
1111 public static boolean RENDERSHADOW = true;
1212
13
+ public static boolean SAVEONMAKE = false; // problems when auto-save (works with manual save)
14
+
1315 public static boolean MOUSEDRAGGED = false;
1416
1517 // Hold on calculation when moving camera
GroupEditor.java
....@@ -580,43 +580,43 @@
580580 //minButton.setToolTipText("Minimize window");
581581 //minButton.addActionListener(this);
582582
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
583
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584584 maxButton.setToolTipText("Maximize window");
585585 maxButton.addActionListener(this);
586586
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588588 fullButton.setToolTipText("Full-screen window");
589589 fullButton.addActionListener(this);
590590
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592592 undoButton.setToolTipText("Undo changes");
593593 undoButton.addActionListener(this);
594594
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596596 redoButton.setToolTipText("Redo changes");
597597 redoButton.addActionListener(this);
598598
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600600 saveButton.setToolTipText("Save changes");
601601 saveButton.addActionListener(this);
602602
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604604 liveCB.setToolTipText("Enable animation");
605605 liveCB.addItemListener(this);
606606
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- oneStepButton.setToolTipText("Animate one step forward");
609
- oneStepButton.addActionListener(this);
610
-
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
612608 fastCB.setToolTipText("Fast mode");
613609 fastCB.addItemListener(this);
614610
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616616 trackCB.setToolTipText("Enable tracking");
617617 trackCB.addItemListener(this);
618618
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620620 screenfitButton.setToolTipText("Screen fit");
621621 screenfitButton.addActionListener(this);
622622
....@@ -630,8 +630,8 @@
630630 snapobjectButton.setToolTipText("Snap Object");
631631 }
632632
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
633
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
635635 flashSelectionButton.addActionListener(this);
636636
637637 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
....@@ -815,6 +815,10 @@
815815 shadowCB.setToolTipText("Compute shadows when live");
816816 shadowCB.addItemListener(this);
817817
818
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
818822 if (Globals.ADVANCED)
819823 {
820824 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -864,25 +868,26 @@
864868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
865869 }
866870
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- JCheckBox smoothfocusCB;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
878882 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
882886
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
886891
887892 // static int COLOR = 1;
888893 // static int MATERIAL = 2;
....@@ -890,9 +895,9 @@
890895
891896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
892897
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
896901
897902 public void itemStateChanged(ItemEvent e)
898903 {
....@@ -988,6 +993,10 @@
988993 else if(e.getSource() == shadowCB)
989994 {
990995 Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
9911000 }
9921001 else if(e.getSource() == lookAtCB)
9931002 {
....@@ -3159,7 +3168,8 @@
31593168 buttonGroup.remove(ab);
31603169 radioPanel.remove(ab);
31613170
3162
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
31633173 // ab.GetObject().objectUI = null; // ?????????
31643174
31653175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3273,6 +3283,7 @@
32733283
32743284 // fix "+" issue
32753285 //group.editWindow = this;
3286
+ group.manipWindow = this;
32763287
32773288 /*
32783289 currentLayout = radio.layout;
....@@ -4595,6 +4606,7 @@
45954606
45964607 if (cut)
45974608 {
4609
+ if (Globals.SAVEONMAKE)
45984610 Save();
45994611 //int indices[] = jList.getSelectedIndices();
46004612 //for (int i = indices.length - 1; i >= 0; i--)
Mocap.java
....@@ -501,6 +501,7 @@
501501 centroid.z = matrix[3][2];
502502 // this.getCentroid(centroid, true);
503503
504
+ CameraPane.CreateSelectedPoint();
504505 CameraPane.debugpointG.name = "";
505506 CameraPane.debugpointG.toParent[3][0] = mocaporigin.x;
506507 CameraPane.debugpointG.toParent[3][1] = mocaporigin.y;
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -37,6 +38,52 @@
3738 JFrame frame;
3839
3940 static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
44
+ try
45
+ {
46
+ ImageIcon icon = GetIcon(name);
47
+ return new cButton(icon, border);
48
+ }
49
+ catch (Exception e)
50
+ {
51
+ return new cButton(name, border);
52
+ }
53
+ }
54
+
55
+ cCheckBox GetCheckBox(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cCheckBox(name, border);
65
+ }
66
+ }
67
+
68
+ private ImageIcon GetIcon(String name) throws IOException
69
+ {
70
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
71
+
72
+ if (image.getWidth() != 24 && image.getHeight() != 24)
73
+ {
74
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
75
+ Graphics2D g = resized.createGraphics();
76
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
77
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
78
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
79
+ g.dispose();
80
+
81
+ image = resized;
82
+ }
83
+
84
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
85
+ return icon;
86
+ }
4087
4188 // SCRIPT
4289
....@@ -3408,6 +3455,8 @@
34083455
34093456 public void Save()
34103457 {
3458
+ System.err.println("Save");
3459
+
34113460 cRadio tab = GetCurrentTab();
34123461
34133462 boolean temp = CameraPane.SWITCH;
....@@ -3492,6 +3541,8 @@
34923541
34933542 public void Undo()
34943543 {
3544
+ System.err.println("Undo");
3545
+
34953546 cRadio tab = GetCurrentTab();
34963547
34973548 if (tab.undoindex == 0)
....@@ -4170,7 +4221,8 @@
41704221
41714222 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41724223 {
4173
- Save();
4224
+ if (Globals.SAVEONMAKE)
4225
+ Save();
41744226 //Tween.set(thing, 0).target(1).start(tweenManager);
41754227 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41764228 // if (thing instanceof GenericJointDemo)
....@@ -4479,6 +4531,7 @@
44794531
44804532 if (readobj != null)
44814533 {
4534
+ if (Globals.SAVEONMAKE)
44824535 Save();
44834536 try
44844537 {
Object3D.java
....@@ -181,7 +181,7 @@
181181 return;
182182 }
183183
184
- Object3D o = new Object3D();
184
+ Object3D o = new Object3D("copy of " + this.name);
185185
186186 hashtable.put(GetUUID(), o);
187187
....@@ -219,16 +219,23 @@
219219 if (!hashtable.containsKey(GetUUID()))
220220 return;
221221
222
+ if (blockloop)
223
+ return;
224
+
225
+ blockloop = true;
226
+
222227 Object3D o = hashtable.get(GetUUID());
223228
224229 RestoreBigData(o);
225230
226
- hashtable.remove(GetUUID());
231
+ //hashtable.remove(GetUUID());
227232
228233 for (int i=0; i<Size(); i++)
229234 {
230235 get(i).RestoreBigData(hashtable);
231236 }
237
+
238
+ blockloop = false;
232239 }
233240
234241 void RestoreBigData(Object3D o)
....@@ -2433,6 +2440,14 @@
24332440 {
24342441 editWindow.refreshContents();
24352442 }
2443
+ else
2444
+ {
2445
+ if (manipWindow != null)
2446
+ {
2447
+ manipWindow.refreshContents();
2448
+ }
2449
+ }
2450
+
24362451 //if (parent != null)
24372452 //parent.refreshEditWindow();
24382453 }
....@@ -4963,6 +4978,14 @@
49634978 }
49644979 }
49654980
4981
+ ObjEditor GetWindow()
4982
+ {
4983
+ if (editWindow != null)
4984
+ return editWindow;
4985
+
4986
+ return manipWindow;
4987
+ }
4988
+
49664989 cTreePath Select(int indexcount, boolean deselect)
49674990 {
49684991 if (hide || dontselect)
....@@ -4999,10 +5022,11 @@
49995022 if (leaf != null)
50005023 {
50015024 cTreePath tp = new cTreePath(this, leaf);
5002
- if (editWindow != null)
5025
+ ObjEditor window = GetWindow();
5026
+ if (window != null)
50035027 {
50045028 //System.out.println("editWindow = " + editWindow + " vs " + this);
5005
- editWindow.Select(tp, deselect, true);
5029
+ window.Select(tp, deselect, true);
50065030 }
50075031
50085032 return tp;
....@@ -5028,9 +5052,10 @@
50285052 if (leaf != null)
50295053 {
50305054 cTreePath tp = new cTreePath(this, leaf);
5031
- if (editWindow != null)
5055
+ ObjEditor window = GetWindow();
5056
+ if (window != null)
50325057 {
5033
- editWindow.Select(tp, deselect, true);
5058
+ window.Select(tp, deselect, true);
50345059 }
50355060
50365061 return tp;
....@@ -7967,6 +7992,8 @@
79677992 }
79687993
79697994 transient ObjEditor editWindow;
7995
+ transient ObjEditor manipWindow;
7996
+
79707997 transient ObjectUI objectUI;
79717998 public static int povDepth = 0;
79727999 private static cVector tbMin = new cVector();
cButton.java
....@@ -21,4 +21,25 @@
2121 //setBorder(null); //new javax.swing.border.EmptyBorder(0,0,0,0));
2222 }
2323 }
24
+
25
+ cButton(javax.swing.ImageIcon icon, boolean border)
26
+ {
27
+ super(icon);
28
+
29
+ setMargin(new java.awt.Insets(1, 1, 1, 1));
30
+
31
+//result = new JButton( icon );
32
+//result.setBorderPainted( false );
33
+//result.setContentAreaFilled( false );
34
+//
35
+//width = icon.getIconWidth();
36
+//height = icon.getIconHeight();
37
+//result.setPreferredSize( new Dimension( width, height ) );
38
+ if (border)
39
+ setBorder(new javax.swing.border.EtchedBorder());
40
+ else
41
+ {
42
+ //setBorder(null); //new javax.swing.border.EmptyBorder(0,0,0,0));
43
+ }
44
+ }
2445 }
cCheckBox.java
....@@ -1,19 +1,40 @@
1
-/*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
4
- */
51
6
-/**
7
- *
8
- * @author nbriere
9
- */
2
+import javax.swing.ImageIcon;
3
+
104 public class cCheckBox extends javax.swing.JCheckBox
115 {
126 cCheckBox(String name, boolean enabled)
137 {
148 super(name, enabled);
15
-
16
- setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
9
+
10
+ setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
1711 //setBorder(new javax.swing.border.EtchedBorder());
1812 }
13
+
14
+ cCheckBox(ImageIcon icon, boolean enabled)
15
+ {
16
+ super("", enabled);
17
+
18
+ this.image = icon.getImage();
19
+ iconWidth = icon.getIconWidth();
20
+
21
+ setBorder(new javax.swing.border.EmptyBorder(8, 0, 8, 24)); // top, left, bottom, right
22
+ //setBorder(new javax.swing.border.EtchedBorder());
23
+ }
24
+
25
+ private java.awt.Image image;
26
+ private int iconWidth;
27
+
28
+ @Override
29
+ protected void paintComponent(java.awt.Graphics g)
30
+ {
31
+ super.paintComponent(g);
32
+ if (image != null)
33
+ {
34
+ //if (getWidth() > image.getWidth(null) + 8)
35
+ {
36
+ g.drawImage(image, 18, 6, this);
37
+ }
38
+ }
39
+ }
1940 }
cFileSystemPane.java
....@@ -26,7 +26,7 @@
2626 JCheckBox stripCB;
2727 JCheckBox genUVCB;
2828
29
- JCheckBox mergeAttributesCB;
29
+ cCheckBox mergeAttributesCB;
3030
3131 cFileSystemPane(iCallBack o)
3232 {
icons/add-128.png
Binary files differ
icons/down_arrow.png
Binary files differ
icons/fit.png
Binary files differ
icons/fullscreen.png
Binary files differ
icons/light-bulb.png
Binary files differ
icons/redo.png
Binary files differ
icons/run.png
Binary files differ
icons/runfast.png
Binary files differ
icons/step.png
Binary files differ
icons/track.png
Binary files differ
icons/undo.png
Binary files differ