From 6c2c00ee7f33ec46f79eba11c349f766cb207ec0 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 29 Apr 2019 10:39:23 -0400 Subject: [PATCH] Material pane --- ObjEditor.java | 1032 ++++++++++++++++++++++++++++++--------------------------- 1 files changed, 540 insertions(+), 492 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 22fab98..e07d192 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -19,6 +19,8 @@ import //weka.core. matrix.Matrix; +import grafeme.ui.*; + class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI, ActionListener, ChangeListener, InputMethodListener, @@ -28,7 +30,12 @@ iSendInfo //KeyListener { + boolean timeline; + boolean wasFullScreen; + GroupEditor callee; + JFrame frame; + // SCRIPT transient JFrame textpanel = null; @@ -119,14 +126,13 @@ void keyPressed(int key, int modifiers) { System.out.println("KEY PRESSED"); - CameraPane.theRenderer.keyPressed(key, modifiers); + Globals.theRenderer.keyPressed(key, modifiers); } */ static GridBagConstraints aConstraints; static GridBagConstraints aWindowConstraints; - GroupEditor callee; - JFrame frame; + static int GRIDWIDTH = 100; // 4; public void closeUI() @@ -158,12 +164,16 @@ objEditor.ctrlPanel.remove(slowerButton); objEditor.ctrlPanel.remove(fasterButton); objEditor.ctrlPanel.remove(remarkButton); + + Remove(normalpushField); } public ObjEditor GetEditor() { return objEditor; //.GetEditor(); } + + // Sometimes myself, sometimes my callee's. ObjEditor objEditor; /* @@ -238,7 +248,7 @@ //if (!isDisplayable()) //setUndecorated(true); - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); + //System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); client = inClient; copy = localCopy; copy.editWindow = this; @@ -292,16 +302,18 @@ //normalLensItem.addActionListener(this); cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); revertCameraItem.addActionListener(this); - cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen")); - toggleFullItem.addItemListener(this); - toggleFullItem.setState(CameraPane.FULLSCREEN); + cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); + toggleTimelineItem.addItemListener(this); + cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); + toggleFullScreenItem.addItemListener(this); + toggleFullScreenItem.setState(CameraPane.FULLSCREEN); cameraMenu.add("-"); cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); toggleTextureItem.addItemListener(this); toggleTextureItem.setState(CameraPane.textureon); cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); toggleLiveItem.addItemListener(this); - toggleLiveItem.setState(CameraPane.isLIVE()); + toggleLiveItem.setState(Globals.isLIVE()); cameraMenu.add(stepItem = new MenuItem("Step")); stepItem.addActionListener(this); // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); @@ -343,9 +355,9 @@ toolbarPanel.setName("Toolbar"); treePanel = new JPanel(); treePanel.setName("Tree"); - ctrlPanel = new JPanel(); // new GridBagLayout()); + ctrlPanel = new cGridBag(); // new GridBagLayout()); ctrlPanel.setName("Edit"); - materialPanel = new JPanel(); + materialPanel = new cGridBag().setVertical(true); materialPanel.setName("Material"); /*JTextPane*/ infoarea = createTextPane(); @@ -375,7 +387,7 @@ toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); treePanel.setLayout(new GridBagLayout()); ctrlPanel.setLayout(new GridBagLayout()); - materialPanel.setLayout(new GridBagLayout()); + //materialPanel.setLayout(new GridBagLayout()); aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0); @@ -522,18 +534,18 @@ maxima.y = sel.toParent[3][1]; maxima.z = sel.toParent[3][2]; si.SendInfo(" Orig: " + maxima, "regular"); - maxima.x = sel.globalTransform[3][0]; - maxima.y = sel.globalTransform[3][1]; - maxima.z = sel.globalTransform[3][2]; - if (full) - si.SendInfo(" Global Orig: " + maxima, "regular"); maxima.x = sel.toParent[0][0]; maxima.y = sel.toParent[1][1]; maxima.z = sel.toParent[2][2]; si.SendInfo(" Scale: " + maxima, "regular"); - maxima.x = sel.globalTransform[0][0]; - maxima.y = sel.globalTransform[1][1]; - maxima.z = sel.globalTransform[2][2]; + maxima.x = sel.globalTransform[3][0]; + maxima.y = sel.globalTransform[3][1]; + maxima.z = sel.globalTransform[3][2]; + if (full) + si.SendInfo(" Global Orig: " + maxima, "regular"); + maxima.x = sel.globalTransform[0][0]; + maxima.y = sel.globalTransform[1][1]; + maxima.z = sel.globalTransform[2][2]; if (full) si.SendInfo(" Global Scale: " + maxima, "regular"); } @@ -593,6 +605,22 @@ System.err.println("Couldn't insert initial text into text pane."); } } + + void ToggleFullScreen() + { + if (CameraPane.FULLSCREEN) + { + frame.getContentPane().remove(/*"Center",*/bigThree); + framePanel.add(bigThree); + frame.getContentPane().add(/*"Center",*/framePanel); + } else + { + frame.getContentPane().remove(/*"Center",*/framePanel); + framePanel.remove(bigThree); + frame.getContentPane().add(/*"Center",*/bigThree); + } + cameraView.ToggleFullScreen(); + } private JTextArea createTextPane() { @@ -692,7 +720,7 @@ protected static ImageIcon createImageIcon(String path, String description) { - java.net.URL imgURL = GraphreeD.class.getResource(path); + java.net.URL imgURL = GrafreeD.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); @@ -786,65 +814,47 @@ return combo; } - NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow) + cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) { - NumberSlider combo; + cGridBag control = new cGridBag(); + + cNumberSlider combo; JLabel jlabel = new JLabel(label); - - aConstraints.fill = GridBagConstraints.VERTICAL; jlabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.gridwidth = 2; - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.gridwidth = 1; - + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setFloat(current); - - combo.label = jlabel; - - combo.addChangeListener(this); - + + ctrlPanel.add(control); + return combo; } - NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current) + cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) { - NumberSlider combo; + cGridBag control = new cGridBag(); + + cNumberSlider combo; JLabel jlabel = new JLabel(label); - - aConstraints.fill = GridBagConstraints.VERTICAL; jlabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.gridwidth = 2; - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.gridwidth = 1; - + ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setInteger(current); - combo.label = jlabel; - - combo.addChangeListener(this); - + ctrlPanel.add(control); + return combo; } - JTextArea AddText(JPanel ctrlPanel, String name) + JTextArea AddText(cGridBag ctrlPanel, String name) { JTextArea text; aConstraints.fill = GridBagConstraints.HORIZONTAL; aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); text.addCaretListener(this); aConstraints.gridx += 1; aConstraints.gridwidth = 1; @@ -874,6 +884,13 @@ { j.removeChangeListener(this); objEditor.ctrlPanel.remove(j.label); + objEditor.ctrlPanel.remove(j); + } + + void Remove(cNumberSlider j) + { + j.removeChangeListener(this); + //objEditor.ctrlPanel.remove(j.label); objEditor.ctrlPanel.remove(j); } @@ -963,6 +980,9 @@ Return(); + normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); + Return(); + // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); // ObjEditor.aConstraints.gridx += 1; @@ -1107,7 +1127,7 @@ //frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------"); //sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------"); -// GridBagConstraints gbc = (GridBagConstraints) GraphreeD.clone(aConstraints); +// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints); Camera cam = GetCamera(copy, 0); Composite cams = null; @@ -1158,10 +1178,22 @@ //JPanel worldPanel = // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true); //worldPanel.setName("World"); - /*JPanel*/ cameraPanel = - new JPanel(new BorderLayout()); - cameraPanel.add(cameraView); + centralPanel = new cGridBag(); + centralPanel.preferredWidth = 20; + timelinePanel = new JPanel(new BorderLayout()); + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); + cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); + cameraPanel.setContinuousLayout(true); + cameraPanel.setOneTouchExpandable(true); +// cameraPanel.setDividerLocation(0.9); +// cameraPanel.setDividerSize(9); + cameraPanel.setResizeWeight(1.0); + + centralPanel.add(cameraView); + //frame.setJMenuBar(timelineMenubar); + //centralPanel.add(timelinePanel); + //topView.camera = ; //frontView.camera = new Camera(2); //sideView.camera = new Camera(3); @@ -1177,12 +1209,13 @@ //frontView.object = copy; //sideView.object = copy; - XYZPanel = new JPanel(); - XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); + XYZPanel = new cGridBag().setVertical(true); + //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); - XYZPanel.add(/*BorderLayout.SOUTH,*/sideView); // Scroll); - XYZPanel.add(/*BorderLayout.CENTER,*/frontView); // Scroll); - XYZPanel.add(/*BorderLayout.NORTH,*/topView); // Scroll); + XYZPanel.preferredWidth = 5; + XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); + XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); + XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); /* gridPanel = new JPanel(); //new BorderLayout()); @@ -1191,7 +1224,7 @@ gridPanel.add(cameraView); gridPanel.add(XYZPanel); */ - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout()); + gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); gridPanel.setContinuousLayout(true); gridPanel.setOneTouchExpandable(true); gridPanel.setDividerLocation(1.0); @@ -1244,16 +1277,23 @@ scrollpane.setWheelScrollingEnabled(true); scrollpane.addMouseWheelListener(this); // Default not fast enough - /*JTabbedPane*/ jtp = new JTabbedPane(); - jtp.add(scrollpane); + /*JTabbedPane*/ scenePanel = new cGridBag(); + scenePanel.preferredWidth = 7; + + JTabbedPane tabbedPane = new JTabbedPane(); + tabbedPane.add(scrollpane); - jtp.add(FSPane = new cFileSystemPane(this)); + tabbedPane.add(FSPane = new cFileSystemPane(this)); - optionsPanel = new JPanel(new GridBagLayout()); + optionsPanel = new cGridBag().setVertical(true); optionsPanel.setName("Options"); - jtp.add(optionsPanel); - + + AddOptions(optionsPanel); //, aConstraints); + + tabbedPane.add(optionsPanel); + + scenePanel.add(tabbedPane); /* cTree jTree = new cTree(null); @@ -1275,7 +1315,7 @@ jtp.add(tree); */ - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel); + bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); bigPanel.setContinuousLayout(true); bigPanel.setOneTouchExpandable(true); bigPanel.setDividerLocation(0.8); @@ -1287,6 +1327,7 @@ //bigPanel.setSize(new Dimension(10,10)); //bigPanel.add(ctrlPanel); //bigPanel.add(gridPanel); + /** bigThree = new JPanel(); //big.setLayout(new FlowLayout(FlowLayout.LEFT)); bigThree.setLayout(new GridBagLayout()); //1,3,5,5)); @@ -1297,20 +1338,26 @@ aWindowConstraints.fill = GridBagConstraints.VERTICAL; aWindowConstraints.weightx = 0; aWindowConstraints.weighty = 1; - bigThree.add(jtp, aWindowConstraints); + bigThree.add(scenePanel, aWindowConstraints); aWindowConstraints.weightx = 1; aWindowConstraints.gridwidth = 3; // aConstraints.gridheight = 3; aWindowConstraints.gridx = 1; aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(cameraPanel, aWindowConstraints); + bigThree.add(centralPanel, aWindowConstraints); aWindowConstraints.weightx = 0; aWindowConstraints.gridx = 4; aWindowConstraints.gridwidth = 1; // aConstraints.gridheight = 3; aWindowConstraints.fill = GridBagConstraints.VERTICAL; bigThree.add(XYZPanel, aWindowConstraints); + /**/ + bigThree = new cGridBag(); + bigThree.addComponent(scenePanel); + bigThree.addComponent(centralPanel); + bigThree.addComponent(XYZPanel); + // // SIDE EFFECT!!! // aConstraints.gridx = 0; // aConstraints.gridy = 0; @@ -1331,10 +1378,11 @@ //worldPane.add(bigPanel); //worldPane.add(worldPanel); /**/ - frame.getContentPane().add(/*"Center",*/framePanel); + //frame.getContentPane().add(/*"Center",*/framePanel); + frame.add(/*"Center",*/framePanel); //frame.getContentPane().add(/*"Center",*/ worldPane); -// aConstraints = gbc; // (GridBagConstraints) GraphreeD.clone(gbc); +// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); frame.setSize(1024, 768); frame.show(); @@ -1352,6 +1400,10 @@ }); } + void AddOptions(cGridBag panel) //, GridBagConstraints constraints) + { + } + JTree GetTree() { return objEditor.jTree; @@ -1363,260 +1415,175 @@ ctrlPanel.removeAll(); } - void SetupMaterial(JPanel ctrlPanel) + void SetupMaterial(cGridBag ctrlPanel) { - aConstraints.weighty = 0; - //aConstraints.weightx = 1; - /* + /* ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; */ - aConstraints.gridwidth = 1; - ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints); - aConstraints.gridx += 1; - aConstraints.weighty = 0; - aConstraints.gridwidth = 1; + cGridBag editBar = new cGridBag().setVertical(false); + + editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); /* ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); - aConstraints.gridx += 1; - aConstraints.weighty = 0; - aConstraints.gridwidth = 1; */ - ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints); - aConstraints.gridx += 1; + editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints); + editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints); + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); - ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints); - - aConstraints.gridx += 1; - - ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints); - - aConstraints.gridx += 1; - - ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints); - - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.weighty = 0; - aConstraints.gridwidth = 1; + ctrlPanel.add(editBar); + /**/ //aConstraints.weighty = 0; ////aConstraints.weightx = 1; //aConstraints.weighty = 1; aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints); - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - //aConstraints.weightx = 0; - ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + JPanel colorPanel = new JPanel(new BorderLayout()); + colorPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + cGridBag colorSection = new cGridBag().setVertical(true); + + colorPanel.add(colorSection); + + cGridBag color = new cGridBag(); + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); + color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(color); - ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints); - modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag modulation = new cGridBag(); + modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); + modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(modulation); - ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints); - textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag texture = new cGridBag(); + texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); + textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); + texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(texture); - ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints); - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag anisoU = new cGridBag(); + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(anisoU); - ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints); - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag anisoV = new cGridBag(); + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(anisoV); - ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints); - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag shadowbias = new cGridBag(); + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + colorSection.add(shadowbias); - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(colorPanel); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + JPanel diffusePanel = new JPanel(new BorderLayout()); + diffusePanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + cGridBag diffuseSection = new cGridBag().setVertical(true); + + diffusePanel.add(diffuseSection); + + cGridBag diffuse = new cGridBag(); + diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); + diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); + diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(diffuse); - ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints); - diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag diffuseness = new cGridBag(); + diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints); + diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); + diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(diffuseness); - ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints); - diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag selfshadow = new cGridBag(); + selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints); + selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); + selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(selfshadow); - ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints); - selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag sheen = new cGridBag(); + sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints); + sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); + sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(sheen); - ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints); - sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag subsurface = new cGridBag(); + subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints); + subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); + subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + diffuseSection.add(subsurface); - ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints); - subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag shadow = new cGridBag(); + shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints); + shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); + shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(shadow); - ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints); - shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag fakedepth = new cGridBag(); + fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints); + fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); + fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(fakedepth); - ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints); - fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(diffusePanel); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + JPanel specularPanel = new JPanel(new BorderLayout()); + specularPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + cGridBag specularSection = new cGridBag().setVertical(true); + + specularPanel.add(specularSection); - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag specular = new cGridBag(); + specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); + specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); + specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(specular); - ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints); - specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag lightarea = new cGridBag(); + lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints); + lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); + lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(lightarea); - ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints); - lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag shininess = new cGridBag(); + shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints); + shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); + shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(shininess); - ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints); - shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag metalness = new cGridBag(); + metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints); + metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); + metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + specularSection.add(metalness); - ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints); - metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag velvet = new cGridBag(); + velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints); + velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); + velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(velvet); - ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints); - velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; - - shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1); - Return(); + shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); + //Return(); // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); // aConstraints.fill = GridBagConstraints.HORIZONTAL; @@ -1627,130 +1594,97 @@ // aConstraints.gridy += 1; // aConstraints.gridwidth = 1; - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; - ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints); - cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(specularPanel); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + JPanel globalPanel = new JPanel(new BorderLayout()); + globalPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + cGridBag globalSection = new cGridBag().setVertical(true); + + globalPanel.add(globalSection); - ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints); - ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag camera = new cGridBag(); + camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); + cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); + camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + globalSection.add(camera); - ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints); - backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag ambient = new cGridBag(); + ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); + ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); + ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + globalSection.add(ambient); - ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints); - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; - aConstraints.weighty = 0; + cGridBag backlit = new cGridBag(); + backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); + backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); + backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + globalSection.add(backlit); - ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints); - bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag opacity = new cGridBag(); + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + globalSection.add(opacity); - ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints); - noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(globalPanel); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + JPanel texturePanel = new JPanel(new BorderLayout()); + texturePanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + cGridBag textureSection = new cGridBag().setVertical(true); + + texturePanel.add(textureSection); - ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints); - powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag bump = new cGridBag(); + bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); + bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); + bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); + textureSection.add(bump); - ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints); - borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag noise = new cGridBag(); + noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints); + noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); + noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints); + textureSection.add(noise); - ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints); - fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag power = new cGridBag(); + power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints); + powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); + power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints); + textureSection.add(power); - ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints); - opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag borderfade = new cGridBag(); + borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints); + borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); + borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); + textureSection.add(borderfade); - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; + cGridBag fog = new cGridBag(); + fog.add(fogLabel = new JLabel("Punch")); // , aConstraints); + fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); + fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints); + textureSection.add(fog); - aConstraints.gridx = 0; - aConstraints.gridy = 0; - aConstraints.gridwidth = 1; + cGridBag opacityPower = new cGridBag(); + opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints); + opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); + opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); + textureSection.add(opacityPower); + + ctrlPanel.add(texturePanel); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); SetMaterial(copy); // .GetMaterial()); - colorField.addChangeListener(this); - modulationField.addChangeListener(this); + //colorField.addChangeListener(this); +// modulationField.addChangeListener(this); metalnessField.addChangeListener(this); diffuseField.addChangeListener(this); specularField.addChangeListener(this); @@ -1859,19 +1793,21 @@ } // Images/textures - if (textures - && (filename.toLowerCase().endsWith(".jpg") - || filename.toLowerCase().endsWith(".jpeg") - || filename.toLowerCase().endsWith(".gif") - || filename.toLowerCase().endsWith(".png") - || filename.toLowerCase().endsWith(".tre") - || filename.toLowerCase().endsWith(".bmp") - || filename.toLowerCase().endsWith(".tga") - || filename.toLowerCase().endsWith(".sgi") - || filename.toLowerCase().endsWith(".tif") - || filename.toLowerCase().endsWith(".tiff"))) + if (filename.toLowerCase().endsWith(".jpg") + || filename.toLowerCase().endsWith(".jpeg") + || filename.toLowerCase().endsWith(".gif") + || filename.toLowerCase().endsWith(".png") + || filename.toLowerCase().endsWith(".tre") + || filename.toLowerCase().endsWith(".bmp") + || filename.toLowerCase().endsWith(".tga") + || filename.toLowerCase().endsWith(".sgi") + || filename.toLowerCase().endsWith(".tif") + || filename.toLowerCase().endsWith(".tiff")) { - DropTexture(filename); + if (textures) + DropTexture(filename); + else + CreateBillboard(filename); continue; } @@ -1880,6 +1816,60 @@ } ResetModel(); + } + + void CreateBillboard(String filename) + { + Object3D source = null; + Object3D group = copy; + + if (group.selection.size() > 0) + { + source = group.selection.get(0); + } + + Grid grid = new Grid(1,1); + grid.material = null; + + grid.toParent = LA.newMatrix(); + grid.fromParent = LA.newMatrix(); + LA.matYRotate(grid.toParent, Math.PI/2); + LA.matXRotate(grid.toParent, -Math.PI/2); + LA.matXRotate(grid.fromParent, Math.PI/2); + LA.matYRotate(grid.fromParent, -Math.PI/2); + + BillboardNode bb = new BillboardNode(); + bb.addChild(grid); + + Object3D newgroup = new Object3D(); + newgroup.CreateMaterial(); + + File file = new File(filename); + newgroup.name = file.getName(); + newgroup.addChild(bb); + + Object3D main = newgroup; + + main.SetPigmentTexture(filename); + + if (source != null) + { + main.material = new cMaterial(source.material); + if (main.projectedVertices.length < source.projectedVertices.length) + { + main.projectedVertices = new Object3D.cVector2[source.projectedVertices.length]; + } + + for (int i=0; i<source.projectedVertices.length; i++) + { + main.projectedVertices[i].x = source.projectedVertices[i].x; + main.projectedVertices[i].y = source.projectedVertices[i].y; + } + + main.texres = source.texres; + } + + makeSomething(newgroup, false); } Point location; @@ -2138,6 +2128,8 @@ { Mocap sel = (Mocap) copy.selection.get(0); + sel.SetCurrentBones(sel.frame); + sel.fullname = fullname; if (changename) @@ -2151,14 +2143,18 @@ sel.smoothed = false; // if (!changename) - sel.SetPositionDelta(false, true, true, true/*?*/); // false + //sel.SetPositionDelta(false, true, true, true/*?*/); // false + sel.SetGlobalTransform(); + sel.LoadData(); + sel.Rewind(); + sel.Fade(); // sel.setPose(0); refreshContents(); } else { mocap.Reset(); // new skeleton - makeSomething(mocap, false); // true); + makeSomething(mocap, true); // true); } } catch (Exception e) { @@ -2185,6 +2181,8 @@ { Mocap sel = (Mocap) select; + sel.SetCurrentBones(sel.frame); + File file = new File(fullname); // Mocap mocap = new Mocap("Mocap" + file.getName()); @@ -2251,7 +2249,11 @@ if (!changename) { - sel.SetPositionDelta(false, true, true, true/*?*/); + //sel.SetPositionDelta(false, true, true, true/*?*/); + sel.SetGlobalTransform(); + sel.LoadData(); + sel.Rewind(); + sel.Fade(); } // sel.setPose(0); @@ -2345,7 +2347,7 @@ void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) { - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { /**/ FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); @@ -2890,20 +2892,37 @@ // june 2013 copy.HardTouch(); cameraView.repaint(); return; - } else if (event.getSource() == toggleFullItem) + } else if (event.getSource() == toggleTimelineItem) { - if (CameraPane.FULLSCREEN) + timeline ^= true; + + if (timeline) { - frame.getContentPane().remove(/*"Center",*/bigThree); - framePanel.add(bigThree); - frame.getContentPane().add(/*"Center",*/framePanel); - } else - { - frame.getContentPane().remove(/*"Center",*/framePanel); - frame.getContentPane().add(/*"Center",*/bigThree); + centralPanel.remove(cameraView); + cameraPanel.add(cameraView); + centralPanel.add(cameraPanel); + frame.setJMenuBar(timelineMenubar); + wasFullScreen = CameraPane.FULLSCREEN; + if (!CameraPane.FULLSCREEN) + ToggleFullScreen(); + toggleFullScreenItem.setEnabled(false); } + else + { + centralPanel.remove(cameraPanel); + centralPanel.add(cameraView); + frame.setJMenuBar(null); + if (!wasFullScreen) + ToggleFullScreen(); + toggleFullScreenItem.setEnabled(true); + } + frame.validate(); - cameraView.ToggleFullScreen(); + return; + } else if (event.getSource() == toggleFullScreenItem) + { + ToggleFullScreen(); + frame.validate(); return; } else if (event.getSource() == toggleRandomItem) @@ -3013,7 +3032,8 @@ objEditor.refreshContents(); } else if (event.getSource() == stepItem) { - cameraView.ONESTEP = true; + //cameraView.ONESTEP = true; + Globals.ONESTEP = true; cameraView.repaint(); return; } else if (event.getSource() == stepButton) @@ -3152,9 +3172,9 @@ cameraView.RevertCamera(); cameraView.repaint(); return; - } else if (event.getSource() == textureButton) - { - return; // true; +// } else if (event.getSource() == textureButton) +// { +// return; // true; } else // combos... if (event.getSource() == texresMenu) { @@ -3170,25 +3190,25 @@ void ToggleAnimation() { - if (!CameraPane.ANIMATION) + if (!Globals.ANIMATION) { FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); browser.show(); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { - CameraPane.filename = browser.getDirectory() + filename; + Globals.filename = browser.getDirectory() + filename; //CameraPane.framecount = 0; - CameraPane.imagecount = 0; + Globals.imagecount = 0; - CameraPane.ANIMATION ^= true; + Globals.ANIMATION ^= true; - GraphreeD.wav.cursor = 0; - GraphreeD.wav.loop = 0; + GrafreeD.wav.cursor = 0; + GrafreeD.wav.loop = 0; } } else { - CameraPane.ANIMATION ^= true; + Globals.ANIMATION ^= true; } } @@ -3367,7 +3387,7 @@ current.fakedepth = (float) fakedepthField.getFloat(); current.shadowbias = (float) shadowbiasField.getFloat(); - if (!NumberSlider.frozen) + if (!cNumberSlider.frozen) { //System.out.println("Propagate = " + propagate); copy.UpdateMaterial(anchor, current, propagate); @@ -3441,7 +3461,13 @@ //System.out.println("PARENT = " + parent); //if (parent != null) // parent.applySelf(); - refreshContents(); + if (e.getSource() == normalpushField) + { + objEditor.refreshContents(); + //Refresh(); + } + else + refreshContents(); // ??? client.refreshEditWindow(); } //else @@ -3453,7 +3479,7 @@ //group.name = nameField.getText(); //objEditor.applySelf(); - assert (objEditor == this); + // OCT2018: assert (objEditor == this); if (copy.selection == null || copy.selection.size() == 0) //super.applySelf() ; else @@ -3477,12 +3503,18 @@ objEditor.copy = keep; } } + + if (normalpushField != null) + copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; } void SnapObject() { - Object3D obj = (Object3D)copy.selection.elementAt(0); - SnapObject(obj); + if (copy.selection.size() > 0) + { + Object3D obj = (Object3D)copy.selection.elementAt(0); + SnapObject(obj); + } } void SnapObject(Object3D obj) @@ -3596,7 +3628,7 @@ if (obj.parent != null) { - obj.parent.TransformToWorld(interest); +// obj.parent.TransformToWorld(interest); } if (!CameraPane.TRACK) @@ -3728,7 +3760,7 @@ radioPanel.revalidate(); radioPanel.repaint(); - ctrlPanel.revalidate(); // ? new + ctrlPanel.validate(); // ? new ctrlPanel.repaint(); } } @@ -4085,7 +4117,7 @@ void load() // throws ClassNotFoundException { - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); browser.show(); @@ -4190,7 +4222,7 @@ void saveAs() { - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); browser.setVisible(true); @@ -4213,10 +4245,20 @@ Object3D object = copy.selection.get(0); + FileObject fileobj = null; + + if (object instanceof FileObject) + fileobj = (FileObject)object; + if (object.fileparent != null) { - FileObject fileobj = (FileObject) object.fileparent; + assert(fileobj == null); + fileobj = (FileObject) object.fileparent; + } + + if (fileobj != null) + { System.out.println("WriteObject " + object + " : " + fileobj.name); WriteObject(object, fileobj.name); } @@ -4259,7 +4301,7 @@ } } else - //if (GraphreeD.standAlone) + //if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE); browser.setVisible(true); @@ -4291,7 +4333,7 @@ Object3D objectparent = obj.parent; obj.parent = null; - Object3D object = (Object3D) GraphreeD.clone(obj); + Object3D object = (Object3D) GrafreeD.clone(obj); obj.parent = objectparent; @@ -4325,7 +4367,7 @@ buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); copy.generatePOV(buffer); - if (GraphreeD.standAlone) + if (GrafreeD.standAlone) { FileDialog browser = new FileDialog(frame, "Export POV", 1); browser.show(); @@ -4366,7 +4408,8 @@ MenuItem revertCameraItem; CheckboxMenuItem toggleLiveItem; MenuItem stepItem; - CheckboxMenuItem toggleFullItem; + CheckboxMenuItem toggleFullScreenItem; + CheckboxMenuItem toggleTimelineItem; CheckboxMenuItem toggleRenderItem; CheckboxMenuItem toggleDebugItem; CheckboxMenuItem toggleFrustumItem; @@ -4384,20 +4427,23 @@ JPanel treePanel; JPanel radioPanel; ButtonGroup buttonGroup; - JPanel ctrlPanel; - JPanel materialPanel; + cGridBag ctrlPanel; + cGridBag materialPanel; JScrollPane infoPanel; - JPanel optionsPanel; + cGridBag optionsPanel; JTabbedPane objectPanel; - JPanel XYZPanel; + cGridBag XYZPanel; JSplitPane gridPanel; JSplitPane bigPanel; - JPanel bigThree; - JTabbedPane jtp; - JPanel cameraPanel; + cGridBag bigThree; + cGridBag scenePanel; + cGridBag centralPanel; + JSplitPane cameraPanel; + JPanel timelinePanel; + JMenuBar timelineMenubar; JSplitPane framePanel; JTextArea/*Field*/ nameField; - cButton textureButton; + //cButton textureButton; cButton okButton; cButton applyButton; cButton cancelButton; @@ -4444,65 +4490,67 @@ // MATERIAL JLabel materialLabel; JLabel colorLabel; - NumberSlider colorField; + cNumberSlider colorField; JLabel modulationLabel; - NumberSlider modulationField; + cNumberSlider modulationField; JLabel metalnessLabel; - NumberSlider metalnessField; + cNumberSlider metalnessField; JLabel diffuseLabel; - NumberSlider diffuseField; + cNumberSlider diffuseField; JLabel specularLabel; - NumberSlider specularField; + cNumberSlider specularField; JLabel shininessLabel; - NumberSlider shininessField; + cNumberSlider shininessField; JLabel shiftLabel; - NumberSlider shiftField; + cNumberSlider shiftField; JLabel ambientLabel; - NumberSlider ambientField; + cNumberSlider ambientField; JLabel lightareaLabel; - NumberSlider lightareaField; + cNumberSlider lightareaField; JLabel diffusenessLabel; - NumberSlider diffusenessField; + cNumberSlider diffusenessField; JLabel velvetLabel; - NumberSlider velvetField; + cNumberSlider velvetField; JLabel sheenLabel; - NumberSlider sheenField; + cNumberSlider sheenField; JLabel subsurfaceLabel; - NumberSlider subsurfaceField; + cNumberSlider subsurfaceField; //JLabel bumpLabel; //NumberSlider bumpField; JLabel backlitLabel; - NumberSlider backlitField; + cNumberSlider backlitField; JLabel anisoLabel; - NumberSlider anisoField; + cNumberSlider anisoField; JLabel anisoVLabel; - NumberSlider anisoVField; + cNumberSlider anisoVField; JLabel cameraLabel; - NumberSlider cameraField; + cNumberSlider cameraField; JLabel selfshadowLabel; - NumberSlider selfshadowField; + cNumberSlider selfshadowField; JLabel shadowLabel; - NumberSlider shadowField; + cNumberSlider shadowField; JLabel textureLabel; - NumberSlider textureField; + cNumberSlider textureField; JLabel opacityLabel; - NumberSlider opacityField; + cNumberSlider opacityField; JLabel fakedepthLabel; - NumberSlider fakedepthField; + cNumberSlider fakedepthField; JLabel shadowbiasLabel; - NumberSlider shadowbiasField; + cNumberSlider shadowbiasField; JLabel bumpLabel; - NumberSlider bumpField; + cNumberSlider bumpField; JLabel noiseLabel; - NumberSlider noiseField; + cNumberSlider noiseField; JLabel powerLabel; - NumberSlider powerField; + cNumberSlider powerField; JLabel borderfadeLabel; - NumberSlider borderfadeField; + cNumberSlider borderfadeField; JLabel fogLabel; - NumberSlider fogField; + cNumberSlider fogField; JLabel opacityPowerLabel; - NumberSlider opacityPowerField; + cNumberSlider opacityPowerField; JTree jTree; //ObjectUI parent; + + cNumberSlider normalpushField; } -- Gitblit v1.6.2