From 914255f70cf047897212839cbf3a6722703f4457 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 24 Jun 2019 13:19:16 -0400 Subject: [PATCH] Fix manip window + new icons. --- GroupEditor.java | 1867 ++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 1,159 insertions(+), 708 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index aafbf22..cce9b1b 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -12,6 +12,7 @@ import com.jme.math.Vector3f; import com.jme.renderer.ColorRGBA; +import grafeme.ui.*; //import buoy.widget.BFileChooser; class GroupEditor extends ObjEditor implements //iParse, //iCallBack, @@ -73,7 +74,7 @@ this.copy = this.group = copy; //selectees = this.group.selectees; - SetupMenu2(objEditor); + SetupMenu2(this); //objEditor); SetupUI2(objEditor); objEditor.SetupUI(true); SetupViews(objEditor); @@ -97,14 +98,14 @@ void CloneClipboard(boolean supports) { - assert(GrafreeD.clipboard.parent == null); - Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; - GrafreeD.clipboard.get(0).parent = null; // Avoid copy? - if (LA.isIdentity(GrafreeD.clipboard.toParent)) - makeSomething(CloneObject(GrafreeD.clipboard.get(0), false)); + assert(Grafreed.clipboard.parent == null); + Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent; + Grafreed.clipboard.get(0).parent = null; // Avoid copy? + if (LA.isIdentity(Grafreed.clipboard.toParent)) + makeSomething(CloneObject(Grafreed.clipboard.get(0), false)); else - makeSomething(CloneObject(GrafreeD.clipboard, false)); - GrafreeD.clipboard.get(0).parent = keepparent; + makeSomething(CloneObject(Grafreed.clipboard, false)); + Grafreed.clipboard.get(0).parent = keepparent; } static Object3D CloneObject(Object3D obj, boolean supports) @@ -118,7 +119,7 @@ // obj.support = null; if (!supports) obj.SaveSupports(); - Object3D clone = (Object3D)GrafreeD.clone(obj); + Object3D clone = (Object3D)Grafreed.clone(obj); obj.parent = parent; // obj.support = support; // clone.support = support; // aout 2013 @@ -147,8 +148,129 @@ //JTextField nameField; - void SetupMenu2(ObjEditor oe) + void SetupMenu2(GroupEditor oe) { + Menu menu; + oe.menuBar.add(menu = new Menu("Edit")); + //editItem = menu.add(new MenuItem("Edit")); + //editItem.addActionListener(this); + +// undoItem = menu.add(new MenuItem("Undo")); +// undoItem.addActionListener(this); +// redoItem = menu.add(new MenuItem("Redo")); +// redoItem.addActionListener(this); +// menu.add("-"); + duplicateItem = menu.add(new MenuItem("Duplicate")); + duplicateItem.addActionListener(this); + cloneItem = menu.add(new MenuItem("Clone")); + cloneItem.addActionListener(this); + if (Globals.ADVANCED) + { + cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); + cloneSupportItem.addActionListener(this); + } + menu.add("-"); + cutItem = menu.add(new MenuItem("Cut")); + cutItem.addActionListener(this); + copyItem = menu.add(new MenuItem("Copy")); + copyItem.addActionListener(this); + pasteItem = menu.add(new MenuItem("Paste")); + pasteItem.addActionListener(this); + + menu.add("-"); + pasteIntoItem = menu.add(new MenuItem("Paste into")); + pasteIntoItem.addActionListener(this); + pasteLinkItem = menu.add(new MenuItem("Paste link")); + pasteLinkItem.addActionListener(this); + pasteCloneItem = menu.add(new MenuItem("Paste clone")); + pasteCloneItem.addActionListener(this); +// pasteExpandItem = menu.add(new MenuItem("Paste expand")); +// pasteExpandItem.addActionListener(this); + menu.add("-"); + clearItem = menu.add(new MenuItem("Clear")); + clearItem.addActionListener(this); + + if (Globals.ADVANCED) + { + // Deletes the cameras... + clearAllItem = menu.add(new MenuItem("Clear All")); + clearAllItem.addActionListener(this); + } + + menuBar.add(cameraMenu = new Menu("View")); + //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); + //zBufferItem.addActionListener(this); + //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); + //normalLensItem.addActionListener(this); + cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint")); + revertCameraItem.addActionListener(this); + + cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); + toggleFullScreenItem.addItemListener(this); + toggleFullScreenItem.setState(CameraPane.FULLSCREEN); + cameraMenu.add("-"); + + cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); + toggleTextureItem.addItemListener(this); + toggleTextureItem.setState(CameraPane.textureon); + + cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); + toggleSwitchItem.addItemListener(this); + toggleSwitchItem.setState(CameraPane.SWITCH); + + cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); + toggleHandleItem.addItemListener(this); + toggleHandleItem.setState(CameraPane.HANDLES); + + cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); + togglePaintItem.addItemListener(this); + togglePaintItem.setState(CameraPane.PAINTMODE); + + if (Globals.ADVANCED) + { + cameraMenu.add("-"); + cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); + toggleLiveItem.addItemListener(this); + toggleLiveItem.setState(Globals.isLIVE()); + + cameraMenu.add(stepItem = new MenuItem("Step")); + stepItem.addActionListener(this); + // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); + // toggleDLItem.addItemListener(this); + // toggleDLItem.setState(false); + + cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); + toggleRenderItem.addItemListener(this); + toggleRenderItem.setState(!CameraPane.frozen); + + cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); + toggleDebugItem.addItemListener(this); + toggleDebugItem.setState(Globals.DEBUG); + + cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); + toggleFrustumItem.addItemListener(this); + toggleFrustumItem.setState(CameraPane.FRUSTUM); + + cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); + toggleFootContactItem.addItemListener(this); + toggleFootContactItem.setState(CameraPane.FOOTCONTACT); + + cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); + toggleTimelineItem.addItemListener(this); + } + +// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); +// toggleRootItem.addItemListener(this); +// toggleRootItem.setState(false); +// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); +// animationItem.addItemListener(this); +// animationItem.setState(CameraPane.ANIMATION); + cameraMenu.add("-"); + cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint")); + editCameraItem.addActionListener(this); + + if (Globals.ADVANCED) + { oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); //cameraMenu.add(switchItem = new MenuItem("Reverse View")); @@ -160,45 +282,17 @@ lookAtItem.addActionListener(this); //lookFromItem.addActinoListener(this); //switchItem.addActionListener(this); - Menu menu; - oe.menuBar.add(menu = new Menu("Edit")); - //editItem = menu.add(new MenuItem("Edit")); - //editItem.addActionListener(this); - duplicateItem = menu.add(new MenuItem("Duplicate")); - duplicateItem.addActionListener(this); - menu.add("-"); - cloneItem = menu.add(new MenuItem("Clone")); - cloneItem.addActionListener(this); - cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); - cloneSupportItem.addActionListener(this); - menu.add("-"); - cutItem = menu.add(new MenuItem("Cut")); - cutItem.addActionListener(this); - copyItem = menu.add(new MenuItem("Copy")); - copyItem.addActionListener(this); - pasteItem = menu.add(new MenuItem("Paste")); - pasteItem.addActionListener(this); - pasteLinkItem = menu.add(new MenuItem("Paste link")); - pasteLinkItem.addActionListener(this); - pasteCloneItem = menu.add(new MenuItem("Paste clone")); - pasteCloneItem.addActionListener(this); -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); -// pasteExpandItem.addActionListener(this); - clearItem = menu.add(new MenuItem("Clear")); - clearItem.addActionListener(this); - clearAllItem = menu.add(new MenuItem("Clear All")); - clearAllItem.addActionListener(this); - + } + oe.menuBar.add(menu = new Menu("Setting")); - resetMeshItem = menu.add(new MenuItem("Reset All")); - resetMeshItem.addActionListener(this); - stepAllItem = menu.add(new MenuItem("Step All")); - stepAllItem.addActionListener(this); + if (Globals.ADVANCED) + { revertMeshItem = menu.add(new MenuItem("Revert Meshes")); revertMeshItem.addActionListener(this); resetreferencesItem = menu.add(new MenuItem("Reset Mesh References")); resetreferencesItem.addActionListener(this); menu.add("-"); + } overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry")); overwriteGeoItem.addActionListener(this); overwriteMatItem = menu.add(new MenuItem("Overwrite Material")); @@ -210,19 +304,26 @@ overwriteUVItem = menu.add(new MenuItem("Overwrite UV")); overwriteUVItem.addActionListener(this); menu.add("-"); + if (Globals.ADVANCED) + { generateMeshItem = menu.add(new MenuItem("Generate Meshes")); generateMeshItem.addActionListener(this); poseMeshItem = menu.add(new MenuItem("Set Pose Meshes")); poseMeshItem.addActionListener(this); menu.add("-"); + } resetsupportItem = menu.add(new MenuItem("Reset support")); resetsupportItem.addActionListener(this); linkverticesItem = menu.add(new MenuItem("Link to Support")); linkverticesItem.addActionListener(this); relinkverticesItem = menu.add(new MenuItem("Re-link to Support")); relinkverticesItem.addActionListener(this); + + if (Globals.ADVANCED) + { setMasterItem = menu.add(new MenuItem("Set Master Mesh")); setMasterItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Group")); grabItem = menu.add(new MenuItem("Grab")); @@ -233,27 +334,32 @@ frontItem.addActionListener(this); compositeItem = menu.add(new MenuItem("Composite")); compositeItem.addActionListener(this); - hideItem = menu.add(new MenuItem("Hide")); + hideItem = menu.add(new MenuItem("Hidden Group")); hideItem.addActionListener(this); ungroupItem = menu.add(new MenuItem("Ungroup")); ungroupItem.addActionListener(this); menu.add("-"); - randomItem = menu.add(new MenuItem("Random")); + randomItem = menu.add(new MenuItem("Switch node")); randomItem.addActionListener(this); - physicsItem = menu.add(new MenuItem("Physics")); - physicsItem.addActionListener(this); - frameselectorItem = menu.add(new MenuItem("Frame Selector")); - frameselectorItem.addActionListener(this); switchGeoItem = menu.add(new MenuItem("Switch Geometry")); switchGeoItem.addActionListener(this); switchTransfoItem = menu.add(new MenuItem("Switch Transform")); switchTransfoItem.addActionListener(this); - morphItem = menu.add(new MenuItem("Morph")); + morphItem = menu.add(new MenuItem("Morph Group")); morphItem.addActionListener(this); + + if (Globals.ADVANCED) + { + menu.add("-"); + physicsItem = menu.add(new MenuItem("Physics")); + physicsItem.addActionListener(this); + frameselectorItem = menu.add(new MenuItem("Frame Selector")); + frameselectorItem.addActionListener(this); scriptNodeItem = menu.add(new MenuItem("Script Node")); scriptNodeItem.addActionListener(this); cameraItem = menu.add(new MenuItem("Camera")); cameraItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Object")); textureItem = menu.add(new MenuItem("Texture")); @@ -262,27 +368,35 @@ billboardItem.addActionListener(this); csgItem = menu.add(new MenuItem("CSG")); csgItem.addActionListener(this); - shadowXItem = menu.add(new MenuItem("Shadow X")); + shadowXItem = menu.add(new MenuItem("Shadow Red")); shadowXItem.addActionListener(this); - shadowYItem = menu.add(new MenuItem("Shadow Y")); + shadowYItem = menu.add(new MenuItem("Shadow Green")); shadowYItem.addActionListener(this); - shadowZItem = menu.add(new MenuItem("Shadow Z")); + shadowZItem = menu.add(new MenuItem("Shadow Blue")); shadowZItem.addActionListener(this); + if (Globals.ADVANCED) + { + menu.add("-"); linkerItem = menu.add(new MenuItem("Linker")); linkerItem.addActionListener(this); - templateItem = menu.add(new MenuItem("Template")); - templateItem.addActionListener(this); attributeItem = menu.add(new MenuItem("Attribute")); attributeItem.addActionListener(this); + templateItem = menu.add(new MenuItem("Template")); + templateItem.addActionListener(this); pointflowItem = menu.add(new MenuItem("Point Flow")); pointflowItem.addActionListener(this); + } menu.add("-"); resetTransformItem = menu.add(new MenuItem("Reset Transform")); resetTransformItem.addActionListener(this); resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); resetCentroidItem.addActionListener(this); - transformgeometryItem = menu.add(new MenuItem("Transform Geometry")); - transformgeometryItem.addActionListener(this); + resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY")); + resetCentroidXZItem.addActionListener(this); + transformGeometryItem = menu.add(new MenuItem("Transform Geometry")); + transformGeometryItem.addActionListener(this); + transformChildrenItem = menu.add(new MenuItem("Transform Children")); + transformChildrenItem.addActionListener(this); oe.menuBar.add(menu = new Menu("Geometry")); genUVItem = menu.add(new MenuItem("Generate UV")); @@ -293,8 +407,11 @@ genNormalsCADItem.addActionListener(this); genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals")); genNormalsMESHItem.addActionListener(this); + if (Globals.ADVANCED) + { genNormalsMINEItem = menu.add(new MenuItem("My Normals")); genNormalsMINEItem.addActionListener(this); + } stripifyItem = menu.add(new MenuItem("Stripify")); stripifyItem.addActionListener(this); unstripifyItem = menu.add(new MenuItem("Unstripify")); @@ -316,23 +433,34 @@ reduce34MeshItem.addActionListener(this); increaseMeshItem = menu.add(new MenuItem("Increase mesh")); increaseMeshItem.addActionListener(this); - smoothMeshItem = menu.add(new MenuItem("Smooth mesh")); - smoothMeshItem.addActionListener(this); clipMeshItem = menu.add(new MenuItem("Clip mesh")); clipMeshItem.addActionListener(this); + + if (Globals.ADVANCED) + { + smoothMeshItem = menu.add(new MenuItem("Smooth mesh")); + smoothMeshItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Attributes")); clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); clearMaterialsItem.addActionListener(this); + resetAllItem = menu.add(new MenuItem("Reset All")); + resetAllItem.addActionListener(this); + stepAllItem = menu.add(new MenuItem("Step All")); + stepAllItem.addActionListener(this); menu.add("-"); liveleavesItem = menu.add(new MenuItem("Live Leaves")); liveleavesItem.addActionListener(this); unliveleavesItem = menu.add(new MenuItem("Unlive Leaves")); unliveleavesItem.addActionListener(this); + if (Globals.ADVANCED) + { supportleavesItem = menu.add(new MenuItem("Support Leaves")); supportleavesItem.addActionListener(this); unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves")); unsupportleavesItem.addActionListener(this); + } hideleavesItem = menu.add(new MenuItem("Hide Leaves")); hideleavesItem.addActionListener(this); showleavesItem = menu.add(new MenuItem("Show Leaves")); @@ -341,6 +469,14 @@ markleavesItem.addActionListener(this); unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); unmarkleavesItem.addActionListener(this); + rewindleavesItem = menu.add(new MenuItem("Rewind Leaves")); + rewindleavesItem.addActionListener(this); + unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves")); + unrewindleavesItem.addActionListener(this); + randomleavesItem = menu.add(new MenuItem("Random Leaves")); + randomleavesItem.addActionListener(this); + unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves")); + unrandomleavesItem.addActionListener(this); menu.add("-"); flipVItem = menu.add(new MenuItem("Flip V")); flipVItem.addActionListener(this); @@ -376,35 +512,40 @@ sortbynameItem = menu.add(new MenuItem("Sort by name")); sortbynameItem.addActionListener(this); menu.add("-"); + shareGeometriesItem = menu.add(new MenuItem("Share Geometries")); + shareGeometriesItem.addActionListener(this); + mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); + mergeGeometriesItem.addActionListener(this); + if (Globals.ADVANCED) + { + // Pretty much the same as duplicate and clone. extractGeometriesItem = menu.add(new MenuItem("Link Geometry")); extractGeometriesItem.addActionListener(this); cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry")); cloneGeometriesItem.addActionListener(this); - shareGeometriesItem = menu.add(new MenuItem("Share Geometry")); - shareGeometriesItem.addActionListener(this); - mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry")); - mergeGeometriesItem.addActionListener(this); + } oe.menuBar.add(menu = new Menu("Insert")); buildCreateMenu(menu); - - oe.menuBar.add(menu = new Menu("Include")); - importGFDItem = menu.add(new MenuItem("GrafreeD Object...")); - importGFDItem.addActionListener(this); - importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object...")); - importVRMLX3DItem.addActionListener(this); - importOBJItem = menu.add(new MenuItem("OBJ Object...")); - importOBJItem.addActionListener(this); - import3DSItem = menu.add(new MenuItem("3DS Object...")); - import3DSItem.addActionListener(this); - oe.menuBar.add(menu = new Menu("Tools")); buildToolsMenu(menu); } void SetupUI2(ObjEditor oe) { + // June 2019 + if (oe == null) + { + //super.SetupUI2(this); + //return; + } + + if (copy != group) + { + //super.SetupUI2(this); + } + //new Exception().printStackTrace(); oe.radioPanel = new JPanel(new GridBagLayout()); @@ -433,153 +574,120 @@ oe.radioPanel.add(dummyButton); oe.buttonGroup.add(dummyButton); */ - aConstraints.gridy += 1; - oe.aConstraints.gridwidth = 1; - oe.aConstraints.gridx = 0; + //this.AddOptions(oe.toolbarPanel, oe.aConstraints); - oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints); + //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + //minButton.setToolTipText("Minimize window"); + //minButton.addActionListener(this); + + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + maxButton.setToolTipText("Maximize window"); + maxButton.addActionListener(this); + + oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + fullButton.setToolTipText("Full-screen window"); + fullButton.addActionListener(this); + + oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + undoButton.setToolTipText("Undo changes"); + undoButton.addActionListener(this); + + oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + redoButton.setToolTipText("Redo changes"); + redoButton.addActionListener(this); + + oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + saveButton.setToolTipText("Save changes"); + saveButton.addActionListener(this); + + oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); + liveCB.setToolTipText("Enable animation"); liveCB.addItemListener(this); - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints); - supportCB.addItemListener(this); - - // oe.aConstraints.gridx += 1; - // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints); - // localCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints); - crowdCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints); - smoothCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints); + oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints); + fastCB.setToolTipText("Fast mode"); fastCB.addItemListener(this); - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints); - slowCB.addItemListener(this); - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints); - boxCB.addItemListener(this); - -// oe.aConstraints.gridx += 1; -// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints); -// speakerMocapCB.addItemListener(this); - - if (false) - { - // handled in scripts - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints); - speakerCameraCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints); - speakerFocusCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints); - smoothfocusCB.addItemListener(this); - } - -//oe.aConstraints.gridx += 1; -//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints); -// debugCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints); - oeilCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints); - lookAtCB.addItemListener(this); - - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints); + + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oneStepButton.setToolTipText("Animate one step forward"); + oneStepButton.addActionListener(this); + + oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); + trackCB.setToolTipText("Enable tracking"); trackCB.addItemListener(this); - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints); + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + screenfitButton.setToolTipText("Screen fit"); screenfitButton.addActionListener(this); - oe.aConstraints.gridx += 1; + // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints); // screenfitpointButton.addActionListener(this); -// oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints); - snapobjectButton.addActionListener(this); - oe.aConstraints.gridx += 1; - //aConstraints.gridx = 0; - //aConstraints.gridy += 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 1; - - oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints); + if (Globals.ADVANCED) + { + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + snapobjectButton.addActionListener(this); + snapobjectButton.setToolTipText("Snap Object"); + } + + oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + flashSelectionButton.setToolTipText("Highlight selection"); flashSelectionButton.addActionListener(this); - oe.toolbarPanel.add(new cButton(" ", false)); + oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); - oe.aConstraints.gridx += 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 1; - - // - oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints); + oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + twoButton.setToolTipText("Show center view only"); twoButton.addActionListener(this); - oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints); + oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); fourButton.addActionListener(this); - oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints); + fourButton.setToolTipText("Show left panel only"); + oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + sixButton.setToolTipText("2-column layout left"); sixButton.addActionListener(this); - oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints); + oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + threeButton.setToolTipText("2-column layout right"); threeButton.addActionListener(this); - oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints); + oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + sevenButton.setToolTipText("3-column layout"); sevenButton.addActionListener(this); // - oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints); + oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + rootButton.setToolTipText("Edit selection in new tab"); rootButton.addActionListener(this); - oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints); + + oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + closeButton.setToolTipText("Close tab"); closeButton.addActionListener(this); //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); //clearButton.addActionListener(this); - oe.aConstraints.gridx += 1; - oe.aConstraints.gridx = 1; // - oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints); + editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + editButton.setToolTipText("Edit selection"); editButton.addActionListener(this); - oe.aConstraints.gridx += 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 1; - oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints); + editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + uneditButton.setToolTipText("Unedit selection"); uneditButton.addActionListener(this); - oe.aConstraints.gridx += 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 1; - - oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints); - clearPanelButton.addActionListener(this); - - oe.aConstraints.gridx += 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 1; - - oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints); + editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); + allParamsButton.setToolTipText("Edit all params"); allParamsButton.addActionListener(this); - oe.aConstraints.gridx += 1; - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 1; - - oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints); + editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + clearPanelButton.setToolTipText("Clear edit panel"); + clearPanelButton.addActionListener(this); + + editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + unselectButton.setToolTipText("Unselect"); unselectButton.addActionListener(this); + editCommandsPanel.preferredHeight = 1; + +// oe.treePanel.add(commandsPanel); +// oe.treePanel.Return(); + // oe.aConstraints.gridx += 1; // oe.aConstraints.weighty = 0; // oe.aConstraints.gridwidth = 1; @@ -591,40 +699,37 @@ // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints); // gcButton.addActionListener(this); - oe.aConstraints.gridx = 0; - oe.aConstraints.gridy += 1; - - //ctrlPanel.add(objList = new List(5, true)); - oe.aConstraints.gridwidth = 100; - // oe.aConstraints.gridheight = 100; - oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL; - oe.aConstraints.gridheight = 1; - oe.aConstraints.weighty = 0.5; - oe.aConstraints.gridx = 0; - JScrollPane jSP; + cGridBag jSPPanel = new cGridBag(); + + JScrollPane jSP; //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); - oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints); + jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints); ResetModel(); - oe.aConstraints.weighty = 0.5; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.aConstraints.gridy += 1; - oe.aConstraints.gridwidth = 1; + + oe.treePanel.add(jSPPanel); + oe.treePanel.Return(); - oe.aConstraints.weighty = 0; - oe.aConstraints.gridwidth = 2; - - oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints); + cGridBag copyOptionsPanel = new cGridBag(); + + copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints); + colorCB.setToolTipText("Copy color when dropped"); colorCB.addItemListener(this); - oe.aConstraints.gridx += 2; - oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints); + + copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints); + materialCB.setToolTipText("Copy material when dropped"); materialCB.addItemListener(this); - oe.aConstraints.gridx += 2; - oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints); + + copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints); + textureCB.setToolTipText("Copy texture when dropped"); textureCB.addItemListener(this); - oe.aConstraints.gridx = 0; - oe.aConstraints.gridy += 1; + copyOptionsPanel.preferredHeight = 1; + oe.treePanel.add(copyOptionsPanel); + oe.treePanel.Return(); +// mainPanel.setDividerLocation(0.5); //1.0); +// mainPanel.setResizeWeight(0.5); + //jList.addListSelectionListener(this); oe.jTree.addTreeSelectionListener(this); //jTree.setRootVisible(false); @@ -646,20 +751,115 @@ radio.layout = sevenButton; oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); } + + void AddOptions(cGridBag panel) //, GridBagConstraints constraints) + { + panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints); + boxCB.setToolTipText("Display bounding boxes"); + boxCB.addItemListener(this); + + panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); + zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); + zoomBoxCB.addItemListener(this); + + if (true) // Globals.ADVANCED) + { + panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); + supportCB.setToolTipText("Enable rigging"); + supportCB.addItemListener(this); + + // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); + // localCB.addItemListener(this); + + 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"); + smoothCB.addItemListener(this); + + panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); + slowCB.setToolTipText("Smooth interpolation"); + slowCB.addItemListener(this); + +// constraints.gridy += 1; +// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); +// speakerMocapCB.addItemListener(this); + + 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); + } + +//constraints.gridx += 1; +//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); +// debugCB.addItemListener(this); + + panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); + oeilCB.setToolTipText("Move camera when tracking target"); + oeilCB.addItemListener(this); + + panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); + shadowCB.setToolTipText("Compute shadows when live"); + shadowCB.addItemListener(this); + + panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); + autosaveCB.setToolTipText("Auto-save on structure change"); + autosaveCB.addItemListener(this); + + if (Globals.ADVANCED) + { + panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints); + lookAtCB.setToolTipText("Look-at target"); + lookAtCB.addItemListener(this); + } + + } + + cGridBag fill = new cGridBag(); + + fill.preferredHeight = 200; + + panel.add(fill); + + } void EditObject(Object3D obj) { - cRadio dummyButton = new cRadio(obj.name); - dummyButton.SetObject(obj); - dummyButton.layout = sevenButton; - dummyButton.SetCamera(cameraView.renderCamera, false); - dummyButton.addActionListener(this); - radioPanel.add(dummyButton); - buttonGroup.add(dummyButton); - dummyButton.doClick(); + cRadio radioButton = new cRadio(obj.name); + + // Patch to avoid bug with transparency. + radioButton.hadMaterial = obj.material != null; + if (!radioButton.hadMaterial) + { + obj.material = new cMaterial(); + } + + radioButton.SetObject(obj); + radioButton.layout = sevenButton; + radioButton.SetCamera(cameraView.renderCamera, false); + radioButton.addActionListener(this); + radioPanel.add(radioButton); + buttonGroup.add(radioButton); + radioButton.doClick(); } + void SetupViews(ObjEditor oe) { + theFrame = this; + oe.SetupViews(); System.out.println("SetupViews"); @@ -668,22 +868,26 @@ /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this); } - JCheckBox liveCB; - JCheckBox supportCB; - JCheckBox localCB; - JCheckBox crowdCB; - JCheckBox smoothCB; - JCheckBox fastCB; - JCheckBox slowCB; - JCheckBox boxCB; - JCheckBox trackCB; - JCheckBox smoothfocusCB; + cCheckBox liveCB; + cCheckBox supportCB; + cCheckBox localCB; + cCheckBox crowdCB; + cCheckBox smoothCB; + cCheckBox fastCB; + cCheckBox slowCB; + cCheckBox boxCB; + cCheckBox zoomBoxCB; + cCheckBox trackCB; + cCheckBox smoothfocusCB; // JCheckBox speakerMocapCB; - JCheckBox speakerCameraCB; - JCheckBox speakerFocusCB; - JCheckBox debugCB; - JCheckBox oeilCB; - JCheckBox lookAtCB; + cCheckBox speakerCameraCB; + cCheckBox speakerFocusCB; + cCheckBox debugCB; + + cCheckBox oeilCB; + cCheckBox shadowCB; + cCheckBox autosaveCB; + cCheckBox lookAtCB; // static int COLOR = 1; // static int MATERIAL = 2; @@ -691,9 +895,9 @@ int dropAttributes = Object3D.COLOR | Object3D.MATERIAL; - JCheckBox colorCB; - JCheckBox materialCB; - JCheckBox textureCB; + cCheckBox colorCB; + cCheckBox materialCB; + cCheckBox textureCB; public void itemStateChanged(ItemEvent e) { @@ -721,6 +925,7 @@ } else if(e.getSource() == liveCB) { cameraView.ToggleLive(); + refreshContents(false); } else if(e.getSource() == supportCB) { @@ -756,6 +961,10 @@ cameraView.repaint(); // refreshContents(); } + else if(e.getSource() == zoomBoxCB) + { + cameraView.ToggleZoomBoxMode(); + } else if(e.getSource() == smoothfocusCB) { cameraView.ToggleSmoothFocus(); @@ -780,6 +989,14 @@ else if(e.getSource() == oeilCB) { cameraView.ToggleOeil(); + } + else if(e.getSource() == shadowCB) + { + Globals.COMPUTESHADOWWHENLIVE ^= true; + } + else if(e.getSource() == autosaveCB) + { + Globals.SAVEONMAKE ^= true; } else if(e.getSource() == lookAtCB) { @@ -869,7 +1086,9 @@ // objEditor.DropFile((java.io.File[]) object, true); // return; // } - if (string.charAt(0) == '/') + + // File path for Mac and Windows + if (string.charAt(0) == '/' || string.charAt(1) == ':') { // file(s) String[] names = string.split("\n"); @@ -896,7 +1115,7 @@ flashIt = false; CameraPane pane = (CameraPane) target; - pane.clickStart(objEditor.location.x, objEditor.location.y, 0); + pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0); pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true); if (group.selection.size() == 1) @@ -923,11 +1142,11 @@ { loadClipboard(true); objEditor.jTree.setSelectionPath(destinationPath); - pasteInto(false); + pasteInto(false, false); } else { loadClipboard(false); objEditor.jTree.setSelectionPath(destinationPath); - pasteInto(false); // true); // ??? + pasteInto(false, false); // true); // ??? } } public void dropActionChanged(DropTargetDragEvent dtde) @@ -1049,27 +1268,33 @@ kleinItem.addActionListener(this); particleItem = menu.add(new MenuItem("Particle system")); particleItem.addActionListener(this); + if (Globals.ADVANCED) + { ragdollItem = menu.add(new MenuItem("Rag Walk")); ragdollItem.addActionListener(this); ragdoll2Item = menu.add(new MenuItem("Rag Fall")); ragdoll2Item.addActionListener(this); + } menu.add("-"); - meshItem = menu.add(new MenuItem("Mesh")); + meshItem = menu.add(new MenuItem("Dynamic Mesh")); meshItem.addActionListener(this); // meshGroupItem = menu.add(new MenuItem("Mesh Group")); // meshGroupItem.addActionListener(this); + if (Globals.ADVANCED) + { springItem = menu.add(new MenuItem("Spring")); springItem.addActionListener(this); flagItem = menu.add(new MenuItem("Flag")); flagItem.addActionListener(this); - bezierItem = menu.add(new MenuItem("Patch")); - bezierItem.addActionListener(this); - checkerItem = menu.add(new MenuItem("Checker")); - checkerItem.addActionListener(this); blobItem = menu.add(new MenuItem("Blob")); blobItem.addActionListener(this); latheItem = menu.add(new MenuItem("Lathe")); latheItem.addActionListener(this); + } + bezierItem = menu.add(new MenuItem("Bezier Patch")); + bezierItem.addActionListener(this); + overlayItem = menu.add(new MenuItem("Overlay")); + overlayItem.addActionListener(this); lightItem = menu.add(new MenuItem("Light")); lightItem.addActionListener(this); menu.add("-"); @@ -1079,39 +1304,44 @@ loopItem.addActionListener(this); doubleItem = menu.add(new MenuItem("Fork")); doubleItem.addActionListener(this); + if (Globals.ADVANCED) + { tripleItem = menu.add(new MenuItem("Trident")); tripleItem.addActionListener(this); + } } void buildToolsMenu(Menu menu) { menu.add(animationItem = new CheckboxMenuItem("Animation...")); animationItem.addItemListener(this); - animationItem.setState(CameraPane.ANIMATION); + animationItem.setState(Globals.ANIMATION); menu.add("-"); parseverticesItem = menu.add(new MenuItem("Multiplicity")); parseverticesItem.addActionListener(this); textureFieldItem = menu.add(new MenuItem("Texture Field")); textureFieldItem.addActionListener(this); - alignItem = menu.add(new MenuItem("Align")); + alignItem = menu.add(new MenuItem("Align Objects")); alignItem.addActionListener(this); - mirrorItem = menu.add(new MenuItem("Mirror Poses")); - mirrorItem.addActionListener(this); reduceMorphItem = menu.add(new MenuItem("Reduce Morphs")); reduceMorphItem.addActionListener(this); reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); reduce34MorphItem.addActionListener(this); - + menu.add("-"); menu.add(computeAOItem = new MenuItem("Compute AO")); computeAOItem.addActionListener(this); - menu.add("-"); + if (Globals.ADVANCED) + { + mirrorItem = menu.add(new MenuItem("Mirror Poses")); + mirrorItem.addActionListener(this); + menu.add("-"); menu.add(memoryItem = new MenuItem("Memory Usage")); 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); @@ -1120,6 +1350,8 @@ resetParentItem.addActionListener(this); repairParentItem = menu.add(new MenuItem("Repair Parent")); repairParentItem.addActionListener(this); + repairShadowItem = menu.add(new MenuItem("Repair Shadow")); + repairShadowItem.addActionListener(this); menu.add(invariantsItem = new MenuItem("Invariants")); invariantsItem.addActionListener(this); menu.add(recompileItem = new MenuItem("Recompile")); @@ -1127,6 +1359,7 @@ menu.add("-"); menu.add(editScriptItem = new MenuItem("Edit Script...")); editScriptItem.addActionListener(this); + } } void ScreenFit() @@ -1249,6 +1482,7 @@ shadow.material = new cMaterial(obj.material); shadow.material.diffuse = 0.0001f; shadow.material.specular = 0.0001f; + //shadow.projectedVertices[1].x = 300; makeSomething(shadow); } @@ -1455,9 +1689,9 @@ void Overwrite(int mask) { - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -1480,6 +1714,7 @@ // public void actionPerformed(ActionEvent event) // , Object arg) { + Object source = event.getSource(); /* if (event.getSource() == nameField) { @@ -1491,11 +1726,11 @@ } else */ - if (event.getSource() == lookAtItem || event.getSource() == lookFromItem) + if (source == lookAtItem || source == lookFromItem) { ScreenFit(); } else - if (event.getSource() == switchItem) + if (source == switchItem) { cVector v1 = new cVector(); cVector v2 = new cVector(); @@ -1504,11 +1739,11 @@ objEditor.cameraView.renderCamera.setAim(v2, v1); objEditor.cameraView.repaint(); } else - if (event.getSource() == rectoidItem) + if (source == rectoidItem) { makeSomething(new Box()); } else - if (event.getSource() == particleItem) + if (source == particleItem) { ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType); ParticleController particleController = new ParticleController(particleGeom); @@ -1529,9 +1764,9 @@ applyExample(particleGeom, "SMOKE"); makeSomething(particleGeom); } else - if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item) + if (source == ragdollItem || source == ragdoll2Item) { - GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem); + GenericJoint ragdoll = new GenericJoint(source == ragdollItem); ragdoll.toParent = LA.newMatrix(); ragdoll.fromParent = LA.newMatrix(); @@ -1549,7 +1784,7 @@ } else /* */ - if (event.getSource() == heightFieldItem) + if (source == heightFieldItem) { Object3D obj = new Object3D(); @@ -1587,31 +1822,31 @@ makeSomething(obj); } else - if (event.getSource() == gridItem) + if (source == gridItem) { makeSomething(new Grid()); } else - if (event.getSource() == ellipsoidItem) + if (source == ellipsoidItem) { makeSomething(new Sphere()); } else - if (event.getSource() == coneItem) + if (source == coneItem) { makeSomething(new Cone()); } else - if (event.getSource() == torusItem) + if (source == torusItem) { makeSomething(new Torus()); } else - if (event.getSource() == superItem) + if (source == superItem) { makeSomething(new Superellipsoid()); } else - if (event.getSource() == kleinItem) + if (source == kleinItem) { makeSomething(new Klein()); } else - if (event.getSource() == blobItem) + if (source == blobItem) { Blob blob = new Blob(); BlobComponent comp = new BlobComponent(); @@ -1619,15 +1854,15 @@ //blob.retile(); makeSomething(blob); } else - if (event.getSource() == latheItem) + if (source == latheItem) { makeSomething(new Lathe()); } else - if (event.getSource() == bezierItem) + if (source == bezierItem) { makeSomething(new BezierSurface()); } else - if (event.getSource() == checkerItem) + if (source == overlayItem) { /* Object3D obj = new BezierSurface(5,8); @@ -1642,7 +1877,7 @@ */ makeSomething(new Checker()); } else - if (event.getSource() == meshItem) + if (source == meshItem) { Object3D itemtomake = new Object3D(); Object3D child; @@ -1663,35 +1898,35 @@ makeSomething(child); } } else - if (event.getSource() == springItem) + if (source == springItem) { cSpring s = new cSpring(); s.setup(); makeSomething(s); } else - if (event.getSource() == flagItem) + if (source == flagItem) { cSpring s = new cFlag(); s.setup(); makeSomething(s); } else - if (event.getSource() == lightItem) + if (source == lightItem) { makeSomething(new Light()); } else - if (event.getSource() == csgItem) + if (source == csgItem) { group(new CSG()); } else - if (event.getSource() == templateItem) + if (source == templateItem) { group(new cTemplate()); } else - if (event.getSource() == attributeItem) + if (source == attributeItem) { makeSomething(new Attribute()); } else - if (event.getSource() == pointflowItem) + if (source == pointflowItem) { makeSomething(new PointFlow()); } else @@ -1703,7 +1938,7 @@ } else */ - if (event.getSource() == superLoopItem) + if (source == superLoopItem) { Composite g = new cGroup(); for (int i=0; i<15; i++) @@ -1725,7 +1960,7 @@ group(g); } else - if (event.getSource() == loopItem) + if (source == loopItem) { Composite csg = new GroupLeaf(); csg.count = 5; @@ -1734,7 +1969,7 @@ csg.addChild(child); child.addChild(csg); } else - if (event.getSource() == doubleItem) + if (source == doubleItem) { Composite csg = new GroupLeaf(); csg.count = 5; @@ -1746,7 +1981,7 @@ csg.addChild(child); child.addChild(csg); } else - if (event.getSource() == tripleItem) + if (source == tripleItem) { Composite csg = new GroupLeaf(); csg.count = 4; @@ -1761,71 +1996,83 @@ csg.addChild(child); child.addChild(csg); } else - - if (event.getSource() == importGFDItem) + if (source == computeAOItem) { - ImportGFD(); + Globals.drawMode = CameraPane.OCCLUSION; + Globals.theRenderer.repaint(); } else - if (event.getSource() == importVRMLX3DItem) - { - ImportVRMLX3D(); - } else - if (event.getSource() == import3DSItem) - { - objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); - } else - if (event.getSource() == importOBJItem) - { - objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); - } else - if (event.getSource() == computeAOItem) - { - CameraPane.drawMode = CameraPane.OCCLUSION; - CameraPane.theRenderer.repaint(); - } else - if (event.getSource() == recompileItem) + if (source == recompileItem) { Recompile(); refreshContents(); } else - if (event.getSource() == editScriptItem) + if (source == editScriptItem) { OpenDialog(); refreshContents(); } else - if (event.getSource() == invariantsItem) + if (source == invariantsItem) { System.out.println("Invariants:"); - GrafreeD.grafreeD.universe.invariants(); + Grafreed.grafreeD.universe.invariants(); } else - if (event.getSource() == memoryItem) + if (source == memoryItem) { //System.out.println("Invariants:"); PrintMemory(); } else - if (event.getSource() == pathItem) + if (source == pathItem) { PrintPath(); } else - if (event.getSource() == analyzeItem) + if (source == analyzeItem) { AnalyzeObject(); } else - if (event.getSource() == dumpItem) + if (source == dumpItem) { DumpObject(); } else - if (event.getSource() == screenfitButton) + if (source == minButton) + { + Minimize(); + } else + if (source == maxButton) + { + Maximize(); + } else + if (source == fullButton) + { + ToggleFullScreen(); + } else + if (source == undoButton) + { + Undo(); + } else + if (source == redoButton) + { + Redo(); + } else + if (source == saveButton) + { + Save(); + } else + if (source == oneStepButton) + { + Globals.ONESTEP = true; + cameraView.repaint(); + } else + if (source == screenfitButton) { //Reload(lastConverter, lastFilename, true); ScreenFit(); } else - if (event.getSource() == screenfitpointButton) + if (source == screenfitpointButton) { //Reload(lastConverter, lastFilename, true); ScreenFitPoint(); } else - if (event.getSource() == snapobjectButton) + if (source == snapobjectButton) { //Reload(lastConverter, lastFilename, true); SnapObject(); @@ -1836,13 +2083,13 @@ // Recompile(); // refreshContents(); // } else - if (event.getSource() == gcButton) + if (source == gcButton) { System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory()); System.gc(); System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory()); } else - if (event.getSource() == editLeafItem) + if (source == editLeafItem) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -1856,62 +2103,74 @@ } refreshContents(true); } else - if (event.getSource() == openWindowItem) + if (source == openWindowItem) { EditSelection(true); } else - if (event.getSource() == cutItem || event.getSource() == clearButton) + if (source == cutItem || source == clearButton) { loadClipboard(true); } else - if (event.getSource() == duplicateItem) + if (source == undoItem) { - Object3D keep = GrafreeD.clipboard; + Undo(); + } else + if (source == redoItem) + { + Redo(); + } else + if (source == duplicateItem) + { + Object3D keep = Grafreed.clipboard; loadClipboard(false); paste(false); - GrafreeD.clipboard = keep; + Grafreed.clipboard = keep; } else - if (event.getSource() == cloneItem) + if (source == cloneItem) { CloneSelection(false); } else - if (event.getSource() == cloneSupportItem) + if (source == cloneSupportItem) { CloneSelection(true); } else - if (event.getSource() == copyItem) + if (source == copyItem) { loadClipboard(false); } else - if (event.getSource() == pasteItem) + if (source == pasteItem) { paste(false); } else - if (event.getSource() == pasteLinkItem) + if (source == pasteIntoItem) { - pasteInto(false); + pasteInto(true, false); } else - if (event.getSource() == pasteCloneItem) + if (source == pasteLinkItem) { - pasteInto(true); + pasteInto(false, false); } else - if (event.getSource() == pasteExpandItem) + if (source == pasteCloneItem) + { + pasteInto(true, true); + } else + if (source == pasteExpandItem) { paste(true); } else - if (event.getSource() == synchronizeItem) + if (source == synchronizeItem) { Overwrite(Object3D.TRANSFORM); } else - if (event.getSource() == overwriteNameItem) + if (source == overwriteNameItem) { Overwrite(Object3D.NAME); } else - if (event.getSource() == overwriteUVItem) + if (source == overwriteUVItem) { Overwrite(Object3D.UV); } else - if (event.getSource() == overwriteMatItem) + if (source == overwriteMatItem) { /* july 2015 if ((dropAttributes & Object3D.TEXTURE) == 0) @@ -1931,7 +2190,7 @@ Overwrite(dropAttributes); } - if (event.getSource() == overwriteGeoItem) + if (source == overwriteGeoItem) { Overwrite(Object3D.GEOMETRY); // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) @@ -1948,7 +2207,7 @@ // refreshContents(); // } } else - if (event.getSource() == generateMeshItem) + if (source == generateMeshItem) { //if (group.selection.size() == 1) // for (int i=0; i<group.selection.size(); i++) @@ -1959,7 +2218,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == extractGeometriesItem) + if (source == extractGeometriesItem) { boolean one = false; @@ -1986,7 +2245,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == cloneGeometriesItem) + if (source == cloneGeometriesItem) { boolean one = false; @@ -2012,7 +2271,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == shareGeometriesItem) + if (source == shareGeometriesItem) { boolean one = false; @@ -2042,7 +2301,7 @@ refreshContents(); } } else - if (event.getSource() == mergeGeometriesItem) + if (source == mergeGeometriesItem) { boolean one = false; @@ -2072,7 +2331,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == linkverticesItem) + if (source == linkverticesItem) { // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) // { @@ -2085,48 +2344,48 @@ // group.selection.get(0).setMasterThis(content); // should be identity // refreshContents(); // } - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); for (int i=0; i<group.selection.size(); i++) { - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes group.selection.get(i).linkVerticesThis(content); // group.selection.get(i).setMasterThis(content); // should be identity - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; } - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); refreshContents(); } } else - if (event.getSource() == resetsupportItem) + if (source == resetsupportItem) { for (int i=0; i<group.selection.size(); i++) { - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes group.selection.get(i).linkVerticesThis(null); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; } refreshContents(); } else - if (event.getSource() == relinkverticesItem) + if (source == relinkverticesItem) { - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes group.selection.RelinkToSupport(); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; refreshContents(); } else - if (event.getSource() == resetreferencesItem) + if (source == resetreferencesItem) { for (int i=0; i<group.selection.size(); i++) { @@ -2135,11 +2394,11 @@ refreshContents(); } else - if (event.getSource() == setMasterItem) + if (source == setMasterItem) { - if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) + if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -2148,13 +2407,13 @@ refreshContents(); } } else - if (event.getSource() == poseMeshItem) + if (source == poseMeshItem) { if (group.selection.size() == 1) { - if (GrafreeD.clipboard.size() == 1) + if (Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -2167,19 +2426,19 @@ } } else - if (event.getSource() == revertMeshItem) + if (source == revertMeshItem) { RevertMeshes(); } else - if (event.getSource() == resetMeshItem) + if (source == resetAllItem) { ResetAll(); } else - if (event.getSource() == stepAllItem) + if (source == stepAllItem) { StepAll(); } else - if (event.getSource() == clearItem) // || event.getSource() == clearButton) + if (source == clearItem) // || event.getSource() == clearButton) { //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) @@ -2187,46 +2446,46 @@ ClearSelection(false); } else - if (event.getSource() == clearAllItem) + if (source == clearAllItem) { ClearSelection(true); } else - if (event.getSource() == grabItem) + if (source == grabItem) { group(new cGroup(), true); } else - if (event.getSource() == hideItem) + if (source == hideItem) { group(new HiddenObject()); } else - if (event.getSource() == frontItem) + if (source == frontItem) { front(); } else - if (event.getSource() == backItem) + if (source == backItem) { back(); } else - if (event.getSource() == cameraItem) + if (source == cameraItem) { makeSomething(new Camera()); } else - if (event.getSource() == compositeItem) + if (source == compositeItem) { group(new Composite()); } else - if (event.getSource() == randomItem) + if (source == randomItem) { RandomNode random = new RandomNode(); group(random); if (random.size() > 0) - random.name = random.get(0).name + "Rnd"; + random.name = random.get(0).name + "Switch"; } else - if (event.getSource() == physicsItem) + if (source == physicsItem) { group(new PhysicsNode()); } else - if (event.getSource() == frameselectorItem) + if (source == frameselectorItem) { for (int i=0; i<group.selection.size(); i++) { @@ -2238,7 +2497,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == switchGeoItem) + if (source == switchGeoItem) { for (int i=0; i<group.selection.size(); i++) { @@ -2250,7 +2509,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == switchTransfoItem) + if (source == switchTransfoItem) { for (int i=0; i<group.selection.size(); i++) { @@ -2262,7 +2521,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == morphItem) + if (source == morphItem) { for (int i=0; i<group.selection.size(); i++) { @@ -2274,7 +2533,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == scriptNodeItem) + if (source == scriptNodeItem) { boolean atleastone = false; @@ -2313,31 +2572,31 @@ } } } else - if (event.getSource() == linkerItem) + if (source == linkerItem) { group(new cLinker()); } else - if (event.getSource() == textureItem) + if (source == textureItem) { group(new TextureNode()); } else - if (event.getSource() == billboardItem) + if (source == billboardItem) { group(new BillboardNode()); } else - if (event.getSource() == shadowXItem) + if (source == shadowXItem) { CastShadow(0); } else - if (event.getSource() == shadowYItem) + if (source == shadowYItem) { CastShadow(1); } else - if (event.getSource() == shadowZItem) + if (source == shadowZItem) { CastShadow(2); } else - if (event.getSource() == ungroupItem) + if (source == ungroupItem) { //ungroup(); for (int i=0; i<group.selection.size(); i++) @@ -2349,179 +2608,203 @@ refreshContents(); } else - if (event.getSource() == genUVItem) + if (source == genUVItem) { GenUV(); } else - if (event.getSource() == genNormalsCADItem) + if (source == genNormalsCADItem) { GenNormals(true); } else - if (event.getSource() == genNormalsMESHItem) + if (source == genNormalsMESHItem) { - GenNormals(true); // TODO + GenNormalsMESH(); } else - if (event.getSource() == genNormalsORGANItem) + if (source == genNormalsORGANItem) { GenNormals(false); } else - if (event.getSource() == genNormalsMINEItem) + if (source == genNormalsMINEItem) { GenNormalsMINE(); } else - if (event.getSource() == stripifyItem) + if (source == stripifyItem) { Stripify(); } else - if (event.getSource() == unstripifyItem) + if (source == unstripifyItem) { Unstripify(); } else - if (event.getSource() == trimItem) + if (source == trimItem) { Trim(); } else - if (event.getSource() == untrimItem) + if (source == untrimItem) { Untrim(); } else - if (event.getSource() == clearColorsItem) + if (source == clearColorsItem) { ClearColors(); } else - if (event.getSource() == clearMaterialsItem) + if (source == clearMaterialsItem) { ClearMaterials(); } else - if (event.getSource() == liveleavesItem) + if (source == liveleavesItem) { LiveLeaves(true); } else - if (event.getSource() == unliveleavesItem) + if (source == unliveleavesItem) { LiveLeaves(false); } else - if (event.getSource() == supportleavesItem) + if (source == supportleavesItem) { SupportLeaves(true); } else - if (event.getSource() == unsupportleavesItem) + if (source == unsupportleavesItem) { SupportLeaves(false); } else - if (event.getSource() == hideleavesItem) + if (source == hideleavesItem) { HideLeaves(true); } else - if (event.getSource() == showleavesItem) + if (source == showleavesItem) { HideLeaves(false); } else - if (event.getSource() == markleavesItem) + if (source == markleavesItem) { MarkLeaves(true); } else - if (event.getSource() == unmarkleavesItem) + if (source == unmarkleavesItem) { MarkLeaves(false); } else - if (event.getSource() == flipVItem) + if (source == rewindleavesItem) + { + RewindLeaves(true); + } else + if (source == unrewindleavesItem) + { + RewindLeaves(false); + } else + if (source == randomleavesItem) + { + RandomLeaves(true); + } else + if (source == unrandomleavesItem) + { + RandomLeaves(false); + } else + if (source == flipVItem) { FlipV(true); } else - if (event.getSource() == unflipVItem) + if (source == unflipVItem) { FlipV(false); } else - if (event.getSource() == lowTexturesItem) + if (source == lowTexturesItem) { SetTexRes(0); } else - if (event.getSource() == normalTexturesItem) + if (source == normalTexturesItem) { SetTexRes(1); } else - if (event.getSource() == highTexturesItem) + if (source == highTexturesItem) { SetTexRes(2); } else - if (event.getSource() == veryhighTexturesItem) + if (source == veryhighTexturesItem) { SetTexRes(3); } else - if (event.getSource() == maxTexturesItem) + if (source == maxTexturesItem) { SetTexRes(4); } else - if (event.getSource() == panoTexturesItem) + if (source == panoTexturesItem) { SetTexRes(5); } else - if (event.getSource() == reverseNormalsItem) + if (source == reverseNormalsItem) { ReverseNormals(); } else - if (event.getSource() == parseverticesItem) + if (source == parseverticesItem) { ParseVertices(); } else - if (event.getSource() == textureFieldItem) + if (source == textureFieldItem) { TextureVertices(); } else - if (event.getSource() == alignItem) + if (source == alignItem) { Align(); } else - if (event.getSource() == mirrorItem) + if (source == mirrorItem) { MirrorPoses(); } else - if (event.getSource() == reduceMorphItem) + if (source == reduceMorphItem) { MeshReduction(false); } else - if (event.getSource() == reduce34MorphItem) + if (source == reduce34MorphItem) { MeshReduction(true); } else - if (event.getSource() == reverseTrianglesItem) + if (source == reverseTrianglesItem) { ReverseTriangles(); } else - if (event.getSource() == reduceMeshItem) + if (source == reduceMeshItem) { ReduceMesh(false); } else - if (event.getSource() == reduce34MeshItem) + if (source == reduce34MeshItem) { ReduceMesh(true); } else - if (event.getSource() == increaseMeshItem) + if (source == increaseMeshItem) { IncreaseMesh(); } else - if (event.getSource() == clipMeshItem) + if (source == clipMeshItem) { ClipMesh(); } else - if (event.getSource() == smoothMeshItem) + if (source == smoothMeshItem) { SmoothMesh(); } else - if (event.getSource() == transformgeometryItem) + if (source == transformGeometryItem) { TransformGeometry(); } else - if (event.getSource() == resetTransformItem) + if (source == transformChildrenItem) + { + TransformChildren(); + } else + if (source == resetTransformItem) { ResetTransform(); } else - if (event.getSource() == resetCentroidItem) + if (source == resetCentroidItem) { - ResetCentroid(); + ResetCentroid(true); } else - if (event.getSource() == resetParentItem) + if (source == resetCentroidXZItem) + { + ResetCentroid(false); + } else + if (source == resetParentItem) { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -2531,7 +2814,7 @@ refreshContents(); } else - if (event.getSource() == repairParentItem) + if (source == repairParentItem) { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -2545,7 +2828,21 @@ refreshContents(); } else - if (event.getSource() == sortbysizeItem) + if (source == repairShadowItem) + { + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + Object3D obj = (Object3D)e.nextElement(); + obj.RepairShadow(); +// for (int i=0; i<obj.size(); i++) +// { +// obj.get(i).parent = obj; +// } + } + + refreshContents(); + } else + if (source == sortbysizeItem) { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -2557,7 +2854,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == sortbynameItem) + if (source == sortbynameItem) { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -2569,7 +2866,7 @@ ResetModel(); refreshContents(); } else - if (event.getSource() == attachPigmentItem) + if (source == attachPigmentItem) { String texture = GetFile("Attach pigment"); Object3D obj; @@ -2581,7 +2878,7 @@ refreshContents(); } else - if (event.getSource() == detachPigmentItem) + if (source == detachPigmentItem) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -2592,7 +2889,7 @@ refreshContents(); } else - if (event.getSource() == attachBumpItem) + if (source == attachBumpItem) { String texture = GetFile("Attach bump"); Object3D obj; @@ -2604,7 +2901,7 @@ refreshContents(); } else - if (event.getSource() == detachBumpItem) + if (source == detachBumpItem) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -2615,7 +2912,7 @@ refreshContents(); } else - if (event.getSource() == pigmentBumpItem) + if (source == pigmentBumpItem) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -2626,158 +2923,221 @@ refreshContents(); } else - if (event.getSource() == flashSelectionButton) + if (source == flashSelectionButton) { CameraPane.flash = true; refreshContents(); } else - if (event.getSource() == oneButton) + if (source == oneButton) { } else - if (event.getSource() == twoButton) + if (source == twoButton) { radio.layout = twoButton; // bug //gridPanel.setDividerLocation(1.0); //bigPanel.setDividerLocation(0.0); - bigThree.remove(scenePanel); - bigThree.remove(centralPanel); - bigThree.remove(XYZPanel); - aWindowConstraints.gridx = 0; - aWindowConstraints.gridy = 0; - aWindowConstraints.gridwidth = 1; - // aConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - aWindowConstraints.weightx = 0; - aWindowConstraints.weighty = 1; - //bigThree.add(jtp, aWindowConstraints); - aWindowConstraints.weightx = 1; - aWindowConstraints.gridwidth = 3; - // aConstraints.gridheight = 3; - aWindowConstraints.gridx = 1; - aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(centralPanel, aWindowConstraints); - aWindowConstraints.weightx = 0; - aWindowConstraints.gridx = 4; - aWindowConstraints.gridwidth = 1; - // aConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - //bigThree.add(XYZPanel, aWindowConstraints); - bigThree.revalidate(); +// bigThree.remove(scenePanel); +// bigThree.remove(centralPanel); +// bigThree.remove(XYZPanel); +// aWindowConstraints.gridx = 0; +// aWindowConstraints.gridy = 0; +// aWindowConstraints.gridwidth = 1; +// // aConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// aWindowConstraints.weightx = 0; +// aWindowConstraints.weighty = 1; +// //bigThree.add(jtp, aWindowConstraints); +// aWindowConstraints.weightx = 1; +// aWindowConstraints.gridwidth = 3; +// // aConstraints.gridheight = 3; +// aWindowConstraints.gridx = 1; +// aWindowConstraints.fill = GridBagConstraints.BOTH; +// bigThree.add(centralPanel, aWindowConstraints); +// aWindowConstraints.weightx = 0; +// aWindowConstraints.gridx = 4; +// aWindowConstraints.gridwidth = 1; +// // aConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// //bigThree.add(XYZPanel, aWindowConstraints); +// scenePanel.setVisible(false); +// centralPanel.setVisible(true); +// XYZPanel.setVisible(false); + bigThree.ClearUI(); + bigThree.add(centralPanel); + bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); + +// refreshContents(true); +// +// try +// { +// java.awt.Robot bot = new java.awt.Robot(); +// int mask = InputEvent.BUTTON1_MASK; +// bot.mouseMove(100, 100); +// bot.mousePress(mask); +// bot.mouseRelease(mask); +// } +// catch (Exception e) +// { +// +// } + } else - if (event.getSource() == threeButton) + if (source == threeButton) { radio.layout = threeButton; - bigThree.remove(scenePanel); - bigThree.remove(centralPanel); - bigThree.remove(XYZPanel); - aWindowConstraints.gridx = 0; - aWindowConstraints.gridy = 0; - aWindowConstraints.gridwidth = 1; - // aConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - aWindowConstraints.weightx = 0; - aWindowConstraints.weighty = 1; - //bigThree.add(jtp, aWindowConstraints); - aWindowConstraints.weightx = 1; - aWindowConstraints.gridwidth = 3; - // aConstraints.gridheight = 3; - aWindowConstraints.gridx = 1; - aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(centralPanel, aWindowConstraints); - aWindowConstraints.weightx = 0; - aWindowConstraints.gridx = 4; - aWindowConstraints.gridwidth = 1; - // aConstraints.gridheight = 3; - aConstraints.fill = GridBagConstraints.VERTICAL; - bigThree.add(XYZPanel, aWindowConstraints); - bigThree.revalidate(); + +// bigThree.remove(scenePanel); +// bigThree.remove(centralPanel); +// bigThree.remove(XYZPanel); +// aWindowConstraints.gridx = 0; +// aWindowConstraints.gridy = 0; +// aWindowConstraints.gridwidth = 1; +// // aConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// aWindowConstraints.weightx = 0; +// aWindowConstraints.weighty = 1; +// //bigThree.add(jtp, aWindowConstraints); +// aWindowConstraints.weightx = 1; +// aWindowConstraints.gridwidth = 3; +// // aConstraints.gridheight = 3; +// aWindowConstraints.gridx = 1; +// aWindowConstraints.fill = GridBagConstraints.BOTH; +// bigThree.add(centralPanel, aWindowConstraints); +// aWindowConstraints.weightx = 0; +// aWindowConstraints.gridx = 4; +// aWindowConstraints.gridwidth = 1; +// // aConstraints.gridheight = 3; +// aConstraints.fill = GridBagConstraints.VERTICAL; +// bigThree.add(XYZPanel, aWindowConstraints); +// bigThree.validate(); +// scenePanel.setVisible(false); +// centralPanel.setVisible(true); +// XYZPanel.setVisible(true); + bigThree.ClearUI(); + bigThree.add(centralPanel); + bigThree.add(XYZPanel); + bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else - if (event.getSource() == fourButton) + if (source == fourButton) { radio.layout = fourButton; - bigThree.remove(scenePanel); - bigThree.remove(centralPanel); - bigThree.remove(XYZPanel); - aWindowConstraints.gridx = 0; - aWindowConstraints.gridy = 0; - aWindowConstraints.gridwidth = 1; - // aWindowConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.BOTH; - aWindowConstraints.weightx = 1; - aWindowConstraints.weighty = 1; - bigThree.add(scenePanel, aWindowConstraints); - aWindowConstraints.weightx = 1; - aWindowConstraints.gridwidth = 3; - // aConstraints.gridheight = 3; - aWindowConstraints.gridx = 1; - aWindowConstraints.fill = GridBagConstraints.BOTH; - //bigThree.add(cameraPanel, aWindowConstraints); - aWindowConstraints.weightx = 0; - aWindowConstraints.gridx = 4; - aWindowConstraints.gridwidth = 1; - // aWindowConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - //bigThree.add(XYZPanel, aWindowConstraints); - bigThree.revalidate(); + +// bigThree.remove(scenePanel); +// bigThree.remove(centralPanel); +// bigThree.remove(XYZPanel); +// aWindowConstraints.gridx = 0; +// aWindowConstraints.gridy = 0; +// aWindowConstraints.gridwidth = 1; +// // aWindowConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.BOTH; +// aWindowConstraints.weightx = 1; +// aWindowConstraints.weighty = 1; +// bigThree.add(scenePanel, aWindowConstraints); +// aWindowConstraints.weightx = 1; +// aWindowConstraints.gridwidth = 3; +// // aConstraints.gridheight = 3; +// aWindowConstraints.gridx = 1; +// aWindowConstraints.fill = GridBagConstraints.BOTH; +// //bigThree.add(cameraPanel, aWindowConstraints); +// aWindowConstraints.weightx = 0; +// aWindowConstraints.gridx = 4; +// aWindowConstraints.gridwidth = 1; +// // aWindowConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// //bigThree.add(XYZPanel, aWindowConstraints); +// bigThree.validate(); +// scenePanel.setVisible(true); +// centralPanel.setVisible(false); +// XYZPanel.setVisible(false); + bigThree.ClearUI(); + bigThree.add(scenePanel); + bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else - if (event.getSource() == sixButton) + if (source == sixButton) { radio.layout = sixButton; - bigThree.remove(scenePanel); - bigThree.remove(centralPanel); - bigThree.remove(XYZPanel); - aWindowConstraints.gridx = 0; - aWindowConstraints.gridy = 0; - aWindowConstraints.gridwidth = 1; - // aConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - aWindowConstraints.weightx = 0; - aWindowConstraints.weighty = 1; - bigThree.add(scenePanel, aWindowConstraints); - aWindowConstraints.weightx = 1; - aWindowConstraints.gridwidth = 3; - // aWindowConstraints.gridheight = 3; - aWindowConstraints.gridx = 1; - aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(centralPanel, aWindowConstraints); - aWindowConstraints.weightx = 0; - aWindowConstraints.gridx = 4; - aWindowConstraints.gridwidth = 1; - // aWindowConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - //bigThree.add(XYZPanel, aConstraints); - bigThree.revalidate(); + +// bigThree.remove(scenePanel); +// bigThree.remove(centralPanel); +// bigThree.remove(XYZPanel); +// aWindowConstraints.gridx = 0; +// aWindowConstraints.gridy = 0; +// aWindowConstraints.gridwidth = 1; +// // aConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// aWindowConstraints.weightx = 0; +// aWindowConstraints.weighty = 1; +// bigThree.add(scenePanel, aWindowConstraints); +// aWindowConstraints.weightx = 1; +// aWindowConstraints.gridwidth = 3; +// // aWindowConstraints.gridheight = 3; +// aWindowConstraints.gridx = 1; +// aWindowConstraints.fill = GridBagConstraints.BOTH; +// bigThree.add(centralPanel, aWindowConstraints); +// aWindowConstraints.weightx = 0; +// aWindowConstraints.gridx = 4; +// aWindowConstraints.gridwidth = 1; +// // aWindowConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// //bigThree.add(XYZPanel, aConstraints); +// bigThree.validate(); +// scenePanel.setVisible(true); +// centralPanel.setVisible(true); +// XYZPanel.setVisible(false); + bigThree.ClearUI(); + bigThree.add(scenePanel); + bigThree.add(centralPanel); + bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else - if (event.getSource() == sevenButton) + if (source == sevenButton) { radio.layout = sevenButton; - bigThree.remove(scenePanel); - bigThree.remove(centralPanel); - bigThree.remove(XYZPanel); - aWindowConstraints.gridx = 0; - aWindowConstraints.gridy = 0; - aWindowConstraints.gridwidth = 1; - // aWindowConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - aWindowConstraints.weightx = 0; - aWindowConstraints.weighty = 1; - bigThree.add(scenePanel, aWindowConstraints); - aWindowConstraints.weightx = 1; - aWindowConstraints.gridwidth = 3; - // aWindowConstraints.gridheight = 3; - aWindowConstraints.gridx = 1; - aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(centralPanel, aWindowConstraints); - aWindowConstraints.weightx = 0; - aWindowConstraints.gridx = 4; - aWindowConstraints.gridwidth = 1; - // aConstraints.gridheight = 3; - aWindowConstraints.fill = GridBagConstraints.VERTICAL; - bigThree.add(XYZPanel, aWindowConstraints); - bigThree.revalidate(); + +// bigThree.remove(scenePanel); +// bigThree.remove(centralPanel); +// bigThree.remove(XYZPanel); +// aWindowConstraints.gridx = 0; +// aWindowConstraints.gridy = 0; +// aWindowConstraints.gridwidth = 1; +// // aWindowConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// aWindowConstraints.weightx = 0; +// aWindowConstraints.weighty = 1; +// bigThree.add(scenePanel, aWindowConstraints); +// aWindowConstraints.weightx = 1; +// aWindowConstraints.gridwidth = 3; +// // aWindowConstraints.gridheight = 3; +// aWindowConstraints.gridx = 1; +// aWindowConstraints.fill = GridBagConstraints.BOTH; +// bigThree.add(centralPanel, aWindowConstraints); +// aWindowConstraints.weightx = 0; +// aWindowConstraints.gridx = 4; +// aWindowConstraints.gridwidth = 1; +// // aConstraints.gridheight = 3; +// aWindowConstraints.fill = GridBagConstraints.VERTICAL; +// bigThree.add(XYZPanel, aWindowConstraints); +// bigThree.validate(); +// scenePanel.setVisible(true); +// centralPanel.setVisible(true); +// XYZPanel.setVisible(true); + bigThree.ClearUI(); + bigThree.add(scenePanel); + bigThree.add(centralPanel); + bigThree.add(XYZPanel); + bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else - if (event.getSource() == rootButton) + if (source == rootButton) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -2787,34 +3147,44 @@ EditObject(obj); } + cameraView.requestFocusInWindow(); refreshContents(true); } else - if (event.getSource() == closeButton) + if (source == closeButton) { //System.out.println("CLOSE: " + buttonGroup.getSelection()); cRadio ab; for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) { ab = (cRadio)e.nextElement(); - if(ab.getModel().isSelected() && ab.GetObject() != client) + if (ab.getModel().isSelected() && ab.GetObject() != client) { + // Patch to avoid bug with transparency. + if (!ab.hadMaterial) + { + ab.object.material = null; + } + buttonGroup.remove(ab); radioPanel.remove(ab); - ab.GetObject().editWindow = null; + //ab.GetObject().editWindow = null; + ab.GetObject().manipWindow = null; // ab.GetObject().objectUI = null; // ????????? ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick(); break; } } + + cameraView.requestFocusInWindow(); refreshContents(true); } else - if (event.getSource() == editItem || event.getSource() == editButton) + if (source == editItem || source == editButton) { EditSelection(false); } else - if (event.getSource() == uneditButton) + if (source == uneditButton) { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { @@ -2824,14 +3194,14 @@ child.CloseUI(); listUI.remove(child); - child.editWindow = null; // ??????????? + //child.editWindow = null; // ??????????? } - objEditor.ctrlPanel.revalidate(); + objEditor.ctrlPanel.FlushUI(); //objEditor.jTree.clearSelection(); //objEditor.ResetSliders(); refreshContents(true); } else - if (event.getSource() == clearPanelButton) + if (source == clearPanelButton) { assert(copy == group); //copy.ClearUI(); @@ -2842,7 +3212,7 @@ listUI.clear(); refreshContents(true); } else - if (event.getSource() == allParamsButton) + if (source == allParamsButton) { assert(copy == group); @@ -2863,19 +3233,19 @@ refreshContents(true); } else - if (event.getSource() == unselectButton) + if (source == unselectButton) { objEditor.jTree.clearSelection(); // ?? oct 2012 GrafreeD.clipboard.clear(); objEditor.ResetSliders(); refreshContents(true); } else - if(event.getSource() instanceof cRadio) + if(source instanceof cRadio) { group.parent = keepparent; group.attributes = 0; //group.editWindow = null; - /*cRadio*/ radio = (cRadio)event.getSource(); + /*cRadio*/ radio = (cRadio)source; Object3D obj = radio.GetObject(); System.out.println("Edit " + obj); if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite) @@ -2895,7 +3265,7 @@ } copy = group; - //CameraPane.theRenderer.object = group; + //Globals.theRenderer.object = group; if(!useclient) { cameraView.renderCamera = radio.camera; @@ -2904,12 +3274,17 @@ cameraView.cameras[cameraView.cameracount] = radio.camera; cameraView.targetLookAt.set(radio.camera.lookAt); cameraView.object = group; - cameraView.lighttouched = true; + //cameraView.lighttouched = true; + Globals.lighttouched = true; topView.object = group; frontView.object = group; sideView.object = group; } - group.editWindow = this; + +// fix "+" issue + //group.editWindow = this; + group.manipWindow = this; + /* currentLayout = radio.layout; if (currentLayout == null) @@ -2921,8 +3296,23 @@ //group.parent = null; // ROOT //group.attributes = -1; ResetModel(); + + cameraView.requestFocusInWindow(); refreshContents(true); - } + } else if (event.getSource() == editCameraItem) + { + cameraView.ProtectCamera(); + cameraView.repaint(); + return; + } else if (event.getSource() == revertCameraItem) + { + cameraView.RevertCamera(); + cameraView.repaint(); + return; + // } else if (event.getSource() == textureButton) + // { + // return; // true; + } else { //return super.action(event, arg); @@ -2931,7 +3321,6 @@ } boolean useclient = false; - cRadio radio; void ToggleRoot() { @@ -2940,7 +3329,7 @@ if (useclient) { cameraView.object = client; - cameraView.lighttouched = true; + Globals.lighttouched = true; //topView.object = client; //frontView.object = client; //sideView.object = client; @@ -2948,7 +3337,7 @@ else { cameraView.object = group; - cameraView.lighttouched = true; + Globals.lighttouched = true; //topView.object = group; //frontView.object = group; //sideView.object = group; @@ -2983,6 +3372,28 @@ refreshContents(); } + void TransformChildren() + { + Object3D obj; + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + obj = (Object3D)e.nextElement(); + obj.KeepTextureMatrices(); + obj.TransformChildren(); + obj.RestoreTextureMatrices(); + +// if (obj.parent == null) +// { +// System.out.println("NULL PARENT!"); +// new Exception().printStackTrace(); +// } +// else +// TouchTransform(obj); +// //obj.parent.Touch(); + } + + refreshContents(); + } void ResetTransform() { @@ -3095,7 +3506,7 @@ refreshContents(); } - void ResetCentroid() + void ResetCentroid(boolean full) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -3110,12 +3521,16 @@ LA.matIdentity(Object3D.mat); obj.getBounds(minima, maxima, false); Object3D.mat[3][0] = -(minima.x + maxima.x)/2; - Object3D.mat[3][1] = -(minima.y + maxima.y)/2; + if (full) + Object3D.mat[3][1] = -(minima.y + maxima.y)/2; Object3D.mat[3][2] = -(minima.z + maxima.z)/2; obj.TransformMesh(Object3D.mat); + Object3D.mat[3][0] = (minima.x + maxima.x)/2; - Object3D.mat[3][1] = (minima.y + maxima.y)/2; + if (full) + Object3D.mat[3][1] = (minima.y + maxima.y)/2; Object3D.mat[3][2] = (minima.z + maxima.z)/2; + LA.matConcat(Object3D.mat, obj.toParent, obj.toParent); //Object3D.mat[3][0] = -Object3D.mat[3][0]; //Object3D.mat[3][1] = -Object3D.mat[3][1]; @@ -3144,7 +3559,8 @@ int size = obj.MemorySize(); - System.err.println((size/1024) + " KB is the size of " + obj); + //System.err.println((size/1024) + " KB is the size of " + obj); + System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)"); } } catch (Exception e) @@ -3181,9 +3597,9 @@ obj = (Object3D)e.nextElement(); System.out.println("Object is: " + obj); - GrafreeD.AnalyzeObject(obj); + Grafreed.AnalyzeObject(obj); System.out.println("Boundary rep: " + obj.bRep); - GrafreeD.AnalyzeObject(obj.bRep); + Grafreed.AnalyzeObject(obj.bRep); // System.err.println((size/1024) + " KB is the size of " + obj); } @@ -3225,6 +3641,13 @@ void GenNormals(boolean crease) { group.GenNormalsS(crease); + + refreshContents(); + } + + void GenNormalsMESH() + { + group.GenNormalsMeshS(); refreshContents(); } @@ -3397,8 +3820,8 @@ void ParseVertices() { - boolean epsequal = GrafreeD.epsequal; - GrafreeD.epsequal = true; + boolean epsequal = Grafreed.epsequal; + Grafreed.epsequal = true; for (int i=0; i<group.selection.size(); i++) { @@ -3423,7 +3846,7 @@ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); - g.add(GrafreeD.clipboard); + g.add(Grafreed.clipboard); buffer.add(g); } @@ -3438,7 +3861,7 @@ makeSomething(buffer, i==group.selection.size()-1); } - GrafreeD.epsequal = epsequal; + Grafreed.epsequal = epsequal; refreshContents(); } @@ -3456,7 +3879,16 @@ String pigment = Object3D.GetPigment(tex); //String bump = Object3D.GetBump(tex); - com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres); + com.sun.opengl.util.texture.TextureData texturedata = null; + + try + { + texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres); + } + catch (Exception e) + { + System.err.println("FAIL: " + node); + } double s = v.s; @@ -3544,11 +3976,11 @@ SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY); - boolean random = CameraPane.RANDOM; - CameraPane.RANDOM = false; // parse all random nodes + boolean random = CameraPane.SWITCH; + CameraPane.SWITCH = false; // parse all random nodes lowres.linkVerticesThis(null); lowres.linkVerticesThis(sn); - CameraPane.RANDOM = random; + CameraPane.SWITCH = random; System.err.flush(); @@ -3588,7 +4020,7 @@ return; Object3D poses = group.selection.get(0); - Object3D ref = GrafreeD.clipboard.get(0); + Object3D ref = Grafreed.clipboard.get(0); Object3D newgroup = new Object3D("Po:" + poses.name); @@ -3757,7 +4189,7 @@ group.selection.RelinkToSupport(); // july 2014 System.out.println("DONE."); refreshContents(); - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); } void ReduceMesh(boolean reduction34) @@ -3782,9 +4214,9 @@ void ClipMesh() { - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { - Object3D content = GrafreeD.clipboard.get(0); + Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); @@ -3793,7 +4225,7 @@ // { // group.selection.get(i).ClipMesh(GrafreeD.clipboard); // } - group.selection.ClipMesh(GrafreeD.clipboard); + group.selection.ClipMesh(Grafreed.clipboard); } // group.selection.ClipMesh(GrafreeD.clipboard); System.out.println("DONE."); @@ -3840,6 +4272,18 @@ void MarkLeaves(boolean hide) { group.selection.MarkLeaves(hide); + refreshContents(); + } + + void RewindLeaves(boolean hide) + { + group.selection.RewindLeaves(hide); + refreshContents(); + } + + void RandomLeaves(boolean hide) + { + group.selection.RandomLeaves(hide); refreshContents(); } @@ -3928,7 +4372,7 @@ objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); Object3D elem = (Object3D)group.selection.elementAt(i); - if(elem != group) + if(elem != group || !newWindow) { // if (!(elem instanceof Composite)) // newWindow = false; @@ -4018,7 +4462,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++) @@ -4027,31 +4470,30 @@ //if (child.parent != null) //child.parent.addSelectee(child); + objEditor.SetMaterial(child); group.addSelectee(child); - objEditor.SetMaterial(child); // .GetMaterial()); - objEditor.AddInfo(child, this, true); // .GetMaterial()); - System.err.println("info : " + child.GetPath()); } } - else - { - objEditor.SetMaterial(group); // .GetMaterial()); - objEditor.AddInfo(group, this, true); // .GetMaterial()); - System.err.println("info : " + group.GetPath()); - } +// else +// { +// objEditor.SetMaterial(group); // .GetMaterial()); +// objEditor.AddInfo(group, this, true); // .GetMaterial()); +// System.err.println("info : " + group.GetPath()); +// } - objEditor.SetText(); // jan 2014 - - if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera)) + if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera)) CameraPane.flash = true; - if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera) + if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) // a camera { - CameraPane.camerachangeframe = 0; // don't refuse it - CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); - // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera; - // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera; + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) + { + CameraPane.camerachangeframe = 0; // don't refuse it + Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); + } + // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera; + // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; } refreshContents(); @@ -4062,6 +4504,26 @@ 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.get(i); + + objEditor.AddInfo(child, this, true); + System.err.println("info : " + child.GetPath()); + } + + objEditor.SetText(); // jan 2014 + } + + super.refreshContents(cp); + } void linkSomething(Object3D thing) { @@ -4133,16 +4595,19 @@ { if (group.selection.isEmpty()) return; - GrafreeD.clipboardIsTempGroup = false; + + Grafreed.clipboardIsTempGroup = false; Composite tGroup = null; if (group.selection.size() > 0) // 1) { tGroup = new cGroup(); - GrafreeD.clipboardIsTempGroup = true; + Grafreed.clipboardIsTempGroup = true; } if (cut) { + if (Globals.SAVEONMAKE) + Save(); //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) //jList.remove(indices[i]); @@ -4178,16 +4643,16 @@ //System.out.println("cut " + child); //System.out.println("parent = " + child.parent); // tmp.addChild(child); - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(tmp); else - GrafreeD.clipboard = tmp; + Grafreed.clipboard = tmp; } else - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(child); else - GrafreeD.clipboard = child; + Grafreed.clipboard = child; } //ResetModel(); @@ -4219,21 +4684,23 @@ //System.out.println("cut " + elem); //System.out.println("parent = " + elem.parent); // tmp.addChild(elem); - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(tmp); else - GrafreeD.clipboard = tmp; + Grafreed.clipboard = tmp; } else - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(child); else - GrafreeD.clipboard = child; + Grafreed.clipboard = child; } } - if (GrafreeD.clipboardIsTempGroup) - GrafreeD.clipboard = tGroup; + + if (Grafreed.clipboardIsTempGroup) + Grafreed.clipboard = tGroup; + if (cut) { ResetModel(); @@ -4247,7 +4714,7 @@ // return; boolean first = true; - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) { Composite temp; @@ -4258,7 +4725,7 @@ temp = (Composite)Applet3D.clipboard.deepCopy(); */ Object3D elem; - for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) + for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) { Object3D child = (Object3D)e.nextElement(); @@ -4292,21 +4759,21 @@ //Object3D cb = Applet3D.clipboard; //temp.addChild(cb); //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0)); - assert(GrafreeD.clipboard.parent == null); - Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; - GrafreeD.clipboard.get(0).parent = null; // Avoid copy? - if (LA.isIdentity(GrafreeD.clipboard.toParent)) - makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy()); + assert(Grafreed.clipboard.parent == null); + Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent; + Grafreed.clipboard.get(0).parent = null; // Avoid copy? + if (LA.isIdentity(Grafreed.clipboard.toParent)) + makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy()); else - makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy()); - GrafreeD.clipboard.get(0).parent = keepparent; + makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy()); + Grafreed.clipboard.get(0).parent = keepparent; } ResetModel(); refreshContents(); } - void pasteInto(boolean copyit) + void pasteInto(boolean copyit, boolean clone) { // if (GrafreeD.clipboard == null) // return; @@ -4335,15 +4802,22 @@ if (copyit) { // paste(false); - CloneClipboard(false); // sept 2014 + if (clone) + { + CloneClipboard(false); // sept 2014 + } + else + { + paste(false); + } } else { boolean first = true; - if (GrafreeD.clipboardIsTempGroup) + if (Grafreed.clipboardIsTempGroup) { - Composite temp = (Composite)GrafreeD.clipboard; + Composite temp = (Composite)Grafreed.clipboard; Object3D copy; for (Enumeration e = temp.children.elements(); e.hasMoreElements();) { @@ -4353,7 +4827,7 @@ } } else { - linkSomething(GrafreeD.clipboard); //.get(0)); + linkSomething(Grafreed.clipboard); //.get(0)); } } } @@ -4758,21 +5232,6 @@ } */ - void ImportGFD() - { - FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); - browser.show(); - String filename = browser.getFile(); - if (filename != null && filename.length() > 0) - { - String fullname = browser.getDirectory() + filename; - - //Object3D readobj = - objEditor.ReadGFD(fullname, objEditor); - //makeSomething(readobj); - } - } - /* public void Callback(Object obj) { @@ -4796,26 +5255,9 @@ } */ - void ImportVRMLX3D() - { - if (GrafreeD.standAlone) - { - /**/ - FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); - browser.show(); - String filename = browser.getFile(); - if (filename != null && filename.length() > 0) - { - String fullname = browser.getDirectory() + filename; - LoadVRMLX3D(fullname); - } - /**/ - } - } - String GetFile(String dialogName) { - if (GrafreeD.standAlone) + if (Grafreed.standAlone) { FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); browser.show(); @@ -4879,10 +5321,18 @@ cButton flashSelectionButton; cButton editButton; cButton uneditButton; + JCheckBox allParamsButton; cButton clearpanelButton; - cButton allParamsButton; cButton unselectButton; + cButton minButton; + cButton maxButton; + cButton fullButton; + cButton undoButton; + cButton redoButton; + cButton saveButton; + cButton oneStepButton; + cButton screenfitButton; cButton screenfitpointButton; cButton snapobjectButton; @@ -4893,14 +5343,6 @@ cButton closeButton; cButton setsupportButton; - - cButton twoButton; - cButton sixButton; - cButton threeButton; - cButton sevenButton; - cButton fourButton; // full panel - cButton oneButton; // full XYZ - //cButton currentLayout; // //Composite @@ -4913,6 +5355,8 @@ private MenuItem lookFromItem; private MenuItem switchItem; private MenuItem cutItem; + private MenuItem undoItem; + private MenuItem redoItem; private MenuItem duplicateItem; private MenuItem cloneItem; private MenuItem cloneSupportItem; @@ -4926,7 +5370,7 @@ private MenuItem linkverticesItem; private MenuItem relinkverticesItem; private MenuItem setMasterItem; - private MenuItem resetMeshItem; + private MenuItem resetAllItem; private MenuItem stepAllItem; private MenuItem revertMeshItem; private MenuItem poseMeshItem; @@ -4937,6 +5381,7 @@ private MenuItem mergeGeometriesItem; private MenuItem copyItem; private MenuItem pasteItem; + private MenuItem pasteIntoItem; private MenuItem pasteLinkItem; private MenuItem pasteCloneItem; private MenuItem pasteExpandItem; @@ -4975,6 +5420,10 @@ private MenuItem showleavesItem; private MenuItem markleavesItem; private MenuItem unmarkleavesItem; + private MenuItem rewindleavesItem; + private MenuItem unrewindleavesItem; + private MenuItem randomleavesItem; + private MenuItem unrandomleavesItem; private MenuItem flipVItem; private MenuItem unflipVItem; @@ -4986,8 +5435,10 @@ private MenuItem panoTexturesItem; private MenuItem resetCentroidItem; - private MenuItem transformgeometryItem; + private MenuItem resetCentroidXZItem; private MenuItem resetTransformItem; + private MenuItem transformGeometryItem; + private MenuItem transformChildrenItem; private MenuItem hideItem; private MenuItem grabItem; private MenuItem backItem; @@ -5009,6 +5460,7 @@ private MenuItem resetParentItem; private MenuItem repairParentItem; + private MenuItem repairShadowItem; private MenuItem sortbysizeItem; private MenuItem sortbynameItem; @@ -5033,7 +5485,7 @@ private MenuItem blobItem; private MenuItem latheItem; private MenuItem bezierItem; - private MenuItem checkerItem; + private MenuItem overlayItem; private MenuItem meshItem; // private MenuItem meshGroupItem; private MenuItem springItem; @@ -5055,11 +5507,6 @@ private MenuItem doubleItem; private MenuItem tripleItem; - private MenuItem importGFDItem; - private MenuItem importVRMLX3DItem; - private MenuItem import3DSItem; - private MenuItem importOBJItem; - private MenuItem computeAOItem; private MenuItem recompileItem; private MenuItem editScriptItem; @@ -5069,4 +5516,8 @@ private MenuItem analyzeItem; private MenuItem dumpItem; //boolean freezemodel = false; + + Menu cameraMenu; + MenuItem editCameraItem; + MenuItem revertCameraItem; } -- Gitblit v1.6.2