import java.awt.*; import java.awt.event.*; import java.awt.dnd.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import java.util.Enumeration; import java.util.Vector; import java.awt.datatransfer.*; import com.jme.math.Vector3f; import com.jme.renderer.ColorRGBA; import grafeme.ui.*; //import buoy.widget.BFileChooser; class GroupEditor extends ObjEditor implements //iParse, //iCallBack, Grafreed.iResourceCallBack, ObjectUI, Runnable, ActionListener, TreeSelectionListener, DragGestureListener, DragSourceListener, DropTargetListener, ItemListener // ListSelectionListener { public void AddSkyboxButton(String f, String s, cGridBag row) { cButton skyboxButton; final String path = "cubemaps/" + f + "-skyboxes/" + s; row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF)); //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); skyboxButton.setToolTipText(s.equals("") ? "No background" : s); skyboxButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ChangeSkybox(path); } }); } public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) { cButton textureButton; final String path = "textures/" + f + "/" + c + "/"; // + t; row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF)); textureButton.setToolTipText(c + count); textureButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ChangeTexture(path + t); } }); } public void AddSkyboxTab0(JTabbedPane skyboxpanel) { cGridBag tab0 = new cGridBag().setVertical(true); tab0.setName("Urban"); skyboxpanel.add(tab0); cGridBag row0 = new cGridBag(); cGridBag row1 = new cGridBag(); cGridBag row2 = new cGridBag(); cGridBag row3 = new cGridBag(); cGridBag row4 = new cGridBag(); cGridBag row5 = new cGridBag(); cGridBag row6 = new cGridBag(); AddSkyboxButton("default", "", row0); //AddSkyboxButton("default", "cornell", row0); AddSkyboxButton("penguins", "dust", row0); AddSkyboxButton("penguins", "tropic", row0); AddSkyboxButton("penguins", "yonder", row0); AddSkyboxButton("default", "uffizi", row1); AddSkyboxButton("bridge", "Bridge", row1); AddSkyboxButton("bridge", "Bridge2", row1); AddSkyboxButton("urban", "GamlaStan2", row1); AddSkyboxButton("urban", "Parliament", row2); AddSkyboxButton("urban", "Roundabout", row2); AddSkyboxButton("urban", "SaintLazarusChurch", row2); AddSkyboxButton("urban", "SaintLazarusChurch2", row2); AddSkyboxButton("urban", "SaintLazarusChurch3", row3); AddSkyboxButton("urban", "UnionSquare", row3); AddSkyboxButton("urban", "Medborgarplatsen", row3); AddSkyboxButton("park", "BerzeliiPark", row3); AddSkyboxButton("park", "Buddha", row4); AddSkyboxButton("park", "CNTower2", row4); AddSkyboxButton("park", "NiagaraFalls1", row4); AddSkyboxButton("park", "NiagaraFalls3", row4); AddSkyboxButton("park", "Park", row5); AddSkyboxButton("park", "Pond", row5); AddSkyboxButton("park", "Skansen", row5); AddSkyboxButton("park", "Skansen2", row5); AddSkyboxButton("park", "Skansen3", row6); AddSkyboxButton("park", "Skansen4", row6); AddSkyboxButton("park", "Skansen5", row6); AddSkyboxButton("persson", "VancouverConventionCentre", row6); tab0.add(row0); tab0.add(row1); tab0.add(row2); tab0.add(row3); tab0.add(row4); tab0.add(row5); tab0.add(row6); for (int i=5; --i>=0;) { //oe.toolboxPanel.Return(); //tab0.add(new cGridBag()); } } public void AddSkyboxTab1(JTabbedPane skyboxpanel) { cGridBag tab0 = new cGridBag().setVertical(true); tab0.setName("Nature"); skyboxpanel.add(tab0); cGridBag row0 = new cGridBag(); cGridBag row1 = new cGridBag(); cGridBag row2 = new cGridBag(); cGridBag row3 = new cGridBag(); cGridBag row4 = new cGridBag(); cGridBag row5 = new cGridBag(); cGridBag row6 = new cGridBag(); AddSkyboxButton("beach", "HeartInTheSand", row0); AddSkyboxButton("beach", "LarnacaBeach", row0); AddSkyboxButton("beach", "PalmTrees", row0); AddSkyboxButton("beach", "Tenerife", row0); AddSkyboxButton("beach", "Tenerife2", row1); AddSkyboxButton("beach", "Tenerife3", row1); AddSkyboxButton("field", "FishPond", row1); AddSkyboxButton("field", "Footballfield", row1); AddSkyboxButton("field", "Meadow", row2); AddSkyboxButton("field", "Sorsele", row2); AddSkyboxButton("field", "Sorsele2", row2); AddSkyboxButton("field", "Sorsele3", row2); AddSkyboxButton("forest", "Brudslojan", row3); AddSkyboxButton("forest", "Langholmen2", row3); AddSkyboxButton("forest", "Plants", row3); AddSkyboxButton("mountain", "Maskonaive", row3); AddSkyboxButton("mountain", "Maskonaive2", row4); AddSkyboxButton("mountain", "Maskonaive3", row4); AddSkyboxButton("mountain", "Teide", row4); AddSkyboxButton("park", "Tantolunden4", row4); AddSkyboxButton("park", "Stairs", row5); AddSkyboxButton("default", "skycube", row6); AddSkyboxButton("rocky", "Langholmen", row5); AddSkyboxButton("rocky", "Skinnarviksberget", row5); AddSkyboxButton("rocky", "Tantolunden6", row5); AddSkyboxButton("default", "CloudyHills", row6); AddSkyboxButton("daz", "Autumn", row6); AddSkyboxButton("daz", "MountainTrail", row6); /* Autumn Greenlands MountainTrail Oasis TheRock TopOfTheWorld Winter */ tab0.add(row0); tab0.add(row1); tab0.add(row2); tab0.add(row3); tab0.add(row4); tab0.add(row5); tab0.add(row6); for (int i=5; --i>=0;) { //oe.toolboxPanel.Return(); //tab0.add(new cGridBag()); } } public void AddSkyboxTab2(JTabbedPane skyboxpanel) { cGridBag tab0 = new cGridBag().setVertical(true); tab0.setName("Night"); skyboxpanel.add(tab0); cGridBag row0 = new cGridBag(); cGridBag row1 = new cGridBag(); cGridBag row2 = new cGridBag(); cGridBag row3 = new cGridBag(); cGridBag row4 = new cGridBag(); cGridBag row5 = new cGridBag(); cGridBag row6 = new cGridBag(); AddSkyboxButton("night", "NightPath", row0); AddSkyboxButton("night", "PondNight", row0); AddSkyboxButton("night", "Powerlines", row0); AddSkyboxButton("night", "SwedishRoyalCastle", row0); AddSkyboxButton("urban", "CNTower", row1); AddSkyboxButton("bridge", "ArstaBridge", row1); AddSkyboxButton("rocky", "Riddarfjarden", row1); AddSkyboxButton("penguins", "sleepyhollow", row1); AddSkyboxButton("penguins", "kenon_star", row2); AddSkyboxButton("persson", "corona", row2); AddSkyboxButton("persson", "spaceskybox", row2); AddSkyboxButton("indoors", "Vasa", row2); AddSkyboxButton("winter", "Backyard", row3); AddSkyboxButton("winter", "Creek", row3); AddSkyboxButton("winter", "FootballField3", row3); AddSkyboxButton("winter", "Forest", row3); AddSkyboxButton("winter", "HornstullsStrand2", row4); AddSkyboxButton("winter", "House", row4); AddSkyboxButton("winter", "IceLake", row4); AddSkyboxButton("winter", "IceRiver", row4); AddSkyboxButton("winter", "Park3", row5); AddSkyboxButton("winter", "PondWinter", row5); AddSkyboxButton("winter", "Tantolunden5", row5); AddSkyboxButton("winter", "Vindelalven", row5); AddSkyboxButton("daz", "TheRock", row6); AddSkyboxButton("daz", "TopOfTheWorld", row6); AddSkyboxButton("daz", "Winter", row6); AddSkyboxButton("mountain", "Ryfjallet", row6); tab0.add(row0); tab0.add(row1); tab0.add(row2); tab0.add(row3); tab0.add(row4); tab0.add(row5); tab0.add(row6); for (int i=5; --i>=0;) { //oe.toolboxPanel.Return(); //tab0.add(new cGridBag()); } } public void AddSkyboxTab3(JTabbedPane skyboxpanel) { cGridBag tab0 = new cGridBag().setVertical(true); tab0.setName("Others"); skyboxpanel.add(tab0); cGridBag row0 = new cGridBag(); cGridBag row1 = new cGridBag(); cGridBag row2 = new cGridBag(); cGridBag row3 = new cGridBag(); cGridBag row4 = new cGridBag(); cGridBag row5 = new cGridBag(); cGridBag row6 = new cGridBag(); AddSkyboxButton("mayhem", "afterrain", row0); AddSkyboxButton("mayhem", "aqua4", row0); AddSkyboxButton("mayhem", "aqua9", row0); AddSkyboxButton("mayhem", "flame", row0); AddSkyboxButton("mayhem", "h2s", row1); AddSkyboxButton("mayhem", "prehistoric", row1); AddSkyboxButton("mayhem", "scorched", row1); AddSkyboxButton("penguins", "desertdawn", row1); AddSkyboxButton("persson", "Citadella", row2); AddSkyboxButton("persson", "Citadella2", row2); AddSkyboxButton("persson", "clouds1", row2); AddSkyboxButton("penguins", "wrath", row2); AddSkyboxButton("persson", "FishermansBastion", row3); AddSkyboxButton("persson", "HeroesSquare", row3); AddSkyboxButton("indoors", "DallasW", row3); AddSkyboxButton("indoors", "MarriottMadisonWest", row3); AddSkyboxButton("persson", "LancellottiChapel", row4); AddSkyboxButton("persson", "PereaBeach1", row4); AddSkyboxButton("persson", "PereaBeach2", row4); AddSkyboxButton("persson", "redeclipse", row4); AddSkyboxButton("daz", "Greenlands", row5); AddSkyboxButton("daz", "Oasis", row5); AddSkyboxButton("elyvisions", "arch3", row5); AddSkyboxButton("elyvisions", "calm_sea", row5); AddSkyboxButton("elyvisions", "rainbow", row6); AddSkyboxButton("elyvisions", "distant_sunset", row6); AddSkyboxButton("elyvisions", "heaven", row6); AddSkyboxButton("elyvisions", "hot", row6); tab0.add(row0); tab0.add(row1); tab0.add(row2); tab0.add(row3); tab0.add(row4); tab0.add(row5); tab0.add(row6); for (int i=5; --i>=0;) { //oe.toolboxPanel.Return(); //tab0.add(new cGridBag()); } } public void ChangeSkybox(String skybox) { if (skybox.endsWith("/")) { group.skyboxname = null; group.skyboxext = null; cameraView.repaint(); } else { //cameraView.envyoff = false; group.skyboxname = skybox; group.skyboxext = "jpg"; cameraView.repaint(); } } public void CreateSkyboxPanel(cGridBag skyboxPanel) { JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT); AddSkyboxTab0(skyboxpane); AddSkyboxTab1(skyboxpane); AddSkyboxTab2(skyboxpane); AddSkyboxTab3(skyboxpane); skyboxPanel.add(skyboxpane); } public void ChangeTexture(String texture) { for (int i=0; i Bump")); pigmentBumpItem.addActionListener(this); //embedTexturesItem detachPigmentItem = menu.add(new MenuItem("Detach Pigment")); detachPigmentItem.addActionListener(this); detachBumpItem = menu.add(new MenuItem("Detach Bump")); detachBumpItem.addActionListener(this); embedTexturesItem = menu.add(new MenuItem("Embed Textures")); embedTexturesItem.addActionListener(this); deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures")); deEmbedTexturesItem.addActionListener(this); menu.add("-"); sortbysizeItem = menu.add(new MenuItem("Sort by size")); sortbysizeItem.addActionListener(this); 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); menu.add("-"); editLeafItem = menu.add(new MenuItem("Edit leaf...")); editLeafItem.addActionListener(this); oe.menuBar.add(menu = new Menu("Insert")); buildCreateMenu(menu); oe.menuBar.add(menu = new Menu("Tools")); buildToolsMenu(menu); } JTabbedPane resourcecontainer; cGridBag currenttab; //boolean added; // patch for jar int totalcount = 0; int tabcount = 0; int colcount = 0; int rowcount = 0; int texturecount = 0; int columns = 5; int rows = 7; public void ResourceCallBack(String[] path) { // for (int i = 0; i < path.length; i++) // System.out.print(path[i] + "/"); // System.out.println(); if (//rowcount == 0 || path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) { currenttab = new cGridBag(); String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); currenttab.setName(tabname); //added = false; resourcecontainer.add(currenttab); resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname); rowcount = 1; colcount = 0; texturecount = 0; } if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png"))) { //if (!added) { //added = true; String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); } columns = 5; if (path[0].contains("D&R") || path[0].contains("Paint")) columns = 4; AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); totalcount++; if (++colcount >= columns) { colcount = 0; currenttab.Return(); if (rowcount++ >= rows) { rowcount = 0; } } } else { // if (!path[path.length-1].equals("icons")) // resourcecontainer.Return(); } } void CreateTexturePanel(cGridBag container) { resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); container.add(resourcecontainer); Grafreed.ParseResources("textures", this); // 935. System.out.println("Total = " + totalcount); } 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()); // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); oe.buttonGroup = new ButtonGroup(); cRadio clientButton = new cRadio(client.name); radio = clientButton; clientButton.addActionListener(this); clientButton.setMnemonic(KeyEvent.VK_B); clientButton.SetObject(client); // clientButton.SetCamera(cameraView.renderCamera); clientButton.setSelected(true); oe.radioPanel.add(clientButton); oe.buttonGroup.add(clientButton); /* cRadio dummyButton = new cRadio("1"); dummyButton.SetObject(null); dummyButton.addActionListener(this); oe.radioPanel.add(dummyButton); oe.buttonGroup.add(dummyButton); */ cGridBag versionManagerPanel = new cGridBag(); versionManagerPanel.preferredHeight = 4; //this.AddOptions(oe.toolbarPanel, oe.aConstraints); //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); //minButton.setToolTipText("Minimize window"); //minButton.addActionListener(this); if (Globals.ADVANCED) { // oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); // maxButton.setToolTipText("Maximize window"); // maxButton.addActionListener(this); } cButton gcButton; // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); // gcButton.setToolTipText("Garbage collect"); // gcButton.addActionListener(new ActionListener() // { // public void actionPerformed(ActionEvent e) // { // System.gc(); // } // }); oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); fullScreenButton.setToolTipText("Full-screen window (ESC to exit)"); fullScreenButton.addActionListener(this); oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); collapseButton.setToolTipText("Collapse toolbar"); collapseButton.addActionListener(this); // oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); // maximize3DButton.setToolTipText("Maximize 3D view"); // maximize3DButton.addActionListener(this); oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); twoButton.setToolTipText("Show 3D view only"); twoButton.addActionListener(this); this.fullscreenLayout = twoButton; oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); threeButton.setToolTipText("Show controls and 3D view"); threeButton.addActionListener(this); if (Globals.ADVANCED) { oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); sixButton.setToolTipText("Show 3D view and controls"); sixButton.addActionListener(this); } // oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); // sevenButton.setToolTipText("3-column layout"); // sevenButton.addActionListener(this); // oe.toolbarPanel.add(antialiasCB = GetToggleButton("icons/antialias.png", Globals.isLIVE())); //, oe.aConstraints); antialiasCB.setToolTipText("Final render"); antialiasCB.addItemListener(this); oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); screenfitButton.setToolTipText("Screen fit"); screenfitButton.addActionListener(this); oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); restoreCameraButton.setToolTipText("Restore viewpoint"); restoreCameraButton.addActionListener(this); versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); saveVersionButton.setToolTipText("Duplicate current version"); saveVersionButton.addActionListener(this); versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); deleteVersionButton.setToolTipText("Delete current version"); deleteVersionButton.addActionListener(this); deleteVersionButton.setEnabled(false); versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); previousVersionButton.setToolTipText("Previous version"); previousVersionButton.addActionListener(this); previousVersionButton.setEnabled(false); cGridBag updown = new cGridBag().setVertical(true); updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); restoreButton.setToolTipText("Undo (restore current version)"); restoreButton.addActionListener(this); restoreButton.setEnabled(false); updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); replaceButton.setToolTipText("Save (replace current version)"); replaceButton.addActionListener(this); replaceButton.setEnabled(false); versionManagerPanel.add(updown); versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); nextVersionButton.setToolTipText("Next version"); nextVersionButton.addActionListener(this); nextVersionButton.setEnabled(false); oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); oneStepButton.setToolTipText("Animate one step forward"); oneStepButton.addActionListener(this); oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); liveCB.setToolTipText("Enable animation"); liveCB.addItemListener(this); oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); fastCB.setToolTipText("Fast mode"); fastCB.addItemListener(this); //oe.toolboxPanel.Return(); // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); // trackCB.setToolTipText("Enable tracking"); // trackCB.addItemListener(this); // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints); // screenfitpointButton.addActionListener(this); if (Globals.ADVANCED) { oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints); snapobjectButton.addActionListener(this); snapobjectButton.setToolTipText("Snap Object"); oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); fourButton.addActionListener(this); fourButton.setToolTipText("Show control panel only"); } //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); rootButton.setToolTipText("Open selection in new tab"); rootButton.addActionListener(this); oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); closeButton.setToolTipText("Close tab"); closeButton.addActionListener(this); //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); //clearButton.addActionListener(this); cGridBag row1 = new cGridBag(); row1.preferredHeight = 8; // INSERT row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); gridButton.setToolTipText("Create ground"); gridButton.addActionListener(this); row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); boxButton.setToolTipText("Create box"); boxButton.addActionListener(this); row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); superButton.setToolTipText("Create superellipsoid"); superButton.addActionListener(this); row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); sphereButton.setToolTipText("Create sphere"); sphereButton.addActionListener(this); row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); coneButton.setToolTipText("Create cone"); coneButton.addActionListener(this); row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); torusButton.setToolTipText("Create torus"); torusButton.addActionListener(this); if (false) //Globals.ADVANCED) { oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); kleinButton.setToolTipText("Create Klein bottle"); kleinButton.addActionListener(this); } row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); particlesButton.setToolTipText("Create particle system"); particlesButton.addActionListener(this); oe.toolboxPanel.add(row1); cGridBag row2 = new cGridBag(); row2.preferredHeight = 8; row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); groupButton.setToolTipText("Create group"); groupButton.addActionListener(this); row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); compositeButton.setToolTipText("Create composite"); compositeButton.addActionListener(this); row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); switchButton.setToolTipText("Create item switcher"); switchButton.addActionListener(this); row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); loopButton.setToolTipText("Create loop"); loopButton.addActionListener(this); row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); textureButton.setToolTipText("Create texture"); textureButton.addActionListener(this); row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); overlayButton.setToolTipText("Create overlay"); overlayButton.addActionListener(this); row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); lightButton.setToolTipText("Create light"); lightButton.addActionListener(this); oe.toolboxPanel.add(row2); cGridBag textures = new cGridBag(); CreateTexturePanel(textures); int tabCount = resourcecontainer.getTabCount(); if (tabCount > 0) resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount)); oe.toolboxPanel.add(textures); textures.preferredHeight = 100; CreateSkyboxPanel(oe.skyboxPanel); // EDIT panel editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); editButton.setToolTipText("Pin selection controls"); editButton.addActionListener(this); editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); uneditButton.setToolTipText("Unpin and remove selection controls"); uneditButton.addActionListener(this); editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); allParamsButton.setToolTipText("Show all controls"); allParamsButton.addActionListener(this); editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); clearPanelButton.setToolTipText("Clear all controls"); clearPanelButton.addActionListener(this); //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); //unselectButton.setToolTipText("Unselect"); //unselectButton.addActionListener(this); editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); flashSelectionButton.setToolTipText("Highlight selection"); flashSelectionButton.addActionListener(this); editCommandsPanel.preferredHeight = 1; SetPinStates(false); // oe.treePanel.add(commandsPanel); // oe.treePanel.Return(); // oe.aConstraints.gridx += 1; // oe.aConstraints.weighty = 0; // oe.aConstraints.gridwidth = 1; // // oe.treePanel.add(recompileButton = new cButton("R"), oe.aConstraints); // recompileButton.addActionListener(this); // oe.aConstraints.gridx += 1; // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints); // gcButton.addActionListener(this); cGridBag jSPPanel = new cGridBag(); jSPPanel.preferredHeight = 20; JScrollPane jSP; //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); ResetModel(); oe.treePanel.add(jSPPanel); oe.treePanel.Return(); oe.treePanel.add(versionManagerPanel); oe.treePanel.Return(); versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); versionSliderPane.preferredHeight = 3; // mainPanel.setDividerLocation(0.1); //1.0); mainPanel.setResizeWeight(0.4); //jList.addListSelectionListener(this); oe.jTree.addTreeSelectionListener(this); //jTree.setRootVisible(false); //jTree.setEditable(true); oe.jTree.setDragEnabled(true); //jTree.setPreferredSize(new Dimension(10,10)); //jSP.setPreferredSize(new Dimension(100,200)); oe.jTree.setCellRenderer(new cTreeModel.Renderer()); /*DragGestureRecognizer dgr =*/ DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(oe.jTree, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? /*DropTarget*/ dropTarget = new DropTarget(oe.jTree, this); /* try{ dgr.addDragGestureListener(this); }catch(Exception e) {} */ radio.layout = threeButton; // sixButton; oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); } void AddOptions(cGridBag panel) //, GridBagConstraints constraints) { panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints); colorCB.setToolTipText("Copy color when dropped"); colorCB.addItemListener(this); panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints); materialCB.setToolTipText("Copy material when dropped"); materialCB.addItemListener(this); panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints); textureCB.setToolTipText("Copy texture when dropped"); textureCB.addItemListener(this); panel.Return(); 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 only for 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(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints); freezeCB.setToolTipText("Fast moving camera"); freezeCB.addItemListener(this); // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); // localCB.addItemListener(this); panel.Return(); //if (Globals.ADVANCED) { panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints); crowdCB.setToolTipText("Use 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); panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints); minshaderCB.setToolTipText("Minimal fast shader"); minshaderCB.addItemListener(this); // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); // speakerMocapCB.addItemListener(this); if (false) { // handled in scripts panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints); speakerCameraCB.addItemListener(this); panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints); speakerFocusCB.addItemListener(this); panel.Return(); } panel.Return(); panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints); smoothfocusCB.addItemListener(this); //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); // debugCB.addItemListener(this); panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); trackCB.setToolTipText("Enable tracking target"); trackCB.addItemListener(this); panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); oeilCB.setToolTipText("Move camera when tracking"); oeilCB.addItemListener(this); if (Globals.ADVANCED) { panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); shadowCB.setToolTipText("When live compute shadows"); shadowCB.addItemListener(this); } panel.Return(); panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints); toggleTextureCB.setToolTipText("Load textures"); toggleTextureCB.addItemListener(this); panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); toggleSwitchCB.setToolTipText("Choose a single item"); toggleSwitchCB.addItemListener(this); panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); autokeepCB.setToolTipText("On structure change"); autokeepCB.addItemListener(this); panel.Return(); 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; cGridBag fill2 = new cGridBag(); fill2.preferredHeight = 200; cGridBag fill3 = new cGridBag(); fill3.preferredHeight = 200; panel.add(fill); panel.add(fill2); panel.add(fill3); } void EditObject(Object3D obj) { //assert(obj instanceof Composite); // if (obj.versionlist == null) // { // obj.versionlist = new Object3D[100]; // obj.versionindex = -1; // } cRadio radioButton = new cRadio(obj.name); // June 2019. Patch to avoid bug with transparency. radioButton.hadMaterial = obj.material != null; if (!radioButton.hadMaterial) { obj.material = new cMaterial(); } radioButton.SetObject(obj); radioButton.layout = threeButton; // sixButton; radioButton.SetCamera(cameraView.renderCamera, false); radioButton.addActionListener(this); radioPanel.add(radioButton); buttonGroup.add(radioButton); radioButton.doClick(); } void SetupViews(ObjEditor oe) { theFrame = this; oe.SetupViews(); if (Globals.DEBUG) System.out.println("SetupViews"); DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this); } cToggleButton liveCB; cToggleButton antialiasCB; cCheckBox supportCB; cCheckBox localCB; cCheckBox crowdCB; cCheckBox smoothCB; cCheckBox minshaderCB; cToggleButton fastCB; cCheckBox slowCB; cCheckBox boxCB; cCheckBox zoomBoxCB; cCheckBox freezeCB; //cToggleButton trackCB; cCheckBox trackCB; cCheckBox smoothfocusCB; // JCheckBox speakerMocapCB; cCheckBox speakerCameraCB; cCheckBox speakerFocusCB; cCheckBox debugCB; cCheckBox oeilCB; cCheckBox shadowCB; cCheckBox autokeepCB; cCheckBox lookAtCB; // static int COLOR = 1; // static int MATERIAL = 2; // static int TEXTURE = 4; int dropAttributes = Object3D.COLOR | Object3D.MATERIAL; cCheckBox colorCB; cCheckBox materialCB; cCheckBox textureCB; public void itemStateChanged(ItemEvent e) { // System.out.println("itemStateChanged = " + e); if(e.getSource() == colorCB) { if (e.getStateChange() == ItemEvent.SELECTED) dropAttributes |= Object3D.COLOR; else dropAttributes &= ~Object3D.COLOR; } else if(e.getSource() == materialCB) { if (e.getStateChange() == ItemEvent.SELECTED) dropAttributes |= Object3D.MATERIAL; else dropAttributes &= ~Object3D.MATERIAL; } else if(e.getSource() == textureCB) { if (e.getStateChange() == ItemEvent.SELECTED) dropAttributes |= Object3D.TEXTURE; else dropAttributes &= ~Object3D.TEXTURE; } else if(e.getSource() == liveCB) { cameraView.ToggleLive(); refreshContents(false); } else if(e.getSource() == antialiasCB) { cameraView.ToggleAntialiasing(); refreshContents(false); } else if(e.getSource() == supportCB) { cameraView.ToggleSupport(); cameraView.repaint(); } else if(e.getSource() == crowdCB) { cameraView.ToggleCrowd(); cameraView.repaint(); } else if(e.getSource() == smoothCB) { cameraView.ToggleInertia(); cameraView.repaint(); } else if(e.getSource() == minshaderCB) { Globals.MINSHADER ^= true; cameraView.programInitialized = false; cameraView.repaint(); } else if(e.getSource() == localCB) { cameraView.ToggleLocal(); } else if(e.getSource() == fastCB) { cameraView.ToggleFast(); } else if(e.getSource() == slowCB) { cameraView.ToggleSlowPose(); } else if(e.getSource() == boxCB) { cameraView.ToggleBoxMode(); Recompile(); cameraView.repaint(); // refreshContents(); } else if(e.getSource() == zoomBoxCB) { cameraView.ToggleZoomBoxMode(); } else if(e.getSource() == smoothfocusCB) { cameraView.ToggleSmoothFocus(); } else if(e.getSource() == speakerCameraCB) { cameraView.ToggleSpeakerCamera(); } else if(e.getSource() == speakerFocusCB) { cameraView.ToggleSpeakerFocus(); } else if(e.getSource() == debugCB) { cameraView.ToggleDebug(); cameraView.repaint(); } else if(e.getSource() == trackCB) { cameraView.ToggleTrack(); } else if(e.getSource() == oeilCB) { cameraView.ToggleOeil(); } else if(e.getSource() == shadowCB) { Globals.COMPUTESHADOWWHENLIVE ^= true; } else if(e.getSource() == freezeCB) { Globals.FREEZEONMOVE ^= true; } else if(e.getSource() == autokeepCB) { Globals.REPLACEONMAKE ^= true; } else if(e.getSource() == lookAtCB) { cameraView.ToggleLookAt(); } else { super.itemStateChanged(e); } } public void dragGestureRecognized(DragGestureEvent dge) { System.out.println("dragGestureRecognized : " + dge); /**/ //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this); //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent()); TreePath path = objEditor.jTree.getSelectionPath(); if ((path == null) || (path.getPathCount() <= 1)) { // We can't move the root node or an empty selection return; } //oldNode = (Object3D) path.getLastPathComponent(); TransferableTreePath transferable = new TransferableTreePath(path); System.out.println("startDrag : " + dge); DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveDrop, transferable, null); /**/ } //Object3D oldNode; //TransferableTreeNode transferable; public void dragEnter(DropTargetDragEvent dtde) // Called when a drag operation has encountered the DropTarget. { System.out.println("dragEnter : " + dtde); } public void dragExit(DropTargetEvent dte) // The drag operation has departed the DropTarget without dropping. { System.out.println("dragExit : " + dte); } public void dragOver(DropTargetDragEvent dtde) // Called when a drag operation is ongoing on the DropTarget. { //System.out.println("dragOver : " + dtde.getSource()); } DropTarget dropTarget; //Point location; public void drop(DropTargetDropEvent dtde) // The drag operation has terminated with a drop on this DropTarget. { objEditor.location = dtde.getLocation(); Component target = dtde.getDropTargetContext().getDropTarget().getComponent(); //assert dropTarget == dtde.getSource(); if (target instanceof CameraPane) { Object object = null; Object debug = dtde.getTransferable(); DataFlavor[] flavors = dtde.getTransferable().getTransferDataFlavors(); for (int i=flavors.length; --i>=0;) { try { object = dtde.getTransferable().getTransferData( flavors[i] // DataFlavor.imageFlavor // stringFlavor // dtde.getTransferable().getTransferDataFlavors()[0] ); break; } catch(Exception e) { e.printStackTrace(); } } System.out.println("Transfer = " + object + "; drop : " + target); // if( object instanceof java.io.File[]) // { // //assert(false); // objEditor.DropFile((java.io.File[]) object, true); // return; // } String string = object.toString(); // File path for Mac and Windows if (string.charAt(0) == '/' || string.charAt(1) == ':') { // file(s) String[] names = string.split("\n"); java.io.File[] files = new java.io.File[names.length]; for (int i=names.length; --i>=0;) { files[i] = new java.io.File(names[i]); } objEditor.DropFile(files, true); return; } // ??? Vector tempsel = (Vector) group.selection.clone(); // grosse patch: on ignore le transfert... Object3D tempsel = group.selection; if (tempsel.size() != 1) return; Object3D source = tempsel.get(0); flashIt = false; CameraPane pane = (CameraPane) target; 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) { DropObject(source); // tempsel.get(0)); } Select(source/*tempsel.get(0)*/.GetTreePath(), true, true); flashIt = true; return; } assert target == objEditor.jTree; TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y); Object3D destinationLeaf; try { destinationLeaf = (Composite) destinationPath.getLastPathComponent(); } catch (Exception e) { System.out.println("destinationPath : " + destinationPath); return; } for (int i=group.selection.size(); --i>=0;) { Object3D child = (Object3D)group.selection.elementAt(i); // Cannot move into itself if (child == destinationLeaf) return; } // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) // { loadClipboard(true); objEditor.jTree.setSelectionPath(destinationPath); pasteInto(false, false); // } else { // loadClipboard(false); // objEditor.jTree.setSelectionPath(destinationPath); // pasteInto(false, false); // true); // ??? // } } public void dropActionChanged(DropTargetDragEvent dtde) // Called if the user has modified the current drop gesture { System.out.println("dropActionChanged : " + dtde); } // DRAG SOURCE public void dragDropEnd(DragSourceDropEvent dsde) // This method is invoked to signify that the Drag and Drop operation is complete. { System.out.println("dragDropEnd : " + dsde.getSource()); /* if (//dsde.getDropSuccess() && true) //(dsde.getDropAction() == DnDConstants.ACTION_MOVE)) { //((DefaultTreeModel) jTree.getModel()).removeNodeFromParent(oldNode); loadClipboard(true); } */ } public void dragEnter(DragSourceDragEvent dsde) // Called as the hotspot enters a platform dependent drop site. { System.out.println("dragEnter : " + dsde); } public void dragExit(DragSourceEvent dse) // Called as the hotspot exits a platform dependent drop site. { System.out.println("dragExit : " + dse); } public void dragOver(DragSourceDragEvent dsde) // Called as the hotspot moves over a platform dependent drop site. { //System.out.println("dragOver : " + dsde); } public void dropActionChanged(DragSourceDragEvent dsde) // Called when the user has modified the drop gesture. { System.out.println("dropActionChanged : " + dsde); System.out.println("Action: " + dsde.getDropAction()); System.out.println("Target Action: " + dsde.getTargetActions()); System.out.println("User Action: " + dsde.getUserAction()); } public static DataFlavor TREE_PATH_FLAVOR = new DataFlavor(TreePath.class, "Tree Path"); static class TransferableTreePath implements Transferable { DataFlavor flavors[] = { TREE_PATH_FLAVOR }; TreePath path; public TransferableTreePath(TreePath tp) { Object[] objs = new Object[tp.getPathCount()]; for (int i=0; i=0;) { //Object3D child = (Object3D)e.nextElement(); Object3D child = (Object3D)group.selection.get(i); CastShadow(child, axis); } } void CastShadow(Object3D obj, int axis) { cVector minima = new cVector(); cVector maxima = new cVector(); obj.getBounds(minima, maxima, true); if(obj.parent != null) { //obj.parent.TransformToWorld(vert1, vert1); //obj.parent.TransformToWorld(vert2, vert2); //obj.parent.TransformToWorld(vert3, vert3); //obj.parent.TransformToWorld(vert4, vert4); obj.parent.TransformToWorld(minima); //, minima); obj.parent.TransformToWorld(maxima); //, maxima); } Object3D shadow = new Object3D("Shadow" + obj.name); shadow.toParent = LA.newMatrix(); shadow.fromParent = LA.newMatrix(); shadow.bRep = new BoundaryRep(); shadow.bRep.redimension(4,2); // vertices / faces cVector norm = null; switch(axis) { case 0 : vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z; vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z; vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z; vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z; norm = cVector.X; break; case 1 : vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z; vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z; vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z; vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z; norm = cVector.Y; break; case 2 : vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f; vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f; vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f; vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f; norm = cVector.Z; break; } cVector interest = new cVector((vert1.x+vert2.x+vert3.x+vert4.x)/4, (vert1.y+vert2.y+vert3.y+vert4.y)/4, (vert1.z+vert2.z+vert3.z+vert4.z)/4); LA.matTranslate(shadow.toParent, interest.x, interest.y, interest.z); LA.matInvert(shadow.toParent, shadow.fromParent); LA.vecSub(vert1, interest, vert1); LA.vecSub(vert2, interest, vert2); LA.vecSub(vert3, interest, vert3); LA.vecSub(vert4, interest, vert4); // ?? LA.vecCopy(norm, vert1.norm); LA.vecCopy(norm, vert2.norm); LA.vecCopy(norm, vert3.norm); LA.vecCopy(norm, vert4.norm); shadow.bRep.SetVertex(vert1, 0); shadow.bRep.SetVertex(vert2, 1); shadow.bRep.SetVertex(vert3, 2); shadow.bRep.SetVertex(vert4, 3); vert1.s = 0; vert1.t = 0; vert2.s = 0; vert2.t = 1; vert3.s = 1; vert3.t = 0; vert4.s = 1; vert4.t = 1; shadow.bRep.setFace(0, 0, 2, 1); shadow.bRep.setFace(1, 1, 2, 3); shadow.bRep.Trim(true, false, false, true, false); shadow.material = new cMaterial(obj.material); shadow.material.diffuse = 0.0001f; shadow.material.specular = 0.0001f; shadow.material.opacity = 0.75f; AllocProjectedVertices(shadow); shadow.projectedVertices[1].x = 300; makeSomething(shadow); } private void ClearUnpinned() { //for (Object3D obj : listUI) for (int i=listUI.size(); --i>=0;) { Object3D obj = listUI.elementAt(i); if (!obj.pinned) { obj.CloseUI(); listUI.remove(i); } } } private void EditElement(Object3D elem, boolean newWindow) { // if (!(elem instanceof Composite)) // newWindow = false; listUI.add(elem); elem.openEditWindow(this, newWindow); //, false); System.out.println("edit : " + elem); elem.editWindow.refreshContents(true); // ? new } private void GenerateMaze() { if (group.selection.size() == 4) { final double scaleX = SelectionSizeX(); final double scaleZ = SelectionSizeZ(); final cGroup mazeGroup = new cGroup("Maze"); final int dim = 15; Maze maze = new Maze(dim, dim); maze.display(); // console maze.Display(new Maze.Parse() { public void Tile(int i, int j, boolean north, boolean east, boolean south, boolean west) { if ((i == 0 || i == dim-1) && j == dim/2) { return; } int v = 0; if (north) { cGroup n = new cGroup("" + i + "," + j); n.Translate(-j * scaleX, 0, i * scaleZ); n.add(group.selection.get(0)); mazeGroup.add(n); } if (east) { cGroup n = new cGroup("" + i + "," + j); n.Translate(-j * scaleX, 0, i * scaleZ); n.add(group.selection.get(1)); mazeGroup.add(n); } if (south) { cGroup n = new cGroup("" + i + "," + j); n.Translate(-j * scaleX, 0, i * scaleZ); n.add(group.selection.get(2)); mazeGroup.add(n); } if (west) { cGroup n = new cGroup("" + i + "," + j); n.Translate(-j * scaleX, 0, i * scaleZ); n.add(group.selection.get(3)); mazeGroup.add(n); } } } ); makeSomething(mazeGroup); } } private double SelectionSize() { cVector bbmin = new cVector(); cVector bbmax = new cVector(); group.selection.getBounds(bbmin, bbmax, true); double dx = bbmax.x - bbmin.x; //double dy = bbmax.y - bbmin.y; double dz = bbmax.z - bbmin.z; return Math.sqrt(dx*dx /*+ dy*dy*/ + dz*dz); } private double SelectionSizeX() { cVector bbmin = new cVector(); cVector bbmax = new cVector(); group.selection.getBounds(bbmin, bbmax, true); return bbmax.x - bbmin.x; } private double SelectionSizeY() { cVector bbmin = new cVector(); cVector bbmax = new cVector(); group.selection.getBounds(bbmin, bbmax, true); return bbmax.y - bbmin.y; } private double SelectionSizeZ() { cVector bbmin = new cVector(); cVector bbmax = new cVector(); group.selection.getBounds(bbmin, bbmax, true); return bbmax.z - bbmin.z; } /** * applyExample */ private void applyExample(ParticleSystem particleGeom, String examType) { // if (exampleList == null || exampleList.getSelectedValue() == null) // return; // String examType = exampleList.getSelectedValue().toString(); // particleGeom.clearInfluences(); if ("FIRE".equalsIgnoreCase(examType)) { particleGeom.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f)); particleGeom.setMaximumAngle(0.20943952f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(1.0f); particleGeom.setMinimumLifeTime(1.0000f); particleGeom.setMaximumLifeTime(1.5000f); particleGeom.setStartSize(40.0f); particleGeom.setEndSize(400.0f); particleGeom .setStartColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 0.0f)); particleGeom.getParticleController().setControlFlow(true); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(0.3f); particleGeom.getParticleController().setRepeatType( Controller.RT_WRAP); } else if ("FOUNTAIN".equalsIgnoreCase(examType)) { // particleGeom.addInfluence(SimpleParticleInfluenceFactory // .createBasicGravity(new Vector3f(0, -3f, 0), true)); particleGeom.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f)); particleGeom.setMaximumAngle(0.2268928f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(1.0f); particleGeom.setMinimumLifeTime(1.3000f); particleGeom.setMaximumLifeTime(1.9500f); particleGeom.setStartSize(10.0f); particleGeom.setEndSize(10.0f); particleGeom .setStartColor(new ColorRGBA(0.0f, 0.0625f, 1.0f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(0.0f, 0.0625f, 1.0f, 0.0f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(1.1f); particleGeom.getParticleController().setRepeatType( Controller.RT_WRAP); } else if ("LAVA".equalsIgnoreCase(examType)) { // particleGeom.addInfluence(SimpleParticleInfluenceFactory // .createBasicGravity(new Vector3f(0, -3f, 0), true)); particleGeom.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f)); particleGeom.setMaximumAngle(0.418f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(1.0f); particleGeom.setMinimumLifeTime(1.0570f); particleGeom.setMaximumLifeTime(1.5000f); particleGeom.setStartSize(40.0f); particleGeom.setEndSize(40.0f); particleGeom .setStartColor(new ColorRGBA(1.0f, 0.18f, 0.125f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(1.0f, 0.18f, 0.125f, 0.0f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(1.1f); particleGeom.getParticleController().setRepeatType( Controller.RT_WRAP); } else if ("SMOKE".equalsIgnoreCase(examType)) { particleGeom.setEmissionDirection(new Vector3f(0.0f, 0.6f, 0.0f)); particleGeom.setMaximumAngle(0.36651915f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(0.2f); particleGeom.setMinimumLifeTime(1.0000f); particleGeom.setMaximumLifeTime(1.5000f); particleGeom.setStartSize(32.5f); particleGeom.setEndSize(40.0f); particleGeom.setStartColor(new ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.0f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(0.58f); particleGeom.setParticleSpinSpeed(0.08f); } else if ("RAIN".equalsIgnoreCase(examType)) { // particleGeom.addInfluence(SimpleParticleInfluenceFactory // .createBasicGravity(new Vector3f(0, -3f, 0), true)); particleGeom.setEmissionDirection(new Vector3f(0.0f, -1.0f, 0.0f)); particleGeom.setMaximumAngle(3.1415927f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(0.5f); particleGeom.setMinimumLifeTime(1.6260f); particleGeom.setMaximumLifeTime(2.4000f); particleGeom.setStartSize(9.1f); particleGeom.setEndSize(13.6f); particleGeom.setStartColor(new ColorRGBA(0.16078432f, 0.16078432f, 1.0f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(0.16078432f, 0.16078432f, 1.0f, 0.15686275f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(0.58f); particleGeom.getParticleController().setRepeatType( Controller.RT_WRAP); } else if ("SNOW".equalsIgnoreCase(examType)) { // particleGeom.addInfluence(SimpleParticleInfluenceFactory // .createBasicGravity(new Vector3f(0, -3f, 0), true)); particleGeom.setEmissionDirection(new Vector3f(0.0f, -1.0f, 0.0f)); particleGeom.setMaximumAngle(1.5707964f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(0.2f); particleGeom.setMinimumLifeTime(1.0570f); particleGeom.setMaximumLifeTime(1.5000f); particleGeom.setStartSize(30.0f); particleGeom.setEndSize(30.0f); particleGeom.setStartColor(new ColorRGBA(0.3764706f, 0.3764706f, 0.3764706f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(0.3764706f, 0.3764706f, 0.3764706f, 0.1882353f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(0.59999996f); particleGeom.getParticleController().setRepeatType( Controller.RT_WRAP); } else if ("JET".equalsIgnoreCase(examType)) { particleGeom.setEmissionDirection(new Vector3f(-1.0f, 0.0f, 0.0f)); particleGeom.setMaximumAngle(0.034906585f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(1.0f); particleGeom.setMinimumLifeTime(.1000f); particleGeom.setMaximumLifeTime(.1500f); particleGeom.setStartSize(6.6f); particleGeom.setEndSize(30.0f); particleGeom.setStartColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(0.6f, 0.2f, 0.0f, 0.0f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(1.4599999f); particleGeom.getParticleController().setRepeatType( Controller.RT_WRAP); } else if ("EXPLOSION".equalsIgnoreCase(examType)) { particleGeom.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f)); particleGeom.setMaximumAngle(3.1415927f); particleGeom.setMinimumAngle(0); particleGeom.getParticleController().setTimeStep(1.4f); particleGeom.setMinimumLifeTime(1.0000f); particleGeom.setMaximumLifeTime(1.5000f); particleGeom.setStartSize(40.0f); particleGeom.setEndSize(40.0f); particleGeom .setStartColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(1.0f, 0.24313726f, 0.03137255f, 0.0f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.getParticleController().setRepeatType( Controller.RT_CLAMP); } else if ("GROUND FOG".equalsIgnoreCase(examType)) { particleGeom.setEmissionDirection(new Vector3f(0.0f, 0.3f, 0.0f)); particleGeom.setMaximumAngle(1.5707964f); particleGeom.setMinimumAngle(1.5707964f); particleGeom.getParticleController().setTimeStep(0.5f); particleGeom.setMinimumLifeTime(1.7740f); particleGeom.setMaximumLifeTime(2.8000f); particleGeom.setStartSize(35.4f); particleGeom.setEndSize(40.0f); particleGeom.setStartColor(new ColorRGBA(0.87058824f, 0.87058824f, 0.87058824f, 1.0f)); particleGeom.setEndColor(new ColorRGBA(0.0f, 0.8f, 0.8f, 0.0f)); particleGeom.getParticleController().setControlFlow(false); particleGeom.setReleaseRate(300); particleGeom.setReleaseVariance(0.0f); particleGeom.setInitialVelocity(1.0f); particleGeom.setParticleSpinSpeed(0.0f); } else if ("FIREFLIES".equalsIgnoreCase(examType)) { particleGeom.setEmissionDirection(new Vector3f(0, 1, 0)); particleGeom.setStartSize(3f); particleGeom.setEndSize(1.5f); particleGeom.setOriginOffset(new Vector3f(0, 0, 0)); particleGeom.setInitialVelocity(.05f); particleGeom.setMinimumLifeTime(5.000f); particleGeom.setMaximumLifeTime(15.000f); particleGeom.setStartColor(new ColorRGBA(1, 0, 0, 1)); particleGeom.setEndColor(new ColorRGBA(0, 1, 0, 1)); particleGeom.setMaximumAngle(com.jme.math.FastMath.PI); particleGeom.getParticleController().setControlFlow(false); particleGeom.getParticleController().setTimeStep(0.75f); // SwarmInfluence swarm = new SwarmInfluence(new Vector3f(0, 0, 0), // .001f); // swarm.setMaxSpeed(.2f); // swarm.setSpeedBump(0.025f); // swarm.setTurnSpeed(FastMath.DEG_TO_RAD * 360); // particleGeom.addInfluence(swarm); } particleGeom.warmUp(120); // updateFromManager(); } void Overwrite(int mask) { if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) { Object3D content = Grafreed.clipboard.get(0); if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); for (int i=0; i 0) // child.count -= 1; child.DecCount(); //makeSomething(s); itemtomake.add(s); } for (int i=0; i= 0; i--) //objList.remove(indices[i]); ClearSelection(false); } else if (source == clearAllItem) { ClearSelection(true); } else if (source == grabItem || source == groupButton) { group(new cGroup(), false); // true); } else if (source == hideItem) { group(new HiddenObject()); } else if (source == frontItem) { front(); } else if (source == backItem) { back(); } else if (source == cameraItem) { makeSomething(new Camera()); } else if (source == compositeItem || source == compositeButton) { group(new Composite()); } else if (source == switchItem || source == switchButton) { RandomNode random = new RandomNode(); group(random); if (random.size() > 0) random.name = random.get(0).name + "Switch"; } else if (source == physicsItem) { group(new PhysicsNode()); } else if (source == frameselectorItem) { for (int i=0; i 0) { for (int i=0; i 0); refreshContents(true); } else if (source == allParamsButton) { assert(copy == group); //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); for (Object3D obj : listUI) { obj.CloseUI(); } allparams ^= true; for (Object3D elem : listUI) { elem.openEditWindow(this, false); elem.editWindow.refreshContents(true); } refreshContents(true); } else if (source == unselectButton) { objEditor.jTree.clearSelection(); // ?? oct 2012 GrafreeD.clipboard.clear(); objEditor.ResetSliders(); refreshContents(true); } else if(source instanceof cRadio) { if (copy.versionlist != null) Replace(); group.parent = keepparent; group.attributes = 0; //group.editWindow = null; /*cRadio*/ radio = (cRadio)source; Object3D obj = radio.GetObject(); System.out.println("Edit " + obj); if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite) { group = //(Composite) obj; // to do !! } else { group = new cGroup(); group.name = "TEMP"; //group.attributes = -1; //group.parent = obj.parent; LA.matCopy(obj.parent.GlobalTransformInv(), group.toParent); LA.matCopy(obj.parent.GlobalTransform(), group.fromParent); group.add(obj); } copy = group; //Globals.theRenderer.object = group; if(!useclient) { cameraView.renderCamera = radio.camera; cameraView.manipCamera = radio.camera; cameraView.eyeCamera = radio.camera; cameraView.cameras[cameraView.cameracount] = radio.camera; cameraView.targetLookAt.set(radio.camera.lookAt); cameraView.object = group; //cameraView.lighttouched = true; Globals.lighttouched = true; topView.object = group; frontView.object = group; sideView.object = group; } // fix "+" issue //group.editWindow = this; group.manipWindow = this; /* currentLayout = radio.layout; if (currentLayout == null) currentLayout = sevenButton; */ radio.layout.doClick(); //assert(copy instanceof Composite); if (copy.versionlist == null) { copy.versionindex = -1; // Cannot work with loops // To fix this issue, we first mark all nodes above the root, // and check if any of these nodes are reachable below the root. Grafreed.grafreed.universe.TagObjects(copy, true); if (copy instanceof Composite && !copy.HasTags()) { if (copy.versionlist == null) copy.versionlist = new Object3D[100]; //Save(true); } else copy.versionindex = -2; Grafreed.grafreed.universe.TagObjects(copy, false); } SetVersionStates(); ClearUnpinned(); //Grafreed.Assert(group != null); //Grafreed.Assert(group.selection != null); SetPinStates(group.selection == null || group.selection.size() > 0); if (group.selection == null || group.selection.size() == 1) EditSelection(false); keepparent = group.parent; // PARENT = NULL or not??? //group.parent = null; // ROOT //group.attributes = -1; ResetModel(); cameraView.requestFocusInWindow(); refreshContents(true); } else if (event.getSource() == editCameraItem) { cameraView.ProtectCamera(); cameraView.requestFocusInWindow(); cameraView.repaint(); return; } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton) { cameraView.RevertCamera(); cameraView.requestFocusInWindow(); cameraView.repaint(); return; // } else if (event.getSource() == textureButton) // { // return; // true; } else { //return super.action(event, arg); super.actionPerformed(event); } } boolean useclient = false; void ToggleRoot() { useclient ^= true; if (useclient) { cameraView.object = client; Globals.lighttouched = true; //topView.object = client; //frontView.object = client; //sideView.object = client; } else { cameraView.object = group; Globals.lighttouched = true; //topView.object = group; //frontView.object = group; //sideView.object = group; } refreshContents(); } Object3D /*Composite*/ keepparent; //TransformGeometry void TransformGeometry() { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); obj.KeepTextureMatrices(); obj.TransformGeometry(); obj.RestoreTextureMatrices(); // if (obj.parent == null) // { // System.out.println("NULL PARENT!"); // new Exception().printStackTrace(); // } // else // TouchTransform(obj); // //obj.parent.Touch(); } 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 TextureRatio(int axis) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); obj.TextureRatio(axis); } refreshContents(); } void ResetTransform() { ResetTransform(-1); } void ScaleSelection(float scale) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); if (obj.toParent == null) { obj.toParent = LA.newMatrix(); obj.fromParent = LA.newMatrix(); } obj.Scale(scale); if (obj.parent == null) { System.out.println("NULL PARENT!"); // new Exception().printStackTrace(); } else TouchTransform(obj); //obj.parent.Touch(); } refreshContents(); } void ResetTransform(int mask) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); if (obj.toParent == null) continue; obj.ResetTransform(mask); if (obj.parent == null) { System.out.println("NULL PARENT!"); // new Exception().printStackTrace(); } else TouchTransform(obj); //obj.parent.Touch(); } refreshContents(); } void TouchTransform(Object3D obj) { // june 2014 if (obj.parent == null) return; if (obj.parent instanceof BezierPatch) { ((BezierSurface)obj.parent.parent).currentHandle = (Sphere)obj; obj.parent.parent.recalculate(); obj.parent.Touch(); } else obj.parent.Touch(); } void FlipTransform() { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); System.out.println("flip " + obj); LA.matIdentity(Object3D.mat); Object3D.mat[0][0] = -1; if (obj.toParent == null) { obj.toParent = LA.newMatrix(); obj.fromParent = LA.newMatrix(); } LA.matConcat(Object3D.mat, obj.fromParent, obj.fromParent); LA.matInvert(obj.fromParent, obj.toParent); if (obj.parent == null) { System.out.println("NULL PARENT!"); new Exception().printStackTrace(); } else TouchTransform(obj); //obj.parent.Touch(); } refreshContents(); } void ResetCentroid(boolean full) { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); System.out.println("reset centroid: " + obj); if (obj.toParent == null) { obj.toParent = LA.newMatrix(); obj.fromParent = LA.newMatrix(); } LA.matIdentity(Object3D.mat); obj.getBounds(minima, maxima, false); Object3D.mat[3][0] = -(minima.x + maxima.x)/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; 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]; //Object3D.mat[3][2] = -Object3D.mat[3][2]; LA.matInvert(obj.toParent, obj.fromParent); if (obj.parent == null) { System.out.println("NULL PARENT!"); new Exception().printStackTrace(); } else obj.parent.Touch(); } refreshContents(); } void PrintMemory() { try { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); int size = obj.MemorySize(); //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) { e.printStackTrace(); } } void PrintPath() { try { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); CameraPane.PrintFromTos(obj); } } catch (Exception e) { e.printStackTrace(); } } void AnalyzeObject() { try { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); System.out.println("Object is: " + obj); Grafreed.AnalyzeObject(obj); System.out.println("Boundary rep: " + obj.bRep); Grafreed.AnalyzeObject(obj.bRep); // System.err.println((size/1024) + " KB is the size of " + obj); } } catch (Exception e) { e.printStackTrace(); } } void DumpObject() { Object3D obj; for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { obj = (Object3D)e.nextElement(); obj.Dump(true); // System.err.println((size/1024) + " KB is the size of " + obj); } } void ClearSelection(boolean all) { group.ClearSelection(all); ResetModel(); refreshContents(); } void GenUV() { group.GenUVS(); refreshContents(); } void GenNormals(boolean crease) { group.GenNormalsS(crease); refreshContents(); } void GenNormalsMESH() { group.GenNormalsMeshS(); refreshContents(); } void GenNormalsMINE() { group.selection.GenNormalsMINE(); refreshContents(); } void Stripify() { group.StripifyS(); refreshContents(); } void Unstripify() { group.UnstripifyS(); refreshContents(); } void Trim() { group.TrimS(); refreshContents(); } void Untrim() { group.UntrimS(); refreshContents(); } void ClearColors() { group.ClearColorsS(); refreshContents(); } void ReverseNormals() { group.ReverseNormalsS(); refreshContents(); } //Object3D buffer; cVector temp = new cVector(); // BoundaryRep temprep; // Object3D nodes; // Vector vertices; // // cGroup buffer; // // public void Vertex(Object3D node, Vertex v) // { //// vertices.add(v); //// nodes.addElement(node); //// //// if (temprep.GetCache(v) != null) //// { //// temprep.Remove(v); //// } else //// { //// temprep.Remember(v); //// } // // //Object3D node = nodes.get(index); // temp.set(v); // vertices.get(index)); // temprep.GetVertex(k)); // // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z); // // LA.xformPos(temp, node.GlobalTransformInv(), temp); // // // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z); // // cGroup g = new cGroup(); // // if (g.toParent == null) // { // g.toParent = LA.newMatrix(); // g.fromParent = LA.newMatrix(); // } // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); // // g.add(GrafreeD.clipboard); // // buffer.add(g); // } // // public void Face(Object3D node, Face f) // { // // } // // void ParseVerticesOld() // ?? // { // //if (group.selection.size() != 1) // // return; // // temprep = new BoundaryRep(); // nodes = new Object3D(); // vertices = new Vector(); // // boolean epsequal = GrafreeD.epsequal; // GrafreeD.epsequal = true; // // for (int i=0; i> set = temprep.vertextable.entrySet(); // // for (java.util.Map.Entry entry : set) // { // cGroup g = new cGroup(); // // int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k)); // // Object3D node = nodes.get(index); // temp.set(vertices.get(index)); // temprep.GetVertex(k)); // // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z); // // LA.xformPos(temp, node.GlobalTransformInv(), temp); // // // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z); // // if (g.toParent == null) // { // g.toParent = LA.newMatrix(); // g.fromParent = LA.newMatrix(); // } // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); // // g.add(GrafreeD.clipboard); // // buffer.add(g); // } // // makeSomething(buffer, i==group.selection.size()-1); // } // // GrafreeD.epsequal = epsequal; // // //buffer = null; // temprep = null; // nodes = null; // // refreshContents(); // } void ParseVertices() { boolean epsequal = Grafreed.epsequal; Grafreed.epsequal = true; for (int i=0; i=0;) { Object3D c = o.get(j); SetAsReduced(c); } } void MeshReduction(Object3D o, boolean reduction34) { // if (o.reduced) // return; if (o.bRep != null) { if (o.bRep.reduced) return; o.ReduceMesh(reduction34, false); //o.ReduceMesh(false); o.Stripify(); System.gc(); return; } for (int i=o.Size(); --i>=0;) { Object3D child = o.get(i); if (child instanceof MorphNode) { MorphNode morph = (MorphNode) child; Object3D group = new Object3D(); Object3D reduced = CloneObject(morph.morphobject.get(0), false); reduced.ReduceMesh(reduction34, false); //reduced.ReduceMesh(false); reduced.Stripify(); //System.gc(); MirrorPoses(morph.morphobject, reduced, group, false); morph.morphobject.overwriteThis(group, Object3D.GEOMETRY); MorphNode newmorph = new MorphNode(morph.morphobject); morph.bRep = newmorph.bRep; SetAsReduced(morph); SetAsReduced(morph.morphobject); // morph.bRep.reduced = true; // if (morph.morphobject.bRep != null) // morph.morphobject.bRep.reduced = true; // for (int j=morph.morphobject.Size(); --j>=0;) // { // Object3D c = morph.morphobject.get(j); // // if (c.bRep != null) // c.bRep.reduced = true; // } //makeSomething(group); //return; } else if (child instanceof SwitchNode) { SwitchNode switchnode = (SwitchNode) child; Object3D group = new Object3D(); Object3D reduced = CloneObject(switchnode.switchobject.get(0), false); reduced.ReduceMesh(reduction34, false); //reduced.ReduceMesh(false); reduced.Stripify(); //System.gc(); MirrorPoses(switchnode.switchobject, reduced, group, false); switchnode.switchobject.overwriteThis(group, Object3D.GEOMETRY); SwitchNode newswitch = new SwitchNode(switchnode.switchobject, Object3D.GEOMETRY); // morph.bRep = newmorph.bRep; switchnode.overwriteThis(newswitch, Object3D.GEOMETRY); SetAsReduced(switchnode); SetAsReduced(switchnode.switchobject); // if (switchnode.bRep != null) // switchnode.bRep.reduced = true; //// morph.switchobject.reduced = true; // if (switchnode.switchobject.bRep != null) // switchnode.switchobject.bRep.reduced = true; // for (int j=switchnode.switchobject.Size(); --j>=0;) // { // Object3D c = switchnode.switchobject.get(j); // // if (c.bRep != null) // c.bRep.reduced = true; // } } else MeshReduction(child, reduction34); } } void ResetReducedFlag(Object3D o) { if (o.bRep != null) o.bRep.reduced = false; for (int i=o.Size(); --i>=0;) { Object3D child = o.get(i); ResetReducedFlag(child); } } void MeshReduction(boolean reduction34) { for (int i=0; i " + child); /// if (deselect) { //group.deselectAll(); //freeze = true; objEditor.jTree.clearSelection(); //freeze = false; } //group.addSelectee(child); //refreshContents(); /// //jList.setSelectedIndex(group.children.indexOf(child)); objEditor.jTree.addSelectionPath(child.GetTreePath()); //jTree.expandPath(child.GetTreePath()); } */ public void valueChanged(ListSelectionEvent e) //public boolean handleEvent(Event event) { if (freezemodel) return; //System.out.println("valueChanged " + e); //new Exception().printStackTrace(); freezemodel = true; //switch (event.id) { //case 701: // Event.LIST_SELECT //case 702: // Event.LIST_DESELECT group.deselectAll(); int indices[] = jList.getSelectedIndices(); for (int i=0; i < indices.length; i++) { Object3D child = (Object3D)group.Children().elementAt(indices[i]); group.addSelectee(child); } refreshContents(); //return true; } //return super.handleEvent(event); freezemodel = false; } public void valueChanged(TreeSelectionEvent e) //public boolean handleEvent(Event event) { if (freezemodel) return; //System.out.println("valueChanged " + e); //new Exception().printStackTrace(); freezemodel = true; ClearUnpinned(); /**/ //switch (event.id) { //case 701: // Event.LIST_SELECT //case 702: // Event.LIST_DESELECT group.deselectAll(); TreePath tps[] = objEditor.jTree.getSelectionPaths(); if (tps != null) { for (int i=0; i < tps.length; i++) { Object3D child = (Object3D) tps[i].getLastPathComponent(); //if (child.parent != null) //child.parent.addSelectee(child); objEditor.SetMaterial(child); group.addSelectee(child); } } // else // { // objEditor.SetMaterial(group); // .GetMaterial()); // objEditor.AddInfo(group, this, true); // .GetMaterial()); // System.err.println("info : " + group.GetPath()); // } if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera)) CameraPane.flash = true; if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) // a camera { if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace { CameraPane.camerachangeframe = 0; // don't refuse it Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true); } // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera; // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; } if (tps != null && tps.length == 1) { int tabIndex = ((Object3D)group.selection.elementAt(0)).tabIndex; if (tabIndex > 0) objectTabbedPane.setSelectedIndex(tabIndex-1); EditSelection(false); } SetPinStates(tps != null && tps.length > 0); this.muteSlider = true; scaleSlider.setInteger(1); scaleInvSlider.setInteger(1); this.muteSlider = false; refreshContents(); //return true; } //return super.handleEvent(event); /**/ freezemodel = false; } void SetPinStates(boolean enabled) { editButton.setEnabled(enabled); uneditButton.setEnabled(enabled); //unselectButton.setEnabled(enabled); flashSelectionButton.setEnabled(enabled); clearPanelButton.setEnabled(!listUI.isEmpty()); boolean allComposites = true; if (group.selection != null) for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { Object next = e.nextElement(); if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) { allComposites = false; break; } } rootButton.setEnabled(true); // allComposites); } void refreshContents(boolean cp) { if (Globals.SHOWINFO) //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) { objEditor.ClearInfo(); // .GetMaterial()); if (group.selection.Size() < 100) 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) { makeSomething(thing, true); } void linkSomething(Object3D thing, boolean resetmodel) // deselect) { makeSomething(thing, resetmodel); // deselect); } void makeSomething(Object3D thing) { objEditor.makeSomething(thing, true); } /*synchronized*/ void makeSomething2(Object3D thing, boolean resetmodel) // deselect) { //assert(false); objEditor.makeSomething(thing, resetmodel); // deselect); //System.out.println("makeSomething of " + thing); /* if (deselect && jList != null) { int indices[] = jList.getSelectedIndices(); for (int i = indices.length - 1; i >= 0; i--) { //objList.deselect(indices[i]); Object3D obj = (Object3D)group.children.elementAt(indices[i]); group.removeSelectee(obj); } } /**/ /* group.addChild(thing); //group.addSelectee(thing); //int index = objList.getItemCount(); //objList.add(thing.name); //objList.select(index); //group.refreshEditWindow(); ResetModel(); refreshContents(); if ((thing instanceof CSG)) objEditor.EditSelection(); */ } void ResetModel2() { objEditor.ResetModel(); /* group = (Composite) objEditor.client; group.selectees = new Vector(); //new Exception().printStackTrace(); freeze = true; jTree.setModel(new cTreeModel(group)); jTree.setCellRenderer(new cTreeModel.Renderer()); freeze = false; //group.refreshEditWindow(); //refreshContents(); */ } void loadClipboard(boolean cut) { if (group.selection.isEmpty()) return; Grafreed.clipboardIsTempGroup = false; Composite tGroup = null; if (group.selection.size() > 0) // 1) { tGroup = new cGroup(); Grafreed.clipboardIsTempGroup = true; } if (cut) { // if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. // Save(); //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) //jList.remove(indices[i]); while (group.selection.size() > 0) { Object3D child = (Object3D)group.selection.elementAt(0); //Composite tmp = new cGroup(); Object3D tmp = child; // new cGroup(); /* if(child == group) { group.selectees.remove(child); continue; } */ //tmp.fromParent = child.parent.GlobalTransform(); if(child.parent!=null && !LA.isIdentity(child.parent.GlobalTransform())) { tmp = new cGroup(); tmp.toParent = LA.newMatrix(); tmp.fromParent = LA.newMatrix(); ((cGroup)tmp).transientlink = true; LA.matCopy(child.parent.GlobalTransform(), tmp.fromParent);; LA.matInvert(tmp.fromParent, tmp.toParent); } group.removeChild(child); if(true) // !LA.isIdentity(tmp.fromParent)) { // LA.matInvert(tmp.fromParent, tmp.toParent); if (tmp != child) tmp.add/*Child*/(child); // ??? //System.out.println("cut " + child); //System.out.println("parent = " + child.parent); // tmp.addChild(child); if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(tmp); else Grafreed.clipboard = tmp; } else if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(child); else Grafreed.clipboard = child; } //ResetModel(); } else { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) { Object3D child = (Object3D)e.nextElement(); Object3D elem = child; // .deepCopy(); //Composite tmp = new cGroup(); Object3D tmp = child; // new cGroup(); //tmp.fromParent = child.parent.GlobalTransform(); // if(child.parent != null) // LA.matCopy(child.parent.GlobalTransform(), tmp.fromParent); if(child.parent!=null && !LA.isIdentity(child.parent.GlobalTransform())) { tmp = new cGroup(); ((cGroup)tmp).transientlink = true; tmp.toParent = LA.newMatrix(); tmp.fromParent = LA.newMatrix(); LA.matCopy(child.parent.GlobalTransform(), tmp.fromParent);; LA.matInvert(tmp.fromParent, tmp.toParent); } if(true) // !LA.isIdentity(tmp.fromParent)) { //LA.matInvert(tmp.fromParent, tmp.toParent); if (tmp != child) tmp.add/*Child*/(elem); // ??? //System.out.println("cut " + elem); //System.out.println("parent = " + elem.parent); // tmp.addChild(elem); if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(tmp); else Grafreed.clipboard = tmp; } else if (Grafreed.clipboardIsTempGroup) tGroup.add/*Child*/(child); else Grafreed.clipboard = child; } } if (Grafreed.clipboardIsTempGroup) Grafreed.clipboard = tGroup; if (cut) { ResetModel(); refreshContents(); } } void paste(boolean expand) { if (Globals.REPLACEONMAKE) Save(); boolean keep = Globals.REPLACEONMAKE; Globals.REPLACEONMAKE = false; // if (GrafreeD.clipboard == null) // return; boolean first = true; if (Grafreed.clipboardIsTempGroup) { Composite temp; /* if (expand) temp = (Composite)Applet3D.clipboard.copyExpand(); else temp = (Composite)Applet3D.clipboard.deepCopy(); */ Object3D elem; for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) { Object3D child = (Object3D)e.nextElement(); if (child instanceof cGroup && ((cGroup)child).transientlink ) child = ((cGroup)child).get(0); Object3D /*Composite*/ keepparent = child.parent; child.parent = null; // Avoid copy? if(expand) elem = child.copyExpand(); // ? else elem = child.deepCopy(); // ? child.parent = keepparent; //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent)) // elem = elem.get(0); makeSomething(elem, true); // ?? first); //group.addChild(elem); first = false; //int index = objList.getItemCount(); } } else { /* Object3D copy = Applet3D.clipboard.deepCopy(); //group.addChild(copy); makeSomething(copy); //int index = objList.getItemCount(); //objList.add(copy.name); */ //Composite temp = new Composite(); //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()); else makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy()); Grafreed.clipboard.get(0).parent = keepparent; } Globals.REPLACEONMAKE = keep; ResetModel(); refreshContents(); } void pasteInto(boolean copyit, boolean clone) { // if (GrafreeD.clipboard == null) // return; if (group.selection.size() != 1) return; // beurk //Composite tmpgroup = (Composite) objEditor.copy; // group; Object3D tmpgroup = (Object3D) objEditor.copy; // group; Object3D /*Composite*/ restore; try { objEditor.copy /*group*/ = /* (Composite)*/ group.selection.get(0); restore = objEditor.copy.parent; //objEditor.copy.parent = group.parent; // null } catch (Exception e) { System.out.println("ERROR pasteLink : " + group.selection); return; } try // protect object editor copy { if (copyit) { // paste(false); if (clone) { CloneClipboard(false); // sept 2014 } else { paste(false); } } else { boolean first = true; if (Grafreed.clipboardIsTempGroup) { Composite temp = (Composite)Grafreed.clipboard; Object3D copy; for (Enumeration e = temp.children.elements(); e.hasMoreElements();) { Object3D child = (Object3D)e.nextElement(); linkSomething(child, first); first = false; } } else { linkSomething(Grafreed.clipboard); //.get(0)); } } } catch (Exception e) { System.out.println("PROTECTED CRASH"); e.printStackTrace(); } objEditor.copy.parent = restore; objEditor.copy /*group*/ = tmpgroup; ResetModel(); refreshContents(); } void group(Object3D csg) { group(csg, false); } void back() { int selcount = group.selection.size(); if (selcount != 1) return; Object3D object = group.selection.get(0); if (object.parent != null) { int index = object.parent.indexOf(object); if (index == 0) return; Object3D theobj = object.parent.remove(index); assert(theobj == object); object.parent.insertElementAt(object, index-1); } ResetModel(); Select(object.GetTreePath(), true, false); // unselect... false); refreshContents(); } void front() { int selcount = group.selection.size(); if (selcount != 1) return; Object3D object = group.selection.get(0); if (object.parent != null) { int index = object.parent.indexOf(object); if (index+1 >= object.parent.size()) return; Object3D theobj = object.parent.remove(index); assert(theobj == object); object.parent.insertElementAt(object, index+1); } ResetModel(); Select(object.GetTreePath(), true, false); // unselect... false); refreshContents(); } void group(Object3D csg, boolean grab) { if (Globals.REPLACEONMAKE) Save(); boolean keep = Globals.REPLACEONMAKE; Globals.REPLACEONMAKE = false; if (//false) // why?? !group.selection.isEmpty()) { /* int indices[] = objList.getSelectedIndexes(); for (int i = indices.length - 1; i >= 0; i--) objList.remove(indices[i]); */ //Composite csg = new Composite(); int selcount = group.selection.size(); Object3D child; for (; group.selection.size() > 0;) { child = (Object3D)group.selection.firstElement(); // ??? lastElement(); if(child == group) { group.selection.remove(child); continue; } Composite tmp = new cGroup(); tmp.toParent = LA.newMatrix(); tmp.fromParent = LA.newMatrix(); if(child.parent != null) LA.matCopy(child.parent.GlobalTransform(), tmp.fromParent); LA.matInvert(group.GlobalTransform(), tmp.toParent); LA.matConcat(tmp.toParent, tmp.fromParent, tmp.fromParent); group.removeChild(child); if(!LA.isIdentityEps(tmp.fromParent)) { LA.matInvert(tmp.fromParent, tmp.toParent); csg.addChild(tmp); tmp.addChild(child); if (grab && selcount == 1) { makeSomething(tmp); return; } } else { if (grab && selcount == 1) { makeSomething(child); return; } csg.addChild(child); } } try { objEditor.jTree.clearSelection(); } catch (Exception e) { e.printStackTrace(); } } if (false) // !group.selection.isEmpty()) { /* int indices[] = objList.getSelectedIndexes(); for (int i = indices.length - 1; i >= 0; i--) objList.remove(indices[i]); */ //Composite csg = new Composite(); int selcount = group.selection.size(); Object3D child; for (; group.selection.size() > 0;) { child = (Object3D)group.selection.firstElement(); // ??? lastElement(); if(child == group) { group.selection.remove(child); continue; } group.removeChild(child); if (grab && selcount == 1) { makeSomething(child); return; } csg.addChild(child); } try { objEditor.jTree.clearSelection(); } catch (Exception e) { e.printStackTrace(); } } //Object3D node = new cGroup(); //node.add(csg); //makeSomething(node); makeSomething(csg); Globals.REPLACEONMAKE = keep; } void Ungroup(Object3D g) { if (Globals.REPLACEONMAKE) Save(); boolean keep = Globals.REPLACEONMAKE; Globals.REPLACEONMAKE = false; if (g instanceof HiddenObject) { HiddenObject h = (HiddenObject) g; for (int i=0; i= 0; i--) { Object3D child = (Object3D)group.children.elementAt(indices[i]); if (child instanceof Composite) { //objList.remove(indices[i]); group.removeChild(child); Object3D grandchild; for (Composite comp = (Composite)child; comp.children.size() > 0;) // objList.add(grandchild.name)) { grandchild = (Object3D)comp.children.elementAt(0); comp.removeChild(grandchild); LA.matConcat(grandchild.toParent, comp.toParent, grandchild.toParent); group.addChild(grandchild); //makeSomething(grandchild, first); first = false; } } } ResetModel(); refreshContents(); */ } void refreshContents2() { objEditor.refreshContents(); /* jTree.repaint(); if (true) return; // freeze) return; //ResetModel(); //System.out.println("Vector = " + (group.GetSelectionTreePaths())); //System.out.println("Array = " + (group.GetSelectionTreePaths().toArray())); jTree.clearSelection(); Object[] list = group.GetSelectionTreePaths().toArray(); for (int i=0; i tempsel = (Vector) group.selectees.clone(); flashIt = false; CameraPane pane = (CameraPane) objEditor.cameraView; pane.clickStart(location.x, location.y, 0); pane.clickEnd(location.x, location.y, 0, true); if (group.selectees.size() == 1) { Object3D targ = group.selectees.get(0); targ.SetTexture(new cTexture(filename)); } boolean first = true; for(Object3D o : tempsel) { Select(o, first); first = false; } flashIt = true; refreshContents(); } LoadJMEThread loadThread; class LoadJMEThread extends Thread { com.jmex.model.converters.FormatConverter converter; java.util.Stack stack; LoadJMEThread(com.jmex.model.converters.FormatConverter conv) { converter = conv; stack = new java.util.Stack(); } void add(String filename) { stack.push(filename); } public void run() { for(;;) { try{sleep(10);}catch(Exception e){}; if(!stack.empty()) { objEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String filename = (String)stack.pop(); System.out.println(" ------- ------- ------ ------ ----- LOADING... " + filename); LoadFile0(filename, converter); System.gc(); } else objEditor.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } //LoadFile0(filename, converter); } } void LoadFile0(String fullname, com.jmex.model.converters.FormatConverter converter) { Reload(converter, fullname, true); } void LoadFile(String fullname, com.jmex.model.converters.FormatConverter converter) { lastFilename = fullname; //cJME.count = 0; //LoadFile0(fullname); //new LoadJMEThread(fullname, converter).start(); if(loadThread == null) { loadThread = new LoadJMEThread(converter); loadThread.start(); } loadThread.add(fullname); } */ /* public void Callback(Object obj) { if(obj == null) return; if (obj instanceof Object3D) // BEURK makeSomething((Object3D) obj); else DropFile((java.io.File[]) obj, false); } */ /* public void DragGesture() { // Patch for DnD failure objEditor.jTree.clearSelection(); objEditor.ResetSliders(); } */ String GetFile(String dialogName) { if (Grafreed.standAlone) { FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); browser.show(); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { String fullname = browser.getDirectory() + filename; return fullname; // try // { // java.io.File file = new java.io.File(fullname); // java.net.URL url = file.toURI().toURL(); // // return file.toString(); // new cTexture(file.toString()); // } // catch(java.io.IOException e2) { e2.printStackTrace(); } } } return null; } static class cListModel implements ListModel { Vector objList = new Vector(); cListModel(GroupEditor owner) { //int index = 0; for (Enumeration e = owner.group.Children().elements(); e.hasMoreElements();) { Object3D child = (Object3D)e.nextElement(); objList.add(child.name); //if (owner.group.isSelected(child)) //objList.setSelectedIndex(index); //index++; } } public void addListDataListener(ListDataListener l) { } public Object getElementAt(int index) { return objList.get(index); } public int getSize() { return objList.size(); } public void removeListDataListener(ListDataListener l) { } } cButton flashSelectionButton; cButton editButton; cButton uneditButton; JCheckBox allParamsButton; cButton clearpanelButton; cButton unselectButton; cButton restoreCameraButton; cButton oneStepButton; cButton groupButton; cButton ungroupButton; cButton compositeButton; cButton switchButton; cButton loopButton; cButton textureButton; cButton skybox1Button; cButton skybox2Button; cButton skybox3Button; cButton skybox4Button; cButton skybox5Button; cButton skybox6Button; cButton skybox7Button; cButton skybox11Button; cButton skybox12Button; cButton skybox13Button; cButton skybox14Button; cButton skybox15Button; cButton skybox16Button; cButton skybox17Button; cButton gridButton; cButton boxButton; cButton sphereButton; cButton coneButton; cButton torusButton; cButton superButton; cButton kleinButton; cButton particlesButton; cButton overlayButton; cButton lightButton; cButton screenfitButton; cButton screenfitpointButton; cButton snapobjectButton; // cButton recompileButton; cButton gcButton; cButton clearButton; cButton rootButton; cButton closeButton; cButton setsupportButton; // //Composite Object3D // to do !! group; //Vector selectees; JList jList; //JTree jTree; private MenuItem lookAtItem; private MenuItem lookFromItem; private MenuItem switchViewItem; private JMenuItem cutItem; private MenuItem undoItem; private MenuItem redoItem; private JMenuItem duplicateItem; private JMenuItem cloneItem; private MenuItem cloneSupportItem; private MenuItem overwriteGeoItem; private MenuItem overwriteMatItem; private MenuItem overwriteNameItem; private MenuItem overwriteUVItem; private MenuItem synchronizeItem; private MenuItem resetsupportItem; private MenuItem resetreferencesItem; private MenuItem linkverticesItem; private MenuItem relinkverticesItem; private MenuItem setMasterItem; private MenuItem resetAllItem; private MenuItem stepAllItem; private MenuItem revertMeshItem; private MenuItem poseMeshItem; private MenuItem generateMeshItem; private MenuItem extractGeometriesItem; private MenuItem cloneGeometriesItem; private MenuItem shareGeometriesItem; private MenuItem mergeGeometriesItem; private JMenuItem copyItem; private MenuItem pasteItem; private JMenuItem pasteIntoItem; private JMenuItem pasteLinkItem; private JMenuItem pasteCloneItem; private JMenuItem pasteExpandItem; private JMenuItem deleteItem; private MenuItem clearAllItem; private MenuItem genUVItem; private MenuItem genNormalsMESHItem; private MenuItem genNormalsCADItem; private MenuItem genNormalsORGANItem; private MenuItem genNormalsMINEItem; private MenuItem stripifyItem; private MenuItem unstripifyItem; private MenuItem trimItem; private MenuItem untrimItem; private MenuItem clearColorsItem; private MenuItem mazeItem; private MenuItem parseverticesItem; private MenuItem alignItem; private MenuItem mirrorItem; private MenuItem reduceMorphItem; private MenuItem reduce34MorphItem; private MenuItem reverseNormalsItem; private MenuItem reverseTrianglesItem; private MenuItem reduceMeshItem; private MenuItem reduce34MeshItem; private MenuItem increaseMeshItem; private MenuItem clipMeshItem; private MenuItem smoothMeshItem; private MenuItem clearMaterialsItem; private MenuItem clearVersionsItem; private MenuItem liveleavesItem; private MenuItem unliveleavesItem; private MenuItem supportleavesItem; private MenuItem unsupportleavesItem; private MenuItem hideleavesItem; 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; private MenuItem minTexturesItem; private MenuItem lowTexturesItem; private MenuItem normalTexturesItem; private MenuItem highTexturesItem; private MenuItem veryhighTexturesItem; private MenuItem maxTexturesItem; private MenuItem panoTexturesItem; private MenuItem textureRatioRItem; private MenuItem textureRatioGItem; private MenuItem textureRatioBItem; private MenuItem resetCentroidItem; private MenuItem resetCentroidXZItem; private MenuItem resetTransformItem; private MenuItem transformGeometryItem; private MenuItem transformChildrenItem; private MenuItem hideItem; private JMenuItem grabItem; private MenuItem backItem; private MenuItem frontItem; private MenuItem cameraItem; private MenuItem compositeItem; private MenuItem switchItem; private MenuItem physicsItem; private MenuItem frameselectorItem; private MenuItem scriptNodeItem; private MenuItem switchGeoItem; private MenuItem switchTransfoItem; private MenuItem morphItem; private MenuItem linkerItem; private JMenuItem ungroupItem; private MenuItem editItem; private MenuItem openWindowItem; private MenuItem editLeafItem; private MenuItem resetParentItem; private MenuItem repairParentItem; private MenuItem repairShadowItem; private MenuItem sortbysizeItem; private MenuItem sortbynameItem; private MenuItem attachPigmentItem; private MenuItem detachPigmentItem; private MenuItem attachBumpItem; private MenuItem detachBumpItem; private MenuItem pigmentBumpItem; private MenuItem embedTexturesItem; private MenuItem deEmbedTexturesItem; private MenuItem particleItem; private MenuItem ragdollItem; private MenuItem ragdoll2Item; private MenuItem heightFieldItem; private MenuItem textureFieldItem; private MenuItem gridItem; private MenuItem rectoidItem; private MenuItem ellipsoidItem; private MenuItem coneItem; private MenuItem torusItem; private MenuItem superItem; private MenuItem kleinItem; private MenuItem blobItem; private MenuItem latheItem; private MenuItem bezierItem; private MenuItem overlayItem; private MenuItem meshItem; // private MenuItem meshGroupItem; private MenuItem springItem; private MenuItem flagItem; private MenuItem lightItem; private MenuItem csgItem; private MenuItem templateItem; private MenuItem textureItem; private MenuItem billboardItem; private MenuItem shadowXItem; private MenuItem shadowYItem; private MenuItem shadowZItem; private MenuItem attributeItem; private MenuItem pointflowItem; private MenuItem superLoopItem; private MenuItem loopItem; private MenuItem doubleItem; private MenuItem tripleItem; private MenuItem computeAOItem; private MenuItem recompileItem; private MenuItem editScriptItem; private MenuItem invariantsItem; private MenuItem memoryItem; private MenuItem pathItem; private MenuItem analyzeItem; private MenuItem dumpItem; //boolean freezemodel = false; Menu cameraMenu; MenuItem editCameraItem; MenuItem restoreCameraItem; }