SDK:
- make opening blender default action for .blend files - improve blender window open cycle git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10248 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
e113ed5dbb
commit
adccdd425d
@ -356,11 +356,11 @@ public class BlenderTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean runBlender(final String options, boolean async) {
|
||||
private static boolean runBlender(final String file, boolean async) {
|
||||
if (!checkBlenderFolders()) {
|
||||
logger.log(Level.SEVERE, "Could not create blender settings folders!");
|
||||
}
|
||||
logger.log(Level.INFO, "Running blender with options {0}", options);
|
||||
logger.log(Level.INFO, "Running blender with options {0}", file);
|
||||
if (blenderOpened.getAndSet(true)) {
|
||||
logger.log(Level.INFO, "Blender seems to be running");
|
||||
return false;
|
||||
@ -379,7 +379,7 @@ public class BlenderTool {
|
||||
public void run() {
|
||||
try {
|
||||
String command = exe.getAbsolutePath();
|
||||
ProcessBuilder buildr = new ProcessBuilder(command, options);
|
||||
ProcessBuilder buildr = new ProcessBuilder(command, file);
|
||||
buildr.directory(getBlenderRootFolder());
|
||||
buildr.environment().put("BLENDER_USER_CONFIG", getConfigEnv());
|
||||
buildr.environment().put("BLENDER_SYSTEM_SCRIPTS", getScriptsEnv());
|
||||
@ -404,6 +404,7 @@ public class BlenderTool {
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
mainWin.setState(Frame.NORMAL);
|
||||
mainWin.requestFocus();
|
||||
}
|
||||
});
|
||||
successful.set(false);
|
||||
@ -419,7 +420,7 @@ public class BlenderTool {
|
||||
}
|
||||
|
||||
public static boolean openInBlender(FileObject file) {
|
||||
String path = "'" + file.getPath().replace("/", File.separator) + "'";
|
||||
String path = file.getPath().replace("/", File.separator);
|
||||
return runBlender(path, true);
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ package com.jme3.gde.blender;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionReferences;
|
||||
@ -23,11 +23,12 @@ displayName = "#CTL_OpenInBlender")
|
||||
@ActionReferences({
|
||||
@ActionReference(path = "Menu/Tools", position = 3333),
|
||||
@ActionReference(path = "Toolbars/File", position = 335),
|
||||
@ActionReference(path = "Loaders/application/blender/Actions", position = 30)
|
||||
@ActionReference(path = "Loaders/application/blender/Actions", position = 9)
|
||||
})
|
||||
@Messages("CTL_OpenInBlender=Open in Blender")
|
||||
public final class OpenInBlender implements ActionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(OpenInBlender.class.getName());
|
||||
private final BlenderDataObject context;
|
||||
|
||||
public OpenInBlender(BlenderDataObject context) {
|
||||
@ -37,7 +38,7 @@ public final class OpenInBlender implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
if (!BlenderTool.openInBlender(context.getPrimaryFile())) {
|
||||
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message("Error opening Blender with file " + context.getPrimaryFile().getNameExt()));
|
||||
logger.log(Level.INFO, "Could not open file in blender, already running?");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user