Class BlenderLauncher
java.lang.Object
org.web3d.x3d.jsail.BlenderLauncher
Utility class for invoking and launching Blender via local operating system to perform a variety of conversion tasks. Note use of static methods.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Default Blender path default for Linux operating system, possibly unneeded ifblender
is in path already.static final String
Default Blender path default for macOS operating system, possibly unneeded ifblender
is in path already.static final String
Default Blender path default for Windows 7 or 10 operating system, possibly unneeded ifblender
is in path already.static final String
Blender python script for converting STL model into X3D model.static final String
Blender python script for converting X3D model into PNG image.static final String
Blender website URLstatic final String
Usage:java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.BlenderLauncher sourceFile [-convert [resultFile]] [-toImage [snapshotName.*]] [-home | -help | -version | -properties fileName.properties | -BLENDER_PATH directoryPath]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Check Blender local path and reset to operating system default, if necessary.static boolean
convertModel
(String inputFileName, String outputFileName) TODO: Use Blender to convert model from one file to another.static boolean
convertModel
(String path, String inputFileName, String outputFileName) TODO: Use Blender to convert model from one file to another based on filename extensions.protected static String
executeCommand
(String command) Launch blender in operating system and run command.static String
TODO: Use blender to export geometry to STLstatic boolean
exportSTLtoFile
(X3D modelToExport, String path, String fileName) TODO: Use blender to export geometry to filestatic String
getBlenderAnalytics
(X3D modelOfInterest) TODO: Get Blender metrics for X3D model of interest.static MetadataSet
getBlenderAnalyticsX3dMetadataSet
(X3D modelOfInterest) TODO: Get Blender metrics as MetadataSet object.static final String
Get directory path for location ofblender
program:blender.exe
on Windows,blender
otherwise.static String
Get Blender help.static final String
Get preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXON
orConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA
.static String
Get Blender version.static boolean
Determine if Blender is locally available.static X3D
importModel
(String path, String fileName) TODO: Use blender to import model to X3Dstatic X3D
TODO finish: Use blender to import STL geometry as X3D modelstatic final void
Initialize this BlenderLauncher instance to default values.static void
Open Blender pagestatic void
Default main() method provided for test and debugging purposes, invoking run() method.static void
Utility run() method provided for test and debugging purposes, allowing invocation with a single String (rather than a String[] array).static void
Default run() method provided for test and debugging purposes, first initializing ConfigurationProperties then reading properties file (if any) and processing arguments.static final void
setBlenderPath
(String newValue) Set preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXON
orConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA
.static boolean
Report whether prior command execution was successful.
-
Field Details
-
BLENDER_URL
-
BLENDER_PATH_DEFAULT_WINDOWS
Default Blender path default for Windows 7 or 10 operating system, possibly unneeded ifblender
is in path already. Can also setBLENDER_PATH
environment variable in operating system. Warning: local settings vary, configure path if necessary.- See Also:
-
BLENDER_PATH_DEFAULT_MACOS
Default Blender path default for macOS operating system, possibly unneeded ifblender
is in path already. Warning: local settings vary, configure path if necessary.- See Also:
-
BLENDER_PATH_DEFAULT_LINUX
Default Blender path default for Linux operating system, possibly unneeded ifblender
is in path already. Warning: local settings vary, configure path if necessary.- See Also:
-
BLENDER_PYTHON_SCRIPT_X3D_TO_PNG
Blender python script for converting X3D model into PNG image.- See Also:
-
BLENDER_PYTHON_SCRIPT_STL_TO_X3D
Blender python script for converting STL model into X3D model.- See Also:
-
USAGE
Usage:java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.BlenderLauncher sourceFile [-convert [resultFile]] [-toImage [snapshotName.*]] [-home | -help | -version | -properties fileName.properties | -BLENDER_PATH directoryPath]
- See Also:
-
-
Constructor Details
-
BlenderLauncher
public BlenderLauncher()Default constructor
-
-
Method Details
-
getBlenderExecutableName
Get directory path for location ofblender
program:blender.exe
on Windows,blender
otherwise.- Returns:
- name of blender program
- See Also:
-
getBlenderPath
Get preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXON
orConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA
.- Returns:
- String constant regarding current configuration: XSLT_ENGINE_SAXON (default) or XSLT_ENGINE_NATIVE_JAVA
-
setBlenderPath
Set preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXON
orConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA
.- Parameters:
newValue
- is new value to assign
-
initialize
public static final void initialize()Initialize this BlenderLauncher instance to default values. -
main
Default main() method provided for test and debugging purposes, invoking run() method.- Parameters:
args
- the command line arguments- See Also:
-
run
Utility run() method provided for test and debugging purposes, allowing invocation with a single String (rather than a String[] array). When invoked without parameters then reports results of validate() self-checks to system output.- Parameters:
singleStringArguments
- the command line arguments- See Also:
-
run
Default run() method provided for test and debugging purposes, first initializing ConfigurationProperties then reading properties file (if any) and processing arguments. When invoked without parameters then reports results of validate() self-checks to system output.- Parameters:
args
- the command line arguments- See Also:
-
launchBlenderWebPage
public static void launchBlenderWebPage()Open Blender page- See Also:
-
checkBlenderPath
public static void checkBlenderPath()Check Blender local path and reset to operating system default, if necessary.- See Also:
-
wasPriorCommandSuccessful
public static boolean wasPriorCommandSuccessful()Report whether prior command execution was successful.- Returns:
- whether prior command execution was successful.
- See Also:
-
executeCommand
-
convertModel
-
convertModel
TODO: Use Blender to convert model from one file to another based on filename extensions.- Parameters:
path
- directory path to file of interestinputFileName
- for input fileoutputFileName
- for output file- Returns:
- whether successful
- See Also:
-
importModel
-
importSTL
-
exportSTL
-
exportSTLtoFile
-
getBlenderAnalytics
-
getBlenderAnalyticsX3dMetadataSet
TODO: Get Blender metrics as MetadataSet object.- Parameters:
modelOfInterest
- X3D model to analyze- Returns:
- Blender output
- See Also:
-
getBlenderVersion
Get Blender version. Warning: ensure BLENDER_HOME or local path is set correctly, especially if more than one version is installed.- Returns:
- Blender version.
- See Also:
-
getBlenderHelp
Get Blender help. Warning: ensure BLENDER_HOME or local path is set correctly, especially if more than one version is installed.- Returns:
- Blender version.
- See Also:
-
hasBlender
public static boolean hasBlender()Determine if Blender is locally available. Warning: ensure BLENDER_HOME or local path is set correctly, especially if more than one version is installed.- Returns:
- whether Blender is found.
- See Also:
-