From 372b7fd481a476cd659713a4a01bf28bf6760cbe Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 16 Jun 2019 12:09:54 -0400 Subject: [PATCH] Fix info panel. --- CameraPane.java | 35 +++++++++++------ GroupEditor.java | 32 ++++++++++++--- Object3D.java | 17 ++++---- 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index b4be4fc..cfdc3d3 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -1890,7 +1890,7 @@ void PushMatrix(double[][] matrix) { // GrafreeD.tracein(matrix); - PushMatrix(matrix,1); + PushMatrix(matrix, 1); } void PushMatrix() @@ -9335,7 +9335,7 @@ if (renderCamera != lightCamera) //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix); + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); @@ -9351,7 +9351,7 @@ if (renderCamera != lightCamera) //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.matConcat(parentcam.GlobalTransform(), matrix, matrix); + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); @@ -10550,7 +10550,7 @@ // if (parentcam != renderCamera) // not a light if (cam != lightCamera) //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix); + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); for (int j = 0; j < 4; j++) { @@ -10565,7 +10565,7 @@ // if (parentcam != renderCamera) // not a light if (cam != lightCamera) //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.matConcat(parentcam.GlobalTransform(), matrix, matrix); + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); @@ -10959,7 +10959,7 @@ // if (cam != lightCamera) //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013 + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 } LA.xformDir(lightposition, cam.toScreen, lightposition); @@ -10981,7 +10981,7 @@ { if (cam != lightCamera) //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.xformDir(light0, parentcam.GlobalTransformInv(), light0); // may 2013 + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 } LA.xformPos(light0, cam.toScreen, light0); @@ -11894,7 +11894,7 @@ for (int i = tp.size(); --i >= 0;) { //for (int count = tp.get(i).GetTransformCount(); --count>=0;) - LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); + LA.xformPos(light, tp.get(i).GlobalTransform(), light); } @@ -11912,7 +11912,7 @@ } //for (int count = parentcam.GetTransformCount(); --count>=0;) - LA.xformPos(light, parentcam.GlobalTransformInv(), light); // may 2013 + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 LA.xformPos(light, renderCamera.toScreen, light); @@ -13833,6 +13833,8 @@ public void mouseDragged(MouseEvent e) { + Globals.MOUSEDRAGGED = true; + //System.out.println("mouseDragged: " + e); if (isRenderer) movingcamera = true; @@ -14398,6 +14400,8 @@ public void mouseReleased(MouseEvent e) { + Globals.MOUSEDRAGGED = false; + movingcamera = false; X = Y = 0; //System.out.println("mouseReleased: " + e); @@ -15513,12 +15517,17 @@ { switch (object.selection.get(0).hitSomething) { - case Object3D.hitCenter: gr.setColor(Color.pink); break; - case Object3D.hitRotate: gr.setColor(Color.green); break; - case Object3D.hitScale: gr.setColor(Color.cyan); break; + case Object3D.hitCenter: gr.setColor(Color.pink); + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); + break; + case Object3D.hitRotate: gr.setColor(Color.yellow); + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); + break; + case Object3D.hitScale: gr.setColor(Color.cyan); + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); + break; } - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); } } } diff --git a/GroupEditor.java b/GroupEditor.java index d52863f..7bbf24b 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -871,6 +871,7 @@ } else if(e.getSource() == liveCB) { cameraView.ToggleLive(); + refreshContents(false); } else if(e.getSource() == supportCB) { @@ -1278,7 +1279,7 @@ memoryItem.addActionListener(this); menu.add(analyzeItem = new MenuItem("Analyze")); analyzeItem.addActionListener(this); - menu.add(dumpItem = new MenuItem("Dump")); + menu.add(dumpItem = new MenuItem("Print")); dumpItem.addActionListener(this); // menu.add(pathItem = new MenuItem("From-to path")); // pathItem.addActionListener(this); @@ -4320,7 +4321,6 @@ //case 702: // Event.LIST_DESELECT group.deselectAll(); TreePath tps[] = objEditor.jTree.getSelectionPaths(); - objEditor.ClearInfo(); // .GetMaterial()); if (tps != null) { for (int i=0; i < tps.length; i++) @@ -4330,9 +4330,6 @@ //if (child.parent != null) //child.parent.addSelectee(child); group.addSelectee(child); - objEditor.SetMaterial(child); // .GetMaterial()); - objEditor.AddInfo(child, this, true); // .GetMaterial()); - System.err.println("info : " + child.GetPath()); } } // else @@ -4342,8 +4339,6 @@ // System.err.println("info : " + group.GetPath()); // } - objEditor.SetText(); // jan 2014 - if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera)) CameraPane.flash = true; @@ -4367,6 +4362,29 @@ freezemodel = false; } + + void refreshContents(boolean cp) + { + if (!Globals.MOUSEDRAGGED) + { + objEditor.ClearInfo(); // .GetMaterial()); + + for (int i=0; i < group.selection.size(); i++) + { + Object3D child = (Object3D) group.selection.reserve(i); + + objEditor.SetMaterial(child); + objEditor.AddInfo(child, this, true); + System.err.println("info : " + child.GetPath()); + + group.selection.release(i); + } + + objEditor.SetText(); // jan 2014 + } + + super.refreshContents(cp); + } void linkSomething(Object3D thing) { diff --git a/Object3D.java b/Object3D.java index 28b696b..04e109f 100644 --- a/Object3D.java +++ b/Object3D.java @@ -7102,7 +7102,7 @@ spot.translate(32, 32); spotw = spot.x + spot.width; spoth = spot.y + spot.height; - info.g.setColor(Color.blue); + info.g.setColor(Color.cyan); info.g.fillRect(spot.x, spot.y, spot.width, spot.height); // if (CameraPane.Xmin > spot.x) // { @@ -7120,11 +7120,12 @@ // { // CameraPane.Ymax = spoth; // } - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 spot.translate(0, -32); - info.g.setColor(Color.green); + info.g.setColor(Color.yellow); info.g.fillRect(spot.x, spot.y, spot.width, spot.height); + info.g.setColor(Color.green); // if (CameraPane.Xmin > spot.x) // { // CameraPane.Xmin = spot.x; @@ -7442,19 +7443,19 @@ switch (info.pane.RenderCamera().viewCode) { case 3: // '\001' - if (modified) + if (modified || opposite) { //LA.matScale(toParent, 1, hScale, vScale); LA.matScale(toParent, totalScale, 1, 1); } // vScale, 1); else { - LA.matScale(toParent, totalScale, totalScale, totalScale); + LA.matScale(toParent, 1, totalScale, totalScale); } // vScale, 1); break; case 2: // '\002' - if (modified) + if (modified || opposite) { //LA.matScale(toParent, hScale, 1, vScale); LA.matScale(toParent, 1, totalScale, 1); @@ -7465,7 +7466,7 @@ break; case 1: // '\003' - if (modified) + if (modified || opposite) { //LA.matScale(toParent, hScale, vScale, 1); LA.matScale(toParent, 1, 1, totalScale); -- Gitblit v1.6.2