本文整理匯總了Java中com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent類的典型用法代碼示例。如果您正苦於以下問題:Java SceneExplorerTopComponent類的具體用法?Java SceneExplorerTopComponent怎麽用?Java SceneExplorerTopComponent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SceneExplorerTopComponent類屬於com.jme3.gde.core.sceneexplorer包,在下文中一共展示了SceneExplorerTopComponent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: select
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private boolean select(AbstractSceneExplorerNode node) {
if (editorController != null) {
editorController.setSelectedExplorerNode(node);
}
if (node instanceof JmeSpatial) {
selectSpatial(((JmeSpatial) node).getLookup().lookup(Spatial.class));
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{node});
SceneExplorerTopComponent.findInstance().setSelectedNode(node);
return true;
} else if (toolController != null) {
Spatial selectedGizmo = toolController.getMarker(node);
if (selectedGizmo != null) {
selectSpatial(selectedGizmo);
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{node});
SceneExplorerTopComponent.findInstance().setSelectedNode(node);
return true;
}
}
return false;
}
示例2: duplicate
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private void duplicate() {
Spatial selected = toolController.getSelectedSpatial();
Spatial clone = selected.clone();
clone.move(1, 0, 1);
selected.getParent().attachChild(clone);
actionPerformed(new DuplicateUndo(clone, selected.getParent()));
selected = clone;
final Spatial cloned = clone;
final JmeNode rootNode = toolController.getRootNode();
refreshSelected(rootNode, selected.getParent());
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (cloned != null) {
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{rootNode.getChild(cloned)});
SceneExplorerTopComponent.findInstance().setSelectedNode(rootNode.getChild(cloned));
}
}
});
toolController.updateSelection(selected);
}
示例3: JmeGeometry
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public JmeGeometry(Geometry spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SceneExplorerTopComponent.findInstance().addMaterialChangeListener(JmeGeometry.this);
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
}
});
}
示例4: destroy
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void destroy() throws IOException {
super.destroy();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SceneExplorerTopComponent.findInstance().removeMaterialChangeListener(JmeGeometry.this);
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
}
});
}
示例5: propertyChange
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void propertyChange(String type, String name, final Object before, final Object after) {
super.propertyChange(type, name, before, after);
if (name.equals("Material")) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
String beforeName = (before == null)? null : ((Material) before).getAssetName();
String afterName = (after == null)? null : ((Material) after).getAssetName();
SceneExplorerTopComponent.findInstance().swapMaterialChangeListener(JmeGeometry.this, beforeName, afterName);
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
}
});
}
}
示例6: getAddAction
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
/**
* This is the Add Waypoint Action. It resides in this Popup Class, however
* it's not added to the Debug Shapes Popup. Instead it is added as a seperate action
* @return
*/
public AbstractAction getAddAction() {
return new AbstractAction("Add Waypoint") {
@Override
public void actionPerformed(ActionEvent e) {
Vector3f pos;
SceneToolController controller = SceneApplication.getApplication().getStateManager().getState(SceneToolController.class);
if (controller != null && (!controller.getCursorLocation().equals(Vector3f.ZERO))) { // Vector3f.ZERO means not yet clicked
pos = controller.getCursorLocation().clone().addLocal(0, jmeMotionPath.getDebugBoxExtents() * 3f, 0); // Shifting up so a) Netbeans isn't merging Waypoints and b) it's visible
} else {
AbstractSceneExplorerNode node = SceneExplorerTopComponent.findInstance().getLastSelected();
if (node instanceof JmeVector3f) { // null instanceof JmeVector3f == false
pos = ((JmeVector3f)node).getVector3f().clone().addLocal(0, jmeMotionPath.getDebugBoxExtents() * 3f, 0);
} else {
pos = new Vector3f(0f, 1.0f, 0f); // Default is a bit over the Center
}
}
JmeVector3fChildren children = (JmeVector3fChildren)jmeMotionPath.getChildren();
JmeVector3f jme = new JmeVector3f(children, jmeMotionPath, pos);
children.add(new Node[] {jme});
jmeMotionPath.refreshChildren();
}
};
}
示例7: JmeGeometry
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public JmeGeometry(Geometry spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SceneExplorerTopComponent.findInstance().addMaterialChangeListener(JmeGeometry.this);
} catch (Exception e) {
e.printStackTrace();
}
}
});
setName(spatial.getName());
}
示例8: destroy
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void destroy() throws IOException {
super.destroy();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SceneExplorerTopComponent.findInstance().removeMaterialChangeListener(JmeGeometry.this);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
示例9: propertyChange
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void propertyChange(String name, final Object before, final Object after) {
super.propertyChange(name, before, after);
System.out.println(name);
if (name.equals("Material")) {
System.out.println(before.toString()+" "+after.toString());
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SceneExplorerTopComponent.findInstance().swapMaterialChangeListener(JmeGeometry.this, ((Material) before).getAssetName(), ((Material) after).getAssetName());
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
示例10: componentClosed
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void componentClosed() {
materialPreviewWidget1.cleanUp();
for (int i = 0; i < texturePanel.getComponentCount(); i++) {
Component c = texturePanel.getComponent(i);
if (c instanceof MaterialPropertyWidget) {
((MaterialPropertyWidget) c).cleanUp();
}
}
clearMaterialChangeListeners();
SceneExplorerTopComponent.getDefault().removeMaterialChangeProvider(this);
}
示例11: setAsText
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public void setAsText(final String text) throws IllegalArgumentException {
if ("create j3m file".equals(text)) {
try {
Node geom = SceneExplorerTopComponent.findInstance().getLastSelected();
assert (geom != null);
ProjectAssetManager pm = geom.getLookup().lookup(ProjectAssetManager.class);
assert (pm != null);
DataObject obj = geom.getLookup().lookup(DataObject.class);
assert (obj != null);
FileObject currentFile = obj.getPrimaryFile();
FileObject currentFolder = pm.getAssetFolder().getFileObject("Materials/Generated");
if (currentFolder == null) {
currentFolder = FileUtil.createFolder(pm.getAssetFolder(), "Materials/Generated");
}
int i = 0;
String newFileName = currentFile.getName() + "-" + sanitizeFileName(geom.getName());
FileObject newFile = currentFolder.getFileObject(newFileName, "j3m");
while (newFile != null) {
i++;
newFileName = currentFile.getName() + "-" + sanitizeFileName(geom.getName()) + "-" + i;
newFile = currentFolder.getFileObject(newFileName, "j3m");
}
newFile = currentFolder.createData(newFileName, "j3m");
EditableMaterialFile properties = new EditableMaterialFile(newFile, pm);
material.setKey(new MaterialKey(pm.getRelativeAssetPath(newFile.getPath())));
properties.setAsMaterial(material);
currentFolder.refresh();
applyMaterial(material.getAssetName());
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
return;
}
} else {
applyMaterial(text);
}
}
示例12: duplicateSelected
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private void duplicateSelected() {
Spatial selected = toolController.getSelectedSpatial();
if (selected == null) {
return;
}
Spatial clone = selected.clone();
clone.move(1, 0, 1);
selected.getParent().attachChild(clone);
actionPerformed(new DuplicateUndo(clone, selected.getParent()));
selected = clone;
final Spatial cloned = clone;
final JmeNode rootNode = toolController.getRootNode();
refreshSelected(rootNode, selected.getParent());
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (cloned != null) {
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{rootNode.getChild(cloned)});
SceneExplorerTopComponent.findInstance().setSelectedNode(rootNode.getChild(cloned));
}
}
});
// set to automatically 'grab'/'translate' the new cloned model
toolController.updateSelection(selected);
currentState = State.translate;
currentAxis = Vector3f.UNIT_XYZ;
}
示例13: selectSpatial
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private void selectSpatial(JmeNode spatial) {
if(editorController!=null)
editorController.setSelectedSpat(spatial);
if(spatial==null) {
setSelectedObjectText(null);
return;
} else{
if(toolController!=null) {
toolController.setSelectedSpatial(spatial);
toolController.updateSelection(spatial.getLookup().lookup(Spatial.class));
}
}
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{spatial});
SceneExplorerTopComponent.findInstance().setSelectedNode(spatial);
}
示例14: setAsText
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public void setAsText(final String text) throws IllegalArgumentException {
if ("create j3m file".equals(text)) {
try {
AbstractSceneExplorerNode geom = SceneExplorerTopComponent.findInstance().getLastSelected();
assert (geom != null);
ProjectAssetManager pm = geom.getLookup().lookup(ProjectAssetManager.class);
assert (pm != null);
DataObject obj = geom.getLookup().lookup(DataObject.class);
assert (obj != null);
FileObject currentFile = obj.getPrimaryFile();
FileObject currentFolder = currentFile.getParent();
int i = 0;
String newFileName = currentFile.getName() + "-" + geom.getName();
FileObject newFile = currentFolder.getFileObject(newFileName, "j3m");
while (newFile != null) {
i++;
newFileName = currentFile.getName() + "-" + geom.getName() + "-" + i;
newFile = currentFolder.getFileObject(newFileName, "j3m");
}
newFile = currentFolder.createData(newFileName, "j3m");
EditableMaterialFile properties = new EditableMaterialFile(newFile, pm);
material.setKey(new MaterialKey(pm.getRelativeAssetPath(newFile.getPath())));
properties.setAsMaterial(material);
currentFolder.refresh();
applyMaterial(material.getAssetName());
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
return;
}
} else {
applyMaterial(text);
}
}
示例15: componentOpened
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void componentOpened() {
SceneExplorerTopComponent.getDefault().addMaterialChangeProvider(this);
}