Normand Briere
2019-07-01 6600d22461ccc1cb602f238a9ffa83cf07dd830e
Get icons 256x256
6 files modified
226 ■■■■■ changed files
CameraPane.java 50 ●●●● patch | view | raw | blame | history
GroupEditor.java 6 ●●●● patch | view | raw | blame | history
ObjEditor.java 14 ●●●● patch | view | raw | blame | history
ScriptNode.java 14 ●●●● patch | view | raw | blame | history
cFileSystemModel.java 85 ●●●● patch | view | raw | blame | history
cTools.java 57 ●●●●● patch | view | raw | blame | history
CameraPane.java
....@@ -2065,7 +2065,7 @@
20652065 //System.err.println("Oeil on");
20662066 OEIL = true;
20672067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20692069 //pingthread.StepToTarget(true);
20702070 }
20712071
....@@ -11527,7 +11527,7 @@
1152711527 if ((TRACK || SHADOWTRACK) || zoomonce)
1152811528 {
1152911529 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11530
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11530
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1153111531 pingthread.StepToTarget(true); // true);
1153211532 // zoomonce = false;
1153311533 }
....@@ -13943,7 +13943,7 @@
1394313943
1394413944 // fev 2014???
1394513945 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13946
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13946
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1394713947 pingthread.StepToTarget(true); // true);
1394813948 }
1394913949 // if (!LIVE)
....@@ -15190,17 +15190,17 @@
1519015190 case '=':
1519115191 IncDepth();
1519215192 //fontsize += 1;
15193
- object.editWindow.refreshContents(true);
15193
+ object.GetWindow().refreshContents(true);
1519415194 maskbit = 6;
1519515195 break;
1519615196 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1519715197 DecDepth();
1519815198 maskbit = 5;
1519915199 //if(fontsize > 1) fontsize -= 1;
15200
- if (object.editWindow == null)
15201
- new Exception().printStackTrace();
15202
- else
15203
- object.editWindow.refreshContents(true);
15200
+// if (object.editWindow == null)
15201
+// new Exception().printStackTrace();
15202
+// else
15203
+ object.GetWindow().refreshContents(true);
1520415204 break;
1520515205 case '{':
1520615206 manipCamera.shaper_fovy /= 1.1;
....@@ -15424,7 +15424,7 @@
1542415424 }
1542515425 */
1542615426
15427
- object.editWindow.EditSelection(false);
15427
+ object.GetWindow().EditSelection(false);
1542815428 }
1542915429
1543015430 void SelectParent()
....@@ -15441,10 +15441,10 @@
1544115441 {
1544215442 //selectees.remove(i);
1544315443 System.out.println("select parent of " + elem);
15444
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15444
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1544515445 } else
1544615446 {
15447
- group.editWindow.Select(elem.GetTreePath(), first, true);
15447
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1544815448 }
1544915449
1545015450 first = false;
....@@ -15486,12 +15486,12 @@
1548615486 for (int j = 0; j < group.children.size(); j++)
1548715487 {
1548815488 elem = (Object3D) group.children.elementAt(j);
15489
- object.editWindow.Select(elem.GetTreePath(), first, true);
15489
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1549015490 first = false;
1549115491 }
1549215492 } else
1549315493 {
15494
- object.editWindow.Select(elem.GetTreePath(), first, true);
15494
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1549515495 }
1549615496
1549715497 first = false;
....@@ -15502,21 +15502,21 @@
1550215502 {
1550315503 //Composite group = (Composite) object;
1550415504 Object3D group = object;
15505
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15505
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1550615506 }
1550715507
1550815508 void ResetTransform(int mask)
1550915509 {
1551015510 //Composite group = (Composite) object;
1551115511 Object3D group = object;
15512
- group.editWindow.ResetTransform(mask);
15512
+ group.GetWindow().ResetTransform(mask);
1551315513 }
1551415514
1551515515 void FlipTransform()
1551615516 {
1551715517 //Composite group = (Composite) object;
1551815518 Object3D group = object;
15519
- group.editWindow.FlipTransform();
15519
+ group.GetWindow().FlipTransform();
1552015520 // group.editWindow.ReduceMesh(true);
1552115521 }
1552215522
....@@ -15524,7 +15524,7 @@
1552415524 {
1552515525 //Composite group = (Composite) object;
1552615526 Object3D group = object;
15527
- group.editWindow.PrintMemory();
15527
+ group.GetWindow().PrintMemory();
1552815528 // group.editWindow.ReduceMesh(true);
1552915529 }
1553015530
....@@ -15532,7 +15532,7 @@
1553215532 {
1553315533 //Composite group = (Composite) object;
1553415534 Object3D group = object;
15535
- group.editWindow.ResetCentroid();
15535
+ group.GetWindow().ResetCentroid();
1553615536 }
1553715537
1553815538 void IncDepth()
....@@ -16724,7 +16724,7 @@
1672416724 }
1672516725
1672616726 if (!movingcamera && !PAINTMODE)
16727
- object.editWindow.ScreenFitPoint(); // fev 2014
16727
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1672816728
1672916729 if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1673016730 {
....@@ -16736,17 +16736,17 @@
1673616736
1673716737 group.add(paintobj); // link
1673816738
16739
- object.editWindow.SnapObject(group);
16739
+ object.GetWindow().SnapObject(group);
1674016740
16741
- Object3D folder = object.editWindow.copy;
16741
+ Object3D folder = object.GetWindow().copy;
1674216742
16743
- if (object.editWindow.copy.selection.Size() > 0)
16744
- folder = object.editWindow.copy.selection.elementAt(0);
16743
+ if (object.GetWindow().copy.selection.Size() > 0)
16744
+ folder = object.GetWindow().copy.selection.elementAt(0);
1674516745
1674616746 folder.add(group);
1674716747
16748
- object.editWindow.ResetModel();
16749
- object.editWindow.refreshContents();
16748
+ object.GetWindow().ResetModel();
16749
+ object.GetWindow().refreshContents();
1675016750 }
1675116751 else
1675216752 paintcount = 0;
GroupEditor.java
....@@ -1472,8 +1472,8 @@
14721472 animationItem.addItemListener(this);
14731473 animationItem.setState(Globals.ANIMATION);
14741474
1475
- menu.add(archiveItem = new CheckboxMenuItem("Archive3D..."));
1476
- archiveItem.addItemListener(this);
1475
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1476
+ archiveItem.addActionListener(this);
14771477
14781478 menu.add("-");
14791479 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
....@@ -4734,7 +4734,7 @@
47344734 void refreshContents(boolean cp)
47354735 {
47364736 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4737
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4737
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47384738 {
47394739 objEditor.ClearInfo(); // .GetMaterial());
47404740
ObjEditor.java
....@@ -449,7 +449,7 @@
449449 // TEXTAREA infoarea.setLineWrap(true);
450450 // TEXTAREA infoarea.setWrapStyleWord(true);
451451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
452
- //infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ infoPanel.setPreferredSize(new Dimension(1, 1));
453453 infoPanel.setName("Info");
454454 //infoPanel.setLayout(new BorderLayout());
455455 //infoPanel.add(createTextPane());
....@@ -1494,7 +1494,7 @@
14941494 // objectPanel.add(north);
14951495 objectPanel.add(editPanel);
14961496
1497
- if (Globals.ADVANCED)
1497
+ //if (Globals.ADVANCED)
14981498 objectPanel.add(infoPanel);
14991499
15001500 objectPanel.add(toolboxPanel);
....@@ -3201,10 +3201,6 @@
32013201 {
32023202 ToggleAnimation();
32033203 return;
3204
- } else if (event.getSource() == archiveItem)
3205
- {
3206
- cTools.Archive(frame);
3207
- return;
32083204 } else if (event.getSource() == flipVCB)
32093205 {
32103206 copy.flipV ^= true;
....@@ -3425,6 +3421,10 @@
34253421 {
34263422 generatePOV();
34273423 //return true;
3424
+ } else if (event.getSource() == archiveItem)
3425
+ {
3426
+ cTools.Archive(frame);
3427
+ return;
34283428 } else if (source == zBufferItem)
34293429 {
34303430 try
....@@ -5035,7 +5035,7 @@
50355035 CheckboxMenuItem toggleSwitchItem;
50365036 CheckboxMenuItem toggleRootItem;
50375037 CheckboxMenuItem animationItem;
5038
- CheckboxMenuItem archiveItem;
5038
+ MenuItem archiveItem;
50395039 CheckboxMenuItem toggleHandleItem;
50405040 CheckboxMenuItem togglePaintItem;
50415041 JSplitPane mainPanel;
ScriptNode.java
....@@ -388,7 +388,7 @@
388388 {
389389 System.err.println("LoadBVHFile = " + obj + "; name = " + iname + "; first frame = " + firstframe + "; last frame = " + lastframe);
390390 obj.blockloop = false; // to force crash right now
391
- GetRoot().editWindow.LoadBVHFile(iname, obj, false, force?firstframe:-1, lastframe);
391
+ GetRoot().GetWindow().LoadBVHFile(iname, obj, false, force?firstframe:-1, lastframe);
392392 }
393393 else
394394 {
....@@ -522,7 +522,7 @@
522522 if (command.equals("recompile"))
523523 {
524524 // TODO assert (GetRoot() == Globals.theRenderer.object);
525
- GetRoot().editWindow.Recompile();
525
+ GetRoot().GetWindow().Recompile();
526526 return;
527527 }
528528 if (command.equals("resetframecount"))
....@@ -533,7 +533,7 @@
533533 if (command.equals("deselect") || command.equals("unselect"))
534534 {
535535 // TODO assert (GetRoot() == Globals.theRenderer.object);
536
- GetRoot().editWindow.jTree.clearSelection();
536
+ GetRoot().GetWindow().jTree.clearSelection();
537537 return;
538538 }
539539 if (command.equals("stoplive") || command.equals("liveoff"))
....@@ -771,7 +771,7 @@
771771 if (!CameraPane.BOXMODE)
772772 {
773773 Globals.theRenderer.ToggleBoxMode();
774
- GetRoot().editWindow.Recompile();
774
+ GetRoot().GetWindow().Recompile();
775775 }
776776 return;
777777 }
....@@ -780,7 +780,7 @@
780780 if (CameraPane.BOXMODE)
781781 {
782782 Globals.theRenderer.ToggleBoxMode();
783
- GetRoot().editWindow.Recompile();
783
+ GetRoot().GetWindow().Recompile();
784784 }
785785 return;
786786 }
....@@ -1172,7 +1172,7 @@
11721172 Object3D root = GetObject(rootobject);
11731173
11741174 System.err.println("ZOOM: root = " + root + "; rootobject = " + rootobject);
1175
- GetRoot().editWindow.objEditor.ScreenFit(root, false);
1175
+ GetRoot().GetWindow().objEditor.ScreenFit(root, false);
11761176 CameraPane.trackedobject = root;
11771177 CameraPane.ABORTED = true;
11781178 System.err.println("SET ABORTED (SPEAKERFOCUS) ");
....@@ -1464,7 +1464,7 @@
14641464 {
14651465 // TODO assert (GetRoot() == Globals.theRenderer.object);
14661466 String path = GetAlias(strs[index+1]);
1467
- GetRoot().editWindow.Select(GetRoot().GetTreePath(path.split("/"), 0), false, false);
1467
+ GetRoot().GetWindow().Select(GetRoot().GetTreePath(path.split("/"), 0), false, false);
14681468 return;
14691469 }
14701470 if (command.equals("mocap"))
cFileSystemModel.java
....@@ -113,35 +113,74 @@
113113
114114 if (valueString.toLowerCase().endsWith(".gfd") || valueString.toLowerCase().endsWith(".obj") || valueString.toLowerCase().endsWith(".3ds"))
115115 {
116
- String valueTruncated = valueString.substring(0, valueString.length()-4);
117
-
118
- System.out.println(valueTruncated);
119
-
120
- javax.swing.ImageIcon rendererIcon = icons.get(valueTruncated);
121
-
122
- if (rendererIcon == null)
116
+ if (true)
123117 {
124
- if (new File(valueTruncated + ".jpg").exists())
125
- {
126
- rendererIcon = new javax.swing.ImageIcon(valueTruncated + ".jpg");
127
- }
128
- else
129
- {
130
- if (new File(valueTruncated + ".png").exists())
131
- {
132
- rendererIcon = new javax.swing.ImageIcon(valueTruncated + ".png");
133
- }
134
- }
135
-
118
+ // Small icons
119
+ String valueTruncated = valueString.substring(0, valueString.length()-4);
120
+
121
+ System.out.println(valueTruncated);
122
+
123
+ javax.swing.ImageIcon rendererIcon = icons.get(valueTruncated);
124
+
136125 if (rendererIcon == null)
137126 {
138
- rendererIcon = new javax.swing.ImageIcon();
127
+ if (new File(valueTruncated + ".jpg").exists())
128
+ {
129
+ rendererIcon = new javax.swing.ImageIcon(valueTruncated + ".jpg");
130
+ }
131
+ else
132
+ {
133
+ if (new File(valueTruncated + ".png").exists())
134
+ {
135
+ rendererIcon = new javax.swing.ImageIcon(valueTruncated + ".png");
136
+ }
137
+ }
138
+
139
+ if (rendererIcon == null)
140
+ {
141
+ rendererIcon = new javax.swing.ImageIcon();
142
+ }
143
+
144
+ icons.put(valueTruncated, rendererIcon);
145
+ }
146
+
147
+ setIcon(rendererIcon);
148
+ }
149
+ else
150
+ {
151
+ // Large icons
152
+ String[] split = valueString.split("/");
153
+
154
+ String valueTruncated = "";
155
+
156
+ for (int i=1; i<split.length-1; i++)
157
+ {
158
+ valueTruncated += "/" + split[i];
139159 }
140160
141
- icons.put(valueTruncated, rendererIcon);
161
+ valueTruncated += "/icon.jpg";
162
+
163
+ System.out.println(valueTruncated);
164
+
165
+ javax.swing.ImageIcon rendererIcon = icons.get(valueTruncated);
166
+
167
+ if (rendererIcon == null)
168
+ {
169
+ if (new File(valueTruncated).exists())
170
+ {
171
+ rendererIcon = new javax.swing.ImageIcon(valueTruncated);
172
+ }
173
+
174
+ if (rendererIcon == null)
175
+ {
176
+ rendererIcon = new javax.swing.ImageIcon();
177
+ }
178
+
179
+ icons.put(valueTruncated, rendererIcon);
180
+ }
181
+
182
+ setIcon(rendererIcon);
142183 }
143
-
144
- setIcon(rendererIcon);
145184 }
146185 else
147186 {
cTools.java
....@@ -1,6 +1,7 @@
11
22 import java.io.*;
33 import java.awt.*;
4
+import java.net.URL;
45 import java.util.zip.ZipInputStream;
56
67 public class cTools
....@@ -15,6 +16,16 @@
1516
1617 java.net.URL u;
1718 InputStream is = null;
19
+
20
+ if (new File(location).exists())
21
+ {
22
+ // Already downloaded
23
+ System.out.println(location + ": Already downloaded");
24
+
25
+ GetIcon(icon, location, "icon");
26
+
27
+ return;
28
+ }
1829
1930 java.util.zip.ZipInputStream zis;
2031
....@@ -39,13 +50,13 @@
3950 if (entryName.endsWith(".gsm"))
4051 {
4152 // ArchiCAD
42
- // continue;
53
+ continue;
4354 }
4455
4556 if (entryName.endsWith(".max"))
4657 {
4758 // 3DS MAX
48
- // continue;
59
+ continue;
4960 }
5061
5162 if (entryName.endsWith(".3ds") || entryName.endsWith(".obj"))
....@@ -63,6 +74,8 @@
6374 // reading until read returns 0 or less.
6475 String outpath = location + "/" + entry.getName();
6576
77
+ //new java.io.File(outpath).mkdirs();
78
+
6679 TransferFile(outpath, zis);
6780 }
6881 } catch (java.net.MalformedURLException mue)
....@@ -72,8 +85,13 @@
7285 //System.exit(2);
7386 } catch (IOException ioe)
7487 {
75
- //System.err.println("Oops - an IOException happened.");
76
- //ioe.printStackTrace();
88
+ System.err.println("Oops - an IOException happened.");
89
+ ioe.printStackTrace();
90
+ //System.exit(3);
91
+ } catch (IllegalArgumentException iae)
92
+ {
93
+ System.err.println("Oops - an IllegalArgumentException happened.");
94
+ iae.printStackTrace();
7795 //System.exit(3);
7896 } finally
7997 {
....@@ -114,6 +132,35 @@
114132 modelName = modelName.substring(0, modelName.length() - 4);
115133
116134 TransferFile(location + "/" + modelName + ".jpg", is);
135
+
136
+ GetIcon(icon, location, "icon");
137
+ }
138
+ catch (Exception e)
139
+ {
140
+ e.printStackTrace();
141
+ }
142
+ }
143
+
144
+ private static void GetIcon(String icon, String location, String iconName)
145
+ {
146
+ URL u;
147
+ InputStream is;
148
+ try
149
+ {
150
+ //icon = https://storage3d.com/storage/2008.08/resized/7142f85f2575b35078f15feddaf8b315_64x64.jpg
151
+
152
+ String[] split = icon.split("resized/");
153
+
154
+ icon = split[0] + split[1];
155
+
156
+ split = icon.split("_64x64");
157
+
158
+ icon = split[0] + ".jpg";
159
+
160
+ u = new java.net.URL(icon);
161
+ is = u.openStream();
162
+
163
+ TransferFile(location + "/" + iconName + ".jpg", is);
117164 }
118165 catch (Exception e)
119166 {
....@@ -201,7 +248,7 @@
201248 GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", browser.getDirectory() + "/" + cat, id, name, icon);
202249
203250 // To avoid network overload.
204
- Thread.sleep(2000);
251
+ Thread.sleep(1000);
205252 }
206253
207254 file.close();