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
FieldsModifier and TypeFieldDescriptionstatic final StringDefault Blender path default for Linux operating system, possibly unneeded ifblenderis in path already.static final StringDefault Blender path default for macOS operating system, possibly unneeded ifblenderis in path already.static final StringDefault Blender path default for Windows operating system, possibly unneeded ifblenderis in path already.static final StringBlender python script for converting STL model into X3D model.static final StringBlender python script for converting X3D model into PNG image.static final StringBlender website URLstatic final StringUsage: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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCheck Blender local path and reset to operating system default, if necessary.static booleanconvertModel(String inputFileName, String outputFileName) TODO: Use Blender to convert model from one file to another.static booleanconvertModel(String path, String inputFileName, String outputFileName) TODO: Use Blender to convert model from one file to another based on filename extensions.protected static StringexecuteCommand(String command) Launch blender in operating system and run command.static StringTODO: Use blender to export geometry to STLstatic booleanexportSTLtoFile(X3D modelToExport, String path, String fileName) TODO: Use blender to export geometry to filestatic StringgetBlenderAnalytics(X3D modelOfInterest) TODO: Get Blender metrics for X3D model of interest.static MetadataSetgetBlenderAnalyticsX3dMetadataSet(X3D modelOfInterest) TODO: Get Blender metrics as MetadataSet object.static final StringGet directory path for location ofblenderprogram:blender.exeon Windows,blenderotherwise.static StringGet Blender help.static final StringGet preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXONorConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA.static StringGet Blender version.static booleanDetermine if Blender is locally available.static X3DimportModel(String path, String fileName) TODO: Use blender to import model to X3Dstatic X3DTODO finish: Use blender to import STL geometry as X3D modelstatic final voidInitialize this BlenderLauncher instance to default values.static voidOpen Blender pagestatic voidDefault main() method provided for test and debugging purposes, invoking run() method.static voidUtility run() method provided for test and debugging purposes, allowing invocation with a single String (rather than a String[] array).static voidDefault run() method provided for test and debugging purposes, first initializing ConfigurationProperties then reading properties file (if any) and processing arguments.static final voidsetBlenderPath(String newValue) Set preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXONorConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA.static booleanReport whether prior command execution was successful.
-
Field Details
-
BLENDER_URL
-
BLENDER_PATH_DEFAULT_WINDOWS
Default Blender path default for Windows operating system, possibly unneeded ifblenderis in path already. Can also setBLENDER_PATHproperty in X3DJSAIL.properties, orBLENDER_PATHenvironment 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 ifblenderis 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 ifblenderis 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 ofblenderprogram:blender.exeon Windows,blenderotherwise.- Returns:
- name of blender program
- See Also:
-
getBlenderPath
Get preference for XSLT transformation engine to use:ConfigurationProperties.XSLT_ENGINE_SAXONorConfigurationProperties.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_SAXONorConfigurationProperties.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:
-