Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
CameraPane.java
....@@ -335,14 +335,28 @@
335335 display.options1[2] = material.shadowbias;
336336 display.options1[3] = material.aniso;
337337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
338343 display.options2[0] = material.opacity;
339344 display.options2[1] = material.diffuse;
340345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
341349
342350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
343354 display.options4[0] = material.cameralight/0.2f;
344355 display.options4[1] = material.subsurface;
345356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
346360
347361 // if (display.CURRENTANTIALIAS > 0)
348362 // display.options3[3] /= 4;
....@@ -2051,7 +2065,7 @@
20512065 //System.err.println("Oeil on");
20522066 OEIL = true;
20532067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2054
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20552069 //pingthread.StepToTarget(true);
20562070 }
20572071
....@@ -2284,10 +2298,17 @@
22842298 HANDLES ^= true;
22852299 }
22862300
2301
+ Object3D paintFolder;
2302
+
22872303 void TogglePaint()
22882304 {
22892305 PAINTMODE ^= true;
22902306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22912312 }
22922313
22932314 void SwapCamera(int a, int b)
....@@ -7909,7 +7930,7 @@
79097930 String pigment = Object3D.GetPigment(tex);
79107931 String bump = Object3D.GetBump(tex);
79117932
7912
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7933
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79137934 {
79147935 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79157936 // System.out.println("; bump = " + bump);
....@@ -7943,7 +7964,7 @@
79437964
79447965 String pigment = Object3D.GetPigment(tex);
79457966
7946
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7967
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79477968 {
79487969 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79497970 // System.out.println("; bump = " + bump);
....@@ -7972,7 +7993,7 @@
79727993
79737994 String bump = Object3D.GetBump(tex);
79747995
7975
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7996
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79767997 {
79777998 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79787999 // System.out.println("; bump = " + bump);
....@@ -8110,7 +8131,7 @@
81108131 usedtextures.put(pigment, pigment);
81118132 usedtextures.put(bump, bump);
81128133
8113
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8134
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81148135 {
81158136 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81168137 // System.out.println("; bump = " + bump);
....@@ -8152,7 +8173,7 @@
81528173
81538174 usedtextures.put(pigment, pigment);
81548175
8155
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8176
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81568177 {
81578178 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81588179 // System.out.println("; bump = " + bump);
....@@ -8185,7 +8206,7 @@
81858206
81868207 usedtextures.put(bump, bump);
81878208
8188
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81898210 {
81908211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81918212 // System.out.println("; bump = " + bump);
....@@ -8496,7 +8517,7 @@
84968517 return false;
84978518 }
84988519
8499
- boolean newtex = false;
8520
+ //boolean newtex = false;
85008521
85018522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
85028523
....@@ -8528,7 +8549,7 @@
85288549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85298550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85308551
8531
- return newtex;
8552
+ return true; // Warning: not used.
85328553 }
85338554
85348555 ShadowBuffer shadowPBuf;
....@@ -9366,11 +9387,35 @@
93669387 jy8[3] = 0.5f;
93679388 }
93689389
9369
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9390
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93709391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93719392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93729393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93739394
9395
+ void ResetOptions()
9396
+ {
9397
+ options1[0] = 100;
9398
+ options1[1] = 0.025f;
9399
+ options1[2] = 0.01f;
9400
+ options1[3] = 0;
9401
+ options1[4] = 0;
9402
+
9403
+ options2[0] = 0;
9404
+ options2[1] = 0.75f;
9405
+ options2[2] = 0;
9406
+ options2[3] = 0;
9407
+
9408
+ options3[0] = 1;
9409
+ options3[1] = 1;
9410
+ options3[2] = 1;
9411
+ options3[3] = 0;
9412
+
9413
+ options4[0] = 1;
9414
+ options4[1] = 0;
9415
+ options4[2] = 1;
9416
+ options4[3] = 0;
9417
+ }
9418
+
93749419 static int imagecount = 0; // movie generation
93759420
93769421 static int jitter = 0;
....@@ -10481,6 +10526,7 @@
1048110526 ANTIALIAS = 0;
1048210527 //System.out.println("RESTART");
1048310528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1048410530 }
1048510531 }
1048610532 }
....@@ -10989,9 +11035,9 @@
1098911035
1099011036 gl.glMatrixMode(GL.GL_MODELVIEW);
1099111037
10992
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10993
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10994
-//gl.glEnable(gl.GL_MULTISAMPLE);
11038
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11039
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11040
+gl.glEnable(gl.GL_MULTISAMPLE);
1099511041 } else
1099611042 {
1099711043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11002,7 +11048,7 @@
1100211048 //System.out.println("BLENDING ON");
1100311049 gl.glEnable(GL.GL_BLEND);
1100411050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11005
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1100611052 gl.glMatrixMode(gl.GL_PROJECTION);
1100711053 gl.glLoadIdentity();
1100811054
....@@ -11459,7 +11505,7 @@
1145911505
1146011506 static boolean zoomonce = false;
1146111507
11462
- void CreateSelectedPoint()
11508
+ static void CreateSelectedPoint()
1146311509 {
1146411510 if (selectedpoint == null)
1146511511 {
....@@ -11479,13 +11525,16 @@
1147911525
1148011526 void DrawObject(GL gl, boolean draw)
1148111527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1148211531 //System.out.println("DRAW OBJECT " + mouseDown);
1148311532 // DrawMode() = SELECTION;
1148411533 //GL gl = getGL();
1148511534 if ((TRACK || SHADOWTRACK) || zoomonce)
1148611535 {
1148711536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11488
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1148911538 pingthread.StepToTarget(true); // true);
1149011539 // zoomonce = false;
1149111540 }
....@@ -12046,7 +12095,7 @@
1204612095 for (int i = tp.size(); --i >= 0;)
1204712096 {
1204812097 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12049
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12098
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1205012099 }
1205112100
1205212101
....@@ -13333,9 +13382,10 @@
1333313382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1333413383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1333513384 //"MOV " + dest + ".w," + "normal.z;" +
13336
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13337
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13338
- //"MOV " + dest + ".z," + "params2.w;" +
13385
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13386
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13387
+
13388
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1333913389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1334013390 "RCP " + dest + ".w," + dest + ".w;" +
1334113391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13840,6 +13890,7 @@
1384013890 else
1384113891 if (evt.getSource() == AAtimer)
1384213892 {
13893
+ Globals.TIMERRUNNING = false;
1384313894 if (mouseDown)
1384413895 {
1384513896 //new Exception().printStackTrace();
....@@ -13899,7 +13950,7 @@
1389913950
1390013951 // fev 2014???
1390113952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13902
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1390313954 pingthread.StepToTarget(true); // true);
1390413955 }
1390513956 // if (!LIVE)
....@@ -13914,6 +13965,7 @@
1391413965 return;
1391513966
1391613967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1391713969
1391813970 // waslive = LIVE;
1391913971 // LIVE = false;
....@@ -14252,12 +14304,12 @@
1425214304 void GoDown(int mod)
1425314305 {
1425414306 MODIFIERS |= COMMAND;
14255
- /*
14307
+ /**/
1425614308 if((mod&SHIFT) == SHIFT)
1425714309 manipCamera.RotatePosition(0, -speed);
1425814310 else
14259
- manipCamera.BackForth(0, -speed*delta, getWidth());
14260
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1426114313 if ((mod & SHIFT) == SHIFT)
1426214314 {
1426314315 mouseMode = mouseMode; // VR??
....@@ -14273,12 +14325,12 @@
1427314325 void GoUp(int mod)
1427414326 {
1427514327 MODIFIERS |= COMMAND;
14276
- /*
14328
+ /**/
1427714329 if((mod&SHIFT) == SHIFT)
1427814330 manipCamera.RotatePosition(0, speed);
1427914331 else
14280
- manipCamera.BackForth(0, speed*delta, getWidth());
14281
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1428214334 if ((mod & SHIFT) == SHIFT)
1428314335 {
1428414336 mouseMode = mouseMode;
....@@ -14294,12 +14346,12 @@
1429414346 void GoLeft(int mod)
1429514347 {
1429614348 MODIFIERS |= COMMAND;
14297
- /*
14349
+ /**/
1429814350 if((mod&SHIFT) == SHIFT)
14299
- manipCamera.RotatePosition(speed, 0);
14300
- else
1430114351 manipCamera.Translate(speed*delta, 0, getWidth());
14302
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1430314355 if ((mod & SHIFT) == SHIFT)
1430414356 {
1430514357 mouseMode = mouseMode;
....@@ -14315,12 +14367,12 @@
1431514367 void GoRight(int mod)
1431614368 {
1431714369 MODIFIERS |= COMMAND;
14318
- /*
14370
+ /**/
1431914371 if((mod&SHIFT) == SHIFT)
14320
- manipCamera.RotatePosition(-speed, 0);
14321
- else
1432214372 manipCamera.Translate(-speed*delta, 0, getWidth());
14323
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1432414376 if ((mod & SHIFT) == SHIFT)
1432514377 {
1432614378 mouseMode = mouseMode;
....@@ -14377,7 +14429,8 @@
1437714429 info.camera = renderCamera;
1437814430 info.x = x;
1437914431 info.y = y;
14380
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1438114434 } else
1438214435 {
1438314436 if (x < startX)
....@@ -14541,9 +14594,9 @@
1454114594 ci.camera = renderCamera;
1454214595 if (!isRenderer)
1454314596 {
14544
- ObjEditor editWindow = object.editWindow;
14545
- Object3D copy = editWindow.copy;
14546
- if (copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1454714600 {
1454814601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1454914602 } else
....@@ -14558,7 +14611,8 @@
1455814611 Globals.MOUSEDRAGGED = false;
1455914612
1456014613 movingcamera = false;
14561
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1456214616 //System.out.println("mouseReleased: " + e);
1456314617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1456414618 }
....@@ -14899,7 +14953,9 @@
1489914953 case 'E' : COMPACT ^= true;
1490014954 repaint();
1490114955 break;
14902
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1490314959 repaint();
1490414960 break;
1490514961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14925,13 +14981,7 @@
1492514981 repaint();
1492614982 break;
1492714983 case 'l':
14928
- lightMode ^= true;
14929
- Globals.lighttouched = true;
14930
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14931
- targetLookAt.set(manipCamera.lookAt);
14932
- repaint();
14933
- break;
14934
- case 'L':
14984
+ //case 'L':
1493514985 if (lightMode)
1493614986 {
1493714987 lightMode = false;
....@@ -15074,11 +15124,14 @@
1507415124 case '_':
1507515125 kompactbit = 5;
1507615126 break;
15077
- case '+':
15078
- kompactbit = 6;
15079
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1508015130 case ' ':
15081
- ObjEditor.theFrame.ToggleFullScreen();
15131
+ lightMode ^= true;
15132
+ Globals.lighttouched = true;
15133
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15134
+ targetLookAt.set(manipCamera.lookAt);
1508215135 repaint();
1508315136 break;
1508415137 //case '`' :
....@@ -15125,8 +15178,9 @@
1512515178 case DELETE:
1512615179 ClearSelection();
1512715180 break;
15128
- /*
1512915181 case '+':
15182
+
15183
+ /*
1513015184 //fontsize += 1;
1513115185 bbzoom *= 2;
1513215186 repaint();
....@@ -15143,17 +15197,17 @@
1514315197 case '=':
1514415198 IncDepth();
1514515199 //fontsize += 1;
15146
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1514715201 maskbit = 6;
1514815202 break;
1514915203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1515015204 DecDepth();
1515115205 maskbit = 5;
1515215206 //if(fontsize > 1) fontsize -= 1;
15153
- if (object.editWindow == null)
15154
- new Exception().printStackTrace();
15155
- else
15156
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1515715211 break;
1515815212 case '{':
1515915213 manipCamera.shaper_fovy /= 1.1;
....@@ -15377,7 +15431,7 @@
1537715431 }
1537815432 */
1537915433
15380
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1538115435 }
1538215436
1538315437 void SelectParent()
....@@ -15394,10 +15448,10 @@
1539415448 {
1539515449 //selectees.remove(i);
1539615450 System.out.println("select parent of " + elem);
15397
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1539815452 } else
1539915453 {
15400
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1540115455 }
1540215456
1540315457 first = false;
....@@ -15439,12 +15493,12 @@
1543915493 for (int j = 0; j < group.children.size(); j++)
1544015494 {
1544115495 elem = (Object3D) group.children.elementAt(j);
15442
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1544315497 first = false;
1544415498 }
1544515499 } else
1544615500 {
15447
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1544815502 }
1544915503
1545015504 first = false;
....@@ -15455,21 +15509,21 @@
1545515509 {
1545615510 //Composite group = (Composite) object;
1545715511 Object3D group = object;
15458
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1545915513 }
1546015514
1546115515 void ResetTransform(int mask)
1546215516 {
1546315517 //Composite group = (Composite) object;
1546415518 Object3D group = object;
15465
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1546615520 }
1546715521
1546815522 void FlipTransform()
1546915523 {
1547015524 //Composite group = (Composite) object;
1547115525 Object3D group = object;
15472
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1547315527 // group.editWindow.ReduceMesh(true);
1547415528 }
1547515529
....@@ -15477,7 +15531,7 @@
1547715531 {
1547815532 //Composite group = (Composite) object;
1547915533 Object3D group = object;
15480
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1548115535 // group.editWindow.ReduceMesh(true);
1548215536 }
1548315537
....@@ -15485,7 +15539,7 @@
1548515539 {
1548615540 //Composite group = (Composite) object;
1548715541 Object3D group = object;
15488
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1548915543 }
1549015544
1549115545 void IncDepth()
....@@ -15661,6 +15715,7 @@
1566115715 info.bounds.y += (height - desired) / 2;
1566215716 }
1566315717 }
15718
+
1566415719 info.g = gr;
1566515720 info.camera = renderCamera;
1566615721 /*
....@@ -15670,23 +15725,44 @@
1567015725 */
1567115726 if (!isRenderer)
1567215727 {
15673
- object.drawEditHandles(info, 0);
15674
-
15675
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15728
+ Grafreed.Assert(object != null);
15729
+ Grafreed.Assert(object.selection != null);
15730
+ if (object.selection.Size() > 0)
1567615731 {
15677
- switch (object.selection.get(0).hitSomething)
15732
+ int hitSomething = object.selection.get(0).hitSomething;
15733
+
15734
+ info.DX = 0;
15735
+ info.DY = 0;
15736
+ info.W = 1;
15737
+ if (hitSomething == Object3D.hitCenter)
1567815738 {
15679
- case Object3D.hitCenter: gr.setColor(Color.pink);
15680
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15681
- break;
15682
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15683
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15684
- break;
15685
- case Object3D.hitScale: gr.setColor(Color.cyan);
15686
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15687
- break;
15739
+ info.DX = X;
15740
+ if (X != 0)
15741
+ info.DX -= info.bounds.width/2;
15742
+
15743
+ info.DY = Y;
15744
+ if (Y != 0)
15745
+ info.DY -= info.bounds.height/2;
1568815746 }
15689
-
15747
+
15748
+ object.drawEditHandles(info, 0);
15749
+
15750
+ if (drag && (X != 0 || Y != 0))
15751
+ {
15752
+ switch (hitSomething)
15753
+ {
15754
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15755
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15756
+ break;
15757
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15758
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15759
+ break;
15760
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15761
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15762
+ break;
15763
+ }
15764
+
15765
+ }
1569015766 }
1569115767 }
1569215768 }
....@@ -16484,6 +16560,14 @@
1648416560 }
1648516561 }
1648616562
16563
+ private Object3D GetFolder()
16564
+ {
16565
+ Object3D folder = object.GetWindow().copy;
16566
+ if (object.GetWindow().copy.selection.Size() > 0)
16567
+ folder = object.GetWindow().copy.selection.elementAt(0);
16568
+ return folder;
16569
+ }
16570
+
1648716571 class SelectBuffer implements GLEventListener
1648816572 {
1648916573
....@@ -16563,6 +16647,17 @@
1656316647
1656416648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1656516649
16650
+ if (PAINTMODE)
16651
+ {
16652
+ if (object.GetWindow().copy.selection.Size() > 0)
16653
+ {
16654
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16655
+
16656
+ // Make what you paint not selectable.
16657
+ paintobj.ResetSelectable();
16658
+ }
16659
+ }
16660
+
1656616661 //int tmp = selection_view;
1656716662 //selection_view = -1;
1656816663 int temp = DrawMode();
....@@ -16574,6 +16669,17 @@
1657416669 // temp = DEFAULT; // patch for selection debug
1657516670 Globals.drawMode = temp; // WARNING
1657616671
16672
+ if (PAINTMODE)
16673
+ {
16674
+ if (object.GetWindow().copy.selection.Size() > 0)
16675
+ {
16676
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16677
+
16678
+ // Revert.
16679
+ paintobj.RestoreSelectable();
16680
+ }
16681
+ }
16682
+
1657716683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1657816684
1657916685 // trying different ways of getting the depth info over
....@@ -16621,6 +16727,8 @@
1662116727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1662216728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1662316729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1662416732
1662516733 // Will fit the mesh !!!
1662616734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16675,29 +16783,31 @@
1667516783 }
1667616784
1667716785 if (!movingcamera && !PAINTMODE)
16678
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1667916787
16680
- if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16788
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1668116789 {
16682
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16790
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1668316791
16684
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1668516795
16686
- group.CreateMaterial(); // use a void leaf to select instances
16687
-
16688
- group.add(paintobj); // link
16689
-
16690
- object.editWindow.SnapObject(group);
16691
-
16692
- Object3D folder = object.editWindow.copy;
16693
-
16694
- if (object.editWindow.copy.selection.Size() > 0)
16695
- folder = object.editWindow.copy.selection.elementAt(0);
16696
-
16697
- folder.add(group);
16698
-
16699
- object.editWindow.ResetModel();
16700
- object.editWindow.refreshContents();
16796
+ Object3D inst = new Object3D("inst" + paintcount++);
16797
+
16798
+ inst.CreateMaterial(); // use a void leaf to select instances
16799
+
16800
+ inst.add(paintobj); // link
16801
+
16802
+ object.GetWindow().SnapObject(inst);
16803
+
16804
+ Object3D folder = paintFolder; // GetFolder();
16805
+
16806
+ folder.add(inst);
16807
+
16808
+ object.GetWindow().ResetModel();
16809
+ object.GetWindow().refreshContents();
16810
+ }
1670116811 }
1670216812 else
1670316813 paintcount = 0;
....@@ -16736,6 +16846,11 @@
1673616846 //System.out.println("objects[color] = " + objects[color]);
1673716847 //objects[color].Select();
1673816848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1673916854 object.Select(color, deselect);
1674016855 }
1674116856