|
import aurelienribon.tweenengine.*;
|
import aurelienribon.tweenengine.equations.*;
|
|
import java.awt.*;
|
import java.awt.event.*;
|
import java.awt.image.BufferedImage;
|
import javax.swing.*;
|
import javax.swing.event.*;
|
import javax.swing.text.*;
|
import java.io.*;
|
|
import javax.swing.UIManager;
|
import javax.swing.plaf.metal.MetalLookAndFeel;
|
//import javax.swing.plaf.ColorUIResource;
|
//import javax.swing.plaf.metal.DefaultMetalTheme;
|
|
import javax.swing.plaf.basic.BasicSplitPaneDivider;
|
import javax.swing.plaf.basic.BasicSplitPaneUI;
|
|
//import javax.media.opengl.GLCanvas;
|
|
import //weka.core.
|
matrix.Matrix;
|
|
import grafeme.ui.*;
|
import org.xj3d.ui.swt.widgets.ImageLoader;
|
|
class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI,
|
ActionListener, ChangeListener,
|
InputMethodListener,
|
CaretListener,
|
MouseWheelListener,
|
ItemListener,
|
iSendInfo
|
//KeyListener
|
{
|
public cToggleButton pinButton;
|
boolean timeline;
|
boolean wasFullScreen;
|
|
GroupEditor callee;
|
JFrame frame;
|
|
static ObjEditor theFrame;
|
|
public void AllocProjectedVertices(Object3D object)
|
{
|
assert (object.projectedVertices != null);
|
|
if (object.projectedVertices.length <= 2)
|
{
|
// Side effect...
|
Object3D.cVector2[] keep = object.projectedVertices;
|
object.projectedVertices = new Object3D.cVector2[3];
|
for (int i = 0; i < 3; i++)
|
{
|
if (i < keep.length)
|
{
|
object.projectedVertices[i] = keep[i];
|
} else
|
{
|
object.projectedVertices[i] = new Object3D.cVector2();
|
}
|
/*
|
if(keep.length == 0)
|
object.projectedVertices[0] = new Object3D.cVector2();
|
else
|
object.projectedVertices[0] = keep[0];
|
object.projectedVertices[1] = new Object3D.cVector2();
|
*/
|
}
|
}
|
}
|
|
public Composite CreateCameras()
|
{
|
Composite cams = new cTemplate();
|
cams.name = "Cameras";
|
copy.insertElementAt(cams, 0);
|
|
cams.addChild(new Camera());
|
cams.addChild(new Camera(1));
|
cams.addChild(new Camera(2));
|
cams.addChild(new Camera(3));
|
cams.addChild(new Camera(4));
|
|
return cams;
|
}
|
|
public cGridBag GetSeparator()
|
{
|
cGridBag separator = new cGridBag();
|
separator.add(new JSeparator());
|
separator.preferredHeight = 5;
|
return separator;
|
}
|
|
cButton GetButton(String name, boolean border)
|
{
|
//ImageIcon icon = GetIcon(name);
|
boolean fit = !name.startsWith("icons");
|
if (//icon != null ||
|
name.contains("/"))
|
return new cButton(name, border, fit);
|
else
|
return new cButton(name, border);
|
}
|
|
cLabel GetLabel(String name, boolean border)
|
{
|
//ImageIcon icon = GetIcon(name);
|
return new cLabel(GetImage(name), border);
|
}
|
|
cToggleButton GetToggleButton(String name, boolean border)
|
{
|
ImageIcon icon = GetIcon(name);
|
return new cToggleButton(icon, border);
|
}
|
|
cCheckBox GetCheckBox(String name, boolean border)
|
{
|
ImageIcon icon = GetIcon(name);
|
return new cCheckBox(icon, border);
|
}
|
|
static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
|
|
static ImageIcon GetIcon(String name)
|
{
|
javax.swing.ImageIcon iconCache = icons.get(name);
|
if (iconCache != null)
|
{
|
return iconCache;
|
}
|
|
try
|
{
|
BufferedImage image;
|
|
if (!Grafreed.isWindows && name.endsWith("jpg"))
|
{
|
try
|
{
|
// Much faster!
|
image = JpegLoader.load(name);
|
}
|
catch (Exception e)
|
{
|
image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
|
}
|
}
|
else
|
image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
|
|
// if (image.getWidth() > 48 && image.getHeight() > 48)
|
// {
|
// BufferedImage resized = new BufferedImage(48, 48, image.getType());
|
// Graphics2D g = resized.createGraphics();
|
// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
|
// g.dispose();
|
//
|
// image = resized;
|
// }
|
|
javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
|
|
icons.put(name, icon);
|
|
return icon;
|
}
|
catch (Exception e)
|
{
|
//icons.put(name, null);
|
return null;
|
}
|
}
|
|
BufferedImage GetImage(String name)
|
{
|
try
|
{
|
BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
|
|
return image;
|
}
|
catch (Exception e)
|
{
|
return null;
|
}
|
}
|
|
// SCRIPT
|
|
transient JFrame textpanel = null;
|
transient JButton cancelbutton = null;
|
transient JButton okbutton = null;
|
|
static GridBagConstraints aScriptConstraints;
|
transient JTextArea textarea;
|
|
//String script;
|
|
JTextArea GetArea()
|
{
|
if (textarea == null)
|
{
|
textarea = new JTextArea();
|
textarea.setText(copy.scriptnode.scripttext);
|
textarea.setFont(textarea.getFont().deriveFont(10, 14f));
|
textarea.setForeground(Color.WHITE);
|
textarea.setOpaque(false);
|
textarea.setLineWrap(true);
|
textarea.setWrapStyleWord(true);
|
}
|
|
return textarea;
|
}
|
|
void OpenDialog()
|
{
|
if (copy.scriptnode == null)
|
{
|
copy.scriptnode = new ScriptNode(copy);
|
}
|
|
if (textpanel == null)
|
{
|
textpanel = new JFrame();
|
textpanel.setBackground(Color.gray);
|
textpanel.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
textpanel.setLayout(new GridBagLayout());
|
|
aScriptConstraints = new GridBagConstraints(0,0,1,1, 1.0,1.0,
|
GridBagConstraints.NORTHEAST,
|
GridBagConstraints.BOTH,
|
new Insets(1,1,1,1), 0,0);
|
aScriptConstraints.weighty = 1;
|
aScriptConstraints.gridwidth = 1;
|
textpanel.add(GetArea(), aScriptConstraints);
|
|
okbutton = new JButton("OK");
|
aScriptConstraints.gridy += 1;
|
aScriptConstraints.weighty = 0;
|
textpanel.add(okbutton, aScriptConstraints);
|
|
cancelbutton = new JButton("Cancel");
|
aScriptConstraints.gridx += 1;
|
aScriptConstraints.weighty = 0;
|
textpanel.add(cancelbutton, aScriptConstraints);
|
|
//textpanel.setVisible(true);
|
//textpanel.repaint();
|
textpanel.setSize(500,500); //okbutton.getHeight());
|
|
okbutton.addActionListener(this);
|
cancelbutton.addActionListener(this);
|
}
|
|
textpanel.setVisible(true);
|
}
|
|
|
/*
|
public void keyTyped(KeyEvent e)
|
{
|
System.out.println("keyTyped: " + e);
|
}
|
|
public void keyPressed(KeyEvent e)
|
{
|
System.out.println("keyPressed: " + e);
|
}
|
|
public void keyReleased(KeyEvent e)
|
{
|
System.out.println("keyReleased: " + e);
|
}
|
|
void keyPressed(int key, int modifiers)
|
{
|
System.out.println("KEY PRESSED");
|
Globals.theRenderer.keyPressed(key, modifiers);
|
}
|
*/
|
|
static GridBagConstraints aConstraints;
|
static GridBagConstraints aWindowConstraints;
|
|
static int GRIDWIDTH = 100; // 4;
|
|
public void closeUI()
|
{
|
//new Exception().printStackTrace();
|
// System.out.println("this = " + this);
|
// System.out.println("objEditor = " + objEditor);
|
//nameField.removeActionListener(this);
|
// objEditor.ctrlPanel.remove(nameField);
|
|
objEditor.ctrlPanel.remove(namePanel);
|
|
if (!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(setupPanel);
|
objEditor.ctrlPanel.remove(setupPanel2);
|
objEditor.ctrlPanel.remove(objectCommandsPanel);
|
objEditor.ctrlPanel.remove(pushPanel);
|
if (versionPanel != null)
|
objEditor.ctrlPanel.remove(versionPanel);
|
if (countPanel != null)
|
objEditor.ctrlPanel.remove(countPanel);
|
//objEditor.ctrlPanel.remove(fillPanel);
|
|
//Remove(normalpushField);
|
}
|
|
public ObjEditor GetEditor()
|
{
|
return objEditor; //.GetEditor();
|
}
|
|
// Sometimes myself, sometimes my callee's.
|
ObjEditor objEditor;
|
|
/*
|
ObjEditor(Object3D inClient)
|
{
|
// For node edition
|
objEditor = this;
|
|
client = inClient;
|
copy = client;
|
}
|
*/
|
public void caretUpdate(CaretEvent e)
|
{
|
//System.out.println("caretUpdate " + e);
|
actionPerformed(new ActionEvent(nameField, 0, ""));
|
}
|
|
public void caretPositionChanged(InputMethodEvent event)
|
{
|
System.out.println("caretPositionChanged " + event);
|
}
|
|
public void inputMethodTextChanged(InputMethodEvent event)
|
{
|
System.out.println("inputMethodTextChanged " + event);
|
}
|
|
ObjEditor(Object3D inClient, GroupEditor callee)
|
{
|
objEditor = callee.GetEditor();
|
|
client = inClient;
|
copy = client;
|
|
// if (copy.versionlist == null)
|
// {
|
// copy.versionlist = new Object3D[100];
|
// copy.versionindex = -1;
|
//
|
// callee.Save(true);
|
// }
|
|
// "this" is not called: SetupUI2(objEditor);
|
}
|
|
ObjEditor(Object3D inClient, ObjectUI p, GroupEditor callee)
|
{
|
assert false;
|
this.callee = callee;
|
|
//parent = p;
|
|
client = inClient;
|
copy = client;
|
|
SetupUI2(callee.GetEditor());
|
}
|
|
// TEMP
|
ObjEditor(Object3D inClient, Object3D localCopy, GroupEditor callee)
|
{
|
this(inClient, localCopy, null, callee);
|
}
|
|
ObjEditor(Object3D inClient, Object3D localCopy, ObjectUI p, GroupEditor callee)
|
{
|
//localCopy.parent = null;
|
|
frame = new JFrame();
|
frame.setUndecorated(false);
|
objEditor = this;
|
this.callee = callee;
|
|
//parent = p;
|
|
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
if (Globals.DEBUG)
|
System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
|
//gd.setFullScreenWindow(this);
|
//setResizable(false);
|
//if (!isDisplayable())
|
//setUndecorated(true);
|
|
//System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
|
client = inClient;
|
copy = localCopy;
|
copy.editWindow = this;
|
|
// if (copy.versionlist == null)
|
// {
|
// copy.versionlist = new Object3D[100];
|
// copy.versionindex = -1;
|
//
|
// Save(true);
|
// }
|
|
SetupMenu();
|
|
//SetupName(objEditor); // new
|
|
frame.setTitle(client.GetName());
|
//frame.show();
|
}
|
|
public boolean action(Event event, Object obj)
|
{
|
return frame.action(event, obj);
|
}
|
|
// Cannot work without static
|
static boolean allparams = true;
|
|
static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
|
|
// This is to refresh the UI of the material panel.
|
boolean patchMaterial;
|
|
void SetupMenu()
|
{
|
frame.setMenuBar(menuBar = new MenuBar());
|
menuBar.add(fileMenu = new Menu("File"));
|
fileMenu.add(newItem = new MenuItem("New"));
|
fileMenu.add(openItem = new MenuItem("Open..."));
|
|
//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);
|
//if (Globals.ADVANCED)
|
{
|
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..."));
|
fileMenu.add("-");
|
fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
|
fileMenu.add(reexportItem = new MenuItem("Re-export"));
|
fileMenu.add("-");
|
if (client.parent != null)
|
{
|
fileMenu.add(closeItem = new MenuItem("Close"));
|
} else
|
{
|
fileMenu.add(closeItem = new MenuItem("Exit"));
|
}
|
|
newItem.addActionListener(this);
|
openItem.addActionListener(this);
|
saveItem.addActionListener(this);
|
saveAsItem.addActionListener(this);
|
exportAsItem.addActionListener(this);
|
reexportItem.addActionListener(this);
|
//povItem.addActionListener(this);
|
closeItem.addActionListener(this);
|
|
objectTabbedPane = new JTabbedPane();
|
|
ChangeListener changeListener = new ChangeListener()
|
{
|
//String name;
|
|
public void stateChanged(ChangeEvent changeEvent)
|
{
|
// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
|
// {
|
// if (latestObject != null)
|
// {
|
// refreshContents(true);
|
// SetMaterial(latestObject);
|
// }
|
//
|
// materialFlushed = true;
|
// }
|
// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
|
// {
|
// if (listUI.size() == 0)
|
// EditSelection(false);
|
// }
|
|
// if (objectPanel.getSelectedIndex() == 4)
|
// {
|
// name = copy.skyboxname;
|
//
|
// if (name == null)
|
// {
|
// name = "";
|
// }
|
//
|
// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
|
// copy.skyboxext = "jpg";
|
// }
|
// else
|
// {
|
// if (name != null)
|
// {
|
// if (name.equals(""))
|
// {
|
// copy.skyboxname = null;
|
// copy.skyboxext = null;
|
// }
|
// else
|
// {
|
// copy.skyboxname = name;
|
// }
|
// }
|
// }
|
cameraView.transformMode = objectTabbedPane.getSelectedIndex() == transformTabIndex;
|
|
if (copy.selection.size() == 1)
|
{
|
copy.selection.get(0).tabIndex = objectTabbedPane.getSelectedIndex() + 1;
|
}
|
|
// refreshContents(false); // To refresh Info tab
|
cameraView.repaint();
|
}
|
};
|
objectTabbedPane.addChangeListener(changeListener);
|
|
toolbarPanel = new JPanel();
|
toolbarPanel.setName("Toolbar");
|
|
treePanel = new cGridBag();
|
treePanel.setName("Tree");
|
|
editPanel = new cGridBag().setVertical(true);
|
//editPanel.setName("Edit");
|
|
ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
|
|
editCommandsPanel = new cGridBag();
|
editPanel.add(editCommandsPanel);
|
editPanel.add(ctrlPanel);
|
|
toolboxPanel = new cGridBag().setVertical(true);
|
//toolboxPanel.setName("Toolbox");
|
|
skyboxPanel = new cGridBag().setVertical(true);
|
|
materialPanel = new cGridBag().setVertical(false);
|
//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);
|
// 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(1, 1));
|
//infoPanel.setName("Info");
|
//infoPanel.setLayout(new BorderLayout());
|
//infoPanel.add(createTextPane());
|
|
mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, objectTabbedPane);
|
mainPanel.setName("Main");
|
mainPanel.setContinuousLayout(true);
|
mainPanel.setOneTouchExpandable(true);
|
mainPanel.setDividerSize(9);
|
mainPanel.setDividerLocation(0.5); //1.0);
|
mainPanel.setResizeWeight(0.5);
|
|
//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
|
BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
|
divider.setDividerSize(15);
|
divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
|
|
mainPanel.setUI(new BasicSplitPaneUI());
|
|
//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());
|
|
aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
|
GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
|
aWindowConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
|
GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0);
|
aWindowConstraints.anchor = GridBagConstraints.NORTH;
|
|
// june 2013 aConstraints.weighty = 0;
|
// aConstraints.gridwidth = 1;
|
// if (client.parent != null)
|
// {
|
// ctrlPanel.add(okButton = new cButton("OK"), aConstraints);
|
// }
|
// aConstraints.gridx += 1;
|
// if (client.parent != null) // ???
|
// ctrlPanel.add(applyButton = new cButton("Apply"), aConstraints);
|
// aConstraints.gridx += 1;
|
// if (client.parent != null)
|
// ctrlPanel.add(cancelButton = new cButton("Close"), aConstraints);
|
// aConstraints.gridx = 0;
|
//
|
// aConstraints.gridy += 1;
|
// aConstraints.weighty = 0;
|
// aConstraints.gridwidth = 1;
|
//
|
// if (okButton != null)
|
// okButton.addActionListener(this);
|
// if (applyButton != null)
|
// applyButton.addActionListener(this);
|
// if (cancelButton != null)
|
// cancelButton.addActionListener(this);
|
|
//SetupUI();
|
}
|
|
static String newline = "\n";
|
protected static final String buttonString = "JButton";
|
StyledDocument doc;
|
JTextPane infoarea;
|
|
void ClearInfo()
|
{
|
try
|
{
|
doc.remove(0, doc.getLength());
|
} catch (BadLocationException ble)
|
{
|
System.err.println("Couldn't insert initial text into text pane.");
|
}
|
}
|
|
void SetText()
|
{
|
try
|
{
|
infoarea.setText(doc.getText(0, doc.getLength()));
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
// String selection = infoarea.getText();
|
// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
|
// java.awt.datatransfer.Clipboard clipboard =
|
// Toolkit.getDefaultToolkit().getSystemClipboard();
|
//clipboard.setContents(data, data);
|
}
|
|
void SetInfo(Object3D sel)
|
{
|
// not used
|
ClearInfo();
|
// AddInfo(sel);
|
// SetText();
|
}
|
|
static cVector minima = new cVector();
|
static cVector maxima = new cVector();
|
static boolean debug = true; // false;
|
|
static void AddInfo(Object3D sel, iSendInfo si, boolean full)
|
{
|
// sel = sel.GetObject();
|
|
//SendInfo("Name:", "bold");
|
if (sel.GetTextures() != null || debug)
|
{
|
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 + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
|
si.SendInfo((debug ? " Path: " : " ") + sel.GetPath(), "regular");
|
si.SendInfo((debug ? " Texture: " : " ") + sel.GetTextures(), "bold");
|
if (sel.GetTextures().pigmentdata != null)
|
si.SendInfo(" EMBEDDED ", "regular");
|
if (sel.toParent != null)
|
{
|
sel.GlobalTransformInv();
|
|
maxima.x = sel.toParent[3][0];
|
maxima.y = sel.toParent[3][1];
|
maxima.z = sel.toParent[3][2];
|
si.SendInfo(" 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[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");
|
}
|
}
|
si.SendInfo(" Transform count: " + sel.transformcount, "regular");
|
si.SendInfo(" Max count: " + sel.maxcount, "regular");
|
// SendInfo(" countdown: " + sel.countdown + newline, "regular");
|
// SendInfo(" delay: " + sel.delay + newline, "regular");
|
if (debug)
|
{
|
try
|
{
|
sel.getBounds(minima, maxima, true);
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
if (full)
|
{
|
si.SendInfo(" BBox min: " + minima, "regular");
|
si.SendInfo(" BBox max: " + maxima, "regular");
|
}
|
|
if (sel.bRep != null)
|
{
|
si.SendInfo(" Mesh: " + sel.bRep.hashCode(), "regular");
|
si.SendInfo(" Size: " + sel.bRep.FaceCount() + " triangles, " + sel.bRep.VertexCount()
|
+ " vertices; ", "regular");
|
si.SendInfo(" Storage: " + sel.bRep, "regular");
|
if (Globals.ADVANCED)
|
{
|
si.SendInfo(" Display list: " + sel.bRep.displaylist, "regular");
|
if (sel.bRep.vertextable != null)
|
{
|
si.SendInfo(" ... has vertextable. ", "regular");
|
}
|
}
|
if (sel.bRep.support != null)
|
{
|
si.SendInfo(" Mesh support: " + sel.bRep.hashCode() + " " + sel.bRep.support, "regular");
|
}
|
}
|
if (sel.transientrep != null)
|
{
|
si.SendInfo(" transient mesh: " + sel.transientrep.hashCode(), "regular");
|
si.SendInfo(" Size: " + sel.transientrep.FaceCount() + " triangles;" + sel.transientrep.VertexCount()
|
+ " vertices; ", "regular");
|
si.SendInfo(" Storage: " + sel.transientrep, "regular");
|
}
|
if (sel.support != null)
|
{
|
si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
|
}
|
if (sel.scriptnode != null)
|
{
|
si.SendInfo(" script: " + sel.scriptnode.scripttext, "regular");
|
}
|
// live, hide, ...
|
//?? SendInfo(" Orig: " + maxima + newline, "regular");
|
// SendInfo((debug ? " Material: " : " ") + sel.material + newline, "regular");
|
if (sel instanceof cMesh)
|
{
|
cMesh mesh = (cMesh) sel;
|
si.SendInfo(" Mesh ref: " + mesh.ref, "regular");
|
si.SendInfo(" Mesh pose: " + mesh.pose, "regular");
|
si.SendInfo(" Mesh avoider: " + mesh.W, "regular");
|
si.SendInfo(" Mesh phys: " + mesh.Phys, "regular");
|
// SendInfo(" Mesh avoider: " + mesh.W.ActingForces??? + newline, "regular");
|
}
|
if (sel instanceof Mocap)
|
{
|
Mocap mocap = (Mocap) sel;
|
si.SendInfo(" Mocap fullname: " + mocap.fullname, "regular");
|
si.SendInfo(" Mocap wavname: " + mocap.wavname, "regular");
|
si.SendInfo(" Mocap #frames: " + mocap.bvh.animation.getNumFrames(), "regular");
|
si.SendInfo(" Mocap frame: " + mocap.frame, "regular");
|
si.SendInfo(" Mocap baseframe: " + mocap.baseframe, "regular");
|
si.SendInfo(" Mocap beginframe: " + mocap.beginframe, "regular");
|
si.SendInfo(" Mocap endframe: " + mocap.endframe, "regular");
|
}
|
if (sel instanceof ScriptNode)
|
{
|
ScriptNode sn = (ScriptNode) sel;
|
si.SendInfo(" Script name: " + sn.filename, "regular");
|
}
|
if (sel instanceof SwitchNode)
|
{
|
SwitchNode sn = (SwitchNode) sel;
|
si.SendInfo(" Switch Object: " + sn.switchobject, "regular");
|
}
|
|
// System.err.println("info : " + sel.GetPath());
|
if (sel instanceof PointFlow)
|
{
|
CameraPane.pointflow = (PointFlow) sel;
|
}
|
|
si.SendInfo("_____________________", "regular");
|
si.SendInfo("", "regular");
|
}
|
}
|
|
public void SendInfo(String text, String style)
|
{
|
try
|
{
|
doc.insertString(doc.getLength(), text + newline,
|
doc.getStyle(style));
|
} catch (BadLocationException ble)
|
{
|
System.err.println("Couldn't insert initial text into text pane.");
|
}
|
}
|
|
//static GraphicsDevice device = GraphicsEnvironment
|
// .getLocalGraphicsEnvironment().getScreenDevices()[0];
|
|
Rectangle keeprect;
|
cRadio radio;
|
|
cButton keepButton;
|
cButton twoButton; // Full 3D
|
cButton sixButton;
|
cButton threeButton;
|
cButton sevenButton;
|
cButton fourButton; // full panel
|
cButton oneButton; // full XYZ
|
//cButton currentLayout;
|
|
boolean maximized;
|
|
cButton fullscreenLayout;
|
cButton expandedLayout;
|
|
void Minimize()
|
{
|
frame.setState(Frame.ICONIFIED);
|
frame.validate();
|
}
|
|
// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
|
// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
|
// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
|
void Maximize()
|
{
|
if (CameraPane.FULLSCREEN)
|
{
|
ToggleFullScreen();
|
}
|
|
if (maximized)
|
{
|
frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
|
}
|
else
|
{
|
keeprect = frame.getBounds();
|
// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
|
// Dimension rect2 = frame.getToolkit().getScreenSize();
|
// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
|
// frame.setState(Frame.MAXIMIZED_BOTH);
|
frame.setBounds(frame.getGraphicsConfiguration().getBounds());
|
}
|
|
maximized ^= true;
|
|
frame.validate();
|
}
|
|
cButton minButton;
|
cButton maxButton;
|
cButton fullScreenButton;
|
cButton collapseButton;
|
cButton maximize3DButton;
|
|
public void Show3DView()
|
{
|
// bug
|
//gridPanel.setDividerLocation(1.0);
|
//bigPanel.setDividerLocation(0.0);
|
bigThree.ClearUI();
|
bigThree.add(centralPanel);
|
bigThree.FlushUI();
|
}
|
|
void ToggleFullScreen()
|
{
|
GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
|
|
cameraView.ToggleFullScreen();
|
|
if (!CameraPane.FULLSCREEN)
|
{
|
device.setFullScreenWindow(null);
|
frame.dispose();
|
frame.setUndecorated(false);
|
frame.validate();
|
frame.setVisible(true);
|
|
//frame.setVisible(false);
|
// frame.removeNotify();
|
// frame.setUndecorated(false);
|
// frame.addNotify();
|
//frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
|
|
// X frame.getContentPane().remove(/*"Center",*/bigThree);
|
// X framePanel.add(bigThree);
|
// X frame.getContentPane().add(/*"Center",*/framePanel);
|
// framePanel.setDividerLocation(46); // icons are 24x24
|
|
//frame.setVisible(true);
|
radio.layout = keepButton;
|
//theFrame = null;
|
keepButton = null;
|
radio.layout.doClick();
|
|
} else
|
{
|
keepButton = radio.layout;
|
|
radio.layout = twoButton;
|
Show3DView();
|
|
//keeprect = frame.getBounds();
|
// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
|
// frame.getToolkit().getScreenSize().height);
|
//frame.setVisible(false);
|
|
frame.dispose();
|
frame.setUndecorated(true);
|
device.setFullScreenWindow(frame);
|
frame.validate();
|
frame.setVisible(true);
|
// frame.removeNotify();
|
// frame.setUndecorated(true);
|
// frame.addNotify();
|
// X frame.getContentPane().remove(/*"Center",*/framePanel);
|
// X framePanel.remove(bigThree);
|
// X frame.getContentPane().add(/*"Center",*/bigThree);
|
// framePanel.setDividerLocation(0);
|
|
// radio.layout = fullscreenLayout;
|
// radio.layout.doClick();
|
//frame.setVisible(true);
|
CollapseToolbar();
|
}
|
frame.validate();
|
|
cameraView.requestFocusInWindow();
|
}
|
|
void CollapseToolbar()
|
{
|
framePanel.setDividerLocation(0);
|
//frame.validate();
|
|
cameraView.requestFocusInWindow();
|
}
|
|
private Object3D Duplicate(Object3D object)
|
{
|
boolean temp = CameraPane.SWITCH;
|
CameraPane.SWITCH = false;
|
|
if (Grafreed.grafreed.universe.versiontable == null)
|
Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
|
|
object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
|
// if (copy == client)
|
|
assert(!object.HasBigData());
|
|
Object3D versions[] = object.versionlist;
|
java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
|
object.versionlist = null;
|
object.versiontable = null;
|
|
Object3D parent = object.parent;
|
object.parent = null;
|
|
//byte[] compress = Compress(copy);
|
Object3D compress = (Object3D)Grafreed.clone(object);
|
|
assert(!compress.HasBigData());
|
|
object.parent = parent;
|
|
object.versionlist = versions;
|
object.versiontable = versiontable; // if Grafreed.grafreed.universe
|
|
object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
|
|
CameraPane.SWITCH = temp;
|
|
return compress;
|
}
|
|
private JTextPane createTextPane()
|
{
|
// 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.");
|
// }
|
|
return new JTextPane(); // textPane;
|
}
|
|
protected void addStylesToDocument(StyledDocument doc)
|
{
|
//Initialize some styles.
|
Style def = StyleContext.getDefaultStyleContext().
|
getStyle(StyleContext.DEFAULT_STYLE);
|
|
Style regular = doc.addStyle("regular", def);
|
StyleConstants.setFontFamily(def, "SansSerif");
|
|
Style s = doc.addStyle("italic", regular);
|
StyleConstants.setItalic(s, true);
|
|
s = doc.addStyle("bold", regular);
|
StyleConstants.setBold(s, true);
|
|
s = doc.addStyle("small", regular);
|
StyleConstants.setFontSize(s, 10);
|
|
s = doc.addStyle("large", regular);
|
StyleConstants.setFontSize(s, 16);
|
|
s = doc.addStyle("icon", regular);
|
StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);
|
// ImageIcon pigIcon = createImageIcon("images/Pig.gif",
|
// "a cute pig");
|
// if (pigIcon != null) {
|
// StyleConstants.setIcon(s, pigIcon);
|
//}
|
|
s = doc.addStyle("button", regular);
|
StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);
|
// ImageIcon soundIcon = createImageIcon("images/sound.gif",
|
// "sound icon");
|
JButton button = new JButton();
|
// if (soundIcon != null) {
|
// button.setIcon(soundIcon);
|
// } else {
|
button.setText("BEEP");
|
// }
|
button.setCursor(Cursor.getDefaultCursor());
|
button.setMargin(new Insets(0, 0, 0, 0));
|
button.setActionCommand(buttonString);
|
button.addActionListener(this);
|
StyleConstants.setComponent(s, button);
|
}
|
|
/** Returns an ImageIcon, or null if the path was invalid. */
|
protected static ImageIcon createImageIcon(String path,
|
String description)
|
{
|
java.net.URL imgURL = Grafreed.class.getResource(path);
|
if (imgURL != null)
|
{
|
return new ImageIcon(imgURL, description);
|
} else
|
{
|
System.err.println("Couldn't find file: " + path);
|
return null;
|
}
|
}
|
|
void SetupWindow()
|
{
|
SetupUI(false);
|
SetupViews();
|
}
|
|
void SetupUI(boolean withMaterial)
|
{
|
if (withMaterial)
|
{
|
SetupMaterial(materialPanel);
|
}
|
|
//SetupName();
|
//SetupViews();
|
}
|
// JLabel uDivsLabel;
|
// JLabel vDivsLabel;
|
// NumberSlider uDivsField;
|
// NumberSlider vDivsField;
|
// JCheckBox endcaps;
|
JCheckBox liveCB;
|
JCheckBox selectableCB;
|
JCheckBox hideCB;
|
JCheckBox link2masterCB;
|
JCheckBox sortCB;
|
JCheckBox markCB;
|
JCheckBox randomCB;
|
JCheckBox speedupCB;
|
JCheckBox rewindCB;
|
JCheckBox flipVCB;
|
|
cCheckBox toggleTextureCB;
|
cCheckBox toggleSwitchCB;
|
|
JComboBox texresMenu;
|
|
JButton resetButton;
|
JButton stepButton;
|
JButton stepAllButton;
|
JButton resetAllButton;
|
JButton slowerButton;
|
JButton fasterButton;
|
JButton remarkButton;
|
|
cGridBag editPanel;
|
cGridBag editCommandsPanel;
|
|
cGridBag namePanel;
|
cGridBag setupPanel;
|
cGridBag setupPanel2;
|
cGridBag objectCommandsPanel;
|
cGridBag pushPanel;
|
cGridBag versionPanel;
|
cGridBag countPanel;
|
cGridBag fillPanel;
|
|
cNumberSlider countField;
|
|
JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
|
{
|
JCheckBox cb;
|
|
panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
|
cb.addItemListener(this);
|
|
return cb;
|
}
|
|
cButton AddButton(cGridBag panel, String label)
|
{
|
cButton cb;
|
|
panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1);
|
cb.addActionListener(this);
|
|
return cb;
|
}
|
|
JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item)
|
{
|
JComboBox combo;
|
|
panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
|
combo.addActionListener(this);
|
|
return combo;
|
}
|
|
cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow)
|
{
|
cGridBag control = new cGridBag();
|
|
cNumberSlider combo;
|
|
JLabel jlabel = new JLabel(label);
|
jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
|
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);
|
|
panel.add(control);
|
|
return control;
|
}
|
|
cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current)
|
{
|
cGridBag control = new cGridBag();
|
|
cNumberSlider combo;
|
|
JLabel jlabel = new JLabel(label);
|
jlabel.setHorizontalAlignment(SwingConstants.TRAILING);
|
control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
|
control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
|
combo.setInteger(current);
|
|
panel.add(control);
|
|
return control;
|
}
|
|
JTextArea AddText(cGridBag ctrlPanel, String name)
|
{
|
JTextArea text;
|
|
ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1);
|
text.addCaretListener(this);
|
|
return text;
|
}
|
|
void Remove(JCheckBox j)
|
{
|
j.removeItemListener(this);
|
objEditor.ctrlPanel.remove(j);
|
}
|
|
void Remove(JButton j)
|
{
|
j.removeActionListener(this);
|
objEditor.ctrlPanel.remove(j);
|
}
|
|
void Remove(JComboBox j)
|
{
|
j.removeActionListener(this);
|
objEditor.ctrlPanel.remove(j);
|
}
|
|
void Remove(NumberSlider j)
|
{
|
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);
|
}
|
|
/*
|
*/
|
void Return0() // ObjEditor oe)
|
{
|
aConstraints.gridy += 1;
|
aConstraints.gridx = 0;
|
}
|
|
class cListModel implements ComboBoxModel
|
{
|
|
java.util.Vector objList; // = new Vector();
|
Object obj;
|
int startWith;
|
|
cListModel(java.util.Vector ol, int first)
|
{
|
objList = ol;
|
startWith = first;
|
//first = owner.csg.csgType - 1;
|
}
|
|
public void addListDataListener(ListDataListener l)
|
{
|
}
|
|
public Object getElementAt(int index)
|
{
|
return objList.get(index);
|
}
|
|
public int getSize()
|
{
|
return objList.size();
|
}
|
|
public void removeListDataListener(ListDataListener l)
|
{
|
}
|
|
public Object getSelectedItem()
|
{
|
if (obj == null)
|
{
|
return objList.get(startWith);
|
}
|
return obj;
|
}
|
|
public void setSelectedItem(Object o)
|
{
|
obj = o;
|
}
|
}
|
|
String GetSupportText()
|
{
|
return "Support";
|
}
|
|
void SetupUI2(ObjEditor oe)
|
{
|
//SetupName(oe);
|
|
namePanel = new cGridBag();
|
|
//if (copy.pinned)
|
{
|
pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
|
pinButton.setSelected(copy.pinned);
|
cGridBag t = new cGridBag();
|
t.preferredWidth = 2;
|
t.add(pinButton);
|
namePanel.add(t);
|
|
pinButton.addItemListener(this);
|
}
|
|
nameField = AddText(namePanel, copy.GetName());
|
namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
|
oe.ctrlPanel.add(namePanel);
|
|
oe.ctrlPanel.Return();
|
|
if (!allparams)
|
return;
|
|
setupPanel = new cGridBag().setVertical(false);
|
|
liveCB = AddCheckBox(setupPanel, "Live", copy.live);
|
liveCB.setToolTipText("Animate object");
|
markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
|
markCB.setToolTipText("Set target transform");
|
selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
|
selectableCB.setToolTipText("Make object selectable");
|
// Return();
|
|
hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
|
hideCB.setToolTipText("Hide object");
|
|
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
|
|
setupPanel2 = new cGridBag().setVertical(false);
|
|
rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
|
rewindCB.setToolTipText("Rewind animation");
|
|
sortCB = AddCheckBox(setupPanel2, "Sort", copy.sort);
|
sortCB.setToolTipText("Display from back to front");
|
|
randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
|
randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
|
|
link2masterCB = AddCheckBox(setupPanel2, GetSupportText(), copy.Link2Support());
|
link2masterCB.setToolTipText("Link to support");
|
|
if (Globals.ADVANCED)
|
{
|
speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
|
speedupCB.setToolTipText("Option motion capture");
|
}
|
|
oe.ctrlPanel.add(setupPanel);
|
oe.ctrlPanel.Return();
|
oe.ctrlPanel.add(setupPanel2);
|
oe.ctrlPanel.Return();
|
|
objectCommandsPanel = new cGridBag().setVertical(false);
|
|
resetButton = AddButton(objectCommandsPanel, "Reset");
|
resetButton.setToolTipText("Jump to frame zero");
|
stepButton = AddButton(objectCommandsPanel, "Step");
|
stepButton.setToolTipText("Step one frame");
|
// resetAllButton = AddButton(oe, "Reset All");
|
// stepAllButton = AddButton(oe, "Step All");
|
// Return();
|
slowerButton = AddButton(objectCommandsPanel, "Slow");
|
slowerButton.setToolTipText("Decrease animation speed");
|
fasterButton = AddButton(objectCommandsPanel, "Fast");
|
fasterButton.setToolTipText("Increase animation speed");
|
remarkButton = AddButton(objectCommandsPanel, "Remark");
|
remarkButton.setToolTipText("Set the current transform as the target");
|
|
oe.ctrlPanel.add(objectCommandsPanel);
|
oe.ctrlPanel.Return();
|
|
pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH * 100, 1.1); // To have the buttons
|
normalpushField = (cNumberSlider)pushPanel.getComponent(1);
|
if (copy instanceof Composite && !(copy instanceof cGroup))
|
{
|
oe.ctrlPanel.Return();
|
countPanel = AddSlider(oe.ctrlPanel, "Count", 0, 50, copy.count);
|
countField = (cNumberSlider)countPanel.getComponent(1);
|
}
|
if (false && copy.versionlist != null && copy.versionindex != -1)
|
{
|
oe.ctrlPanel.Return();
|
versionPanel = AddSlider(oe.ctrlPanel, "Version", 0, copy.VersionCount() - 1, copy.versionindex);
|
versionField = (cNumberSlider)versionPanel.getComponent(1);
|
}
|
|
oe.ctrlPanel.Return();
|
|
// oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2);
|
// ObjEditor.aConstraints.gridx += 1;
|
|
// flipVCB = AddCheckBox(oe, "Flip V", copy.flipV);
|
// Return(oe);
|
//
|
// java.util.Vector list = new java.util.Vector();
|
// list.add("Low res texture");
|
// list.add("Normal");
|
// list.add("High res");
|
// texresMenu = AddCombo(oe, list, copy.texres);
|
// Return(oe);
|
|
// oe.aConstraints.gridwidth = 1;
|
// oe.aConstraints.fill = GridBagConstraints.VERTICAL;
|
// oe.ctrlPanel.add(uDivsLabel = new JLabel("U #"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; // 1;
|
// oe.aConstraints.gridx += 1;
|
// oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
// oe.ctrlPanel.add(uDivsField = new NumberSlider(0, 64), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// oe.aConstraints.gridy += 1;
|
// oe.aConstraints.gridwidth = 1;
|
// oe.aConstraints.fill = 0;
|
// oe.aConstraints.gridx -= 1;
|
// oe.aConstraints.fill = GridBagConstraints.VERTICAL;
|
// oe.ctrlPanel.add(vDivsLabel = new JLabel("V #"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; // 1;
|
// oe.aConstraints.gridx += 1;
|
// oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
// oe.ctrlPanel.add(vDivsField = new NumberSlider(0, 64), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// uDivsField.setInteger(2);
|
// vDivsField.setInteger(3);
|
// uDivsField.addChangeListener(this);
|
// vDivsField.addChangeListener(this);
|
// oe.aConstraints.fill = 0;
|
// oe.aConstraints.gridx -= 1;
|
// oe.aConstraints.gridwidth = 1;
|
// if (true)
|
// {
|
// oe.aConstraints.gridy += 1;
|
// oe.aConstraints.gridwidth = 3;
|
// oe.aConstraints.anchor = GridBagConstraints.WEST;
|
// oe.ctrlPanel.add(endcaps = new JCheckBox("Close Surface", true), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
// endcaps.addItemListener(this);
|
// oe.aConstraints.anchor = GridBagConstraints.EAST;
|
// oe.aConstraints.gridwidth = 1;
|
// //endcaps.setState(!biparam.endcaps);
|
// }
|
// oe.aConstraints.gridy += 1;
|
// oe.aConstraints.gridx = 0;
|
}
|
|
void SetupName(ObjEditor oe)
|
{
|
/**
|
//new Exception().printStackTrace();
|
// System.out.println("editor = " + this);
|
// System.out.println("objecteditor? = " + oe);
|
// System.out.println("callee = " + this.callee);
|
// System.out.println("client = " + this.client);
|
// System.out.println("copy = " + this.copy);
|
// System.out.println("---------------");
|
//System.out.println("OE = " + oe);
|
|
oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
|
oe.aConstraints.gridx = 0;
|
if(objEditor == this)
|
{
|
oe.aConstraints.weighty = 1;
|
oe.aConstraints.gridy = 100;
|
}
|
else
|
{
|
oe.aConstraints.weighty = 0;
|
oe.aConstraints.gridy += 1;
|
}
|
oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH+1;
|
oe.ctrlPanel.add(nameField = new JTextArea(copy.GetName()), oe.aConstraints, oe.ctrlPanel.getComponentCount()-1);
|
//nameField.addActionListener(this);
|
//nameField.addInputMethodListener(this);
|
nameField.addCaretListener(this);
|
if(objEditor == this)
|
{
|
oe.aConstraints.gridy = 0; // Remove for "Edit copy..."
|
}
|
else
|
{
|
oe.aConstraints.gridy += 1;
|
}
|
oe.aConstraints.weighty = 0;
|
oe.aConstraints.gridwidth = 1;
|
/**/
|
nameField = AddText(oe.ctrlPanel, copy.GetName());
|
oe.ctrlPanel.Return();
|
|
//ctrlPanel.add(textureButton = new Button("Texture..."));
|
//textureButton.setEnabled(false);
|
//applyButton.setEnabled(inClient.parent != null);
|
}
|
|
Camera GetCamera(Object3D obj, int viewcode)
|
{
|
if ((obj instanceof Camera) && ((Camera) obj).viewCode == viewcode)
|
{
|
return (Camera) obj;
|
}
|
|
if (!(obj instanceof Composite))
|
{
|
return null;
|
}
|
|
Composite comp = (Composite) obj;
|
|
for (int i = 0; i < comp.Size(); i++)
|
{
|
Object3D child = comp.reserve(i);
|
//Applet3D.tracein("child = ", child);
|
Camera cam = GetCamera(child, viewcode);
|
comp.release(i);
|
//Applet3D.traceout("child = ", child);
|
if (cam != null)
|
{
|
if (cam.hAspect != 0) // && cam.hAspect != -1)
|
{
|
System.out.println("HHH = " + cam.hAspect);
|
}
|
return cam;
|
}
|
}
|
|
return null;
|
}
|
|
int objectTabCount;
|
|
int transformTabIndex;
|
|
void SetupViews()
|
{
|
//topScroll = new CameraScroller();
|
//frontScroll = new CameraScroller();
|
//sideScroll = new CameraScroller();
|
|
//topScroll.setLabel("------------------------------ XY (top) ---------------------------------------------------");
|
//frontScroll.setLabel("------------------------------ XZ (front) ---------------------------------------------------");
|
//sideScroll.setLabel("------------------------------- YZ (side) ---------------------------------------------------");
|
|
// GridBagConstraints gbc = (GridBagConstraints) GrafreeD.clone(aConstraints);
|
Camera cam = GetCamera(copy, 0);
|
|
Composite cams = null;
|
|
if (cam == null || !(copy.get(0) instanceof cGroup))
|
{
|
if (Globals.DEBUG)
|
System.out.println("CREATE CAMERAS");
|
cams = CreateCameras();
|
} else
|
{
|
cams = (cGroup) copy.get(0);
|
}
|
|
cam = GetCamera(copy, 1);
|
topView = new CameraPane(copy, cam, false); // topScroll.cameraPane;
|
topView.linecolor = topView.linecolorZ;
|
cam = GetCamera(copy, 2);
|
frontView = new CameraPane(copy, cam, false); // frontScroll.cameraPane;
|
frontView.linecolor = topView.linecolorY;
|
cam = GetCamera(copy, 3);
|
sideView = new CameraPane(copy, cam, false); // sideScroll.cameraPane;
|
sideView.linecolor = topView.linecolorX;
|
|
cam = GetCamera(copy, 0);
|
cameraView = new CameraPane(copy, cam, false);
|
cam = GetCamera(copy, 4);
|
cameraView.SetLight(cam);
|
|
cameraView.SetAsGLRenderer(true);
|
//cameraView.camera.perspective = true;
|
|
//worldView = new gov.nasa.worldwind.awt.WorldWindowGLCanvas();
|
|
//JPanel worldPanel =
|
// new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
|
//worldPanel.setName("World");
|
centralPanel = new cGridBag();
|
centralPanel.preferredWidth = 20;
|
|
if (Globals.ADVANCED)
|
{
|
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);
|
centralPanel.setFocusable(true);
|
//frame.setJMenuBar(timelineMenubar);
|
//centralPanel.add(timelinePanel);
|
|
//topView.camera = ;
|
//frontView.camera = new Camera(2);
|
//sideView.camera = new Camera(3);
|
if (false)
|
{
|
topView.SetAsGLRenderer(true);
|
frontView.SetAsGLRenderer(true);
|
sideView.SetAsGLRenderer(true);
|
}
|
|
//cameraView.object = copy;
|
//topView.object = copy;
|
//frontView.object = copy;
|
//sideView.object = copy;
|
|
transformPanel = new cGridBag().setVertical(true);
|
|
cGridBag resetTransformPanel = new cGridBag();
|
|
resetTransformPanel.preferredHeight = 2;
|
|
cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
|
resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
|
resetTransform.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
ResetTransform();
|
}
|
});
|
resetTransformPanel.add(resetTransform);
|
|
resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
|
resetTransform.setToolTipText("Reset Translation only");
|
resetTransform.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
ResetTransform(1);
|
}
|
});
|
resetTransformPanel.add(resetTransform);
|
|
resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
|
resetTransform.setToolTipText("Reset Rotation and Scale only");
|
resetTransform.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
ResetTransform(2);
|
}
|
});
|
resetTransformPanel.add(resetTransform);
|
|
XYZPanel = new cGridBag().setVertical(true);
|
//XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
|
|
XYZPanel.preferredWidth = 5;
|
XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
|
XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
|
XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
|
//XYZPanel.setName("XYZ");
|
|
transformPanel.add(resetTransformPanel);
|
|
cGridBag scalePanel = AddSlider(transformPanel, "Inflate", 1, 10, 1);
|
scalePanel.preferredHeight = 2;
|
scaleSlider = (cNumberSlider)scalePanel.getComponent(1);
|
transformPanel.add(scalePanel);
|
|
scalePanel = AddSlider(transformPanel, "Deflate", 1, 10, 1);
|
scalePanel.preferredHeight = 2;
|
scaleInvSlider = (cNumberSlider)scalePanel.getComponent(1);
|
transformPanel.add(scalePanel);
|
|
transformPanel.add(XYZPanel);
|
|
/*
|
gridPanel = new JPanel(); //new BorderLayout());
|
gridPanel.setLayout(new GridLayout(1, 2));
|
|
gridPanel.add(cameraView);
|
gridPanel.add(XYZPanel);
|
*/
|
// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
|
// gridPanel.setContinuousLayout(true);
|
// gridPanel.setOneTouchExpandable(true);
|
// gridPanel.setDividerLocation(1.0);
|
// gridPanel.setDividerSize(9);
|
// gridPanel.setResizeWeight(0.85);
|
|
// aConstraints.weighty = 0;
|
//System.out.println("THIS = " + this);
|
// juin 2013
|
//SetupName(this); // new
|
|
// System.out.println("Constraints = " + aConstraints);
|
// aConstraints.gridx = 0;
|
// aConstraints.gridy = 0;
|
// aConstraints.gridwidth = 1;
|
////
|
//// ctrlPanel.add(clearPanelButton = new cButton("Clear Panel"), aConstraints, ctrlPanel.getComponentCount()-1);
|
//// clearPanelButton.addActionListener(this);
|
////
|
//// aConstraints.gridy += 1;
|
// clearPanelButton = AddButton(this, "Clear Panel");
|
// Return(this);
|
// aConstraints.weighty = 0;
|
// aConstraints.gridy = 0;
|
|
//JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
//tmp.setName("Edit");
|
|
objectTabCount = 0;
|
|
objectTabbedPane.add(skyboxPanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/skybox.jpg"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "Backgrounds");
|
|
objectTabbedPane.add(toolboxPanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/primitives.png"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "Objects & textures");
|
|
objectTabbedPane.add(materialPanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/material.png"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "Material");
|
|
if (Globals.ADVANCED)
|
{
|
figurePanel = new cGridBag();
|
figurePanel.add(new cButton("FIGURES and POSES coming soon!"));
|
objectTabbedPane.add(figurePanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/figure.png"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "Figures and poses");
|
}
|
|
// JPanel north = new JPanel(new BorderLayout());
|
// north.setName("Edit");
|
// north.add(ctrlPanel, BorderLayout.NORTH);
|
// objectPanel.add(north);
|
objectTabbedPane.add(editPanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/writewhite.png"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "Edit controls");
|
|
transformTabIndex = objectTabCount;
|
objectTabbedPane.add(transformPanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/XYZ.png"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "TRS transform");
|
|
patchMaterial = true;
|
cameraView.patchMaterial = this;
|
objectTabbedPane.setSelectedIndex(2);
|
|
/*
|
aConstraints.gridx = 0;
|
aConstraints.gridwidth = 1;
|
mainPanel.add(treePanel, aConstraints);
|
aConstraints.gridy += 1;
|
aConstraints.gridwidth = 1;
|
mainPanel.add(objectPanel, aConstraints);
|
*/
|
|
scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
|
VERTICAL_SCROLLBAR_AS_NEEDED,
|
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
//JPanel jsp = mainPanel;
|
scrollpane.setName("Scene");
|
//jsp.setViewportView(ctrlPanel);
|
scrollpane.setWheelScrollingEnabled(true);
|
scrollpane.addMouseWheelListener(this); // Default not fast enough
|
|
/*JTabbedPane*/ scenePanel = new cGridBag();
|
scenePanel.preferredWidth = 6;
|
|
JTabbedPane sceneTabbedPane = new JTabbedPane();
|
sceneTabbedPane.add(scrollpane);
|
|
optionsPanel = new cGridBag().setVertical(false);
|
|
optionsPanel.setName("Options");
|
|
AddOptions(optionsPanel); //, aConstraints);
|
|
sceneTabbedPane.add(FSPane = new cFileSystemPane(this));
|
|
fullscenePanel = new cGridBag();
|
fullscenePanel.setName("Download");
|
sceneTabbedPane.add(fullscenePanel);
|
|
cButton fullsceneButton;
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/tom.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Tom!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/tom.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = false;
|
Globals.setLIVE(true);
|
Globals.WALK = false;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/adameve.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Adam and Eve!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/adameve.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = false;
|
Globals.setLIVE(true);
|
Globals.WALK = false;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.Return();
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/alsace.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Alsace!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Alsace.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/desertmotel.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Desert Motel!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/DesertMotel.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.Return();
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/london.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Old London!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/oldlondon.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/skullcove.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Skull Cove Island!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/SkullCoveIsland.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(true);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.Return();
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/tuscany.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Tuscany!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Tuscany.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(true);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/urbanfuture3.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Urban Future!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/uf3.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = false;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.Return();
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/urbanfuture4.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Street Level!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/uf4.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/venice.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Venice!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Venice.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(true);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.Return();
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/viking.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Viking Village!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/VikingVillage.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.add(fullsceneButton = GetButton("fullscenes/yvoire.png", !Globals.NIMBUSLAF));
|
fullsceneButton.setToolTipText("Yvoire!");
|
fullsceneButton.addActionListener(new ActionListener()
|
{
|
@Override
|
public void actionPerformed(ActionEvent e)
|
{
|
ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Yvoire.gfd", new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
CameraPane.capsLocked = true;
|
Globals.setLIVE(false);
|
Globals.WALK = true;
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
}
|
});
|
|
fullscenePanel.Return();
|
|
sceneTabbedPane.add(optionsPanel);
|
|
scenePanel.add(sceneTabbedPane);
|
|
cButton creditButton;
|
|
cGridBag creditsPanel = new cGridBag().setVertical(true);
|
creditsPanel.setName("Credits");
|
|
cLabel ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
|
creditsPanel.add(ogaLabel);
|
|
creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
|
creditButton.setToolTipText("https://3delicious.net");
|
|
creditButton.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
try
|
{
|
Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net"));
|
} catch (Exception e1)
|
// } catch (java.io.IOException | java.net.URISyntaxException e1)
|
{
|
e1.printStackTrace();
|
}
|
}
|
});
|
|
creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF));
|
creditButton.setToolTipText("https://archive3d.net");
|
|
creditButton.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
try
|
{
|
Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net"));
|
} catch (Exception e1)
|
// } catch (java.io.IOException | java.net.URISyntaxException e1)
|
{
|
e1.printStackTrace();
|
}
|
}
|
});
|
|
creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF));
|
creditButton.setToolTipText("https://turbosquid.com");
|
|
creditButton.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
try
|
{
|
Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free"));
|
} catch (Exception e1)
|
// } catch (java.io.IOException | java.net.URISyntaxException e1)
|
{
|
e1.printStackTrace();
|
}
|
}
|
});
|
|
ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
|
creditsPanel.add(ogaLabel);
|
|
creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
|
creditButton.setToolTipText("https://opengameart.org");
|
|
creditButton.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
try
|
{
|
Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
|
} catch (Exception e1)
|
// } catch (java.io.IOException | java.net.URISyntaxException e1)
|
{
|
e1.printStackTrace();
|
}
|
}
|
});
|
|
for (int i=6; --i>=0;)
|
{
|
creditsPanel.add(new cGridBag());
|
}
|
|
sceneTabbedPane.add(creditsPanel);
|
sceneTabbedPane.setToolTipTextAt(3, "Credits");
|
|
if (Globals.SHOWINFO)
|
{
|
objectTabbedPane.add(infoPanel);
|
objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/info.png"));
|
objectTabbedPane.setToolTipTextAt(objectTabCount++, "Information (advanced)");
|
}
|
|
/*
|
cTree jTree = new cTree(null);
|
ToolTipManager.sharedInstance().registerComponent(jTree);
|
jTree.setCellRenderer(new cFileSystemModel.Renderer());
|
jTree.setModel(new cFileSystemModel(
|
//java.io.File.listRoots()[1])
|
javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(),
|
new cFilter("3ds")
|
));
|
jTree.setDragEnabled(true);
|
|
JScrollPane tree = new cFileSystemPane(jTree);
|
tree.setName("File system");
|
//jTree.addTreeSelectionListener(this);
|
//jTree.setRootVisible(false);
|
//jTree.setEditable(true);
|
|
jtp.add(tree);
|
*/
|
|
// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
|
// bigPanel.setContinuousLayout(true);
|
// bigPanel.setOneTouchExpandable(true);
|
// bigPanel.setDividerLocation(0.8);
|
// bigPanel.setDividerSize(15);
|
// bigPanel.setResizeWeight(0.15);
|
// bigPanel.setName("Scene");
|
|
//bigPanel.setLayout(new BorderLayout());
|
//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));
|
aWindowConstraints.gridx = 0;
|
aWindowConstraints.gridy = 0;
|
aWindowConstraints.gridwidth = 1;
|
// aWindowConstraints.gridheight = 3;
|
aWindowConstraints.fill = GridBagConstraints.VERTICAL;
|
aWindowConstraints.weightx = 0;
|
aWindowConstraints.weighty = 1;
|
bigThree.add(scenePanel, aWindowConstraints);
|
aWindowConstraints.weightx = 1;
|
aWindowConstraints.gridwidth = 3;
|
// aConstraints.gridheight = 3;
|
aWindowConstraints.gridx = 1;
|
aWindowConstraints.fill = GridBagConstraints.BOTH;
|
bigThree.add(centralPanel, aWindowConstraints);
|
aWindowConstraints.weightx = 0;
|
aWindowConstraints.gridx = 4;
|
aWindowConstraints.gridwidth = 1;
|
// aConstraints.gridheight = 3;
|
aWindowConstraints.fill = GridBagConstraints.VERTICAL;
|
bigThree.add(XYZPanel, aWindowConstraints);
|
/**/
|
|
bigThree = new cGridBag();
|
bigThree.addComponent(scenePanel);
|
bigThree.addComponent(centralPanel);
|
//bigThree.addComponent(XYZPanel);
|
|
// // SIDE EFFECT!!!
|
// aConstraints.gridx = 0;
|
// aConstraints.gridy = 0;
|
// aConstraints.weighty = 0;
|
// aConstraints.gridheight = 1;
|
|
framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
|
|
framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
|
new java.beans.PropertyChangeListener()
|
{
|
public void propertyChange(java.beans.PropertyChangeEvent pce)
|
{
|
if ((Integer)pce.getOldValue() == 1)
|
{
|
if (CameraPane.FULLSCREEN)
|
{
|
ToggleFullScreen();
|
}
|
|
// if (radio.layout != expandedLayout)
|
// {
|
// radio.layout = expandedLayout;
|
// radio.layout.doClick();
|
// }
|
}
|
}
|
});
|
|
framePanel.setContinuousLayout(false);
|
framePanel.setOneTouchExpandable(false);
|
//.setDividerLocation(0.8);
|
//framePanel.setDividerSize(15);
|
//framePanel.setResizeWeight(0.15);
|
framePanel.setName("Frame");
|
|
frame.getContentPane().setLayout(new BorderLayout());
|
/**/
|
//JTabbedPane worldPane = new JTabbedPane();
|
//worldPane.add(bigPanel);
|
//worldPane.add(worldPanel);
|
/**/
|
//frame.getContentPane().add(/*"Center",*/framePanel);
|
frame.add(/*"Center",*/framePanel);
|
//frame.getContentPane().add(/*"Center",*/ worldPane);
|
|
// aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
|
|
frame.setSize(1280, 900);
|
|
cameraView.requestFocusInWindow();
|
|
// gridPanel.setDividerLocation(1.0);
|
|
frame.validate();
|
|
frame.setVisible(true);
|
|
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
frame.addWindowListener(new WindowAdapter()
|
{
|
public void windowClosing(WindowEvent e)
|
{
|
Close();
|
}
|
});
|
}
|
|
void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
|
{
|
}
|
|
JTree GetTree()
|
{
|
return objEditor.jTree;
|
}
|
|
void ClearCtrlPanel()
|
{
|
//System.out.println("Clear panel");
|
ctrlPanel.removeAll();
|
}
|
|
void SetupMaterial(cGridBag materialpanel)
|
{
|
cGridBag presetpanel = new cGridBag().setVertical(true);
|
|
cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
|
skin.setToolTipText("Skin");
|
skin.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[0].get(0);
|
cMaterial material = object.material;
|
|
// Skin
|
colorField.setFloat(material.color);
|
float saturation = material.modulation;
|
|
if (!cameraView.Skinshader)
|
{
|
saturation /= 1.5;
|
}
|
|
saturationField.setFloat(saturation);
|
|
subsurfaceField.setFloat(material.subsurface);
|
selfshadowField.setFloat(material.diffuseness);
|
diffusenessField.setFloat(material.factor);
|
shininessField.setFloat(material.shininess);
|
shadowbiasField.setFloat(material.shadowbias);
|
diffuseField.setFloat(material.diffuse);
|
specularField.setFloat(material.specular);
|
|
bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
|
noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
|
powerField.setFloat(object.projectedVertices[2].x / 1000.0);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(skin);
|
|
cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
|
lambert.setToolTipText("Diffuse");
|
lambert.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[2].get(0);
|
cMaterial material = object.material;
|
|
diffusenessField.setFloat(material.factor);
|
selfshadowField.setFloat(material.diffuseness);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(lambert);
|
|
cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
|
diffuse2.setToolTipText("Diffuse2");
|
diffuse2.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[3].get(0);
|
cMaterial material = object.material;
|
|
diffusenessField.setFloat(material.factor);
|
selfshadowField.setFloat(material.diffuseness);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(diffuse2);
|
|
cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
|
diffusemoon.setToolTipText("Moon");
|
diffusemoon.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[4].get(0);
|
cMaterial material = object.material;
|
|
diffusenessField.setFloat(material.factor);
|
selfshadowField.setFloat(material.diffuseness);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(diffusemoon);
|
|
cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
|
diffusemoon2.setToolTipText("Moon2");
|
diffusemoon2.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[5].get(0);
|
cMaterial material = object.material;
|
|
diffusenessField.setFloat(material.factor);
|
selfshadowField.setFloat(material.diffuseness);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(diffusemoon2);
|
|
cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
|
diffusemoon3.setToolTipText("Moon3");
|
diffusemoon3.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[6].get(0);
|
cMaterial material = object.material;
|
|
diffusenessField.setFloat(material.factor);
|
selfshadowField.setFloat(material.diffuseness);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(diffusemoon3);
|
|
cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
|
diffusesheen.setToolTipText("Sheen");
|
diffusesheen.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[7].get(0);
|
cMaterial material = object.material;
|
|
sheenField.setFloat(material.sheen);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(diffusesheen);
|
|
cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
|
rough.setToolTipText("Rough metal");
|
rough.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[1].get(0);
|
cMaterial material = object.material;
|
|
shininessField.setFloat(material.shininess);
|
velvetField.setFloat(material.velvet);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(rough);
|
|
cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
|
rough2.setToolTipText("Medium metal");
|
rough2.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[13].get(0);
|
cMaterial material = object.material;
|
|
shininessField.setFloat(material.shininess);
|
lightareaField.setFloat(material.lightarea);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(rough2);
|
|
cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
|
shini0.setToolTipText("Shiny");
|
shini0.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[14].get(0);
|
cMaterial material = object.material;
|
|
shininessField.setFloat(material.shininess);
|
lightareaField.setFloat(material.lightarea);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(shini0);
|
|
cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
|
shini1.setToolTipText("Shiny2");
|
shini1.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[11].get(0);
|
cMaterial material = object.material;
|
|
shininessField.setFloat(material.shininess);
|
lightareaField.setFloat(material.lightarea);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(shini1);
|
|
cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
|
shini2.setToolTipText("Shiny3");
|
shini2.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[12].get(0);
|
cMaterial material = object.material;
|
|
shininessField.setFloat(material.shininess);
|
lightareaField.setFloat(material.lightarea);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(shini2);
|
|
cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
|
aniso.setToolTipText("AnisoU");
|
aniso.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[8].get(0);
|
cMaterial material = object.material;
|
|
anisoField.setFloat(material.aniso);
|
anisoVField.setFloat(material.anisoV);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(aniso);
|
|
cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
|
aniso2.setToolTipText("AnisoV");
|
aniso2.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[9].get(0);
|
cMaterial material = object.material;
|
|
anisoField.setFloat(material.aniso);
|
anisoVField.setFloat(material.anisoV);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(aniso2);
|
|
cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
|
aniso3.setToolTipText("AnisoUV");
|
aniso3.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[10].get(0);
|
cMaterial material = object.material;
|
|
anisoField.setFloat(material.aniso);
|
anisoVField.setFloat(material.anisoV);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(aniso3);
|
|
cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
|
velvet0.setToolTipText("Velvet");
|
velvet0.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[15].get(0);
|
cMaterial material = object.material;
|
|
diffusenessField.setFloat(material.factor);
|
selfshadowField.setFloat(material.diffuseness);
|
sheenField.setFloat(material.sheen);
|
shininessField.setFloat(material.shininess);
|
velvetField.setFloat(material.velvet);
|
shiftField.setFloat(material.shift);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(velvet0);
|
|
cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
|
bump0.setToolTipText("Bump texture");
|
bump0.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[16].get(0);
|
cMaterial material = object.material;
|
|
bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
|
noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
|
powerField.setFloat(object.projectedVertices[2].x / 1000.0);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(bump0);
|
|
cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
|
borderShader.setToolTipText("Border fade");
|
borderShader.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
borderfadeField.setFloat(0.4);
|
opacityField.setFloat(0.75);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(borderShader);
|
|
cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
|
halo.setToolTipText("Halo");
|
halo.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[17].get(0);
|
cMaterial material = object.material;
|
|
opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(halo);
|
|
cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
|
candle.setToolTipText("Candle");
|
candle.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
Object3D object = Grafreed.materials.versionlist[18].get(0);
|
cMaterial material = object.material;
|
|
subsurfaceField.setFloat(material.subsurface);
|
shadowbiasField.setFloat(material.shadowbias);
|
ambientField.setFloat(material.ambient);
|
specularField.setFloat(material.specular);
|
lightareaField.setFloat(material.lightarea);
|
shininessField.setFloat(material.shininess);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(candle);
|
|
cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
|
shadowShader.setToolTipText("Shadow");
|
shadowShader.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
diffuseField.setFloat(0.001);
|
ambientField.setFloat(0.001);
|
cameraField.setFloat(0.001);
|
specularField.setFloat(0.001);
|
fakedepthField.setFloat(0.001);
|
opacityField.setFloat(0.4);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(shadowShader);
|
|
cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
|
para0.setToolTipText("No parallax");
|
para0.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
parallaxField.setFloat(0.125);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(para0);
|
|
cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
|
para1.setToolTipText("With parallax");
|
para1.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
parallaxField.setFloat(0.13);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(para1);
|
|
cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
|
para2.setToolTipText("Reset parallax");
|
para2.addMouseListener(new MouseAdapter()
|
{
|
public void mouseClicked(MouseEvent e)
|
{
|
parallaxField.setFloat(0.14);
|
|
materialtouched = true;
|
applySelf();
|
}
|
});
|
presetpanel.add(para2);
|
|
cGridBag panel = new cGridBag().setVertical(true);
|
|
presetpanel.preferredWidth = 1;
|
|
materialpanel.add(presetpanel);
|
materialpanel.add(panel);
|
|
panel.preferredWidth = 8;
|
|
/*
|
ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
|
materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
|
*/
|
|
cGridBag editBar = new cGridBag().setVertical(false);
|
|
editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
|
createMaterialButton.setToolTipText("Create material");
|
|
/*
|
ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
|
*/
|
|
editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
|
clearMaterialButton.setToolTipText("Clear material");
|
|
if (Globals.ADVANCED)
|
{
|
editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
|
editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
|
editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
|
}
|
|
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);
|
|
cGridBag colorSection = new cGridBag().setVertical(true);
|
|
cGridBag huepanel = new cGridBag();
|
cGridBag huelabel = new cGridBag();
|
cLabel hue = GetLabel("icons/hue.png", false);
|
hue.fit = true;
|
|
hue.addMouseListener(new MouseAdapter()
|
{
|
public void mousePressed(MouseEvent e)
|
{
|
int x = e.getX();
|
|
colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
|
}
|
});
|
|
huelabel.add(hue);
|
huelabel.preferredWidth = 20;
|
huepanel.add(new cGridBag()); // Label
|
huepanel.add(huelabel); // Field/slider
|
|
huepanel.preferredHeight = 7;
|
|
colorSection.add(huepanel);
|
|
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)); // , aConstraints);
|
|
//colorField.preferredWidth = 200;
|
colorSection.add(color);
|
|
cGridBag modulation = new cGridBag();
|
modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
|
modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
|
modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
|
colorSection.add(modulation);
|
|
cGridBag opacity = new cGridBag();
|
opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
|
opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
|
opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
|
colorSection.add(opacity);
|
|
colorSection.add(GetSeparator());
|
|
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);
|
|
panel.add(GetSeparator());
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
diffuseSection.add(shadowbias);
|
|
panel.add(GetSeparator());
|
|
panel.add(diffuseSection);
|
|
//ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
|
|
cGridBag specularSection = new cGridBag().setVertical(true);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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;
|
// aConstraints.gridx += 1;
|
// aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
|
// ctrlPanel.add(shiftField = new NumberSlider(0.001,50,-1 /*.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);
|
specularSection.add(anisoU);
|
|
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);
|
specularSection.add(anisoV);
|
|
|
panel.add(GetSeparator());
|
|
panel.add(specularSection);
|
|
//ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
|
|
//cGridBag globalSection = new cGridBag().setVertical(true);
|
|
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);
|
colorSection.add(camera);
|
|
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);
|
colorSection.add(ambient);
|
|
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);
|
colorSection.add(backlit);
|
|
cGridBag parallax = new cGridBag();
|
parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
|
parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
|
parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints);
|
colorSection.add(parallax);
|
|
//panel.add(new JSeparator());
|
|
//panel.add(globalSection);
|
|
//ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
|
|
cGridBag textureSection = new cGridBag().setVertical(true);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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(GetSeparator());
|
|
panel.add(textureSection);
|
|
//ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
|
|
SetMaterial(copy); // .GetMaterial());
|
|
//colorField.addChangeListener(this);
|
// modulationField.addChangeListener(this);
|
metalnessField.addChangeListener(this);
|
diffuseField.addChangeListener(this);
|
specularField.addChangeListener(this);
|
shininessField.addChangeListener(this);
|
shiftField.addChangeListener(this);
|
ambientField.addChangeListener(this);
|
lightareaField.addChangeListener(this);
|
diffusenessField.addChangeListener(this);
|
velvetField.addChangeListener(this);
|
sheenField.addChangeListener(this);
|
subsurfaceField.addChangeListener(this);
|
backlitField.addChangeListener(this);
|
anisoField.addChangeListener(this);
|
anisoVField.addChangeListener(this);
|
cameraField.addChangeListener(this);
|
selfshadowField.addChangeListener(this);
|
shadowField.addChangeListener(this);
|
textureField.addChangeListener(this);
|
opacityField.addChangeListener(this);
|
fakedepthField.addChangeListener(this);
|
shadowbiasField.addChangeListener(this);
|
bumpField.addChangeListener(this);
|
noiseField.addChangeListener(this);
|
powerField.addChangeListener(this);
|
borderfadeField.addChangeListener(this);
|
fogField.addChangeListener(this);
|
opacityPowerField.addChangeListener(this);
|
/**/
|
|
clearMaterialButton.addActionListener(this);
|
createMaterialButton.addActionListener(this);
|
|
if (Globals.ADVANCED)
|
{
|
resetSlidersButton.addActionListener(this);
|
propagateToggle.addItemListener(this);
|
multiplyToggle.addItemListener(this);
|
}
|
}
|
|
void DropFile(java.io.File[] files, boolean textures)
|
{
|
for (java.io.File file : files)
|
{
|
String filename = file.getAbsolutePath();
|
|
if (filename.endsWith(".switch"))
|
{
|
LoadSwitch(filename);
|
continue;
|
}
|
|
// 3D models
|
if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
|
{
|
//lastConverter = new com.jmex.model.converters.MaxToJme();
|
//LoadFile(filename, lastConverter);
|
LoadObjFile(filename); // New 3ds loader
|
continue;
|
}
|
if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
|
{
|
try
|
{
|
java.net.URL url = file.toURI().toURL();
|
// converter.setProperty( "texurl", url );
|
// java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
|
// converter.convert( , bos );
|
|
com.jmex.model.collada.ColladaImporter.load(url.openStream(), "allo");
|
|
Object3D newobj = new cJME().Read(com.jmex.model.collada.ColladaImporter.getModel());
|
makeSomething(newobj, true);
|
} catch (Exception e)
|
{
|
}
|
// lastConverter = new com.jmex.model.collada.ColladaToJme();
|
// LoadFile(filename, lastConverter);
|
continue;
|
}
|
if (filename.endsWith(".obj") || filename.endsWith(".OBJ"))
|
{
|
//lastConverter = new com.jmex.model.converters.ObjToJme();
|
//LoadFile(filename, lastConverter);
|
LoadObjFile(filename);
|
continue;
|
} // if(inFile.getName().toUpperCase().endsWith(".DAE"))
|
if (filename.endsWith(".gfd") || filename.endsWith(".GFD"))
|
{
|
LoadGFDFile(filename);
|
continue;
|
}
|
if (filename.endsWith(".bvh") || filename.endsWith(".BVH"))
|
{
|
LoadBVHFile(filename, true);
|
continue;
|
}
|
|
if (filename.toUpperCase().endsWith(".DAE"))
|
{
|
LoadCollada(filename, true);
|
continue;
|
}
|
|
if (filename.endsWith(".wrl") || filename.endsWith(".WRL")
|
|| filename.endsWith(".x3d") || filename.endsWith(".X3D"))
|
{
|
LoadVRMLX3D(filename);
|
continue;
|
}
|
|
// Images/textures
|
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"))
|
{
|
if (textures)
|
DropTexture(filename);
|
else
|
CreateBillboard(filename);
|
continue;
|
}
|
|
//makeSomething(ReadGFD(filename));
|
ReadGFD(filename, this);
|
}
|
|
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;
|
|
void DropTexture(String filename)
|
{
|
// assert(copy instanceof Composite);
|
// Composite group = (Composite) copy;
|
Object3D group = copy;
|
|
//??? java.util.Vector<Object3D> tempsel = (java.util.Vector<Object3D>) group.selection.clone();
|
Object3D source = null;
|
|
if (group.selection.size() > 0)
|
{
|
source = group.selection.get(0);
|
}
|
|
//? flashIt = false;
|
CameraPane pane = (CameraPane) cameraView;
|
pane.clickStart(location.x, location.y, 0, 0);
|
pane.clickEnd(location.x, location.y, 0, true);
|
|
if (group.selection.size() == 1)
|
{
|
Object3D targ = group.selection.get(0);
|
|
if (filename.endsWith("NRM.jpg") || filename.endsWith("Normal.jpg") || filename.endsWith("Bump.jpg") || filename.endsWith("_B.jpg"))
|
{
|
targ.SetBumpTexture(filename);
|
} else
|
{
|
targ.SetPigmentTexture(filename);
|
}
|
}
|
|
// ?? boolean first = true;
|
// for(Object3D o : tempsel)
|
// {
|
// Select(o.GetTreePath(), first);
|
// first = false;
|
// }
|
|
if (source != null)
|
{
|
Select(source.GetTreePath(), true, true);
|
}
|
|
//? flashIt = true;
|
|
refreshContents();
|
}
|
|
void LoadVRMLX3D(String fullname)
|
{
|
try
|
{
|
//org.j3d.renderer.aviatrix3d.loader.AVModel scene = new org.xj3d.loaders.ogl.VRML97Loader().load(new java.io.File(fullname));
|
org.j3d.renderer.aviatrix3d.loader.AVModel scene = new org.xj3d.loaders.ogl.X3DLoader().load(new java.io.File(fullname));
|
//org.j3d.renderer.aviatrix3d.loader.AVModel scene = new org.j3d.renderer.aviatrix3d.loader.discreet.MaxLoader().load(new java.io.File(fullname));
|
System.out.println("Scene = " + scene);
|
makeSomething(cAviatrix.Read(scene.getModelRoot()), true);
|
System.gc();
|
//refreshContents();
|
} catch (java.io.IOException e2)
|
{
|
e2.printStackTrace();
|
}
|
}
|
|
LoadJMEThread loadThread;
|
|
class LoadJMEThread extends Thread
|
{
|
//String filename;
|
//com.jmex.model.converters.FormatConverter converter;
|
|
java.util.Stack stack;
|
|
LoadJMEThread(/*String fullname, com.jmex.model.converters.FormatConverter conv*/)
|
{
|
//filename = fullname;
|
//converter = conv;
|
stack = new java.util.Stack();
|
}
|
|
void add(String filename, com.jmex.model.converters.FormatConverter conv)
|
{
|
stack.push(filename);
|
stack.push(conv);
|
}
|
|
public void run()
|
{
|
boolean wasbusy = false;
|
|
for (;;)
|
{
|
try
|
{
|
sleep(10);
|
} catch (Exception e)
|
{
|
};
|
if (!stack.empty())
|
{
|
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
com.jmex.model.converters.FormatConverter converter = (com.jmex.model.converters.FormatConverter) stack.pop();
|
String filename = (String) stack.pop();
|
System.out.println(" ------- ------- ------ ------ ----- LOADING... " + filename);
|
LoadFile0(filename, converter);
|
System.gc();
|
|
wasbusy = true;
|
} else
|
{
|
if (wasbusy)
|
{
|
frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
wasbusy = false;
|
}
|
}
|
}
|
|
//LoadFile0(filename, converter);
|
}
|
}
|
|
LoadOBJThread loadObjThread;
|
|
class LoadOBJThread extends Thread
|
{
|
//String filename;
|
//com.jmex.model.converters.FormatConverter converter;
|
|
java.util.Stack stack;
|
|
LoadOBJThread(/*String fullname, com.jmex.model.converters.FormatConverter conv*/)
|
{
|
//filename = fullname;
|
//converter = conv;
|
stack = new java.util.Stack();
|
}
|
|
void add(String filename)
|
{
|
stack.push(filename);
|
}
|
|
public void run()
|
{
|
boolean wasbusy = false;
|
|
for (;;)
|
{
|
try
|
{
|
sleep(10);
|
} catch (Exception e)
|
{
|
};
|
if (!stack.empty())
|
{
|
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
String filename = (String) stack.pop();
|
System.out.println(" ------- ------- ------ ------ ----- LOADING... " + filename);
|
makeSomething(ReadOBJ(filename), true);
|
System.gc();
|
|
wasbusy = true;
|
} else
|
{
|
if (wasbusy)
|
{
|
frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
wasbusy = false;
|
}
|
}
|
}
|
|
//LoadFile0(filename, converter);
|
}
|
}
|
|
void LoadFile0(String fullname, com.jmex.model.converters.FormatConverter converter)
|
{
|
Reload(converter, fullname, true);
|
}
|
|
void LoadFile(String fullname, com.jmex.model.converters.FormatConverter converter)
|
{
|
//lastFilename = fullname;
|
//cJME.count = 0;
|
//LoadFile0(fullname);
|
//new LoadJMEThread(fullname, converter).start();
|
if (loadThread == null)
|
{
|
loadThread = new LoadJMEThread(/*fullname, converter*/);
|
loadThread.start();
|
}
|
|
loadThread.add(fullname, converter);
|
}
|
|
void LoadObjFile(String fullname)
|
{
|
System.out.println("Loading " + fullname);
|
/**/
|
//lastFilename = fullname;
|
if(loadObjThread == null)
|
{
|
loadObjThread = new LoadOBJThread();
|
loadObjThread.start();
|
}
|
|
loadObjThread.add(fullname);
|
/**/
|
|
//makeSomething(new FileObject(fullname, true), true);
|
}
|
|
void LoadGFDFile(String fullname)
|
{
|
System.out.println("Loading " + fullname);
|
makeSomething(new FileObject(fullname, false), true);
|
}
|
|
void LoadBVHFile(String fullname, boolean changename)
|
{
|
System.out.println("Loading " + fullname);
|
|
mocap.reader.BVHReader rd = new mocap.reader.BVHReader(0.75);
|
try
|
{
|
File file = new File(fullname);
|
|
Mocap mocap = new Mocap("Mocap" + file.getName());
|
|
mocap.bvh = rd.readFile(file);
|
//System.err.println("NEW MOCAP fullname = " + fullname);
|
mocap.fullname = fullname;
|
//initFigure(bvh.skeleton, f.getName(), offset);
|
|
//? mocap.setPose(0);
|
|
// mocap.SmoothAnimData(); // FilterAnimData();
|
|
// for (int i=50; --i>=0;)
|
// mocap.SmoothAnimData(); // much reduces shakiness
|
|
// CROWD
|
//if (!changename)
|
// mocap.SetPositionDelta();
|
|
mocap.live = true;
|
|
if (copy.selection.size() > 0 && copy.selection.get(0) instanceof Mocap)
|
{
|
Mocap sel = (Mocap) copy.selection.get(0);
|
|
sel.SetCurrentBones(sel.frame);
|
|
sel.fullname = fullname;
|
|
if (changename)
|
{
|
sel.name = mocap.name;
|
}
|
sel.bvh.animation = mocap.bvh.animation;
|
|
sel.endframe = sel.bvh.animation.getNumFrames(); // june 2013
|
|
sel.smoothed = false;
|
|
// if (!changename)
|
//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, true); // true);
|
}
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
// CameraPane.tickcount = 64; // global slow pose for half a second
|
}
|
|
static void LoadBVHFile(String fullname, Object3D select, boolean changename, int beginframe, int endframe)
|
{
|
// june 2014
|
beginframe = 0; endframe = 0;
|
|
if (fullname == null)
|
{
|
System.err.println("NO MOCAP for " + select);
|
return;
|
}
|
System.out.println("Loading FULL " + fullname);
|
|
mocap.reader.BVHReader rd = new mocap.reader.BVHReader(0.75);
|
try
|
{
|
Mocap sel = (Mocap) select;
|
|
sel.SetCurrentBones(sel.frame);
|
|
File file = new File(fullname);
|
|
// Mocap mocap = new Mocap("Mocap" + file.getName());
|
|
if (select.random) // june 2014 && !CameraPane.FAST)
|
{
|
// suppose a random crowd. We need longer mocap data.
|
System.err.println("MOCAP EXTENSION (load)");
|
rd.mocapextension = rd.EXTENSION;
|
}
|
|
//mocap.
|
sel.bvh = rd.readFile(file);
|
//System.err.println("NEW2 MOCAP fullname = " + fullname);
|
// mocap.fullname = fullname;
|
//initFigure(bvh.skeleton, f.getName(), offset);
|
|
//sel.skeleton = null;
|
sel.smoothed = false;
|
|
// CROWD
|
// if (!changename)
|
// mocap.SetPositionDelta();
|
|
//? mocap.setPose(0);
|
|
// mocap.SmoothAnimData(); // FilterAnimData();
|
|
// for (int i=50; --i>=0;)
|
// mocap.SmoothAnimData(); // much reduces shakiness
|
|
// CROWD
|
//if (!changename)
|
// mocap.SetPositionDelta();
|
|
// mocap.live = true;
|
|
sel.fullname = fullname;
|
|
sel.endframe = endframe;
|
|
sel.firstframe = 0;
|
sel.lastframe = 0;
|
|
if (sel.endframe == 0)
|
{
|
sel.endframe = sel.bvh.animation.getNumFrames();
|
}
|
|
if (beginframe != -1)
|
{
|
sel.beginframe = beginframe;
|
} else
|
{
|
sel.beginframe = 0; // (int)(Math.random()*endframe);
|
}
|
// if (changename)
|
// sel.name = mocap.name;
|
|
// sel.bvh.animation = mocap.bvh.animation;
|
|
// for (int i=50; --i>=0;)
|
// sel.SmoothAnimData(); // much reduces shakiness
|
|
if (!changename)
|
{
|
//sel.SetPositionDelta(false, true, true, true/*?*/);
|
sel.SetGlobalTransform();
|
sel.LoadData();
|
sel.Rewind();
|
sel.Fade();
|
}
|
|
// sel.setPose(0);
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
CameraPane.tickcount = 64; // global slow pose for half a second
|
}
|
|
void LoadSwitch(String fullname)
|
{
|
try
|
{
|
File file = new File(fullname);
|
|
File[] files = file.listFiles();
|
|
int count = 0;
|
|
for (int i = files.length; --i >= 0;)
|
{
|
if (files[i].getName().endsWith(".obj"))
|
{
|
count++;
|
}
|
}
|
|
boolean stripify = cJME.stripify;
|
cJME.stripify = false; // Poses change stripification
|
|
if (copy.selection.Size() > 0 && copy.selection.get(0).Size() == count) // not good
|
{
|
// replace
|
Object3D target = copy.selection.get(0);
|
|
for (int i = files.length; --i >= 0;)
|
{
|
String filename = files[i].getAbsolutePath();
|
|
if (!filename.endsWith(".obj"))
|
{
|
continue;
|
}
|
|
Object3D obj = ReadOBJ(filename);
|
|
target.get(--count).overwriteThis(obj, Object3D.GEOMETRY);
|
target.get(count).name = files[i].getName().split(".obj")[0];
|
}
|
|
refreshContents();
|
} else
|
{
|
Object3D newgroup = new Object3D(file.getName());
|
|
for (int i=0; i<files.length; i++)
|
{
|
String filename = files[i].getAbsolutePath();
|
|
if (!filename.endsWith(".obj"))
|
continue;
|
|
Object3D obj = ReadOBJ(filename);
|
|
Object3D tmpgroup = new Object3D(obj.name);
|
cMesh mesh = new cMesh(obj);
|
mesh.setup();
|
mesh.ExtractGeometries(tmpgroup, false);
|
tmpgroup.get(0).bRep.Stripify();
|
tmpgroup.get(0).bRep.Untrim();
|
obj = tmpgroup.get(0);
|
|
newgroup.addChild(obj);
|
}
|
|
// load
|
makeSomething(newgroup, true);
|
}
|
|
cJME.stripify = stripify;
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
}
|
|
com.jmex.model.converters.FormatConverter lastConverter;
|
String lastFilename;
|
|
void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
|
{
|
if (Grafreed.standAlone)
|
{
|
/**/
|
FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
|
browser.setVisible(true);
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
String fullname = browser.getDirectory() + filename;
|
lastConverter = converter;
|
LoadFile(fullname, lastConverter);
|
}
|
/**/
|
|
// Note: source for ExampleFileFilter can be found in FileChooserDemo,
|
// under the demo/jfc directory in the JDK.
|
/*
|
Filter filter = new Filter(ext);
|
//filter.addExtension("3ds");
|
//filter.addExtension("gif");
|
//filter.setDescription("JPG & GIF Images");
|
chooser.setUI(new cFileChooserUI(chooser));
|
chooser.updateUI();
|
chooser.setFileFilter(filter);
|
chooser.setDragEnabled(true);
|
chooser.setMultiSelectionEnabled(true);
|
chooser.setDialogTitle(dialogName);
|
*/
|
/*
|
BFileChooser chooser = new BFileChooser(BFileChooser.OPEN_FILE, dialogName);
|
chooser.setMultipleSelectionEnabled(true);
|
if( chooser.showDialog(null) )
|
{
|
System.out.println("ALLO");
|
for (java.io.File f : chooser.getSelectedFiles())
|
{
|
lastConverter = converter;
|
lastFilename = f.getAbsolutePath();
|
System.out.println(lastFilename);
|
cJME.count = 0;
|
Reload(false, ext.equals("3ds"));
|
}
|
System.gc();
|
}
|
*/
|
}
|
}
|
|
static Object3D ReadOBJ(String filename)
|
{
|
try
|
{
|
ObjectFile f = new ObjectFile();
|
com.sun.j3d.loaders.Scene s = null;
|
|
String[] splits = filename.split("/");
|
System.out.println("Loading... " + filename);
|
|
s = f.load(filename);
|
|
System.gc();
|
// System.gc();
|
// System.gc();
|
System.out.println("Reading... " + splits[splits.length - 1]);
|
Object3D object = new cJ3D().Read(s, splits[splits.length - 1].split("\\.")[0]);
|
// object.SetPigmentTexture(file.toString() + object.GetPigmentTexture());
|
// object.SetBumpTexture(file.toString() + object.GetBumpTexture());
|
return object;
|
} catch (//FileNotFound
|
Exception e)
|
{
|
System.err.println(e);
|
}
|
|
return null;
|
}
|
|
void Reload(com.jmex.model.converters.FormatConverter converter, String filename, boolean gc)
|
{
|
if (filename == null)
|
{
|
return;
|
}
|
|
try
|
{
|
//com.jmex.model.converters.FormatConverter converter = new com.jmex.model.converters.ObjToJme();
|
java.io.File file = new java.io.File(filename);
|
java.net.URL url = file.toURI().toURL();
|
converter.setProperty("texurl", url);
|
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
|
converter.convert(url.openStream(), bos);
|
com.jme.scene.Spatial scene = (com.jme.scene.Spatial) com.jme.util.export.binary.BinaryImporter.getInstance().load(
|
new java.io.ByteArrayInputStream(bos.toByteArray()));
|
|
System.out.println("Scene = " + scene);
|
Object3D newobj = new cJME().Read(scene);
|
newobj.name = file.getName();
|
//if(.xxx
|
newobj.name = newobj.name.substring(0, newobj.name.length() - 4);
|
makeSomething(newobj, true);
|
if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
|
{
|
// Patch
|
//Composite group = (Composite) copy;
|
Object3D group = (Object3D) copy;
|
|
if (group.name.equals("TEMP"))
|
{
|
group = (Composite) group.get(0);
|
}
|
|
LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
|
LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
|
}
|
|
//cJME.count++;
|
//cJME.count %= 12;
|
if (gc)
|
{
|
System.gc();
|
}
|
} catch (java.io.IOException e2)
|
{
|
e2.printStackTrace();
|
}
|
}
|
|
void LoadCollada(String filename, boolean gc)
|
{
|
if (filename == null)
|
{
|
return;
|
}
|
// try
|
{
|
//com.jmex.model.converters.FormatConverter converter = new com.jmex.model.converters.ObjToJme();
|
java.io.File inFile = new java.io.File(filename);
|
com.jme.scene.Spatial collada = null;
|
// if(inFile.getName().toUpperCase().endsWith(".DAE"))
|
{
|
FileInputStream input = null;
|
try
|
{
|
input = new FileInputStream(inFile);
|
} catch (FileNotFoundException e1)
|
{
|
}
|
if (input == null)
|
{
|
new Exception().printStackTrace();
|
System.exit(0);
|
}
|
|
|
try
|
{
|
String modelName = inFile.getName().substring(0,
|
inFile.getName().indexOf("."));
|
com.jmex.model.collada.ColladaImporter.load(input, modelName);
|
collada = com.jmex.model.collada.ColladaImporter.getModel();
|
com.jmex.model.collada.ColladaImporter.cleanUp();
|
} catch (Exception e)
|
{
|
}
|
|
collada.updateGeometricState(0, true);
|
collada.updateRenderState();
|
|
System.out.println("Collada Scene = " + collada);
|
Object3D newobj = new cJME().Read(collada);
|
newobj.name = inFile.getName();
|
//if(.xxx
|
newobj.name = newobj.name.substring(0, newobj.name.length() - 4);
|
makeSomething(newobj, true);
|
}
|
if (gc)
|
{
|
System.gc();
|
}
|
}
|
// catch(java.io.IOException e2) { e2.printStackTrace(); }
|
}
|
|
public void Callback(Object obj)
|
{
|
//assert(false);
|
if (obj == null)
|
{
|
return;
|
}
|
|
if (obj instanceof Object3D)
|
// BEURK
|
{
|
new Exception().printStackTrace();
|
makeSomething((Object3D) obj, true);
|
} else
|
{
|
DropFile((java.io.File[]) obj, false);
|
}
|
}
|
|
public void DragGesture()
|
{
|
//assert(false);
|
// Patch for DnD failure
|
if (GetTree() != null)
|
{
|
GetTree().clearSelection();
|
}
|
ResetSliders();
|
}
|
|
static void scrollByUnits(JScrollBar scrollbar, int direction,
|
int units)
|
{
|
// This method is called from BasicScrollPaneUI to implement wheel
|
// scrolling, as well as from scrollByUnit().
|
int delta;
|
|
for (int i = 0; i < units; i++)
|
{
|
if (direction > 0)
|
{
|
delta = scrollbar.getUnitIncrement(direction);
|
} else
|
{
|
delta = -scrollbar.getUnitIncrement(direction);
|
}
|
|
int oldValue = scrollbar.getValue();
|
int newValue = oldValue + delta;
|
|
// Check for overflow.
|
if (delta > 0 && newValue < oldValue)
|
{
|
newValue = scrollbar.getMaximum();
|
} else if (delta < 0 && newValue > oldValue)
|
{
|
newValue = scrollbar.getMinimum();
|
}
|
if (oldValue == newValue)
|
{
|
break;
|
}
|
scrollbar.setValue(newValue);
|
}
|
}
|
|
static void scrollByBlock(JScrollBar scrollbar, int direction)
|
{
|
// This method is called from BasicScrollPaneUI to implement wheel
|
// scrolling, and also from scrollByBlock().
|
int oldValue = scrollbar.getValue();
|
int blockIncrement = scrollbar.getBlockIncrement(direction);
|
int delta = blockIncrement * ((direction > 0) ? +1 : -1);
|
int newValue = oldValue + delta;
|
|
// Check for overflow.
|
if (delta > 0 && newValue < oldValue)
|
{
|
newValue = scrollbar.getMaximum();
|
} else if (delta < 0 && newValue > oldValue)
|
{
|
newValue = scrollbar.getMinimum();
|
}
|
|
scrollbar.setValue(newValue);
|
}
|
|
public void mouseWheelMoved(MouseWheelEvent e)
|
{
|
if (scrollpane.isWheelScrollingEnabled()
|
&& e.getScrollAmount() != 0)
|
{
|
JScrollBar toScroll = scrollpane.getVerticalScrollBar();
|
int direction = 0;
|
// find which scrollbar to scroll, or return if none
|
if (toScroll == null || !toScroll.isVisible())
|
{
|
toScroll = scrollpane.getHorizontalScrollBar();
|
if (toScroll == null || !toScroll.isVisible())
|
{
|
return;
|
}
|
}
|
direction = e.getWheelRotation() < 0 ? -1 : 1;
|
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL)
|
{
|
scrollByUnits(toScroll, direction,
|
e.getScrollAmount() * 10);
|
} else if (e.getScrollType()
|
== MouseWheelEvent.WHEEL_BLOCK_SCROLL)
|
{
|
scrollByBlock(toScroll, direction);
|
}
|
}
|
}
|
|
cFileSystemPane FSPane;
|
|
void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
|
{
|
current.Set(mat); // ...
|
anchor.Set(mat); // ...
|
|
freezematerial = true;
|
colorField.setFloat(mat.color);
|
saturationField.setFloat(mat.modulation);
|
metalnessField.setFloat(mat.metalness);
|
diffuseField.setFloat(mat.diffuse);
|
specularField.setFloat(mat.specular);
|
shininessField.setFloat(mat.shininess);
|
shiftField.setFloat(mat.shift);
|
ambientField.setFloat(mat.ambient);
|
lightareaField.setFloat(mat.lightarea);
|
diffusenessField.setFloat(mat.factor);
|
velvetField.setFloat(mat.velvet);
|
sheenField.setFloat(mat.sheen);
|
subsurfaceField.setFloat(mat.subsurface);
|
backlitField.setFloat(mat.bump);
|
anisoField.setFloat(mat.aniso);
|
anisoVField.setFloat(mat.anisoV);
|
cameraField.setFloat(mat.cameralight);
|
selfshadowField.setFloat(mat.diffuseness);
|
shadowField.setFloat(mat.shadow);
|
textureField.setFloat(mat.texture);
|
opacityField.setFloat(mat.opacity);
|
parallaxField.setFloat(mat.parallax + 0.125f);
|
fakedepthField.setFloat(mat.fakedepth);
|
shadowbiasField.setFloat(mat.shadowbias);
|
bumpField.setInteger(1); // dec 2013
|
noiseField.setInteger(0);
|
powerField.setInteger(0);
|
borderfadeField.setInteger(0);
|
fogField.setInteger(0);
|
opacityPowerField.setInteger(0);
|
|
if (others != null && others.length > 0 && others[0] != null)
|
{
|
bumpField.setFloat(others[0].x / 1000.0f);
|
noiseField.setFloat(others[0].y / 1000.0f);
|
if (others.length > 1)
|
{
|
borderfadeField.setFloat(others[1].x / 1000.0f);
|
fogField.setFloat(others[1].y / 1000.0f);
|
if (others.length > 2)
|
{
|
powerField.setFloat(others[2].x / 1000.0f);
|
opacityPowerField.setFloat(others[2].y / 1000.0f);
|
}
|
}
|
}
|
|
freezematerial = false;
|
}
|
|
void SetMaterial(Object3D object)
|
{
|
latestObject = object;
|
|
cMaterial mat = object.material;
|
|
if (mat == null)
|
{
|
ResetSliders();
|
return;
|
}
|
|
if (multiplyToggle != null)
|
multiplyToggle.setSelected(mat.multiply);
|
|
AllocProjectedVertices(object);
|
|
SetMaterial(mat, object.projectedVertices);
|
}
|
|
void ResetSliders()
|
{
|
cMaterial mid = new cMaterial(1);
|
|
mid.color = mid.modulation = mid.metalness = 0.1f;
|
mid.subsurface = mid.aniso = mid.anisoV = 0.1f;
|
mid.texture = 0.1f;
|
//mid.shadow = 0.25f;
|
// mid.shift = 1.5f;
|
// mid.sheen = 10f;
|
|
mid.parallax = 0;
|
|
SetMaterial(mid, null);
|
}
|
|
void SetAnchorMaterial(cMaterial mat)
|
{
|
anchor.Set(mat);
|
}
|
|
void Clear()
|
{
|
cameraView.Clear();
|
topView.Clear();
|
sideView.Clear();
|
frontView.Clear();
|
|
copy = client = null;
|
}
|
|
void labelAndField(Component label, Component field)
|
{
|
int lblWidth = label.getPreferredSize().width;
|
label.setBounds(5, widgetPos, lblWidth, textHeight);
|
field.setBounds(5 + lblWidth, widgetPos, 190 - lblWidth, textHeight);
|
widgetPos += textHeight;
|
}
|
|
/*
|
public void doLayout()
|
{
|
super.doLayout();
|
int width = bigPanel.getSize().width;
|
int height = bigPanel.getSize().height;
|
ctrlPanel.setBounds(0, 0, 200, height);
|
gridPanel.setBounds(200, 0, width - 200, height);
|
widgetPos = 5;
|
textHeight = nameField.getPreferredSize().height;
|
nameField.setBounds(5, widgetPos, 190, textHeight);
|
widgetPos += textHeight + 5;
|
buttonHeight = textureButton.getPreferredSize().height;
|
textureButton.setBounds(5, widgetPos, 190, buttonHeight);
|
widgetPos += buttonHeight + 5;
|
applyButton.setBounds(5, height - buttonHeight - 5, 190, buttonHeight);
|
}
|
*/
|
public void Select(cTreePath child, boolean deselect, boolean raise)
|
{
|
//assert(false);
|
//assert child.parent == group;
|
//assert group.children.indexOf(child) != -1;
|
|
System.err.println("selection : " + child); // + " --> " + child.Leaf());
|
|
//CameraPane.pointflow = null;
|
|
// if (child.Leaf() instanceof PointFlow)
|
// {
|
// CameraPane.pointflow = (PointFlow) child.Leaf();
|
// }
|
|
/**/
|
if (deselect || child == null)
|
{
|
//group.deselectAll();
|
//freeze = true;
|
GetTree().clearSelection();
|
//freeze = false;
|
|
if (child == null)
|
{
|
return;
|
}
|
}
|
|
//group.addSelectee(child);
|
|
//refreshContents();
|
/**/
|
|
//new Exception().printStackTrace();
|
|
//jList.setSelectedIndex(group.children.indexOf(child));
|
javax.swing.tree.TreePath path;
|
|
if (raise)
|
{
|
path = child.Raise2Material().GetTreePath();
|
} else
|
{
|
path = child.GetTreePath();
|
}
|
|
if (GetTree().isPathSelected(path) && !CameraPane.movingcamera)
|
{
|
GetTree().removeSelectionPath(path);
|
} else
|
{
|
GetTree().addSelectionPath(path);
|
}
|
//GetTree().expandPath(path);
|
}
|
|
public void itemStateChanged(ItemEvent event)
|
{
|
// System.out.println("Propagate = " + propagate);
|
if (event.getSource() == pinButton)
|
{
|
copy.pinned ^= true;
|
if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
|
{
|
((GroupEditor)copy.editWindow).listUI.remove(copy);
|
copy.CloseUI();
|
//copy.editWindow.refreshContents();
|
}
|
}
|
else
|
if (event.getSource() == propagateToggle)
|
{
|
propagate ^= true;
|
} else if (event.getSource() == multiplyToggle)
|
{
|
//copy.material.multiply ^= true;
|
//copy.selection.Multiply(multiply)
|
} else if (event.getSource() == toggleRenderItem)
|
{
|
cameraView.ToggleRender();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleDebugItem)
|
{
|
cameraView.ToggleDebug();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleFrustumItem)
|
{
|
cameraView.ToggleFrustum();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleFootContactItem)
|
{
|
cameraView.ToggleFootContact();
|
return;
|
} else if (event.getSource() == toggleLiveItem)
|
{
|
cameraView.ToggleLive();
|
return;
|
} else if (event.getSource() == toggleDLItem)
|
{
|
cameraView.ToggleDL();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
|
{
|
cameraView.ToggleTexture();
|
// june 2013 copy.HardTouch();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleTimelineItem)
|
{
|
timeline ^= true;
|
|
if (timeline)
|
{
|
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();
|
return;
|
} else if (event.getSource() == toggleFullScreenItem)
|
{
|
ToggleFullScreen();
|
frame.validate();
|
|
return;
|
} else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
|
{
|
cameraView.ToggleSwitch();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleHandleItem)
|
{
|
cameraView.ToggleHandles();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == togglePaintItem)
|
{
|
cameraView.TogglePaint();
|
cameraView.repaint();
|
return;
|
} else if (event.getSource() == toggleRootItem)
|
{
|
ToggleRoot();
|
return;
|
} else if (event.getSource() == animationItem)
|
{
|
ToggleAnimation();
|
return;
|
} else if (event.getSource() == flipVCB)
|
{
|
copy.flipV ^= true;
|
return;
|
} else if (event.getSource() == liveCB)
|
{
|
copy.live ^= true;
|
objEditor.refreshContents(true); // To show item colors
|
return;
|
} else if (event.getSource() == selectableCB)
|
{
|
copy.dontselect ^= true;
|
return;
|
} else if (event.getSource() == hideCB)
|
{
|
copy.hide ^= true;
|
copy.Touch(); // display list issue
|
objEditor.refreshContents(true); // To show item colors
|
return;
|
} else if (event.getSource() == sortCB)
|
{
|
copy.sort ^= true;
|
copy.Touch(); // display list issue
|
objEditor.refreshContents();
|
return;
|
} else if (event.getSource() == link2masterCB)
|
{
|
copy.link2master ^= true;
|
objEditor.refreshContents();
|
return;
|
}
|
if (event.getSource() == randomCB)
|
{
|
copy.random ^= true;
|
if (this instanceof RandomEditor)
|
{
|
cGridBag itemPanel = ((RandomEditor)this).itemPanel;
|
itemPanel.getComponent(0).setEnabled(!copy.random);
|
|
// Tooltip?
|
if (copy.random)
|
{
|
}
|
else
|
{
|
}
|
}
|
|
objEditor.refreshContents();
|
return;
|
}
|
if (event.getSource() == speedupCB)
|
{
|
copy.speedup ^= true;
|
return;
|
}
|
if (event.getSource() == rewindCB)
|
{
|
copy.rewind ^= true;
|
return;
|
}
|
if (event.getSource() == markCB)
|
{
|
copy.SwitchMark();
|
|
objEditor.refreshContents();
|
return;
|
}
|
}
|
|
public void actionPerformed(ActionEvent event)
|
{
|
Object source = event.getSource();
|
// SCRIPT DIALOG
|
if (source == okbutton)
|
{
|
textpanel.setVisible(false);
|
textpanel.remove(textarea);
|
|
copy.scriptnode.scripttext = GetArea().getText();
|
|
copy.scriptnode.Reset();
|
|
textarea = null;
|
textpanel = null;
|
}
|
if (source == cancelbutton)
|
{
|
textpanel.setVisible(false);
|
textpanel.remove(textarea);
|
|
textarea = null;
|
textpanel = null;
|
}
|
|
//applySelf();
|
//client.refreshEditWindow();
|
//refreshContents();
|
if (source == nameField)
|
{
|
//System.out.println("ObjEditor " + event);
|
applySelf0(true);
|
//parent.applySelf();
|
// conflicts with requestFocus objEditor.refreshContents();
|
} else if (source == resetButton)
|
{
|
CameraPane.fullreset = true;
|
copy.Reset(); // ResetMeshes();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else if (source == stepItem)
|
{
|
//cameraView.ONESTEP = true;
|
Globals.ONESTEP = true;
|
cameraView.repaint();
|
return;
|
} else if (source == stepButton)
|
{
|
copy.Step();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else if (source == slowerButton)
|
{
|
copy.Slower();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else if (source == fasterButton)
|
{
|
copy.Faster();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else if (source == remarkButton)
|
{
|
copy.Remark();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else if (source == stepAllButton)
|
{
|
copy.StepAll();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else if (source == resetAllButton)
|
{
|
//CameraPane.fullreset = true;
|
copy.ResetAll(); // ResetMeshes();
|
copy.Touch();
|
objEditor.refreshContents();
|
} else // if (event.getSource() == okButton)
|
// {
|
// System.out.println("Obj :: ok");
|
// applySelf();
|
// copy.deepCopySelf(client);
|
// ////client.refreshEditWindow();
|
// //client.closeEditWindow();
|
// Apply();
|
// Close();
|
// } else
|
// if (event.getSource() == applyButton)
|
// {
|
// System.out.println("Obj :: apply");
|
// applySelf();
|
// copy.deepCopySelf(client);
|
// //client.refreshEditWindow();
|
// Apply();
|
// } else
|
// if (event.getSource() == cancelButton)
|
// {
|
// System.out.println("Obj :: cancel");
|
// //applySelf();
|
// ////client.refreshEditWindow();
|
// //client.closeEditWindow();
|
// Close();
|
// }
|
// else
|
if (source == resetSlidersButton)
|
{
|
ResetSliders();
|
} else if (source == clearMaterialButton)
|
{
|
ClearMaterial();
|
} else if (source == createMaterialButton)
|
{
|
CreateMaterial();
|
} else if (source == clearPanelButton)
|
{
|
copy.ClearUI();
|
refreshContents(true);
|
} 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 (source == openItem)
|
{
|
Open();
|
//return true;
|
} else if (source == newItem)
|
{
|
New();
|
} else if (source == saveItem)
|
{
|
save();
|
//return true;
|
} else if (source == saveAsItem)
|
{
|
saveAs();
|
//return true;
|
} else if (source == reexportItem)
|
{
|
reexport();
|
//return true;
|
} else if (source == exportAsItem)
|
{
|
export();
|
//return true;
|
} else if (source == povItem)
|
{
|
generatePOV();
|
//return true;
|
} else if (event.getSource() == archiveItem)
|
{
|
cTools.Archive(frame);
|
return;
|
} else if (source == zBufferItem)
|
{
|
try
|
{
|
System.out.println("Obj :: UI");
|
//MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
|
MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme));
|
UIManager.setLookAndFeel(new MetalLookAndFeel());
|
((JComponent) frame.getContentPane()).updateUI();
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
//return true;
|
} /*
|
if (event.getSource() == normalLensItem)
|
{
|
cameraView.renderCamera.focalLength = 1;
|
cameraView.repaint();
|
//return true;
|
}
|
*/ else // combos...
|
if (source == texresMenu)
|
{
|
System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
|
copy.texres = texresMenu.getSelectedIndex();
|
return;
|
}
|
//else
|
{
|
//return super.actionPerformed(event); //, arg);
|
}
|
}
|
|
void New()
|
{
|
copy.skyboxname = "cubemaps/penguins-skyboxes/yonder";
|
copy.skyboxext = "jpg";
|
|
copy.versionlist = null;
|
copy.versionindex = -1;
|
|
while (copy.Size() > 0)
|
{
|
copy.remove(0);
|
}
|
|
copy.selection.clear();
|
|
if (copy == Grafreed.grafreed.universe)
|
{
|
CreateCameras();
|
cameraView.SetCamera(GetCamera(copy, 0), true);
|
cameraView.SetLight(GetCamera(copy, 4));
|
}
|
|
ResetModel();
|
|
//DuplicateVersion();
|
|
this.SetVersionStates();
|
objEditor.refreshContents();
|
}
|
|
static public byte[] Compress(Object3D o)
|
{
|
// Slower to actually compress.
|
try
|
{
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
|
ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
|
|
Object3D parent = o.parent;
|
o.parent = null;
|
|
out.writeObject(o);
|
|
o.parent = parent;
|
|
out.flush();
|
|
baos //zstream
|
.close();
|
out.close();
|
|
byte[] bytes = baos.toByteArray();
|
|
System.out.println("save #bytes = " + bytes.length);
|
return bytes;
|
} catch (Exception e)
|
{
|
System.err.println(e);
|
return null;
|
}
|
}
|
|
static public Object Uncompress(byte[] bytes)
|
{
|
System.out.println("restore #bytes = " + bytes.length);
|
try
|
{
|
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
//java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
|
ObjectInputStream in = new ObjectInputStream(bais); // istream);
|
Object obj = in.readObject();
|
|
bais //istream
|
.close();
|
in.close();
|
|
return obj;
|
} catch (Exception e)
|
{
|
System.err.println(e);
|
return null;
|
}
|
}
|
|
static public Object clone(Object o)
|
{
|
try
|
{
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ObjectOutputStream out = new ObjectOutputStream(baos);
|
|
out.writeObject(o);
|
|
out.flush();
|
out.close();
|
|
byte[] bytes = baos.toByteArray();
|
|
System.out.println("clone = " + bytes.length);
|
|
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
ObjectInputStream in = new ObjectInputStream(bais);
|
Object obj = in.readObject();
|
in.close();
|
|
return obj;
|
} catch (Exception e)
|
{
|
System.err.println(e);
|
return null;
|
}
|
}
|
|
cRadio GetCurrentTab()
|
{
|
cRadio ab;
|
for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
|
{
|
ab = (cRadio)e.nextElement();
|
if(ab.GetObject() == copy)
|
{
|
return ab;
|
}
|
}
|
|
return null;
|
}
|
|
|
public void Save()
|
{
|
//Save(true);
|
Replace();
|
SetVersionStates();
|
}
|
|
private boolean Equal(byte[] compress, byte[] name)
|
{
|
if (compress.length != name.length)
|
{
|
return false;
|
}
|
|
for (int i=compress.length; --i>=0;)
|
{
|
if (compress[i] != name[i])
|
return false;
|
}
|
|
return true;
|
}
|
|
void DeleteVersion()
|
{
|
for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
|
{
|
copy.versionlist[i] = copy.versionlist[i+1];
|
}
|
|
if (copy.versionlist[copy.versionindex] == null)
|
copy.versionindex -= 1;
|
|
if (copy.versionindex != -1)
|
CopyChanged(copy);
|
|
SetVersionStates();
|
|
SetCameras(false);
|
}
|
|
public boolean DuplicateVersion() // boolean user)
|
{
|
System.err.println("Save");
|
//Replace();
|
|
if (copy.versionlist == null)
|
{
|
copy.versionlist = new Object3D[100];
|
copy.versionindex = -1;
|
}
|
|
Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
|
|
boolean thesame = false;
|
|
// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
|
// {
|
// thesame = true;
|
// }
|
|
//EditorFrame.m_MainFrame.requestFocusInWindow();
|
if (!thesame)
|
{
|
for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
|
{
|
copy.versionlist[i] = copy.versionlist[i-1];
|
}
|
|
//tab.user[tab.versionindex] = user;
|
//boolean increment = true; // tab.graphs[tab.versionindex] == null;
|
|
copy.versionlist[++copy.versionindex] = compress;
|
|
// if (increment)
|
// tab.versionindex++;
|
}
|
|
//copy.RestoreBigData(versiontable);
|
|
//assert(hashtable.isEmpty());
|
|
// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
|
// {
|
// //tab.user[i] = false;
|
// copy.versionlist[i] = null;
|
// }
|
|
SetVersionStates();
|
|
// test save
|
if (false)
|
{
|
try
|
{
|
FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
|
ObjectOutputStream p = new ObjectOutputStream(ostream);
|
|
p.writeObject(copy);
|
|
p.flush();
|
|
ostream.close();
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
}
|
|
return !thesame;
|
}
|
|
boolean flashIt = true;
|
|
void RefreshSelection()
|
{
|
Object3D selection = new Object3D();
|
|
if (objEditor.copy.selection == null)
|
{
|
objEditor.copy.selection = new Object3D();
|
}
|
|
for (int i = 0; i < objEditor.copy.selection.size(); i++)
|
{
|
Object3D elem = objEditor.copy.selection.elementAt(i);
|
|
Object3D obj = objEditor.copy.GetObject(elem.GetUUID());
|
|
if (obj == null)
|
{
|
objEditor.copy.selection.remove(i--);
|
}
|
else
|
{
|
selection.add(obj);
|
objEditor.copy.selection.setElementAt(obj, i);
|
}
|
}
|
|
flashIt = false;
|
GetTree().clearSelection();
|
for (int i = 0; i < selection.size(); i++)
|
GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
|
flashIt = true;
|
|
//refreshContents(false);
|
}
|
|
void CopyChanged(Object3D changed)
|
{
|
Object3D obj = (Object3D)Grafreed.clone(changed.versionlist[copy.versionindex]);
|
|
assert(!obj.HasBigData());
|
|
boolean temp = CameraPane.SWITCH;
|
CameraPane.SWITCH = false;
|
|
changed.ExtractBigData(Grafreed.grafreed.universe.versiontable);
|
|
changed.clear();
|
|
obj.deepCopyNode(changed);
|
|
for (int i=0; i<obj.Size(); i++)
|
{
|
changed.add(obj.get(i));
|
}
|
|
changed.RestoreBigData(Grafreed.grafreed.universe.versiontable);
|
|
CameraPane.SWITCH = temp;
|
|
if (objEditor == this)
|
RefreshSelection();
|
//assert(hashtable.isEmpty());
|
|
objEditor.copy.Touch();
|
|
ResetModel();
|
objEditor.copy.HardTouch(); // recompile?
|
|
cRadio ab;
|
for (java.util.Enumeration e = objEditor.buttonGroup.getElements(); e.hasMoreElements();)
|
{
|
ab = (cRadio)e.nextElement();
|
Object3D test = objEditor.copy.GetObject(ab.object.GetUUID());
|
//ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
|
if (test != null)
|
{
|
test.editWindow = ab.object.editWindow;
|
ab.object = test;
|
}
|
}
|
|
objEditor.refreshContents(true);
|
}
|
|
cButton previousVersionButton;
|
cButton restoreButton;
|
cButton replaceButton;
|
cButton nextVersionButton;
|
cButton saveVersionButton;
|
cButton deleteVersionButton;
|
|
boolean muteSlider;
|
|
int VersionCount()
|
{
|
return copy.VersionCount();
|
}
|
|
public cGridBag versionSliderPane;
|
|
void SetVersionStates()
|
{
|
//if (true)
|
// return;
|
|
//cRadio tab = GetCurrentTab();
|
|
if (copy.versionindex == -2)
|
{
|
saveVersionButton.setEnabled(false);
|
restoreButton.setEnabled(false);
|
replaceButton.setEnabled(false);
|
previousVersionButton.setEnabled(false);
|
nextVersionButton.setEnabled(false);
|
deleteVersionButton.setEnabled(false);
|
versionSliderPane.setVisible(false);
|
}
|
else
|
{
|
restoreButton.setEnabled(copy.versionindex != -1);
|
replaceButton.setEnabled(copy.versionindex != -1);
|
|
previousVersionButton.setEnabled(copy.versionindex > 0);
|
nextVersionButton.setEnabled(copy.versionlist != null && copy.versionlist[copy.versionindex + 1] != null);
|
|
deleteVersionButton.setEnabled(copy.versionindex != -1);
|
//copy.versionlist[copy.versionindex + 1] != null);
|
|
muteSlider = true;
|
versionSlider.setMinimum(0);
|
versionSlider.setMaximum(VersionCount() - 1);
|
versionSlider.setInteger(copy.versionindex);
|
versionSlider.setEnabled(copy.versionindex != -1);
|
muteSlider = false;
|
|
versionSliderPane.setVisible(true);
|
}
|
}
|
|
public boolean PreviousVersion()
|
{
|
// Option?
|
Replace();
|
|
//System.err.println("Previous");
|
|
//cRadio tab = GetCurrentTab();
|
|
if (copy.versionindex == 0)
|
{
|
Grafreed.Beep();
|
return false;
|
}
|
|
// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
|
// {
|
// if (Save(false))
|
// tab.versionindex -= 1;
|
// else
|
// {
|
// if (tab.versionindex <= 0)
|
// return false;
|
// else
|
// tab.versionindex -= 1;
|
// }
|
// }
|
|
copy.versionindex -= 1;
|
|
CopyChanged(copy);
|
|
SetVersionStates();
|
|
SetCameras(false);
|
|
return true;
|
}
|
|
public boolean Restore()
|
{
|
System.err.println("Restore");
|
|
//cRadio tab = GetCurrentTab();
|
|
if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
|
{
|
Grafreed.Beep();
|
return false;
|
}
|
|
//CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
|
CopyChanged(copy);
|
|
SetVersionStates();
|
|
SetCameras(false);
|
|
return true;
|
}
|
|
public boolean Replace()
|
{
|
//System.err.println("Replace");
|
|
//cRadio tab = GetCurrentTab();
|
|
// < 0 means == -2 || == -1
|
if (copy.versionindex < 0 || copy.versionlist[copy.versionindex] == null)
|
{
|
// No version yet. OK. Grafreed.Beep();
|
return false;
|
}
|
|
copy.versionlist[copy.versionindex] = Duplicate(copy);
|
|
return true;
|
}
|
|
public void NextVersion()
|
{
|
// Option?
|
Replace();
|
|
//cRadio tab = GetCurrentTab();
|
|
if (copy.versionlist[copy.versionindex + 1] == null)
|
{
|
Grafreed.Beep();
|
return;
|
}
|
|
copy.versionindex += 1;
|
|
CopyChanged(copy);
|
|
//if (!tab.user[tab.versionindex])
|
// tab.graphs[tab.versionindex] = null;
|
|
SetVersionStates();
|
|
SetCameras(false);
|
}
|
|
void SetCameras(boolean set)
|
{
|
if (copy == Grafreed.grafreed.universe)
|
{
|
Camera neweye = (Camera)copy.GetObject(cameraView.cameras[cameraView.cameracount^1].GetUUID());
|
Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID());
|
|
cameraView.SetCamera(neweye, set);
|
cameraView.SetLight(newlight);
|
}
|
}
|
|
void ImportGFD(String url)
|
{
|
objEditor.ReadGFD(url, objEditor);
|
}
|
|
void ImportGFD()
|
{
|
FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
|
browser.setVisible(true);
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
String fullname = browser.getDirectory() + filename;
|
|
//Object3D readobj =
|
// objEditor.ReadGFD(fullname, objEditor);
|
//makeSomething(readobj);
|
ImportGFD(fullname);
|
}
|
}
|
|
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;
|
Globals.imagecount = 0;
|
|
Globals.ANIMATION ^= true;
|
|
Grafreed.wav.cursor = 0;
|
Grafreed.wav.loop = 0;
|
}
|
} else
|
{
|
Globals.ANIMATION ^= true;
|
}
|
}
|
|
void ToggleRoot()
|
{
|
assert false;
|
}
|
|
void Close()
|
{
|
if (client.parent != null)
|
{
|
client.closeEditWindow();
|
callee.refreshContents();
|
} else
|
{
|
System.exit(0);
|
}
|
}
|
|
void Apply()
|
{
|
client.refreshEditWindow();
|
if (callee != null)
|
{
|
callee.refreshContents();
|
}
|
}
|
|
void ClearMaterial()
|
{
|
// copy??
|
copy.ClearMaterialS();
|
if (copy.selection.size() > 0)
|
//SetMaterial(copy);
|
{
|
SetMaterial(copy.selection.get(0));
|
}
|
copy.SoftTouch();
|
refreshContents(true);
|
}
|
|
void CreateMaterial()
|
{
|
//copy.ClearMaterial(); // PATCH
|
copy.CreateMaterialS(multiplyToggle != null && multiplyToggle.isSelected());
|
if (copy.selection.size() > 0)
|
//SetMaterial(copy);
|
{
|
SetMaterial(copy.selection.get(0));
|
}
|
|
copy.SoftTouch();
|
refreshContents(true);
|
}
|
|
void loadClipboard(boolean cut)
|
{
|
System.err.println("hmm...");
|
}
|
|
void ClearSelection(boolean all)
|
{
|
assert false;
|
}
|
|
void PrintMemory()
|
{
|
assert false;
|
}
|
|
void ResetTransform()
|
{
|
assert false;
|
}
|
|
void ResetTransform(int mask)
|
{
|
assert false;
|
}
|
|
void FlipTransform()
|
{
|
assert false;
|
}
|
|
void ReduceMesh(boolean onlyone)
|
{
|
assert false;
|
}
|
|
void ResetCentroid()
|
{
|
assert false;
|
}
|
|
void EditSelection(boolean newWindow)
|
{
|
}
|
|
void Recompile()
|
{
|
copy.ResetBlockLoop(); // temporary problem
|
|
boolean random = CameraPane.SWITCH;
|
CameraPane.SWITCH = false; // parse everything
|
copy.ResetDisplayList();
|
copy.HardTouch();
|
CameraPane.SWITCH = random;
|
}
|
|
// public void applySelf()
|
// {
|
// //System.out.println("Object :: applySelf");
|
// if(false) // copy instanceof Composite)
|
// {
|
// Composite group = (Composite) copy;
|
//
|
// if (group.selection.size() == 0)
|
// applySelf(false);
|
// else
|
// {
|
// for (int i=0; i<group.selection.size(); i++)
|
// {
|
// Object3D elem = (Object3D)group.selection.elementAt(i);
|
//
|
// Object3D keep = copy;
|
// copy = elem;
|
// holdon = i < group.selection.size() - 1;
|
// applySelf(false);
|
// holdon = false;
|
// copy = keep;
|
// }
|
// }
|
// }
|
// else
|
// applySelf(true);
|
// }
|
|
boolean Equal(double a, double b)
|
{
|
return Math.abs(a - b) < 0.001;
|
}
|
|
void applySelf0(boolean name)
|
{
|
if (name)
|
{
|
copy.name = nameField.getText();
|
if (frame != null)
|
{
|
frame.setTitle(copy.name); // + " (id=" + copy.displaylist + ")");
|
}
|
}
|
|
if (materialtouched)
|
{
|
//if (copy.material == null)
|
//copy.material = new cMaterial(copy.GetMaterial());
|
|
current.color = (float) colorField.getFloat();
|
current.modulation = (float) saturationField.getFloat();
|
current.metalness = (float) metalnessField.getFloat();
|
current.diffuse = (float) diffuseField.getFloat();
|
current.specular = (float) specularField.getFloat();
|
current.shininess = (float) shininessField.getFloat();
|
current.shift = (float) shiftField.getFloat();
|
current.ambient = (float) ambientField.getFloat();
|
current.lightarea = (float) lightareaField.getFloat();
|
current.factor = (float) diffusenessField.getFloat();
|
current.velvet = (float) velvetField.getFloat();
|
current.sheen = (float) sheenField.getFloat();
|
current.subsurface = (float) subsurfaceField.getFloat();
|
current.bump = (float) backlitField.getFloat();
|
current.aniso = (float) anisoField.getFloat();
|
current.anisoV = (float) anisoVField.getFloat();
|
current.cameralight = (float) cameraField.getFloat();
|
current.diffuseness = (float) selfshadowField.getFloat();
|
current.shadow = (float) shadowField.getFloat();
|
current.texture = (float) textureField.getFloat();
|
current.opacity = (float) opacityField.getFloat();
|
current.parallax = (float) parallaxField.getFloat() - 0.125f;
|
current.fakedepth = (float) fakedepthField.getFloat();
|
current.shadowbias = (float) shadowbiasField.getFloat();
|
|
if (!cNumberSlider.frozen)
|
{
|
//System.out.println("Propagate = " + propagate);
|
copy.UpdateMaterial(anchor, current, propagate, true);
|
|
if (copy.material != null)
|
{
|
cMaterial mat = copy.material;
|
|
if (!Equal(colorField.getFloat(), mat.color))
|
colorField.SetToolTipValue((mat.color));
|
if (!Equal(saturationField.getFloat(), mat.modulation))
|
saturationField.SetToolTipValue((mat.modulation));
|
if (!Equal(metalnessField.getFloat(), mat.metalness))
|
metalnessField.SetToolTipValue((mat.metalness));
|
if (!Equal(diffuseField.getFloat(), mat.diffuse))
|
diffuseField.SetToolTipValue((mat.diffuse));
|
if (!Equal(specularField.getFloat(), mat.specular))
|
specularField.SetToolTipValue((mat.specular));
|
if (!Equal(shininessField.getFloat(), mat.shininess))
|
shininessField.SetToolTipValue((mat.shininess));
|
if (!Equal(shiftField.getFloat(), mat.shift))
|
shiftField.SetToolTipValue((mat.shift));
|
if (!Equal(ambientField.getFloat(), mat.ambient))
|
ambientField.SetToolTipValue((mat.ambient));
|
if (!Equal(lightareaField.getFloat(), mat.lightarea))
|
lightareaField.SetToolTipValue((mat.lightarea));
|
if (!Equal(diffusenessField.getFloat(), mat.factor))
|
diffusenessField.SetToolTipValue((mat.factor));
|
if (!Equal(velvetField.getFloat(), mat.velvet))
|
velvetField.SetToolTipValue((mat.velvet));
|
if (!Equal(sheenField.getFloat(), mat.sheen))
|
sheenField.SetToolTipValue((mat.sheen));
|
if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
|
subsurfaceField.SetToolTipValue((mat.subsurface));
|
if (!Equal(backlitField.getFloat(), mat.bump))
|
backlitField.SetToolTipValue((mat.bump));
|
if (!Equal(anisoField.getFloat(), mat.aniso))
|
anisoField.SetToolTipValue((mat.aniso));
|
if (!Equal(anisoVField.getFloat(), mat.anisoV))
|
anisoVField.SetToolTipValue((mat.anisoV));
|
if (!Equal(cameraField.getFloat(), mat.cameralight))
|
cameraField.SetToolTipValue((mat.cameralight));
|
if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
|
selfshadowField.SetToolTipValue((mat.diffuseness));
|
if (!Equal(shadowField.getFloat(), mat.shadow))
|
shadowField.SetToolTipValue((mat.shadow));
|
if (!Equal(textureField.getFloat(), mat.texture))
|
textureField.SetToolTipValue((mat.texture));
|
if (!Equal(opacityField.getFloat(), mat.opacity))
|
opacityField.SetToolTipValue((mat.opacity));
|
//if (!Equal(parallaxField.getFloat(), mat.parallax))
|
parallaxField.SetToolTipValue((mat.parallax));
|
if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
|
fakedepthField.SetToolTipValue((mat.fakedepth));
|
if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
|
shadowbiasField.SetToolTipValue((mat.shadowbias));
|
}
|
|
if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
|
{
|
copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
|
copy.projectedVertices[0].y = (int) (noiseField.getFloat() * 1000);
|
if (copy.projectedVertices.length > 1)
|
{
|
copy.projectedVertices[1].x = (int) (borderfadeField.getFloat() * 1000);
|
copy.projectedVertices[1].y = (int) (fogField.getFloat() * 1000);
|
if (copy.projectedVertices.length > 2)
|
{
|
copy.projectedVertices[2].x = (int) (powerField.getFloat() * 1000);
|
copy.projectedVertices[2].y = (int) (opacityPowerField.getFloat() * 1000);
|
}
|
}
|
}
|
}
|
|
if (!holdon)
|
{
|
anchor.Set(current);
|
}
|
}
|
|
copy.SoftTouch();
|
copy.ResetTransparency();
|
//copy.Touch();
|
}
|
|
cNumberSlider versionSlider; // Main
|
cNumberSlider versionField; // selection (off)
|
|
cNumberSlider scaleSlider;
|
cNumberSlider scaleInvSlider;
|
|
void ScaleSelection(float scale)
|
{
|
}
|
|
public void stateChanged(ChangeEvent e)
|
{
|
// assert(false);
|
// Main version slider
|
if (e.getSource() == versionSlider)
|
{
|
if (muteSlider)
|
return;
|
|
Replace();
|
|
int version = versionSlider.getInteger();
|
|
if (version != -1 && copy.versionlist[version] != null)
|
{
|
copy.versionindex = version;
|
CopyChanged(copy);
|
SetVersionStates();
|
SetCameras(false);
|
}
|
|
return;
|
}
|
|
// Version slider of edited object
|
if (e.getSource() == versionField)
|
{
|
int version = versionField.getInteger();
|
|
if (version != -1 && copy.versionindex != version && copy.versionlist[version] != null)
|
{
|
copy.versionindex = version;
|
CopyChanged(copy);
|
}
|
|
return;
|
}
|
|
if (e.getSource() == countField)
|
{
|
copy.count = countField.getInteger();
|
Globals.lighttouched = true;
|
objEditor.refreshContents();
|
return;
|
}
|
|
if (!muteSlider && (e.getSource() == scaleSlider || e.getSource() == scaleInvSlider))
|
{
|
float scale = scaleSlider.getInteger();
|
scale /= scaleInvSlider.getInteger();
|
|
ScaleSelection(scale);
|
return;
|
}
|
|
if (freezematerial)
|
{
|
return;
|
}
|
|
if (e.getSource() == fogdensityField
|
|| e.getSource() == fogintensityField
|
|| e.getSource() == elevationField
|
|| e.getSource() == focusField
|
|| 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;
|
cameraView.options1[2] = (float) shadowblurField.getFloat();
|
cameraView.options2[0] = (float) fogdensityField.getFloat() / 100;
|
cameraView.options2[1] = (float) fogintensityField.getFloat() / 25;
|
cameraView.options2[2] = (float) elevationField.getFloat() / 100;
|
|
//System.out.println("Focus = " + cameraView.options1[0]);
|
//System.out.println("Aperture = " + cameraView.options1[1]);
|
//System.out.println("ShadowBlur = " + cameraView.options1[2]);
|
//System.out.println("Fog = " + cameraView.options2[0]);
|
//System.out.println("Intensity = " + cameraView.options2[1]);
|
//System.out.println("Elevation = " + cameraView.options2[2]);
|
|
cameraView.repaint();
|
} else
|
//if (e.getSource() == diffuseField ||
|
{
|
//System.out.println("stateChanged = " + this);
|
materialtouched = true;
|
|
if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
|
{
|
saturationField.setFloat(1);
|
}
|
|
applySelf();
|
//System.out.println("this = " + this);
|
//System.out.println("PARENT = " + parent);
|
//if (parent != null)
|
// parent.applySelf();
|
if (e.getSource() == normalpushField)
|
{
|
objEditor.refreshContents();
|
//Refresh();
|
}
|
else
|
refreshContents();
|
// ??? client.refreshEditWindow();
|
}
|
//else
|
//super.stateChanged(e);
|
}
|
|
public void applySelf()
|
{
|
//group.name = nameField.getText();
|
//objEditor.applySelf();
|
|
// OCT2018: assert (objEditor == this);
|
if (copy.selection == null || copy.selection.size() == 0)
|
//super.applySelf()
|
; else
|
{
|
for (int i = 0; i < copy.selection.size(); i++)
|
{
|
Object3D elem = (Object3D) copy.selection.elementAt(i);
|
|
Object3D keep = objEditor.copy;
|
objEditor.holdon = i < copy.selection.size() - 1;
|
objEditor.copy = elem;
|
try
|
{
|
objEditor.applySelf0(false);
|
} catch (Error e)
|
{
|
System.out.println("PROTECTED CRASH");
|
e.printStackTrace();
|
}
|
objEditor.holdon = false;
|
objEditor.copy = keep;
|
}
|
}
|
|
if (normalpushField != null)
|
copy.NORMALPUSH = (float)normalpushField.getFloat() / 100;
|
}
|
|
void SnapObject()
|
{
|
if (copy.selection.size() > 0)
|
{
|
Object3D obj = (Object3D)copy.selection.elementAt(0);
|
SnapObject(obj);
|
}
|
}
|
|
void SnapObject(Object3D obj)
|
{
|
Object3D point = CameraPane.selectedpoint;
|
|
cVector v = new cVector();
|
point.TransformToWorld(v);
|
obj.TransformToLocal(v);
|
|
//LA.xformPos(v, point.toParent);
|
//LA.xformPos(v, obj.fromParent);
|
|
// System.err.println("v = " + v);
|
|
if (obj.toParent == null)
|
{
|
obj.toParent = LA.newMatrix();
|
obj.fromParent = LA.newMatrix();
|
}
|
|
double[][] mat = LA.newMatrix();
|
|
double vertical = v.y;
|
|
//vertical = 0;
|
|
LA.matTranslate(mat, v.x, vertical, v.z);
|
LA.matConcat(obj.toParent, mat, obj.toParent);
|
LA.matIdentity(mat);
|
LA.matTranslate(mat, -v.x, -vertical, -v.z);
|
LA.matConcat(mat, obj.fromParent, obj.fromParent);
|
|
refreshContents();
|
}
|
|
void ScreenFit()
|
{
|
if (false) // copy instanceof Composite)
|
{
|
Composite group = (Composite) copy;
|
|
if (group.selection.size() == 0)
|
{
|
ScreenFit();
|
return;
|
}
|
|
Object3D obj = group.selection.elementAt(0);
|
ScreenFit(obj, false);
|
} else
|
{
|
ScreenFit(copy, false);
|
}
|
}
|
static cVector interest = new cVector();
|
static cVector centroid = new cVector();
|
|
void ScreenFit(Object3D obj, boolean shadowonly)
|
{
|
//cVector origin = new cVector(0,0,0);
|
// cVector minima = new cVector();
|
// cVector maxima = new cVector();
|
// // try
|
// {
|
// obj.getBounds(minima, maxima, true);
|
// }
|
// // catch(Exception e)
|
// //{
|
// // e.printStackTrace();
|
// //}
|
// //cVector interest = new cVector(0,0,0);
|
// cVector interest = new cVector((minima.x+maxima.x)/2,
|
// (minima.y+maxima.y)/2,
|
// (minima.z+maxima.z)/2);
|
//
|
// // crash protection
|
// if (Double.isNaN(interest.x))
|
// return;
|
|
boolean success = obj.getCentroid(centroid); // sept 2014, true);
|
|
if (!success)
|
//new Exception().printStackTrace();
|
{
|
System.err.println("NO CENTROID FOR : " + obj);
|
}
|
|
if (Double.isNaN(centroid.x))
|
{
|
System.err.println("interestBUG : " + centroid);
|
return;
|
}
|
|
// CameraPane.selectedpoint.toParent[3][0] = centroid.x;
|
// CameraPane.selectedpoint.toParent[3][1] = centroid.y;
|
// CameraPane.selectedpoint.toParent[3][2] = centroid.z;
|
|
// System.out.println("ScreenFit : " + this);
|
// System.out.println("obj : " + obj);
|
if (!CameraPane.TRACK)
|
{
|
// System.out.println("centroid : " + centroid);
|
}
|
// System.out.println("minima : " + minima);
|
// System.out.println("maxima : " + maxima);
|
|
interest.set(centroid); // aout 2013
|
|
double height = interest.y;
|
|
if (obj.parent != null)
|
{
|
// obj.parent.TransformToWorld(interest);
|
}
|
|
if (!CameraPane.TRACK)
|
{
|
// System.out.println("interest : " + interest);
|
}
|
//if (event.getSource() == lookAtItem)
|
{
|
/*
|
cVector delta = new cVector();
|
// manipCamera?
|
delta.set(cameraView.renderCamera.location);
|
delta.add(interest);
|
delta.sub(cameraView.renderCamera.lookAt);
|
cameraView.renderCamera.setLocation(delta);
|
*/
|
|
if (height != 0)
|
{
|
double k = 1; // 0.1;
|
|
interest.y = k * interest.y + (1 - k) * height;
|
}
|
|
// CameraPane.zoomonce = true;
|
|
// june 2014
|
Camera parentcam = cameraView.manipCamera;
|
|
if (cameraView.manipCamera == cameraView.cameras[0])
|
{
|
parentcam = cameraView.cameras[1];
|
}
|
|
if (cameraView.manipCamera == cameraView.cameras[1])
|
{
|
parentcam = cameraView.cameras[0];
|
}
|
|
|
//assert (parentcam != manipCamera);
|
if (parentcam == cameraView.manipCamera) // probably the light
|
return;
|
|
cameraView.lightLookAt.set(interest);
|
|
if (!shadowonly)
|
{
|
for (int count = parentcam.GetTransformCount(); --count>=0;)
|
LA.xformPos(interest, parentcam.toParent, interest);
|
|
cameraView.targetLookAt.set(interest);
|
}
|
|
cameraView.pingthread.StepToTarget(false); // fev 2014
|
/*
|
delta.set(topView.renderCamera.location);
|
delta.add(interest);
|
delta.sub(topView.renderCamera.lookAt);
|
topView.renderCamera.setLocation(delta);
|
delta.set(frontView.renderCamera.location);
|
delta.add(interest);
|
delta.sub(frontView.renderCamera.lookAt);
|
frontView.renderCamera.setLocation(delta);
|
delta.set(sideView.renderCamera.location);
|
delta.add(interest);
|
delta.sub(sideView.renderCamera.lookAt);
|
sideView.renderCamera.setLocation(delta);
|
*/
|
|
//cameraView.renderCamera.setFocus(interest);
|
//topView.renderCamera.setFocus(interest);
|
//frontView.renderCamera.setFocus(interest);
|
//sideView.renderCamera.setFocus(interest);
|
}
|
//else
|
// cameraView.renderCamera.setLocation(interest);
|
cameraView.renderCamera.computeTransform();
|
topView.renderCamera.computeTransform();
|
frontView.renderCamera.computeTransform();
|
sideView.renderCamera.computeTransform();
|
}
|
|
void ScreenFit0(Object3D obj, boolean shadowonly)
|
{
|
ScreenFit(obj, shadowonly);
|
cameraView.repaint();
|
topView.repaint();
|
frontView.repaint();
|
sideView.repaint();
|
}
|
|
void ScreenFitPoint()
|
{
|
Object3D obj = CameraPane.selectedpoint;
|
|
objEditor.ScreenFit(obj, false);
|
|
cameraView.pingthread.StepToTarget(); //true); // aout 2013
|
refreshContents();
|
}
|
|
void refreshContents()
|
{
|
refreshContents(false);
|
}
|
|
void refreshContents(boolean cp)
|
{
|
//System.out.println("REPAINT : " + this);
|
if (topView == null)
|
{
|
new Exception().printStackTrace();
|
return;
|
}
|
topView.repaint();
|
frontView.repaint();
|
sideView.repaint();
|
cameraView.repaint();
|
|
/* Balloons? */
|
|
if (cp)
|
{
|
if (GetTree() != null)
|
{
|
GetTree().revalidate();
|
GetTree().repaint();
|
}
|
|
radioPanel.revalidate();
|
radioPanel.repaint();
|
ctrlPanel.validate(); // ? new
|
ctrlPanel.repaint();
|
}
|
|
if (previousVersionButton != null && copy.versionlist != null)
|
SetVersionStates();
|
|
cameraView.requestFocusInWindow();
|
}
|
|
static TweenManager tweenManager = new TweenManager();
|
|
void makeSomething(Object3D thing, boolean resetmodel) // deselect)
|
{
|
if (Globals.REPLACEONMAKE) // && resetmodel)
|
Save();
|
//Tween.set(thing, 0).target(1).start(tweenManager);
|
//Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
|
// if (thing instanceof GenericJointDemo)
|
// Tween.to(thing, 0, 100)
|
// .target(0, 0, -50)
|
// .ease(Linear.INOUT)
|
// //.delay(1000)
|
// //.repeat(2, 200)
|
// .start(tweenManager);
|
// assert(copy instanceof Composite);
|
/*Composite*/ Object3D group = /*(Composite)*/ copy;
|
|
// if (group.name.equals("TEMP"))
|
// {
|
// if (!(group.get(0) instanceof Composite))
|
// {
|
// System.out.println("NO GROUP TO ADD " + thing);
|
// return;
|
// }
|
//
|
// group = (Composite) group.get(0);
|
// }
|
|
//System.out.println("makeSomething of " + thing);
|
|
/*
|
if (deselect && jList != null)
|
{
|
int indices[] = jList.getSelectedIndices();
|
for (int i = indices.length - 1; i >= 0; i--)
|
{
|
//objList.deselect(indices[i]);
|
Object3D obj = (Object3D)group.children.elementAt(indices[i]);
|
group.removeSelectee(obj);
|
}
|
}
|
/**/
|
|
if (false) // group.parent == null)
|
{
|
group.addChild(thing);
|
} else
|
{
|
if (true) // ?? group.parent != null)
|
{
|
/*
|
Composite tmp = new cGroup();
|
if(group.parent != null)
|
LA.matCopy(group.parent.GlobalTransform(), tmp.fromParent);
|
if(!LA.isIdentity(tmp.fromParent))
|
{
|
LA.matInvert(tmp.fromParent, tmp.toParent);
|
group.addChild(tmp);
|
tmp.addChild(thing);
|
}
|
else
|
group.addChild(thing);
|
*/
|
if (false) // why??
|
// !LA.isIdentity(group.GlobalTransform()))
|
{
|
Composite tmp = new cGroup();
|
tmp.toParent = LA.newMatrix();
|
tmp.fromParent = LA.newMatrix();
|
LA.matCopy(group.GlobalTransform(), tmp.toParent);
|
LA.matInvert(tmp.toParent, tmp.fromParent);
|
tmp.addChild(thing);
|
group.addChild(tmp);
|
} else
|
{
|
group.addChild(thing);
|
}
|
} else
|
{
|
group.addChild(thing);
|
}
|
}
|
//group.addSelectee(thing);
|
//int index = objList.getItemCount();
|
//objList.add(thing.name);
|
//objList.select(index);
|
//group.refreshEditWindow();
|
if (resetmodel)
|
{
|
ResetModel();
|
Select(thing.GetTreePath(), true, false); // unselect... false);
|
|
if (thing.Size() == 0)
|
{
|
//EditSelection(false);
|
}
|
|
refreshContents();
|
}
|
|
//if ((thing instanceof CSG))
|
// objEditor.EditSelection();
|
}
|
|
void ResetModel()
|
{
|
//assert(copy instanceof Composite);
|
Object3D /*Composite*/ group = (Object3D /*Composite*/) objEditor.copy;
|
|
// necessary? group.selection = new Object3D(); // java.util.Vector();
|
|
//new Exception().printStackTrace();
|
freezemodel = true;
|
GetTree().setModel(new cTreeModel(group));
|
GetTree().setCellRenderer(new cTreeModel.Renderer());
|
//group.refreshEditWindow();
|
//refreshContents();
|
|
if (objEditor.copy.selection == null)
|
{
|
objEditor.copy.selection = new Object3D();
|
}
|
|
for (int j = 0; j < objEditor.copy.selection.size(); j++)
|
{
|
Object3D item = objEditor.copy.selection.get(j);
|
|
if (item instanceof cGroup && ((cGroup) item).transientlink)
|
{
|
item = ((cGroup) item).get(0);
|
}
|
|
if (item.count <= 1) // ??? == 0)
|
{
|
objEditor.copy.selection.remove(item);
|
}
|
}
|
|
boolean first = true;
|
|
for (int i = objEditor.copy.selection.size(); --i >= 0;)
|
{
|
Object3D item = objEditor.copy.selection.get(i);
|
|
if (item instanceof cGroup && ((cGroup) item).transientlink)
|
{
|
item = ((cGroup) item).get(0);
|
}
|
|
Select(item.GetTreePath(), first, false);
|
first = false;
|
}
|
|
freezemodel = false;
|
}
|
|
/*
|
void ResetModel()
|
{
|
assert false;
|
}
|
*/
|
class LoadGFDThread extends Thread
|
{
|
//String filename;
|
//iCallBack callback;
|
|
boolean running;
|
|
java.util.Stack stack;
|
|
LoadGFDThread(/*String fullname, iCallBack cb*/)
|
{
|
//filename = fullname;
|
//callback = cb;
|
stack = new java.util.Stack();
|
}
|
|
void add(String filename, iCallBack cb)
|
{
|
stack.push(filename);
|
stack.push(cb);
|
}
|
|
public void run()
|
{
|
boolean wasbusy = false;
|
|
for (;;)
|
{
|
try
|
{
|
sleep(10);
|
} catch (Exception e)
|
{
|
};
|
if (!stack.empty())
|
{
|
running = true;
|
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
iCallBack callback = (iCallBack) stack.pop();
|
String filename = (String) stack.pop();
|
System.out.println(" ------- ------- ------ ------ ----- LOADING2... " + filename);
|
callback.Callback(ReadGFD(filename));
|
System.gc();
|
wasbusy = true;
|
running = false;
|
} else
|
{
|
if (wasbusy)
|
{
|
frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
wasbusy = false;
|
}
|
}
|
}
|
}
|
}
|
|
LoadGFDThread loadGFDThread;
|
|
void ReadGFD(String fullname, iCallBack cb)
|
{
|
if (loadGFDThread == null)
|
{
|
loadGFDThread = new LoadGFDThread(/*fullname, cb*/);
|
loadGFDThread.start();
|
}
|
|
if (loadGFDThread.running)
|
{
|
Grafreed.Beep();
|
return;
|
}
|
|
loadGFDThread.add(fullname, cb);
|
}
|
|
static Object3D ReadGFD(String fullname)
|
{
|
Object3D readobj = null;
|
|
java.net.URL url = null;
|
|
try
|
{
|
url = new java.net.URL(fullname);
|
} catch (Exception e)
|
{
|
try
|
{
|
url = new java.net.URL("file:///" + fullname);
|
} catch (Exception e2)
|
{
|
e2.printStackTrace();
|
}
|
}
|
|
try
|
{
|
// Try compressed version first.
|
java.io.InputStream istream //= new java.io.FileInputStream(fullname);
|
= url.openStream();
|
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();
|
|
readobj.ResetDisplayList();
|
} catch (Exception e)
|
{
|
if (!e.toString().contains("GZIP"))
|
e.printStackTrace();
|
|
try
|
{
|
java.io.InputStream istream //= new java.io.FileInputStream(fullname);
|
= url.openStream();
|
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(); }
|
// catch(ClassNotFoundException e) { System.out.println("ClassNotFoundException"); e.printStackTrace(); }
|
// catch(ClassCastException e) {}
|
|
return readobj;
|
}
|
|
static Object3D ReadGFDz(String fullname)
|
{
|
Object3D readobj = null;
|
|
try
|
{
|
java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
|
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();
|
zstream.close();
|
|
readobj.ResetDisplayList();
|
} catch (java.io.StreamCorruptedException e)
|
{
|
e.printStackTrace();
|
} catch (java.io.IOException e)
|
{
|
System.out.println("IOexception");
|
e.printStackTrace();
|
} catch (ClassNotFoundException e)
|
{
|
System.out.println("ClassNotFoundException");
|
e.printStackTrace();
|
} catch (ClassCastException e)
|
{
|
}
|
|
return readobj;
|
}
|
|
void LoadIt(Object obj)
|
{
|
if (obj == null)
|
{
|
// Invalid file
|
return;
|
}
|
|
System.out.println("Loaded " + obj);
|
//new Exception().printStackTrace();
|
Object3D readobj = (Object3D) obj;
|
|
// may 2014
|
readobj.RepairTexture(); // Serialization issue
|
|
if (readobj != null)
|
{
|
//if (Globals.SAVEONMAKE) // A new object cannot share meshes
|
// Save();
|
try
|
{
|
//readobj.deepCopySelf(copy);
|
copy.clear(); // june 2014
|
copy.skyboxname = readobj.skyboxname;
|
copy.skyboxext = readobj.skyboxext;
|
for (int i = 0; i < readobj.size(); i++)
|
{
|
Object3D child = readobj.get(i); // reserve(i);
|
// if (child == null)
|
// continue;
|
if (true) // child instanceof Composite)
|
{
|
//Composite cams = (Composite) child;
|
Object3D cams = (Object3D) child;
|
if (!(cams instanceof FileObject) /*&& cams.count > 0 ZEROCOUNT*/ && cams.size() > 0 && cams.get(0) instanceof Camera)
|
{
|
System.out.println("UPDATE CAMS");
|
// patch
|
// june 2014 for (int j = 0; j < 5; j++)
|
// {
|
// Object3D cam = cams.get(j);
|
// // oct 2012 if(cam.parent == null)
|
// cam.parent = copy.get(0); // cams;
|
// }
|
cameraView.SetCamera((Camera) cams.get(0), true);
|
cameraView.SetLight((Camera) cams.get(4)); // MAJOR CRASH!!
|
topView.SetCamera((Camera) cams.get(1), true);
|
frontView.SetCamera((Camera) cams.get(2), true);
|
sideView.SetCamera((Camera) cams.get(3), true);
|
|
// copy.get(0).clear();
|
// copy.get(0).addAll(cams);
|
|
//readobj.release(i);
|
// continue;
|
}
|
}
|
child.parent = null;
|
(/*(Composite)*/copy).addChild(child);
|
|
// readobj.release(i);
|
}
|
} catch (ClassCastException e)
|
{
|
e.printStackTrace();
|
assert (false);
|
Composite c = (Composite) copy;
|
c.children.clear();
|
CSG csg = new CSG();
|
Object3D /*Composite*/ parent = copy.parent;
|
readobj.deepCopySelf(csg);
|
copy.parent = parent;
|
c.addChild(csg);
|
}
|
|
copy.versionlist = readobj.versionlist;
|
copy.versionindex = readobj.versionindex;
|
copy.versiontable = readobj.versiontable;
|
|
if (copy.versionlist == null)
|
{
|
// Backward compatibility
|
copy.versionlist = new Object3D[100];
|
copy.versionindex = -1;
|
|
//Save(true);
|
}
|
|
//? SetUndoStates();
|
|
cameraView.RevertCamera();
|
|
ResetModel();
|
copy.HardTouch(); // recompile?
|
refreshContents();
|
}
|
}
|
|
void Open() // throws ClassNotFoundException
|
{
|
if (Grafreed.standAlone)
|
{
|
FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
|
browser.setVisible(true);
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
copy.ClearUI();
|
copy.clear(); // force
|
|
lastname = browser.getDirectory() + filename;
|
/*Object3D readobj =*/ ReadGFD(lastname, new iCallBack()
|
{
|
|
public void Callback(Object obj)
|
{
|
LoadIt(obj);
|
}
|
|
public void DragGesture()
|
{
|
}
|
});
|
/*
|
try
|
{
|
FileInputStream istream = new FileInputStream(lastname);
|
ObjectInputStream p = new ObjectInputStream(istream);
|
|
readobj = (Object3D) p.readObject();
|
istream.close();
|
|
readobj.Reset();
|
|
Composite parent = client.parent;
|
|
//System.out.println("read obj = " + readobj);
|
readobj.deepCopySelf(copy);
|
//System.out.println("local obj = " + copy);
|
//client = copy = readobj;
|
//client.editWindow = this;
|
//client.parent = parent;
|
//Apply();
|
|
ResetModel();
|
refreshContents();
|
}
|
catch(IOException e) { e.printStackTrace(); }
|
catch(ClassNotFoundException e) { e.printStackTrace(); }
|
catch(ClassCastException e)
|
*/
|
|
/*
|
try
|
{
|
readobj.deepCopySelf(copy);
|
}
|
catch(ClassCastException e)
|
{
|
Composite c = (Composite) copy;
|
c.children.clear();
|
CSG csg = new CSG();
|
Composite parent = copy.parent;
|
readobj.deepCopySelf(csg);
|
copy.parent = parent;
|
c.addChild(csg);
|
}
|
ResetModel();
|
refreshContents();
|
*/
|
}
|
} else
|
{
|
//new TextFrame(buffer.toString());
|
}
|
}
|
|
void save()
|
{
|
Replace();
|
|
if (lastname == null)
|
{
|
return;
|
}
|
|
try
|
{
|
FileOutputStream ostream = new FileOutputStream(lastname);
|
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);
|
//PrintStream ps = new PrintStream(fos);
|
//ps.print(buffer.toString());
|
} catch (IOException e)
|
{
|
e.printStackTrace();
|
}
|
}
|
|
String lastname;
|
|
void saveAs()
|
{
|
if (Grafreed.standAlone)
|
{
|
FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
|
browser.setVisible(true);
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
if (!filename.endsWith(".gfd"))
|
filename += ".gfd";
|
lastname = browser.getDirectory() + filename;
|
save();
|
}
|
} else
|
{
|
//new TextFrame(buffer.toString());
|
}
|
}
|
|
void reexport()
|
{
|
if (copy.selection.size() == 0)
|
return;
|
|
Object3D object = copy.selection.get(0);
|
|
FileObject fileobj = null;
|
|
if (object instanceof FileObject)
|
fileobj = (FileObject)object;
|
|
if (object.fileparent != null)
|
{
|
assert(fileobj == null);
|
|
fileobj = (FileObject) object.fileparent;
|
}
|
|
if (fileobj != null)
|
{
|
System.out.println("WriteObject " + object + " : " + fileobj.name);
|
WriteObject(object, fileobj.name);
|
}
|
}
|
|
void export()
|
{
|
if (copy.selection.size() == 0)
|
return;
|
|
if (copy.selection.get(0) instanceof Mocap)
|
{
|
// Export Motion Capture
|
FileDialog browser = new FileDialog(frame, "Export Motion", FileDialog.SAVE);
|
browser.setVisible(true);
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
if (!filename.endsWith(".bvh"))
|
{
|
filename += ".bvh";
|
}
|
|
try
|
{
|
FileOutputStream ostream = new FileOutputStream(browser.getDirectory() + filename);
|
OutputStreamWriter writer = new OutputStreamWriter(ostream);
|
|
writer.write(MocapHeader.header);
|
copy.selection.get(0).WriteTo(writer);
|
writer.flush();
|
|
writer.close();
|
ostream.close();
|
} catch (Exception e)
|
{
|
e.printStackTrace();
|
}
|
|
}
|
}
|
else
|
//if (GrafreeD.standAlone)
|
{
|
FileDialog browser = new FileDialog(frame, "Export", FileDialog.SAVE);
|
browser.setVisible(true);
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
if (!filename.endsWith(".gfd"))
|
{
|
filename += ".gfd";
|
}
|
//lastname = browser.getDirectory() + filename;
|
//save();
|
WriteObject(copy.selection.get(0), browser.getDirectory() + filename);
|
}
|
// } else
|
// {
|
// //new TextFrame(buffer.toString());
|
}
|
}
|
|
void WriteObject(Object3D obj, String filename)
|
{
|
try
|
{
|
FileOutputStream ostream = new FileOutputStream(filename);
|
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);
|
|
obj.parent = objectparent;
|
|
//Object3D parent = object.parent;
|
|
object.parent = null;
|
// OK... object.Stripify();
|
|
p.writeObject(object);
|
p.flush();
|
|
zstream.close();
|
ostream.close();
|
|
// group.selection.get(0).parent = parent;
|
//FileOutputStream fos = new FileOutputStream(fullname);
|
//PrintStream ps = new PrintStream(fos);
|
//ps.print(buffer.toString());
|
} catch (IOException e)
|
{
|
}
|
}
|
|
void generatePOV()
|
{
|
StringBuffer buffer = new StringBuffer(5000);
|
Rectangle bnds = cameraView.getBounds();
|
buffer.append("#default {\n texture {\n");
|
buffer.append(" pigment { color rgb <1,1,1> }\n");
|
buffer.append(" finish { ambient 0.2 diffuse 0.6 phong 0.2 } } }\n\n");
|
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)
|
{
|
FileDialog browser = new FileDialog(frame, "Export POV", 1);
|
browser.show();
|
String filename = browser.getFile();
|
if (filename != null && filename.length() > 0)
|
{
|
String fullname = browser.getDirectory() + filename;
|
try
|
{
|
FileOutputStream fos = new FileOutputStream(fullname);
|
PrintStream ps = new PrintStream(fos);
|
ps.print(buffer.toString());
|
} catch (IOException e)
|
{
|
}
|
}
|
} else
|
{
|
new TextFrame(buffer.toString());
|
}
|
}
|
|
Object3D client;
|
Object3D copy;
|
MenuBar menuBar;
|
Menu fileMenu;
|
MenuItem newItem;
|
MenuItem openItem;
|
MenuItem saveItem;
|
MenuItem saveAsItem;
|
MenuItem exportAsItem;
|
MenuItem reexportItem;
|
MenuItem povItem;
|
MenuItem closeItem;
|
|
CheckboxMenuItem zBufferItem;
|
//MenuItem normalLensItem;
|
MenuItem stepItem;
|
CheckboxMenuItem toggleLiveItem;
|
CheckboxMenuItem toggleFullScreenItem;
|
CheckboxMenuItem toggleTimelineItem;
|
CheckboxMenuItem toggleRenderItem;
|
CheckboxMenuItem toggleDebugItem;
|
CheckboxMenuItem toggleFrustumItem;
|
CheckboxMenuItem toggleFootContactItem;
|
CheckboxMenuItem toggleDLItem;
|
CheckboxMenuItem toggleTextureItem;
|
CheckboxMenuItem toggleSwitchItem;
|
CheckboxMenuItem toggleRootItem;
|
CheckboxMenuItem animationItem;
|
MenuItem archiveItem;
|
CheckboxMenuItem toggleHandleItem;
|
CheckboxMenuItem togglePaintItem;
|
JSplitPane mainPanel;
|
JScrollPane scrollpane;
|
|
JPanel toolbarPanel;
|
|
cGridBag treePanel;
|
|
JPanel radioPanel;
|
ButtonGroup buttonGroup;
|
|
cGridBag toolboxPanel;
|
cGridBag skyboxPanel;
|
cGridBag materialPanel;
|
cGridBag ctrlPanel;
|
cGridBag figurePanel;
|
cGridBag fullscenePanel;
|
|
JScrollPane infoPanel;
|
|
cGridBag optionsPanel;
|
|
JTabbedPane objectTabbedPane;
|
boolean materialFlushed;
|
Object3D latestObject;
|
|
cGridBag transformPanel;
|
cGridBag XYZPanel;
|
|
JSplitPane gridPanel;
|
JSplitPane bigPanel;
|
|
cGridBag bigThree;
|
cGridBag scenePanel;
|
cGridBag centralPanel;
|
JSplitPane cameraPanel;
|
JPanel timelinePanel;
|
JMenuBar timelineMenubar;
|
JSplitPane framePanel;
|
JTextArea/*Field*/ nameField;
|
//cButton textureButton;
|
cButton okButton;
|
cButton applyButton;
|
cButton cancelButton;
|
cButton resetSlidersButton;
|
cButton clearMaterialButton;
|
cButton createMaterialButton;
|
cCheckBox propagateToggle;
|
cCheckBox multiplyToggle;
|
cButton clearPanelButton;
|
//CameraScroller topScroll;
|
//CameraScroller frontScroll;
|
//CameraScroller sideScroll;
|
CameraPane topView;
|
CameraPane frontView;
|
CameraPane sideView;
|
CameraPane cameraView;
|
// GLCanvas worldView;
|
int labelHeight;
|
int textHeight;
|
int buttonHeight;
|
int widgetPos;
|
static final int panelWidth = 200;
|
static final int panelMargin = 5;
|
static final int itemWidth = 190;
|
boolean materialtouched = false;
|
boolean propagate = true;
|
boolean freezematerial = false;
|
boolean freezemodel = false;
|
boolean holdon = false; // multiple selection
|
cMaterial anchor = new cMaterial(1);
|
cMaterial current = new cMaterial();
|
JLabel fogdensityLabel;
|
NumberSlider fogdensityField;
|
JLabel fogintensityLabel;
|
NumberSlider fogintensityField;
|
JLabel elevationLabel;
|
NumberSlider elevationField;
|
JLabel focusLabel;
|
NumberSlider focusField;
|
JLabel apertureLabel;
|
NumberSlider apertureField;
|
JLabel shadowblurLabel;
|
NumberSlider shadowblurField;
|
// MATERIAL
|
JLabel materialLabel;
|
JLabel colorLabel;
|
cNumberSlider colorField;
|
JLabel modulationLabel;
|
cNumberSlider saturationField;
|
JLabel metalnessLabel;
|
cNumberSlider metalnessField;
|
JLabel diffuseLabel;
|
cNumberSlider diffuseField;
|
JLabel specularLabel;
|
cNumberSlider specularField;
|
JLabel shininessLabel;
|
cNumberSlider shininessField;
|
JLabel shiftLabel;
|
cNumberSlider shiftField;
|
JLabel ambientLabel;
|
cNumberSlider ambientField;
|
JLabel lightareaLabel;
|
cNumberSlider lightareaField;
|
JLabel diffusenessLabel;
|
cNumberSlider diffusenessField;
|
JLabel velvetLabel;
|
cNumberSlider velvetField;
|
JLabel sheenLabel;
|
cNumberSlider sheenField;
|
JLabel subsurfaceLabel;
|
cNumberSlider subsurfaceField;
|
//JLabel bumpLabel;
|
//NumberSlider bumpField;
|
JLabel backlitLabel;
|
cNumberSlider backlitField;
|
JLabel anisoLabel;
|
cNumberSlider anisoField;
|
JLabel anisoVLabel;
|
cNumberSlider anisoVField;
|
|
JLabel cameraLabel;
|
cNumberSlider cameraField;
|
JLabel selfshadowLabel;
|
cNumberSlider selfshadowField;
|
JLabel shadowLabel;
|
cNumberSlider shadowField;
|
JLabel textureLabel;
|
cNumberSlider textureField;
|
JLabel opacityLabel;
|
cNumberSlider opacityField;
|
JLabel parallaxLabel;
|
cNumberSlider parallaxField;
|
JLabel fakedepthLabel;
|
cNumberSlider fakedepthField;
|
JLabel shadowbiasLabel;
|
cNumberSlider shadowbiasField;
|
|
JLabel bumpLabel;
|
cNumberSlider bumpField;
|
JLabel noiseLabel;
|
cNumberSlider noiseField;
|
JLabel powerLabel;
|
cNumberSlider powerField;
|
JLabel borderfadeLabel;
|
cNumberSlider borderfadeField;
|
JLabel fogLabel;
|
cNumberSlider fogField;
|
JLabel opacityPowerLabel;
|
cNumberSlider opacityPowerField;
|
cTree jTree;
|
//ObjectUI parent;
|
|
cNumberSlider normalpushField;
|
|
private MenuItem importGFDItem;
|
private MenuItem importVRMLX3DItem;
|
private MenuItem import3DSItem;
|
private MenuItem importOBJItem;
|
}
|