From f9325048496d7cdbcad233f8a6b84c88e79adcc2 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 17 Sep 2019 20:11:47 -0400 Subject: [PATCH] Rename link2master to link2support. --- GroupEditor.java | 221 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 132 insertions(+), 89 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index 83301a6..d328971 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -368,16 +368,6 @@ refreshContents(); } - public void Show3DView() - { - // bug - //gridPanel.setDividerLocation(1.0); - //bigPanel.setDividerLocation(0.0); - bigThree.ClearUI(); - bigThree.add(centralPanel); - bigThree.FlushUI(); - } - //ObjEditor objEditor; public void closeUI2() { @@ -493,11 +483,16 @@ Object3D parent = obj.parent; obj.parent = null; + // Object3D support = obj.support; // obj.support = null; if (!supports) obj.SaveSupports(); + Object3D clone = (Object3D)Grafreed.clone(obj); + + clone.ResetUUIDs(); + obj.parent = parent; // obj.support = support; // clone.support = support; // aout 2013 @@ -567,8 +562,10 @@ pasteLinkItem.addActionListener(this); pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); pasteCloneItem.addActionListener(this); -// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); -// pasteExpandItem.addActionListener(this); +// CRASH + pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); +// + pasteExpandItem.addActionListener(this); //menu.add("-"); oe.jTree.popup.addSeparator(); @@ -765,9 +762,9 @@ shadowYItem.addActionListener(this); shadowZItem = menu.add(new MenuItem("Shadow Blue")); shadowZItem.addActionListener(this); + attributeItem = menu.add(new MenuItem("Attribute")); attributeItem.addActionListener(this); - if (Globals.ADVANCED) { menu.add("-"); @@ -779,11 +776,18 @@ pointflowItem.addActionListener(this); } menu.add("-"); + textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red")); + textureRatioRItem.addActionListener(this); + textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green")); + textureRatioGItem.addActionListener(this); + textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue")); + textureRatioBItem.addActionListener(this); + menu.add("-"); resetTransformItem = menu.add(new MenuItem("Reset Transform")); resetTransformItem.addActionListener(this); resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); resetCentroidItem.addActionListener(this); - resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY")); + resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ")); resetCentroidXZItem.addActionListener(this); transformGeometryItem = menu.add(new MenuItem("Transform Geometry")); transformGeometryItem.addActionListener(this); @@ -799,7 +803,7 @@ genNormalsCADItem.addActionListener(this); genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals")); genNormalsMESHItem.addActionListener(this); - if (Globals.ADVANCED) + //if (Globals.ADVANCED) { genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals")); genNormalsMINEItem.addActionListener(this); @@ -962,7 +966,7 @@ currenttab.setName(tabname); //added = false; resourcecontainer.add(currenttab); - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); + resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname); rowcount = 1; colcount = 0; texturecount = 0; @@ -977,6 +981,11 @@ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); } + columns = 5; + + if (path[0].contains("D&R") || path[0].contains("Paint")) + columns = 4; + AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); totalcount++; @@ -1074,13 +1083,17 @@ // } // }); + oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); + fullScreenButton.setToolTipText("Full-screen window"); + fullScreenButton.addActionListener(this); + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); collapseButton.setToolTipText("Collapse toolbar"); collapseButton.addActionListener(this); - oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); - maximize3DButton.setToolTipText("Maximize 3D view"); - maximize3DButton.addActionListener(this); +// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); +// maximize3DButton.setToolTipText("Maximize 3D view"); +// maximize3DButton.addActionListener(this); oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); twoButton.setToolTipText("Show 3D view only"); @@ -1100,10 +1113,6 @@ // sevenButton.setToolTipText("3-column layout"); // sevenButton.addActionListener(this); // - - oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); - fullButton.setToolTipText("Full-screen window"); - fullButton.addActionListener(this); oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); screenfitButton.setToolTipText("Screen fit"); @@ -1191,6 +1200,7 @@ //clearButton.addActionListener(this); cGridBag row1 = new cGridBag(); + row1.preferredHeight = 8; // INSERT row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); @@ -1217,7 +1227,7 @@ torusButton.setToolTipText("Create torus"); torusButton.addActionListener(this); - if (Globals.ADVANCED) + if (false) //Globals.ADVANCED) { oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); kleinButton.setToolTipText("Create Klein bottle"); @@ -1231,6 +1241,7 @@ oe.toolboxPanel.add(row1); cGridBag row2 = new cGridBag(); + row2.preferredHeight = 8; row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); groupButton.setToolTipText("Create group"); @@ -1333,6 +1344,7 @@ oe.treePanel.add(versionManagerPanel); oe.treePanel.Return(); + versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); versionSliderPane.preferredHeight = 3; @@ -1392,7 +1404,7 @@ // supportCB.setToolTipText("Enable rigging"); // supportCB.addItemListener(this); - panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints); + panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints); freezeCB.setToolTipText("Fast moving camera"); freezeCB.addItemListener(this); @@ -1401,9 +1413,12 @@ panel.Return(); + if (Globals.ADVANCED) + { panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints); crowdCB.setToolTipText("Used for crowds"); crowdCB.addItemListener(this); + } panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints); smoothCB.setToolTipText("Snapping delay"); @@ -1416,30 +1431,26 @@ minshaderCB.setToolTipText("Minimal fast shader"); minshaderCB.addItemListener(this); -// constraints.gridy += 1; // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); // speakerMocapCB.addItemListener(this); - panel.Return(); - if (false) { // handled in scripts - //constraints.gridy += 1; panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints); speakerCameraCB.addItemListener(this); - //constraints.gridy += 1; panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints); speakerFocusCB.addItemListener(this); - //constraints.gridy += 1; - panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints); - smoothfocusCB.addItemListener(this); panel.Return(); } -//constraints.gridx += 1; + panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints); + smoothfocusCB.addItemListener(this); + + panel.Return(); + //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); // debugCB.addItemListener(this); @@ -1493,7 +1504,7 @@ void EditObject(Object3D obj) { - assert(obj instanceof Composite); + //assert(obj instanceof Composite); // if (obj.versionlist == null) // { @@ -2078,7 +2089,7 @@ Object3D obj = (Object3D)group.selection.elementAt(0); objEditor.ScreenFit(obj, false); - cameraView.pingthread.StepToTarget(true); + cameraView.pingthread.StepToTarget(); //true); refreshContents(); } @@ -2115,7 +2126,7 @@ obj.parent.TransformToWorld(maxima); //, maxima); } - Object3D shadow = new Object3D("Shadow " + obj.name); + Object3D shadow = new Object3D("Shadow" + obj.name); shadow.toParent = LA.newMatrix(); shadow.fromParent = LA.newMatrix(); @@ -2715,11 +2726,11 @@ if (!group.selection.isEmpty()) { Composite csg = new GroupLeaf(); + group(csg); csg.count = 5; Composite child = new cGroup("Branch"); csg.addChild(child); child.addChild(csg); - group(csg); } } else if (source == doubleItem) @@ -2727,6 +2738,7 @@ if (!group.selection.isEmpty()) { Composite csg = new GroupLeaf("Fork"); + group(csg); csg.count = 5; Composite child = new cGroup("Branch A"); csg.addChild(child); @@ -2734,7 +2746,6 @@ child = new cGroup("Branch B"); csg.addChild(child); child.addChild(csg); - group(csg); } } else if (source == tripleItem) @@ -2800,7 +2811,7 @@ { Maximize(); } else - if (source == fullButton) + if (source == fullScreenButton) { ToggleFullScreen(); } else @@ -2809,13 +2820,13 @@ this.expandedLayout = radio.layout; CollapseToolbar(); } else - if (source == maximize3DButton) - { - this.expandedLayout = radio.layout; - radio.layout = twoButton; - Show3DView(); - CollapseToolbar(); - } else +// if (source == maximize3DButton) +// { +// this.expandedLayout = radio.layout; +// radio.layout = twoButton; +// CollapseToolbar(); +// Show3DView(); +// } else if (source == previousVersionButton) { // Go to previous version @@ -2843,7 +2854,7 @@ if (source == saveVersionButton) { // Save a new version - if (!Save(true)) + if (!DuplicateVersion()) //true)) java.awt.Toolkit.getDefaultToolkit().beep(); } else if (source == deleteVersionButton) @@ -3612,6 +3623,18 @@ { TransformChildren(); } else + if (source == textureRatioRItem) + { + TextureRatio(0); + } else + if (source == textureRatioGItem) + { + TextureRatio(1); + } else + if (source == textureRatioBItem) + { + TextureRatio(2); + } else if (source == resetTransformItem) { ResetTransform(); @@ -3984,7 +4007,8 @@ if (source == closeButton) { //System.out.println("CLOSE: " + buttonGroup.getSelection()); - Replace(); + if (copy.versionlist != null) + Replace(); cRadio ab; for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) @@ -4084,7 +4108,8 @@ } else if(source instanceof cRadio) { - Replace(); + if (copy.versionlist != null) + Replace(); group.parent = keepparent; group.attributes = 0; @@ -4137,7 +4162,7 @@ */ radio.layout.doClick(); - assert(copy instanceof Composite); + //assert(copy instanceof Composite); if (copy.versionlist == null) { @@ -4148,9 +4173,10 @@ // and check if any of these nodes are reachable below the root. Grafreed.grafreed.universe.TagObjects(copy, true); - if (copy.versionlist == null && !copy.HasTags()) + if (copy instanceof Composite && !copy.HasTags()) { - copy.versionlist = new Object3D[100]; + if (copy.versionlist == null) + copy.versionlist = new Object3D[100]; //Save(true); } @@ -4275,9 +4301,46 @@ refreshContents(); } + void TextureRatio(int axis) + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + obj.TextureRatio(axis); + } + + refreshContents(); + } + void ResetTransform() { ResetTransform(-1); + } + + void ScaleSelection(int scale) + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + + if (obj.toParent == null) + continue; + + obj.Scale(scale); + + if (obj.parent == null) + { + System.out.println("NULL PARENT!"); + // new Exception().printStackTrace(); + } + else + TouchTransform(obj); + //obj.parent.Touch(); + } + + refreshContents(); } void ResetTransform(int mask) @@ -4290,38 +4353,8 @@ if (obj.toParent == null) continue; - if (mask == -1) - { - if (obj instanceof Camera) // jan 2014 - { - LA.matIdentity(obj.toParent); - LA.matIdentity(obj.fromParent); - } - else - { - obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); - obj.fromParent = null; // LA.matIdentity(obj.fromParent); - } - TouchTransform(obj); - continue; - } - if ((mask&2) != 0) // Scale/rotation - { - obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; - obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; - obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; - obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; - obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; - obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; - } - if ((mask&1) != 0) // Translation - { - if (obj.toParent != null) - { - obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; - obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; - } - } + obj.ResetTransform(mask); + if (obj.parent == null) { System.out.println("NULL PARENT!"); @@ -4830,10 +4863,17 @@ { Object3D obj = group.selection.get(i); + if (obj.toParent == null) + { + obj.toParent = LA.newMatrix(); + obj.fromParent = LA.newMatrix(); + } + LA.matTranslate(obj.toParent, i * scale, 0, 0); LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0); } + Globals.lighttouched = true; refreshContents(); } @@ -5365,10 +5405,10 @@ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) // a camera { - if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace { CameraPane.camerachangeframe = 0; // don't refuse it - Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); + Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true); } // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera; // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; @@ -5412,12 +5452,12 @@ } } - rootButton.setEnabled(allComposites); + rootButton.setEnabled(true); // allComposites); } void refreshContents(boolean cp) { - if (Globals.ADVANCED) + if (Globals.SHOWINFO) //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { @@ -6392,6 +6432,9 @@ private MenuItem maxTexturesItem; private MenuItem panoTexturesItem; + private MenuItem textureRatioRItem; + private MenuItem textureRatioGItem; + private MenuItem textureRatioBItem; private MenuItem resetCentroidItem; private MenuItem resetCentroidXZItem; private MenuItem resetTransformItem; -- Gitblit v1.6.2