This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

文件系统

警告
本文介绍的功能在 Community SDK 版本中不可用。
您应该升级到 Engineering / Sim SDK版本才能使用它。

The Export System allows you to use default plugins and write custom ones to export UNIGINE's nodes to a file of different format and store it on a disk.导出系统允许您使用默认插件并编写自定义插件以将 UNIGINE 的节点导出到不同格式的文件并将其存储在磁盘上。

The structure of Export System is shown below. It includes Export Manager and a dynamic set of exporters for various external file formats.导出系统的结构如下图所示。它包括导出管理器和一组动态的出口商适用于各种外部文件格式。

Export System

Export System Structure出口系统结构

Export Manager is used to create and manage exporters, as well as to directly export files to non-native formats, if an exporter for such files was previously registered.导出管理器用于创建和管理导出器,以及直接将文件导出为非本地格式(如果此类文件的导出器之前已注册)。

Exporter出口商#

Exporter is a module used by Export System to transfer UNIGINE's objects to files in various non-native formats. A single exporter can be used to export multiple nodes, but there shouldn't be two or more exporters registered for a single node type.Exporter 是导出系统用来将 UNIGINE 的对象传输到各种非本地格式的文件的模块。单个导出器可用于导出多个节点,但不应为单个节点类型注册两个或多个导出器。

Each exporter has a set of parameters that control the whole export process (e.g., whether to export lights, cameras, and material normal maps, reset root node transformation, etc.). The exporter should be initialized before the use.每个导出器都有一组参数来控制整个导出过程(例如,是否导出灯光、相机和材质法线贴图,重置根节点变换等)。使用前应初始化导出器。

Basic Workflow基本工作流程#

In order to be used, exporters must be registered in the system via Export Manager. You can manage the list of available modules dynamically by adding them to or removing from the registry. When you export a node to any external format, Export System automatically tries to find and use an appropriate exporter registered for the specified file extension.为了使用,出口商必须通过 Export Manager 在系统中注册。您可以通过将可用模块添加到注册表或从注册表中删除来动态管理可用模块的列表。当您将节点导出为任何外部格式时,导出系统会自动尝试查找并使用为指定文件扩展名注册的适当导出器。

The basic node export workflow is as follows:基本节点导出工作流程如下:

  1. Check the extension of the specified output file and find the appropriate exporter among the registered ones.检查指定输出文件的扩展名,并在已注册的导出器中找到合适的导出器。
  2. Extract scene data from the node, create the export scene and put the data to the corresponding export structures (e.g., FBX nodes).从节点中提取场景数据,创建导出场景并将数据放入相应的导出结构(例如,FBX 节点)。
  3. Use the appropriate exporter to generate output files on the basis of scene metadata.使用适当的导出器根据场景元数据生成输出文件。

Customization定制#

You can consider the FbxExporter plugin as an example to build your own custom exporting modules. You can also modify and rebuild this plugin to use your own custom exporter in the Editor.您可以将 FbxExporter 插件作为示例来构建您自己的自定义导出模块。您还可以修改和重建此插件以在编辑器中使用您自己的自定义导出器。

To use the FbxExporter plugin, just load it via the plugin_load console command or the following command line option on the application start-up:要使用 FbxExporter 插件,只需通过 plugin_load 控制台命令或以下命令加载它命令行选项在应用程序启动时:

命令行
-extern_plugin UnigineFbxExporter

In general, the workflow via the C++ API may be represented as follows:一般来说,通过 C++ API 的工作流可以表示如下:

源代码 (C++)
// create an exporter for the exported file ("1.fbx" in our case)
Unigine::Exporter* exporter = Unigine::Export::get()->createExporterByFileName("1.fbx");

// enable the "export_material_normal_maps" parameter 
exporter->setParameterInt("export_material_normal_maps", 1);

// initialize exporter
exporter->init();

// get the node
NodePtr node = World::getNodeByName("material_ball");

// export the node to the specified file path
exporter->doExport(node, "1.fbx");

// exporter deinitialization
exporter->deinit();

You can also export a node with default settings simply like this:您还可以像这样使用默认设置导出节点:

源代码 (C++)
// get the node
NodePtr node = World::getNodeByName("material_ball");

// export the node to the file of specified format
Unigine::Export::get()->doExport(node, "../data/1/1.fbx")

Built-in Export Options内置导出选项#

The engine's built-in exporters (such as FbxExporter plugin) have a number of export options that customize the exporter's behavior and can also be used in custom exporters.引擎的内置导出器(例如 FbxExporter 插件)有许多导出选项,可以自定义导出器的行为,也可以在自定义导出器中使用。

Parameter Names参数名称#

The following table lists the names for the parameters available out of the box that can be set via the setParameterInt("name", value) method. 下表列出了可通过 setParameterInt("name", value) 方法设置的现成可用参数的名称。

export_lights

Exports the light nodes.导出灯光节点。

  • 0 — disabled0 — 禁用
  • 1 — to enable (by default)1 — 启用(默认)
export_cameras

Exports the camera nodes.导出相机节点。

  • 0 — disable0 — 禁用
  • 1 — enabled (by default)1 — 启用(默认)
export_material_normal_maps

Exports all surfaces as separate meshes inside the target FBX container.导出材质的法线贴图。

  • 0 — disabled0 — 禁用
  • 1 — to enable (by default)1 — 启用(默认)
reset_root_node_transformation

Exports normal maps of materials.重置节点的根变换。

  • 0 — disabled0 — 禁用(默认)
  • 1 — to enable (by default)1 — 启用

See Also也可以看看#

  • FbxExporter 插件作为自定义导出插件的示例:source/plugins/Export/FbxExporter

Fbx 导出系统 API:

  • FBX 导出功能类有关通过代码管理导出系统的更多详细信息。

    注意
    导出系统 API 不适用于 Community SDK 版本。
最新更新: 2024-01-12
Build: ()