浏览我们的产品
Aspose.3D for Java 18.9-2018年9月
此页面包含以下内容的发行说明Aspose.3D for Java 18.9。
其他改进和变化
摘要 | 类别 |
---|---|
取消令牌支持 | 新功能 |
FBX ExportException-高多边形计数 | Bug |
打开巨大的FBX文件时的ImportException | Bug |
并非来自FBX的全局设置的所有属性都加载到AssetInfo中 | Bug |
公共API和向后不兼容的更改
请查看对公共API所做的任何更改的列表,如添加、重命名、删除或不推荐使用的成员,以及对Aspose.3D for Java API所做的任何非向后兼容的更改。如果您对列出的任何更改有疑问,请在Aspose.3D支持论坛。
API更改:
类com.aspose.threed.Node添加了2个新方法:
/**
* Per-node asset info
* @param value New value
*/
public void setAssetInfo(com.aspose.threed.AssetInfo);
/**
* Per-node asset info
*/
public com.aspose.threed.AssetInfo getAssetInfo();
某些文件类型可以具有每个节点的资产信息。 在FBX中,根节点的AssetInfo属性包含FBX文件中定义的全局设置。
示例代码:
//Access GlobalSettings in FBX file, more properties can be found by opening the ASCII FBX files in a text editor.
//And FBXHeaderExtension/SceneInfo inside FBX file will be mapped to Scene.AssetInfo
Scene scene = new Scene("test.fbx");
AssetInfo globalSettings = scene.getRootNode().getAssetInfo();
System.out.println(globalSettings.getProperty("DefaultCamera"));
System.out.println(globalSettings.getProperty("UpAxis"));
System.out.println(globalSettings.getProperty("FrontAxis"));
类 ‘com.aspose.threed.Scene’ 增加了10个新方法:
这些都是对原始保存/打开方法的新重载:
旧方法:
/**
* Opens the scene from given stream using specified file format.
* @param stream Input stream, user is responsible for closing the stream.
* @param format File format.
* @param cancellationToken Cancellation token to the load task
*/
public void open(Stream stream, FileFormat format, Cancellation cancellationToken)
throws ImportException;
/**
* Opens the scene from given stream using specified IO config.
* @param stream Input stream, user is responsible for closing the stream.
* @param options More detailed configuration to open the stream.
* @param cancellationToken Cancellation token to the load task
*/
public void open(Stream stream, LoadOptions options, Cancellation cancellationToken)
throws ImportException;
/**
* Opens the scene from given stream
* @param stream Input stream, user is responsible for closing the stream.
* @param cancellationToken Cancellation token to the load task
*/
public void open(Stream stream, Cancellation cancellationToken)
throws IOException;
/**
* Opens the scene from given path using specified file format.
* @param fileName File name.
* @param format File format.
* @param cancellationToken Cancellation token to the load task
*/
public void open(String fileName, FileFormat format, Cancellation cancellationToken)
throws IOException;
/**
* Opens the scene from given path using specified file format.
* @param fileName File name.
* @param options More detailed configuration to open the stream.
* @param cancellationToken Cancellation token to the load task
*/
public void open(String fileName, LoadOptions options, Cancellation cancellationToken)
throws IOException;
/**
* Opens the scene from given path
* @param fileName File name.
* @param cancellationToken Cancellation token to the load task
*/
public void open(String fileName, Cancellation cancellationToken)
throws IOException;
/**
* Saves the scene to stream using specified file format.
* @param stream Input stream, user is responsible for closing the stream.
* @param format Format.
* @param cancellationToken Cancellation token to the save task
*/
public void save(Stream stream, FileFormat format, Cancellation cancellationToken)
throws ExportException;
/**
* Saves the scene to stream using specified file format.
* @param stream Input stream, user is responsible for closing the stream.
* @param options More detailed configuration to save the stream.
* @param cancellationToken Cancellation token to the save task
*/
public void save(Stream stream, SaveOptions options, Cancellation cancellationToken)
throws ExportException;
/**
* Saves the scene to specified path using specified file format.
* @param fileName File name.
* @param format Format.
* @param cancellationToken Cancellation token to the save task
*/
public void save(String fileName, FileFormat format, Cancellation cancellationToken)
throws IOException;
/**
* Saves the scene to specified path using specified file format.
* @param fileName File name.
* @param options More detailed configuration to save the stream.
* @param cancellationToken Cancellation token to the save task
*/
public void save(String fileName, SaveOptions options, Cancellation cancellationToken)
throws IOException;
您可以在需要的任何时候使用取消取消保存/打开任务。
示例代码:
final Cancellation cts = new Cancellation();
Thread thread = new Thread(() -> {
try {
Thread.sleep(1000);
cts.cancel();
} catch(InterruptedException e) {
throw new RuntimeException(e);
}
});
thread.start();
Scene scene = new Scene();
try {
scene.open("test.fbx", cts);
System.out.println("Import is done within 1000ms");
} catch(ImportException e) {
if(e.getCause() instanceof CancellationException) {
System.out.println("It takes too long time to import, and we have canceled the importing.");
}
}