|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2009-2010 jMonkeyEngine
|
|
|
|
|
|
+ * Copyright (c) 2009-2016 jMonkeyEngine
|
|
* All rights reserved.
|
|
* All rights reserved.
|
|
*
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -34,21 +34,11 @@ package com.jme3.gde.core.sceneexplorer.nodes;
|
|
import com.jme3.bullet.collision.shapes.CollisionShape;
|
|
import com.jme3.bullet.collision.shapes.CollisionShape;
|
|
import com.jme3.bullet.control.RigidBodyControl;
|
|
import com.jme3.bullet.control.RigidBodyControl;
|
|
import com.jme3.gde.core.icons.IconList;
|
|
import com.jme3.gde.core.icons.IconList;
|
|
-import com.jme3.gde.core.scene.SceneApplication;
|
|
|
|
import com.jme3.math.Quaternion;
|
|
import com.jme3.math.Quaternion;
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.math.Vector3f;
|
|
-import com.jme3.scene.Spatial;
|
|
|
|
import java.awt.Image;
|
|
import java.awt.Image;
|
|
-import java.io.IOException;
|
|
|
|
-import java.util.concurrent.Callable;
|
|
|
|
-import java.util.concurrent.ExecutionException;
|
|
|
|
-import javax.swing.Action;
|
|
|
|
-import org.openide.actions.DeleteAction;
|
|
|
|
import org.openide.loaders.DataObject;
|
|
import org.openide.loaders.DataObject;
|
|
-import org.openide.nodes.Node;
|
|
|
|
import org.openide.nodes.Sheet;
|
|
import org.openide.nodes.Sheet;
|
|
-import org.openide.util.Exceptions;
|
|
|
|
-import org.openide.util.actions.SystemAction;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
@@ -56,7 +46,7 @@ import org.openide.util.actions.SystemAction;
|
|
*/
|
|
*/
|
|
@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
|
|
@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
|
-public class JmeRigidBodyControl extends AbstractSceneExplorerNode {
|
|
|
|
|
|
+public class JmeRigidBodyControl extends JmeControl {
|
|
|
|
|
|
private static Image smallImage = IconList.physicsControl.getImage();
|
|
private static Image smallImage = IconList.physicsControl.getImage();
|
|
private RigidBodyControl geom;
|
|
private RigidBodyControl geom;
|
|
@@ -69,6 +59,7 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode {
|
|
getLookupContents().add(spatial);
|
|
getLookupContents().add(spatial);
|
|
getLookupContents().add(this);
|
|
getLookupContents().add(this);
|
|
this.geom = spatial;
|
|
this.geom = spatial;
|
|
|
|
+ control = spatial;
|
|
setName("PhysicsControl");
|
|
setName("PhysicsControl");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -82,51 +73,6 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode {
|
|
return smallImage;
|
|
return smallImage;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public Action[] getActions(boolean context) {
|
|
|
|
- return new SystemAction[]{
|
|
|
|
- // SystemAction.get(CopyAction.class),
|
|
|
|
- // SystemAction.get(CutAction.class),
|
|
|
|
- // SystemAction.get(PasteAction.class),
|
|
|
|
- SystemAction.get(DeleteAction.class)
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- protected void fireSave(boolean modified) {
|
|
|
|
- Node parent = getParentNode();
|
|
|
|
- if (parent instanceof AbstractSceneExplorerNode) {
|
|
|
|
- AbstractSceneExplorerNode par=(AbstractSceneExplorerNode)parent;
|
|
|
|
- par.fireSave(modified);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public boolean canDestroy() {
|
|
|
|
- return !readOnly;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void destroy() throws IOException {
|
|
|
|
- super.destroy();
|
|
|
|
- final Spatial spat=getParentNode().getLookup().lookup(Spatial.class);
|
|
|
|
- try {
|
|
|
|
- fireSave(true);
|
|
|
|
- SceneApplication.getApplication().enqueue(new Callable<Void>() {
|
|
|
|
-
|
|
|
|
- public Void call() throws Exception {
|
|
|
|
- spat.removeControl(geom);
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }).get();
|
|
|
|
- ((AbstractSceneExplorerNode)getParentNode()).refresh(true);
|
|
|
|
- } catch (InterruptedException ex) {
|
|
|
|
- Exceptions.printStackTrace(ex);
|
|
|
|
- } catch (ExecutionException ex) {
|
|
|
|
- Exceptions.printStackTrace(ex);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
protected Sheet createSheet() {
|
|
protected Sheet createSheet() {
|
|
Sheet sheet = super.createSheet();
|
|
Sheet sheet = super.createSheet();
|
|
@@ -161,6 +107,7 @@ public class JmeRigidBodyControl extends AbstractSceneExplorerNode {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public Class getExplorerObjectClass() {
|
|
public Class getExplorerObjectClass() {
|
|
return RigidBodyControl.class;
|
|
return RigidBodyControl.class;
|
|
}
|
|
}
|