From c5b599b48b333b34e554b464aefbca0b9bc66275 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 09 Jun 2019 02:04:44 -0400
Subject: [PATCH] Menu cleanup + transform feedback.
---
ObjEditor.java | 1432 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 723 insertions(+), 709 deletions(-)
diff --git a/ObjEditor.java b/ObjEditor.java
index f7c8293..1edfe37 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,
@@ -31,6 +33,9 @@
boolean timeline;
boolean wasFullScreen;
+ GroupEditor callee;
+ JFrame frame;
+
// SCRIPT
transient JFrame textpanel = null;
@@ -121,47 +126,53 @@
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()
{
//new Exception().printStackTrace();
- System.out.println("this = " + this);
- System.out.println("objEditor = " + objEditor);
+// System.out.println("this = " + this);
+// System.out.println("objEditor = " + objEditor);
//nameField.removeActionListener(this);
- objEditor.ctrlPanel.remove(nameField);
+// objEditor.ctrlPanel.remove(nameField);
+
+ objEditor.ctrlPanel.remove(namePanel);
if (!GroupEditor.allparams)
return;
- objEditor.ctrlPanel.remove(liveCB);
- objEditor.ctrlPanel.remove(hideCB);
- objEditor.ctrlPanel.remove(markCB);
-
- objEditor.ctrlPanel.remove(randomCB);
- objEditor.ctrlPanel.remove(speedupCB);
- objEditor.ctrlPanel.remove(rewindCB);
-
- objEditor.ctrlPanel.remove(resetButton);
- objEditor.ctrlPanel.remove(stepButton);
-// objEditor.ctrlPanel.remove(stepAllButton);
-// objEditor.ctrlPanel.remove(resetAllButton);
- objEditor.ctrlPanel.remove(link2masterCB);
- //objEditor.ctrlPanel.remove(flipVCB);
- //objEditor.ctrlPanel.remove(texresMenu);
- objEditor.ctrlPanel.remove(slowerButton);
- objEditor.ctrlPanel.remove(fasterButton);
- objEditor.ctrlPanel.remove(remarkButton);
+// objEditor.ctrlPanel.remove(liveCB);
+// objEditor.ctrlPanel.remove(hideCB);
+// objEditor.ctrlPanel.remove(markCB);
+//
+// objEditor.ctrlPanel.remove(randomCB);
+// objEditor.ctrlPanel.remove(speedupCB);
+// objEditor.ctrlPanel.remove(rewindCB);
+//
+// objEditor.ctrlPanel.remove(resetButton);
+// objEditor.ctrlPanel.remove(stepButton);
+//// objEditor.ctrlPanel.remove(stepAllButton);
+//// objEditor.ctrlPanel.remove(resetAllButton);
+// objEditor.ctrlPanel.remove(link2masterCB);
+// //objEditor.ctrlPanel.remove(flipVCB);
+// //objEditor.ctrlPanel.remove(texresMenu);
+// objEditor.ctrlPanel.remove(slowerButton);
+// objEditor.ctrlPanel.remove(fasterButton);
+// objEditor.ctrlPanel.remove(remarkButton);
- Remove(normalpushField);
+ objEditor.ctrlPanel.remove(setupPanel);
+ objEditor.ctrlPanel.remove(commandsPanel);
+ objEditor.ctrlPanel.remove(pushPanel);
+ //objEditor.ctrlPanel.remove(fillPanel);
+
+ //Remove(normalpushField);
}
public ObjEditor GetEditor()
@@ -265,24 +276,40 @@
void SetupMenu()
{
frame.setMenuBar(menuBar = new MenuBar());
- menuBar.add(windowMenu = new Menu("File"));
- windowMenu.add(loadItem = new MenuItem("Load..."));
- windowMenu.add("-");
- windowMenu.add(saveItem = new MenuItem("Save"));
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
+ menuBar.add(fileMenu = new Menu("File"));
+ fileMenu.add(newItem = new MenuItem("New"));
+ fileMenu.add(loadItem = new MenuItem("Load..."));
+
+ //oe.menuBar.add(menu = new Menu("Include"));
+ Menu menu = new Menu("Import");
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
+ importOBJItem.addActionListener(this);
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
+ import3DSItem.addActionListener(this);
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
+ importVRMLX3DItem.addActionListener(this);
+ menu.add("-");
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
+ importGFDItem.addActionListener(this);
+ fileMenu.add(menu);
+ fileMenu.add("-");
+
+ fileMenu.add(saveItem = new MenuItem("Save"));
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
//windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
- windowMenu.add("-");
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
- windowMenu.add("-");
+ fileMenu.add("-");
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
+ fileMenu.add("-");
if (client.parent != null)
{
- windowMenu.add(closeItem = new MenuItem("Close"));
+ fileMenu.add(closeItem = new MenuItem("Close"));
} else
{
- windowMenu.add(closeItem = new MenuItem("Exit"));
+ fileMenu.add(closeItem = new MenuItem("Exit"));
}
+ newItem.addActionListener(this);
loadItem.addActionListener(this);
saveItem.addActionListener(this);
saveAsItem.addActionListener(this);
@@ -291,79 +318,26 @@
//povItem.addActionListener(this);
closeItem.addActionListener(this);
- menuBar.add(cameraMenu = new Menu("View"));
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
- //zBufferItem.addActionListener(this);
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
- //normalLensItem.addActionListener(this);
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
- revertCameraItem.addActionListener(this);
- 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());
- cameraMenu.add(stepItem = new MenuItem("Step"));
- stepItem.addActionListener(this);
-// cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
-// toggleDLItem.addItemListener(this);
-// toggleDLItem.setState(false);
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
- toggleRenderItem.addItemListener(this);
- toggleRenderItem.setState(!CameraPane.frozen);
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
- toggleDebugItem.addItemListener(this);
- toggleDebugItem.setState(CameraPane.DEBUG);
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
- toggleFrustumItem.addItemListener(this);
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
- toggleFootContactItem.addItemListener(this);
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
- cameraMenu.add(toggleRandomItem = new CheckboxMenuItem("Random"));
- toggleRandomItem.addItemListener(this);
- toggleRandomItem.setState(CameraPane.RANDOM);
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
- toggleHandleItem.addItemListener(this);
- toggleHandleItem.setState(CameraPane.HANDLES);
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
- togglePaintItem.addItemListener(this);
- togglePaintItem.setState(CameraPane.PAINTMODE);
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
-// toggleRootItem.addItemListener(this);
-// toggleRootItem.setState(false);
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
-// animationItem.addItemListener(this);
-// animationItem.setState(CameraPane.ANIMATION);
- cameraMenu.add("-");
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
- editCameraItem.addActionListener(this);
-
objectPanel = new JTabbedPane();
toolbarPanel = new JPanel();
toolbarPanel.setName("Toolbar");
- treePanel = new JPanel();
+ treePanel = new cGridBag();
treePanel.setName("Tree");
- ctrlPanel = new JPanel(); // new GridBagLayout());
+ ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
ctrlPanel.setName("Edit");
- materialPanel = new JPanel();
+ materialPanel = new cGridBag().setVertical(true);
materialPanel.setName("Material");
/*JTextPane*/
infoarea = createTextPane();
+ doc = infoarea.getStyledDocument();
+
infoarea.setEditable(true);
SetText();
// infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
// infoarea.setOpaque(false);
// //infoarea.setForeground(textcolor);
- infoarea.setLineWrap(true);
- infoarea.setWrapStyleWord(true);
+// TEXTAREA infoarea.setLineWrap(true);
+// TEXTAREA infoarea.setWrapStyleWord(true);
infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
infoPanel.setPreferredSize(new Dimension(50, 200));
infoPanel.setName("Info");
@@ -374,16 +348,16 @@
mainPanel.setName("Main");
mainPanel.setContinuousLayout(true);
mainPanel.setOneTouchExpandable(true);
- mainPanel.setDividerLocation(1.0);
mainPanel.setDividerSize(9);
- mainPanel.setResizeWeight(0);
+ mainPanel.setDividerLocation(0.5); //1.0);
+ mainPanel.setResizeWeight(0.5);
//ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
//mainPanel.setLayout(new GridBagLayout());
toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
- treePanel.setLayout(new GridBagLayout());
- ctrlPanel.setLayout(new GridBagLayout());
- materialPanel.setLayout(new GridBagLayout());
+// treePanel.setLayout(new GridBagLayout());
+ //ctrlPanel.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);
@@ -422,7 +396,7 @@
static String newline = "\n";
protected static final String buttonString = "JButton";
StyledDocument doc;
- JTextArea infoarea;
+ JTextPane infoarea;
void ClearInfo()
{
@@ -471,13 +445,13 @@
//SendInfo("Name:", "bold");
if (sel.GetTextures() != null || debug)
{
- si.SendInfo(sel.toString(), "bold");
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
//SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
if (sel.Size() > 0)
{
si.SendInfo("#children = " + sel.Size(), "regular");
}
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
if (debug)
{
try
@@ -489,7 +463,10 @@
}
if (full)
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
+ {
+ si.SendInfo(" BBox min: " + minima, "regular");
+ si.SendInfo(" BBox max: " + maxima, "regular");
+ }
if (sel.bRep != null)
{
@@ -516,7 +493,7 @@
}
if (sel.support != null)
{
- si.SendInfo(" support: " + sel.support, "regular");
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
}
if (sel.scriptnode != null)
{
@@ -587,6 +564,9 @@
{
CameraPane.pointflow = (PointFlow) sel;
}
+
+ si.SendInfo("_____________________", "regular");
+ si.SendInfo("", "regular");
}
}
@@ -618,52 +598,52 @@
cameraView.ToggleFullScreen();
}
- private JTextArea createTextPane()
+ private JTextPane createTextPane()
{
- String[] initString =
- {
- "This is an editable JTextPane, ", //regular
- "another ", //italic
- "styled ", //bold
- "text ", //small
- "component, ", //large
- "which supports embedded components..." + newline,//regular
- " " + newline, //button
- "...and embedded icons..." + newline, //regular
- " ", //icon
- newline + "JTextPane is a subclass of JEditorPane that "
- + "uses a StyledEditorKit and StyledDocument, and provides "
- + "cover methods for interacting with those objects."
- };
+// TEXTAREA String[] initString =
+// {
+// "This is an editable JTextPane, ", //regular
+// "another ", //italic
+// "styled ", //bold
+// "text ", //small
+// "component, ", //large
+// "which supports embedded components..." + newline,//regular
+// " " + newline, //button
+// "...and embedded icons..." + newline, //regular
+// " ", //icon
+// newline + "JTextPane is a subclass of JEditorPane that "
+// + "uses a StyledEditorKit and StyledDocument, and provides "
+// + "cover methods for interacting with those objects."
+// };
+//
+// String[] initStyles =
+// {
+// "regular", "italic", "bold", "small", "large",
+// "regular", "button", "regular", "icon",
+// "regular"
+// };
+//
+// JTextPane textPane = new JTextPane();
+// textPane.setEditable(true);
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
+// addStylesToDocument(doc);
+//
+// try
+// {
+// for (int j = 0; j < 2; j++)
+// {
+// for (int i = 0; i < initString.length; i++)
+// {
+// doc.insertString(doc.getLength(), initString[i],
+// doc.getStyle(initStyles[i]));
+// }
+// }
+// } catch (BadLocationException ble)
+// {
+// System.err.println("Couldn't insert initial text into text pane.");
+// }
- String[] initStyles =
- {
- "regular", "italic", "bold", "small", "large",
- "regular", "button", "regular", "icon",
- "regular"
- };
-
- JTextPane textPane = new JTextPane();
- textPane.setEditable(true);
- /*StyledDocument*/ doc = textPane.getStyledDocument();
- addStylesToDocument(doc);
-
- try
- {
- for (int j = 0; j < 2; j++)
- {
- for (int i = 0; i < initString.length; i++)
- {
- doc.insertString(doc.getLength(), initString[i],
- doc.getStyle(initStyles[i]));
- }
- }
- } catch (BadLocationException ble)
- {
- System.err.println("Couldn't insert initial text into text pane.");
- }
-
- return new JTextArea(); // textPane;
+ return new JTextPane(); // textPane;
}
protected void addStylesToDocument(StyledDocument doc)
@@ -716,7 +696,7 @@
protected static ImageIcon createImageIcon(String path,
String description)
{
- java.net.URL imgURL = GrafreeD.class.getResource(path);
+ java.net.URL imgURL = Grafreed.class.getResource(path);
if (imgURL != null)
{
return new ImageIcon(imgURL, description);
@@ -748,6 +728,7 @@
// NumberSlider vDivsField;
// JCheckBox endcaps;
JCheckBox liveCB;
+ JCheckBox selectCB;
JCheckBox hideCB;
JCheckBox link2masterCB;
JCheckBox markCB;
@@ -763,115 +744,83 @@
JButton slowerButton;
JButton fasterButton;
JButton remarkButton;
+
+ cGridBag namePanel;
+ cGridBag setupPanel;
+ cGridBag commandsPanel;
+ cGridBag pushPanel;
+ cGridBag fillPanel;
- JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on)
+ JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
{
JCheckBox cb;
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
- oe.aConstraints.gridwidth = 1; // 3;
-// oe.aConstraints.weightx = 1;
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
- oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
+ panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
cb.addItemListener(this);
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
- oe.aConstraints.gridwidth = 1;
- oe.aConstraints.gridx += 1;
return cb;
}
- cButton AddButton(ObjEditor oe, String label)
+ cButton AddButton(cGridBag panel, String label)
{
cButton cb;
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
- oe.aConstraints.gridwidth = 1;
-// oe.aConstraints.weightx = 1;
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
- oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
+ panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
cb.addActionListener(this);
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
- oe.aConstraints.gridwidth = 1;
- oe.aConstraints.gridx += 1;
return cb;
}
- JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item)
+ JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
{
JComboBox combo;
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
- oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
- oe.aConstraints.gridx += 1;
+ panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
combo.addActionListener(this);
return combo;
}
- NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow)
+ cGridBag AddSlider(cGridBag panel, 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 = 1;
- 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);
-
- return combo;
+
+ panel.add(control);
+
+ return control;
}
- NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current)
+ cGridBag AddSlider(cGridBag panel, 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;
-
+ control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
+ control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
combo.setInteger(current);
- combo.label = jlabel;
-
- combo.addChangeListener(this);
-
- return combo;
+ panel.add(control);
+
+ return control;
}
- 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;
return text;
}
@@ -901,9 +850,16 @@
objEditor.ctrlPanel.remove(j);
}
+ void Remove(cNumberSlider j)
+ {
+ j.removeChangeListener(this);
+ //objEditor.ctrlPanel.remove(j.label);
+ objEditor.ctrlPanel.remove(j);
+ }
+
/*
*/
- void Return() // ObjEditor oe)
+ void Return0() // ObjEditor oe)
{
aConstraints.gridy += 1;
aConstraints.gridx = 0;
@@ -958,37 +914,72 @@
void SetupUI2(ObjEditor oe)
{
-// oe.aConstraints.weightx = 0;
-// oe.aConstraints.weighty = 0;
-// oe.aConstraints.gridx = 0;
-// oe.aConstraints.gridy = 0;
- SetupName(oe);
+ //SetupName(oe);
+
+ namePanel = new cGridBag();
+
+ nameField = AddText(namePanel, copy.GetName());
+ namePanel.add(nameField);
+ oe.ctrlPanel.add(namePanel);
+
+ oe.ctrlPanel.Return();
if (!GroupEditor.allparams)
return;
- liveCB = AddCheckBox(oe, "Live", copy.live);
- link2masterCB = AddCheckBox(oe, "Supp", copy.link2master);
- hideCB = AddCheckBox(oe, "Hide", copy.hide);
+ setupPanel = new cGridBag().setVertical(false);
+
+ liveCB = AddCheckBox(setupPanel, "Live", copy.live);
+ liveCB.setToolTipText("Animate object");
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
+ selectCB.setToolTipText("Make object selectable");
// Return();
- markCB = AddCheckBox(oe, "Mark", copy.marked);
- rewindCB = AddCheckBox(oe, "Rew", copy.rewind);
- randomCB = AddCheckBox(oe, "Rand", copy.random);
- Return();
- resetButton = AddButton(oe, "Reset");
- stepButton = AddButton(oe, "Step");
+ hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
+ hideCB.setToolTipText("Hide object");
+ markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
+ markCB.setToolTipText("Set the animation target transform");
+
+ rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
+ rewindCB.setToolTipText("Rewind animation");
+
+ randomCB = AddCheckBox(setupPanel, "Random", copy.random);
+ randomCB.setToolTipText("Option for switch node");
+
+ if (Globals.ADVANCED)
+ {
+ link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
+ link2masterCB.setToolTipText("Attach to support");
+ speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
+ speedupCB.setToolTipText("Option motion capture");
+ }
+
+ oe.ctrlPanel.add(setupPanel);
+ oe.ctrlPanel.Return();
+
+ commandsPanel = new cGridBag().setVertical(false);
+
+ resetButton = AddButton(commandsPanel, "Reset");
+ resetButton.setToolTipText("Jump to frame zero");
+ stepButton = AddButton(commandsPanel, "Step");
+ stepButton.setToolTipText("Step one frame");
// resetAllButton = AddButton(oe, "Reset All");
// stepAllButton = AddButton(oe, "Step All");
- speedupCB = AddCheckBox(oe, "Speed", copy.speedup);
// Return();
- slowerButton = AddButton(oe, "Slow");
- fasterButton = AddButton(oe, "Fast");
- remarkButton = AddButton(oe, "Rem");
+ slowerButton = AddButton(commandsPanel, "Slow");
+ slowerButton.setToolTipText("Decrease animation speed");
+ fasterButton = AddButton(commandsPanel, "Fast");
+ fasterButton.setToolTipText("Increase animation speed");
+ remarkButton = AddButton(commandsPanel, "Remark");
+ remarkButton.setToolTipText("Set the current transform as the target");
- Return();
+ oe.ctrlPanel.add(commandsPanel);
+ oe.ctrlPanel.Return();
- normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1);
- Return();
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
+ normalpushField = (cNumberSlider)pushPanel.getComponent(1);
+ //Return();
+
+ oe.ctrlPanel.Return();
// oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
// ObjEditor.aConstraints.gridx += 1;
@@ -1083,7 +1074,7 @@
oe.aConstraints.gridwidth = 1;
/**/
nameField = AddText(oe.ctrlPanel, copy.GetName());
- Return();
+ oe.ctrlPanel.Return();
//ctrlPanel.add(textureButton = new Button("Texture..."));
//textureButton.setEnabled(false);
@@ -1185,10 +1176,18 @@
//JPanel worldPanel =
// new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
//worldPanel.setName("World");
- centralPanel = new JPanel(new BorderLayout());
+ 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);
@@ -1208,12 +1207,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());
@@ -1251,10 +1251,11 @@
//JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//tmp.setName("Edit");
objectPanel.add(materialPanel);
- JPanel north = new JPanel(new BorderLayout());
- north.setName("Edit");
- north.add(ctrlPanel, BorderLayout.NORTH);
- objectPanel.add(north);
+// JPanel north = new JPanel(new BorderLayout());
+// north.setName("Edit");
+// north.add(ctrlPanel, BorderLayout.NORTH);
+// objectPanel.add(north);
+ objectPanel.add(ctrlPanel);
objectPanel.add(infoPanel);
/*
@@ -1275,16 +1276,23 @@
scrollpane.setWheelScrollingEnabled(true);
scrollpane.addMouseWheelListener(this); // Default not fast enough
- /*JTabbedPane*/ scenePanel = new JTabbedPane();
- scenePanel.add(scrollpane);
+ /*JTabbedPane*/ scenePanel = new cGridBag();
+ scenePanel.preferredWidth = 6;
+
+ JTabbedPane tabbedPane = new JTabbedPane();
+ tabbedPane.add(scrollpane);
- scenePanel.add(FSPane = new cFileSystemPane(this));
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
- optionsPanel = new JPanel(new GridBagLayout());
+ optionsPanel = new cGridBag().setVertical(true);
optionsPanel.setName("Options");
- scenePanel.add(optionsPanel);
-
+
+ AddOptions(optionsPanel); //, aConstraints);
+
+ tabbedPane.add(optionsPanel);
+
+ scenePanel.add(tabbedPane);
/*
cTree jTree = new cTree(null);
@@ -1318,6 +1326,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));
@@ -1341,7 +1350,13 @@
// 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;
@@ -1362,13 +1377,14 @@
//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) GrafreeD.clone(gbc);
- frame.setSize(1024, 768);
- frame.show();
+ frame.setSize(1280, 860);
+ frame.setVisible(true);
gridPanel.setDividerLocation(1.0);
@@ -1383,6 +1399,10 @@
});
}
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
+ {
+ }
+
JTree GetTree()
{
return objEditor.jTree;
@@ -1394,260 +1414,173 @@
ctrlPanel.removeAll();
}
- void SetupMaterial(JPanel ctrlPanel)
+ void SetupMaterial(cGridBag panel)
{
- 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", !Grafreed.NIMBUSLAF)); // , aConstraints);
+ createMaterialButton.setToolTipText("Create material");
/*
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", !Grafreed.NIMBUSLAF)); // , aConstraints);
+ clearMaterialButton.setToolTipText("Clear material");
+
+ if (Globals.ADVANCED)
+ {
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , 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;
+ editBar.preferredHeight = 15;
+
+ panel.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.5), aConstraints);
- aConstraints.gridx = 0;
- aConstraints.gridy += 1;
- aConstraints.gridwidth = 1;
+ cGridBag colorSection = new cGridBag().setVertical(true);
+
+ 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);
+ //colorField.preferredWidth = 200;
+ 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.5), 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.5), 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.5), 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.5), 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;
+ panel.add(new JSeparator());
+
+ panel.add(colorSection);
+
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
+
+ cGridBag diffuseSection = new cGridBag().setVertical(true);
+
+ 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.5), 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;
+ panel.add(new JSeparator());
+
+ panel.add(diffuseSection);
+
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
+
+ cGridBag specularSection = new cGridBag().setVertical(true);
- //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.5), 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 = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1);
+ //Return();
// ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints);
// shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING);
// aConstraints.fill = GridBagConstraints.HORIZONTAL;
@@ -1658,130 +1591,93 @@
// 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;
+ panel.add(new JSeparator());
+
+ panel.add(specularSection);
+
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
+
+ cGridBag globalSection = new cGridBag().setVertical(true);
- 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.5), 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;
+ panel.add(new JSeparator());
+
+ panel.add(globalSection);
+
+ //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
+
+ cGridBag textureSection = new cGridBag().setVertical(true);
- 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);
+
+ panel.add(new JSeparator());
+
+ panel.add(textureSection);
+
+ //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);
@@ -1811,12 +1707,15 @@
opacityPowerField.addChangeListener(this);
/**/
- resetSlidersButton.addActionListener(this);
clearMaterialButton.addActionListener(this);
createMaterialButton.addActionListener(this);
-
- propagateToggle.addItemListener(this);
- multiplyToggle.addItemListener(this);
+
+ if (Globals.ADVANCED)
+ {
+ resetSlidersButton.addActionListener(this);
+ propagateToggle.addItemListener(this);
+ multiplyToggle.addItemListener(this);
+ }
}
void DropFile(java.io.File[] files, boolean textures)
@@ -1987,7 +1886,7 @@
//? flashIt = false;
CameraPane pane = (CameraPane) cameraView;
- pane.clickStart(location.x, location.y, 0);
+ pane.clickStart(location.x, location.y, 0, 0);
pane.clickEnd(location.x, location.y, 0, true);
if (group.selection.size() == 1)
@@ -2444,11 +2343,11 @@
void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
{
- if (GrafreeD.standAlone)
+ if (Grafreed.standAlone)
{
/**/
FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
- browser.show();
+ browser.setVisible(true);
String filename = browser.getFile();
if (filename != null && filename.length() > 0)
{
@@ -2593,6 +2492,7 @@
}
if (input == null)
{
+ new Exception().printStackTrace();
System.exit(0);
}
@@ -2807,7 +2707,8 @@
return;
}
- multiplyToggle.setSelected(mat.multiply);
+ if (multiplyToggle != null)
+ multiplyToggle.setSelected(mat.multiply);
assert (object.projectedVertices != null);
@@ -2996,7 +2897,8 @@
if (timeline)
{
centralPanel.remove(cameraView);
- centralPanel.add(timelinePanel);
+ cameraPanel.add(cameraView);
+ centralPanel.add(cameraPanel);
frame.setJMenuBar(timelineMenubar);
wasFullScreen = CameraPane.FULLSCREEN;
if (!CameraPane.FULLSCREEN)
@@ -3005,7 +2907,7 @@
}
else
{
- centralPanel.remove(timelinePanel);
+ centralPanel.remove(cameraPanel);
centralPanel.add(cameraView);
frame.setJMenuBar(null);
if (!wasFullScreen)
@@ -3021,7 +2923,7 @@
frame.validate();
return;
- } else if (event.getSource() == toggleRandomItem)
+ } else if (event.getSource() == toggleSwitchItem)
{
cameraView.ToggleRandom();
cameraView.repaint();
@@ -3052,6 +2954,10 @@
{
copy.live ^= true;
return;
+ } else if (event.getSource() == selectCB)
+ {
+ copy.dontselect ^= true;
+ return;
} else if (event.getSource() == hideCB)
{
copy.hide ^= true;
@@ -3066,6 +2972,7 @@
if (event.getSource() == randomCB)
{
copy.random ^= true;
+ objEditor.refreshContents();
return;
}
if (event.getSource() == speedupCB)
@@ -3089,8 +2996,9 @@
public void actionPerformed(ActionEvent event)
{
+ Object source = event.getSource();
// SCRIPT DIALOG
- if (event.getSource() == okbutton)
+ if (source == okbutton)
{
textpanel.setVisible(false);
textpanel.remove(textarea);
@@ -3102,7 +3010,7 @@
textarea = null;
textpanel = null;
}
- if (event.getSource() == cancelbutton)
+ if (source == cancelbutton)
{
textpanel.setVisible(false);
textpanel.remove(textarea);
@@ -3114,49 +3022,50 @@
//applySelf();
//client.refreshEditWindow();
//refreshContents();
- if (event.getSource() == nameField)
+ if (source == nameField)
{
//System.out.println("ObjEditor " + event);
applySelf0(true);
//parent.applySelf();
objEditor.refreshContents();
- } else if (event.getSource() == resetButton)
+ } else if (source == resetButton)
{
CameraPane.fullreset = true;
copy.Reset(); // ResetMeshes();
copy.Touch();
objEditor.refreshContents();
- } else if (event.getSource() == stepItem)
+ } else if (source == stepItem)
{
- cameraView.ONESTEP = true;
+ //cameraView.ONESTEP = true;
+ Globals.ONESTEP = true;
cameraView.repaint();
return;
- } else if (event.getSource() == stepButton)
+ } else if (source == stepButton)
{
copy.Step();
copy.Touch();
objEditor.refreshContents();
- } else if (event.getSource() == slowerButton)
+ } else if (source == slowerButton)
{
copy.Slower();
copy.Touch();
objEditor.refreshContents();
- } else if (event.getSource() == fasterButton)
+ } else if (source == fasterButton)
{
copy.Faster();
copy.Touch();
objEditor.refreshContents();
- } else if (event.getSource() == remarkButton)
+ } else if (source == remarkButton)
{
copy.Remark();
copy.Touch();
objEditor.refreshContents();
- } else if (event.getSource() == stepAllButton)
+ } else if (source == stepAllButton)
{
copy.StepAll();
copy.Touch();
objEditor.refreshContents();
- } else if (event.getSource() == resetAllButton)
+ } else if (source == resetAllButton)
{
//CameraPane.fullreset = true;
copy.ResetAll(); // ResetMeshes();
@@ -3189,53 +3098,75 @@
// Close();
// }
// else
- if (event.getSource() == resetSlidersButton)
+ if (source == resetSlidersButton)
{
ResetSliders();
- } else if (event.getSource() == clearMaterialButton)
+ } else if (source == clearMaterialButton)
{
ClearMaterial();
- } else if (event.getSource() == createMaterialButton)
+ } else if (source == createMaterialButton)
{
CreateMaterial();
- } else if (event.getSource() == clearPanelButton)
+ } else if (source == clearPanelButton)
{
copy.ClearUI();
refreshContents(true);
- } /*
- }
-
- public boolean action(Event event, Object arg)
- {
- */ else if (event.getSource() == closeItem)
+ } else if (source == importGFDItem)
+ {
+ ImportGFD();
+ } else
+ if (source == importVRMLX3DItem)
+ {
+ ImportVRMLX3D();
+ } else
+ if (source == import3DSItem)
+ {
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
+ } else
+ if (source == importOBJItem)
+ {
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
+ browser.setVisible(true);
+ String filename = browser.getFile();
+ if (filename != null && filename.length() > 0)
+ {
+ String fullname = browser.getDirectory() + filename;
+ makeSomething(ReadOBJ(fullname), true);
+ }
+ } else
+ if (source == closeItem)
{
Close();
//return true;
- } else if (event.getSource() == loadItem)
+ } else if (source == loadItem)
{
load();
//return true;
- } else if (event.getSource() == saveItem)
+ } else if (source == newItem)
+ {
+ New();
+ } else if (source == saveItem)
{
save();
//return true;
- } else if (event.getSource() == saveAsItem)
+ } else if (source == saveAsItem)
{
saveAs();
//return true;
- } else if (event.getSource() == reexportItem)
+ } else if (source == reexportItem)
{
reexport();
//return true;
- } else if (event.getSource() == exportAsItem)
+ } else if (source == exportAsItem)
{
export();
//return true;
- } else if (event.getSource() == povItem)
+ } else if (source == povItem)
{
generatePOV();
//return true;
- } else if (event.getSource() == zBufferItem)
+ } else if (source == zBufferItem)
{
try
{
@@ -3257,21 +3188,8 @@
cameraView.repaint();
//return true;
}
- */ else if (event.getSource() == editCameraItem)
- {
- cameraView.ProtectCamera();
- cameraView.repaint();
- return;
- } else if (event.getSource() == revertCameraItem)
- {
- cameraView.RevertCamera();
- cameraView.repaint();
- return;
-// } else if (event.getSource() == textureButton)
-// {
-// return; // true;
- } else // combos...
- if (event.getSource() == texresMenu)
+ */ else // combos...
+ if (source == texresMenu)
{
System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
copy.texres = texresMenu.getSelectedIndex();
@@ -3283,27 +3201,69 @@
}
}
- void ToggleAnimation()
+ void New()
{
- if (!CameraPane.ANIMATION)
+ while (copy.Size() > 1)
{
- FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
+ copy.remove(1);
+ }
+ ResetModel();
+ objEditor.refreshContents();
+ }
+
+ void ImportGFD()
+ {
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
browser.show();
String filename = browser.getFile();
if (filename != null && filename.length() > 0)
{
- CameraPane.filename = browser.getDirectory() + filename;
+ String fullname = browser.getDirectory() + filename;
+
+ //Object3D readobj =
+ objEditor.ReadGFD(fullname, objEditor);
+ //makeSomething(readobj);
+ }
+ }
+
+ void ImportVRMLX3D()
+ {
+ if (Grafreed.standAlone)
+ {
+ /**/
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
+ browser.show();
+ String filename = browser.getFile();
+ if (filename != null && filename.length() > 0)
+ {
+ String fullname = browser.getDirectory() + filename;
+ LoadVRMLX3D(fullname);
+ }
+ /**/
+ }
+ }
+
+ void ToggleAnimation()
+ {
+ if (!Globals.ANIMATION)
+ {
+ FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE);
+ browser.setVisible(true);
+ String filename = browser.getFile();
+ if (filename != null && filename.length() > 0)
+ {
+ Globals.filename = browser.getDirectory() + filename;
//CameraPane.framecount = 0;
- CameraPane.imagecount = 0;
+ Globals.imagecount = 0;
- CameraPane.ANIMATION ^= true;
+ Globals.ANIMATION ^= true;
- GrafreeD.wav.cursor = 0;
- GrafreeD.wav.loop = 0;
+ Grafreed.wav.cursor = 0;
+ Grafreed.wav.loop = 0;
}
} else
{
- CameraPane.ANIMATION ^= true;
+ Globals.ANIMATION ^= true;
}
}
@@ -3349,7 +3309,7 @@
void CreateMaterial()
{
//copy.ClearMaterial(); // PATCH
- copy.CreateMaterialS(multiplyToggle.isSelected());
+ copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
if (copy.selection.size() > 0)
//SetMaterial(copy);
{
@@ -3408,11 +3368,11 @@
{
copy.ResetBlockLoop(); // temporary problem
- boolean random = CameraPane.RANDOM;
- CameraPane.RANDOM = false; // parse everything
+ boolean random = CameraPane.SWITCH;
+ CameraPane.SWITCH = false; // parse everything
copy.ResetDisplayList();
copy.HardTouch();
- CameraPane.RANDOM = random;
+ CameraPane.SWITCH = random;
}
// public void applySelf()
@@ -3482,10 +3442,40 @@
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);
+
+ if (copy.material != null)
+ {
+ cMaterial mat = copy.material;
+
+ colorField.SetToolTipValue((mat.color));
+ modulationField.SetToolTipValue((mat.modulation));
+ metalnessField.SetToolTipValue((mat.metalness));
+ diffuseField.SetToolTipValue((mat.diffuse));
+ specularField.SetToolTipValue((mat.specular));
+ shininessField.SetToolTipValue((mat.shininess));
+ shiftField.SetToolTipValue((mat.shift));
+ ambientField.SetToolTipValue((mat.ambient));
+ lightareaField.SetToolTipValue((mat.lightarea));
+ diffusenessField.SetToolTipValue((mat.factor));
+ velvetField.SetToolTipValue((mat.velvet));
+ sheenField.SetToolTipValue((mat.sheen));
+ subsurfaceField.SetToolTipValue((mat.subsurface));
+ backlitField.SetToolTipValue((mat.bump));
+ anisoField.SetToolTipValue((mat.aniso));
+ anisoVField.SetToolTipValue((mat.anisoV));
+ cameraField.SetToolTipValue((mat.cameralight));
+ selfshadowField.SetToolTipValue((mat.diffuseness));
+ shadowField.SetToolTipValue((mat.shadow));
+ textureField.SetToolTipValue((mat.texture));
+ opacityField.SetToolTipValue((mat.opacity));
+ fakedepthField.SetToolTipValue((mat.fakedepth));
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
+ }
+
if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
{
copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
@@ -3530,6 +3520,7 @@
|| e.getSource() == apertureField
|| e.getSource() == shadowblurField)
{
+ new Exception().printStackTrace();
System.exit(0);
cameraView.options1[0] = (float) focusField.getFloat() * 10;
cameraView.options1[1] = (float) apertureField.getFloat() / 1000;
@@ -3600,7 +3591,7 @@
}
if (normalpushField != null)
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
}
void SnapObject()
@@ -3855,7 +3846,7 @@
radioPanel.revalidate();
radioPanel.repaint();
- ctrlPanel.revalidate(); // ? new
+ ctrlPanel.validate(); // ? new
ctrlPanel.repaint();
}
}
@@ -4067,6 +4058,7 @@
}
}
}
+
LoadGFDThread loadGFDThread;
void ReadGFD(String fullname, iCallBack cb)
@@ -4087,7 +4079,8 @@
try
{
java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
readobj = (Object3D) p.readObject();
istream.close();
@@ -4095,7 +4088,20 @@
readobj.ResetDisplayList();
} catch (Exception e)
{
- e.printStackTrace();
+ //e.printStackTrace();
+ try
+ {
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
+
+ readobj = (Object3D) p.readObject();
+ istream.close();
+
+ readobj.ResetDisplayList();
+ } catch (Exception e2)
+ {
+ e2.printStackTrace();
+ }
}
// catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
// catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
@@ -4212,7 +4218,7 @@
void load() // throws ClassNotFoundException
{
- if (GrafreeD.standAlone)
+ if (Grafreed.standAlone)
{
FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
browser.show();
@@ -4299,11 +4305,13 @@
try
{
FileOutputStream ostream = new FileOutputStream(lastname);
- ObjectOutputStream p = new ObjectOutputStream(ostream);
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
p.writeObject(copy);
p.flush();
+ zstream.close();
ostream.close();
//FileOutputStream fos = new FileOutputStream(fullname);
@@ -4313,11 +4321,12 @@
{
}
}
+
String lastname;
void saveAs()
{
- if (GrafreeD.standAlone)
+ if (Grafreed.standAlone)
{
FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
browser.setVisible(true);
@@ -4422,13 +4431,13 @@
try
{
FileOutputStream ostream = new FileOutputStream(filename);
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
Object3D objectparent = obj.parent;
obj.parent = null;
- Object3D object = (Object3D) GrafreeD.clone(obj);
+ Object3D object = (Object3D) Grafreed.clone(obj);
obj.parent = objectparent;
@@ -4440,8 +4449,8 @@
p.writeObject(object);
p.flush();
+ zstream.close();
ostream.close();
- // zstream.close();
// group.selection.get(0).parent = parent;
//FileOutputStream fos = new FileOutputStream(fullname);
@@ -4462,7 +4471,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 (GrafreeD.standAlone)
+ if (Grafreed.standAlone)
{
FileDialog browser = new FileDialog(frame, "Export POV", 1);
browser.show();
@@ -4488,7 +4497,8 @@
Object3D client;
Object3D copy;
MenuBar menuBar;
- Menu windowMenu;
+ Menu fileMenu;
+ MenuItem newItem;
MenuItem loadItem;
MenuItem saveItem;
MenuItem saveAsItem;
@@ -4496,13 +4506,11 @@
MenuItem reexportItem;
MenuItem povItem;
MenuItem closeItem;
- Menu cameraMenu;
+
CheckboxMenuItem zBufferItem;
//MenuItem normalLensItem;
- MenuItem editCameraItem;
- MenuItem revertCameraItem;
- CheckboxMenuItem toggleLiveItem;
MenuItem stepItem;
+ CheckboxMenuItem toggleLiveItem;
CheckboxMenuItem toggleFullScreenItem;
CheckboxMenuItem toggleTimelineItem;
CheckboxMenuItem toggleRenderItem;
@@ -4511,7 +4519,7 @@
CheckboxMenuItem toggleFootContactItem;
CheckboxMenuItem toggleDLItem;
CheckboxMenuItem toggleTextureItem;
- CheckboxMenuItem toggleRandomItem;
+ CheckboxMenuItem toggleSwitchItem;
CheckboxMenuItem toggleRootItem;
CheckboxMenuItem animationItem;
CheckboxMenuItem toggleHandleItem;
@@ -4519,20 +4527,21 @@
JSplitPane mainPanel;
JScrollPane scrollpane;
JPanel toolbarPanel;
- JPanel treePanel;
+ cGridBag 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 scenePanel;
- JPanel centralPanel;
+ cGridBag bigThree;
+ cGridBag scenePanel;
+ cGridBag centralPanel;
+ JSplitPane cameraPanel;
JPanel timelinePanel;
JMenuBar timelineMenubar;
JSplitPane framePanel;
@@ -4584,67 +4593,72 @@
// 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;
- NumberSlider normalpushField;
+ cNumberSlider normalpushField;
+
+ private MenuItem importGFDItem;
+ private MenuItem importVRMLX3DItem;
+ private MenuItem import3DSItem;
+ private MenuItem importOBJItem;
}
--
Gitblit v1.6.2