From 66aca73cce89e4b4d7521862760edf4b0888bc38 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sat, 17 Aug 2019 20:45:38 -0400 Subject: [PATCH] Tree icons, tabbed pane + credits. --- Object3D.java | 163 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 120 insertions(+), 43 deletions(-) diff --git a/Object3D.java b/Object3D.java index adb076e..aba2406 100644 --- a/Object3D.java +++ b/Object3D.java @@ -36,6 +36,8 @@ Object3D versionlist[]; int versionindex = -1; + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); + ScriptNode scriptnode; void InitOthers() @@ -269,6 +271,50 @@ // // return null; // } + + transient boolean tag; + + void TagObjects(Object3D o, boolean tag) + { + if (blockloop) + return; + + o.tag = tag; + + if (o == this) + return; + + blockloop = true; + + for (int i=0; i<Size(); i++) + { + get(i).TagObjects(o, tag); + } + + blockloop = false; + } + + boolean HasTags() + { + if (blockloop) + return false; + + blockloop = true; + + boolean hasTags = false; + + for (int i=0; i<Size(); i++) + { + hasTags |= get(i).tag || get(i).HasTags(); + + if (hasTags) + break; + } + + blockloop = false; + + return hasTags; + } void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) { @@ -2468,7 +2514,11 @@ else { //((ObjEditor)editWindow).SetupUI2(null); - ((ObjEditor)objectUI).pinButton.setSelected(pinned); + if (objectUI != null) + ((ObjEditor)objectUI).pinButton.setSelected(pinned); + else + //new Exception().printStackTrace(); + System.err.println("objectUI is null"); } } @@ -5570,6 +5620,11 @@ if (fullname == null) return ""; + if (fullname.pigment != null) + { + return fullname.pigment; + } + // System.out.println("Fullname = " + fullname); // Does not work on Windows due to C: @@ -5582,7 +5637,7 @@ if (split.length == 0) { - return ""; + return fullname.pigment = ""; } if (split.length <= 2) @@ -5590,22 +5645,27 @@ if (fullname.name.endsWith(":")) { // Windows - return fullname.name.substring(0, fullname.name.length()-1); + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); } - return split[0]; + return fullname.pigment = split[0]; } // Windows assert(split.length == 4); - return split[0] + ":" + split[1]; + return fullname.pigment = split[0] + ":" + split[1]; } static String GetBump(cTexture fullname) { if (fullname == null) return ""; + + if (fullname.bump != null) + { + return fullname.bump; + } // System.out.println("Fullname = " + fullname); // Does not work on Windows due to C: @@ -5617,12 +5677,12 @@ if (split.length == 0) { - return ""; + return fullname.bump = ""; } if (split.length == 1) { - return ""; + return fullname.bump = ""; } if (split.length == 2) @@ -5630,16 +5690,16 @@ if (fullname.name.endsWith(":")) { // Windows - return ""; + return fullname.bump = ""; } - return split[1]; + return fullname.bump = split[1]; } // Windows assert(split.length == 4); - return split[2] + ":" + split[3]; + return fullname.bump = split[2] + ":" + split[3]; } String GetPigmentTexture() @@ -5722,6 +5782,9 @@ texname = ""; GetTextures().name = texname + ":" + GetBump(GetTextures()); + + GetTextures().pigment = null; + Touch(); } @@ -5794,6 +5857,8 @@ texname = ""; GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; + + GetTextures().bump = null; Touch(); } @@ -7398,7 +7463,7 @@ boundary.y = spot.y - 30; boundary.width = spot.width + 60; boundary.height = spot.height + 60; - clickInfo.g.setColor(Color.red); + clickInfo.g.setColor(Color.white); int spotw = spot.x + spot.width; int spoth = spot.y + spot.height; clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); @@ -7418,7 +7483,29 @@ // { // CameraPane.Ymax = spoth; // } - spot.translate(32, 32); +// if (CameraPane.Xmin > spot.x) +// { +// CameraPane.Xmin = spot.x; +// } +// if (CameraPane.Xmax < spotw) +// { +// CameraPane.Xmax = spotw; +// } +// if (CameraPane.Ymin > spot.y) +// { +// CameraPane.Ymin = spot.y; +// } +// if (CameraPane.Ymax < spoth) +// { +// CameraPane.Ymax = 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(32, 0); + clickInfo.g.setColor(Color.yellow); + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); + + spot.translate(32, 64); spotw = spot.x + spot.width; spoth = spot.y + spot.height; clickInfo.g.setColor(Color.cyan); @@ -7439,28 +7526,7 @@ // { // CameraPane.Ymax = 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); - clickInfo.g.setColor(Color.yellow); - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); clickInfo.g.setColor(Color.green); -// if (CameraPane.Xmin > spot.x) -// { -// CameraPane.Xmin = spot.x; -// } -// if (CameraPane.Xmax < spotw) -// { -// CameraPane.Xmax = spotw; -// } -// if (CameraPane.Ymin > spot.y) -// { -// CameraPane.Ymin = spot.y; -// } -// if (CameraPane.Ymax < spoth) -// { -// CameraPane.Ymax = spoth; -// } clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); @@ -7519,12 +7585,14 @@ retval = true; } spot.translate(0, 32); + spot.translate(32, 0); + spot.translate(0, 32); if (spot.contains(clickInfo.x, clickInfo.y)) { hitSomething = hitScale; double scale = 0.005f * clickInfo.camera.Distance(); - double hScale = (double) (clickInfo.x - centerPt.x) / 32; + double hScale = (double) (clickInfo.x - centerPt.x) / 64; double sign = 1; if (hScale < 0) { @@ -7536,7 +7604,7 @@ //hScale = 0.01; } - double vScale = (double) (clickInfo.y - centerPt.y) / 32; + double vScale = (double) (clickInfo.y - centerPt.y) / 64; sign = 1; if (vScale < 0) { @@ -7751,7 +7819,7 @@ break; case hitScale: // scale - double hScale = (double) (clickInfo.x - centerPt.x) / 32; + double hScale = (double) (clickInfo.x - centerPt.x) / 64; double sign = 1; if (hScale < 0) { @@ -7763,7 +7831,7 @@ //hScale = 0.01; } - double vScale = (double) (clickInfo.y - centerPt.y) / 32; + double vScale = (double) (clickInfo.y - centerPt.y) / 64; sign = 1; if (vScale < 0) { @@ -7796,21 +7864,27 @@ case 3: // '\001' if (modified || opposite) { + if (modified && opposite) + LA.matScale(toParent, totalScale, totalScale, totalScale); + else //LA.matScale(toParent, 1, hScale, vScale); - LA.matScale(toParent, totalScale, 1, 1); + LA.matScale(toParent, totalScale, 1, 1); } // vScale, 1); else { // EXCEPTION! - LA.matScale(toParent, totalScale, totalScale, totalScale); + LA.matScale(toParent, 1, totalScale, totalScale); } // vScale, 1); break; case 2: // '\002' if (modified || opposite) { - //LA.matScale(toParent, hScale, 1, vScale); - LA.matScale(toParent, 1, totalScale, 1); + if (modified && opposite) + LA.matScale(toParent, totalScale, totalScale, totalScale); + else + //LA.matScale(toParent, hScale, 1, vScale); + LA.matScale(toParent, 1, totalScale, 1); } else { LA.matScale(toParent, totalScale, 1, totalScale); @@ -7820,8 +7894,11 @@ case 1: // '\003' if (modified || opposite) { - //LA.matScale(toParent, hScale, vScale, 1); - LA.matScale(toParent, 1, 1, totalScale); + if (modified && opposite) + LA.matScale(toParent, totalScale, totalScale, totalScale); + else + //LA.matScale(toParent, hScale, vScale, 1); + LA.matScale(toParent, 1, 1, totalScale); } else { LA.matScale(toParent, totalScale, totalScale, 1); -- Gitblit v1.6.2