Skip to content

Commit ead88a4

Browse files
authored
Ut 3732 fix errors when modifying fbx export settings preset (#543)
* fix errors when creating preset of FbxExportSettings - errors were caused by presets creating a new instance of a singleton * add unit test * fix checkbox alignment for export/convert settings * use copy of export model settings in export options window - so that the project settings are not modified when exporting * add export/convert options to Fbx Export settings UI * clean up FBX export settings UI * disable buttons in presets * create option editors on enable instead of each OnInspectorGUI * use a copy of the settings in convert/export windows - persist the settings in the Unity session so that they remain after the window is closed * use "Display Options Window" option for export window - previously it was called "Show Convert UI" and only used for the convert window * fix toggle UI offset compared to toggle - had to click to the right of the toggle in order for it to register. Issue was a missing `EditorGUI.indentLevel--;` * Default to default preset for export/convert options if one exists * fix failing test when loading settings from defaults - TestExportSettingsPresets() fails with NullRefException as serialized settings not set properly * update documentation * split up sections in FBX export settings doc for easier readability * add tests to check that export/convert settings load and save correctly * store recent fbx/prefab save paths separately for each window - so that modifying the save paths in one window does not affect another * clean up implementation - save settings to Session as json - only store settings to Session if they diverge from project settings * add unit test for save paths * update changelog * code review fix - add test for changing preset * reset settings to project settings when settings modified * fix project settings don't affect export options if there is a default preset - clearing the settings will always reload the settings as the default preset instead of project settings * add parens around bitshift * use xor instead of or for enums
1 parent 42a366c commit ead88a4

15 files changed

+1113
-198
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Changes in Fbx Exporter
22

33
## [UNRELEASED] - 2020-09-29
4+
### Changed
5+
- The Export and Convert to Prefab options can now be changed in the FBX Export Settings in Edit > Project Settings > Fbx Export.
6+
- The Export and Convert to Prefab Options windows will use these settings by default.
7+
- When modifying the settings in the Export/Convert to Prefab windows, the Project Settings are no longer updated, but the changes persist for the remainder of the Unity session.
8+
- Disable buttons such as the "Install Integration" button when editing an FBX export setting preset.
9+
- Rename "Show Convert UI" in project settings to "Display Options Window" and use it for both the Convert and Export windows instead of just the Convert to Prefab window.
10+
411
### Fixed
512
- Fix Export Model and Convert to Prefab Variant setting presets not serializing settings properly.
13+
- Fix NullReferenceException when modifying a preset for the FBX export settings in Edit > Project Settings > Fbx Export.
14+
- Fix error in an export when the project settings are not writeable (e.g. if you're using Perforce).
615

716
## [3.2.1-preview.2] - 2020-08-05
817
### Added

com.unity.formats.fbx/Documentation~/exporting.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,17 @@ When exporting an FBX file, the following **Export Options** window opens, displ
219219
| __Compatible Naming__ | Check this option to control renaming the GameObject and Materials during export. <br/><br/>The FBX Exporter ensures compatible naming with Autodesk® Maya® and Autodesk® Maya LT™ to avoid unexpected name changes between Unity and Autodesk® Maya® and Autodesk® Maya LT™. During export the FBX Exporter replaces characters in Unity names as follows:<br/> - Replaces invalid characters with underscores ("\_"). Invalid characters are all non-alphanumeric characters, except for the colon (":").<br/> - Adds an underscore ("\_") to names that begin with a number.<br/> - Replaces diacritics. For example, replaces "é" with “e”.<br/><br/>**NOTE:** If you have a Material with a space in its name, the space is replaced with an underscore ("_"). This results in a new Material being created when it is imported. For example, the Material named "Default Material" is exported as "Default_Material" and is created as a new Material when it is imported. If you want the exported Material to match an existing Material in the scene, you must manually rename the Material before exporting. |
220220
| __Export Unrendered__ | Check this option to export meshes that either don't have a renderer component, or that have a disabled renderer component. For example, a simplified mesh used as a Mesh collider. |
221221
|__Preserve Import Settings__ | Check this option to preserve all import settings applied to an existing fbx that will be overwritten in the export. If the GameObject is being exported as a new fbx, the import settings will not be carried over.|
222+
| __Don't ask me again__ | Check this option to use the same **Export Option** properties and hide this window when exporting to FBX in the future. You can reset this option by turning on the **Display Options Window** option under **Edit** > **Project Settings** > **Fbx Export** in Unity's top menu. |
222223

223224
> **NOTE:** For FBX Model filenames, the FBX Exporter ensures that names do not contain invalid characters for the file system. The set of invalid characters may differ between file systems.
224225
226+
227+
> **NOTE:** If a Default Preset has been set in the Preset Manager, the settings will default to this preset. Otherwise, the settings will default to the settings in Edit > Project Settings... > Fbx Export under FBX File Options.
228+
However, modifying the settings in the Export Options window will preserve the changes for the remainder of the Unity session.
229+
225230
## Exporting animation from the Timeline
226231

227-
In order to export an animation clip from the timeline, in the Timeline editor select the desired clip, then from the top menu select __GameObject__ > __Export Selected Timeline Clip__.
232+
In order to export an animation clip from the timeline, in the Timeline editor select the desired clip, then from the top menu select **GameObject** > **Export Selected Timeline Clip**.
228233

229234

230235
## Exporting with relevant system units
-39.9 KB
Loading
39.3 KB
Loading
Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FBX Export settings
22

3-
Use the Fbx Export Settings window to show or hide the Convert to Model Prefab Variant UI and to install the [Unity Integration](integration.html) for Autodesk® Maya®, Autodesk® Maya LT™, or Autodesk® 3ds Max®.
3+
Use the Fbx Export Settings window to show or hide the Export and Convert to Model Prefab Variant UI, to change the default FBX File options and Convert To Prefab options, and to install the [Unity Integration](integration.html) for Autodesk® Maya®, Autodesk® Maya LT™, or Autodesk® 3ds Max®.
44

55
![](images/FBXExporter_FBXExportSettingsWindow.png)
66

@@ -9,13 +9,49 @@ Use the Fbx Export Settings window to show or hide the Convert to Model Prefab V
99
<a name="FBXSettings"></a>
1010
## Fbx Export Settings window
1111

12+
### Export Options
13+
14+
| Property: | Function: |
15+
| :---------------------------- | :----------------------------------------------------------- |
16+
| __Display Options Window__ | Check this option to hide the Convert to Model Prefab Variant and Export UI when converting or exporting. The last selected path will be used and the filename will be based on the selected object's name. |
17+
18+
#### FBX File Options
19+
| Property: | Function: |
20+
| :---------------------------- | :----------------------------------------------------------- |
21+
| __Export Path__ | Specify the location where the FBX Exporter will save the FBX file. |
22+
| __Export Format__ | Select the format to use in the FBX file (ASCII or Binary). |
23+
| __Include__ | Choose whether to export both Models and Animation, only Models, or only Animations. |
24+
| __LOD level__ | For level of detail (LOD) groups, choose the desired level of detail to export (all, highest, or lowest). <br/><br/>**NOTES:**<br/> - The FBX Exporter ignores LODs outside of selected hierarchy.<br/> - The FBX Exporter does not filter out objects that are used as LODs and doesn't export them if they aren’t direct descendants of their respective LOD Group |
25+
| __Object(s) Position__ | Choose whether to reset the exported objects to world center, or keep world transforms during export.<br/><br/>If you select multiple objects for export, and you choose __Local Centered__ from this drop-down menu, the FBX Exporter centers objects around a shared root while keeping their relative placement unchanged. |
26+
| __Animated Skinned Mesh__ | Check this option to export animation on objects with skinned meshes.<br/><br/>If unchecked, the FBX Exporter does not export animation on skinned meshes. |
27+
| __Compatible Naming__ | Check this option to control renaming the GameObject and Materials during export. <br/><br/>The FBX Exporter ensures compatible naming with Autodesk® Maya® and Autodesk® Maya LT™ to avoid unexpected name changes between Unity and Autodesk® Maya® and Autodesk® Maya LT™. During export the FBX Exporter replaces characters in Unity names as follows:<br/> - Replaces invalid characters with underscores ("\_"). Invalid characters are all non-alphanumeric characters, except for the colon (":").<br/> - Adds an underscore ("\_") to names that begin with a number.<br/> - Replaces diacritics. For example, replaces "é" with “e”.<br/><br/>**NOTE:** If you have a Material with a space in its name, the space is replaced with an underscore ("_"). This results in a new Material being created when it is imported. For example, the Material named "Default Material" is exported as "Default_Material" and is created as a new Material when it is imported. If you want the exported Material to match an existing Material in the scene, you must manually rename the Material before exporting. |
28+
| __Export Unrendered__ | Check this option to export meshes that either don't have a renderer component, or that have a disabled renderer component. For example, a simplified mesh used as a Mesh collider. |
29+
|__Preserve Import Settings__ | Check this option to preserve all import settings applied to an existing fbx that will be overwritten in the export. If the GameObject is being exported as a new fbx, the import settings will not be carried over.|
30+
31+
32+
#### Convert to Prefab Options
33+
| Property: | Function: |
34+
| :---------------------------- | :----------------------------------------------------------- |
35+
| __Prefab Path__ | Specify the location where the FBX Exporter will save the FBX Prefab Variant file. |
36+
| __Export Format__ | Select the format for the FBX Exporter to use when exporting the FBX file (ASCII or binary). |
37+
| __Include__ | __Convert to FBX Prefab Variant__ always exports both Models and Animation in the hierarchy. |
38+
| __LOD level__ | __Convert to FBX Prefab Variant__ always exports All levels of detail (LOD) available in the hierarchy for LOD groups. |
39+
| __Object(s) Position__ | __Convert to FBX Prefab Variant__ always resets the root object's transform during export. However, the Prefab maintains the global transform for the root object. |
40+
| __Animated Skinned Mesh__ | Check this option to export animation on objects with skinned meshes.<br/><br/>If unchecked, the FBX Exporter does not export animation on skinned meshes. |
41+
| __Compatible Naming__ | Check this option to control renaming the GameObject and Materials during export. <br/><br/>The FBX Exporter ensures compatible naming with Autodesk® Maya® and Autodesk® Maya LT™ to avoid unexpected name changes between Unity and Autodesk® Maya® and Autodesk® Maya LT™. During export the FBX Exporter replaces characters in Unity names as follows:<br/> - Replaces invalid characters with underscores ("\_"). Invalid characters are all non-alphanumeric characters, except for colon (":").<br/> - Adds an underscore ("\_") to names that begin with a number. - Replaces diacritics. For example, replaces "é" with “e”.<br/><br/>**NOTE:** If you have a Material with a space in its name, the space is replaced with an underscore ("_"). This results in a new Material being created when it is imported. For example, the Material named "Default Material" is exported as "Default_Material" and is created as a new Material when it is imported. If you want the exported Material to match an existing Material in the scene, you must manually rename the Material before exporting. |
42+
43+
44+
### Integration
1245
| Property: | Function: |
1346
| :---------------------------- | :----------------------------------------------------------- |
14-
| __Show Convert UI__ | Check this option to hide the Convert to Model Prefab Variant UI when converting. The last selected path will be used and the filename will be based on the selected object's name. |
1547
| __3D Application__ | Select the 3D modeling software you want to integrate with Unity. Autodesk® Maya® 2017+, Autodesk® Maya LT™ 2017+, and Autodesk® 3ds Max® 2017+ are the three applications currently supported.<br/><br/>Click the Browse button to choose a 3D modeling software installed in a non-standard location. |
1648
| __Keep Open__ | Check this option to keep the selected 3D modeling software open after installing it. |
1749
| __Hide Native Menu__ | Check this option to hide the native __Send to Unity__ menu in Autodesk® Maya® and Autodesk® Maya LT™. |
1850
| __Install Unity Integration__ | Click this button to install [Unity Integration](integration.html) for the selected __3D Application__. |
51+
52+
### FBX Prefab Component Updater
53+
| Property: | Function: |
54+
| :---------------------------- | :----------------------------------------------------------- |
1955
| __Run Component Updater__ | Click this button to run the [Component Updater](index.html#Repairs_1_3_0f_1) to repair any missing FbxPrefab components if you were using version 1.3.0f1 or earlier of the FBX Exporter package. |
2056

2157

com.unity.formats.fbx/Documentation~/prefabs.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ When converting to an FBX Prefab Variant, the following window opens, displaying
8585
| __Object(s) Position__ | __Convert to FBX Prefab Variant__ always resets the root object's transform during export. However, the Prefab maintains the global transform for the root object. |
8686
| __Animated Skinned Mesh__ | Check this option to export animation on objects with skinned meshes.<br/><br/>If unchecked, the FBX Exporter does not export animation on skinned meshes. |
8787
| __Compatible Naming__ | Check this option to control renaming the GameObject and Materials during export. <br/><br/>The FBX Exporter ensures compatible naming with Autodesk® Maya® and Autodesk® Maya LT™ to avoid unexpected name changes between Unity and Autodesk® Maya® and Autodesk® Maya LT™. During export the FBX Exporter replaces characters in Unity names as follows:<br/> - Replaces invalid characters with underscores ("\_"). Invalid characters are all non-alphanumeric characters, except for colon (":").<br/> - Adds an underscore ("\_") to names that begin with a number. - Replaces diacritics. For example, replaces "é" with “e”.<br/><br/>**NOTE:** If you have a Material with a space in its name, the space is replaced with an underscore ("_"). This results in a new Material being created when it is imported. For example, the Material named "Default Material" is exported as "Default_Material" and is created as a new Material when it is imported. If you want the exported Material to match an existing Material in the scene, you must manually rename the Material before exporting. |
88-
| __Don't ask me again__ | Check this option to use the same **Convert Option** properties and hide this window when converting to FBX Prefab Variants in the future. You can reset this option by turning on the **Show Convert UI** option under **Edit** > **Project Settings** > **Fbx Export** in Unity's top menu. |
88+
| __Don't ask me again__ | Check this option to use the same **Convert Option** properties and hide this window when converting to FBX Prefab Variants in the future. You can reset this option by turning on the **Display Options Window** option under **Edit** > **Project Settings** > **Fbx Export** in Unity's top menu. |
8989

9090
> **NOTE:** For FBX Model filenames, the FBX Exporter ensures that names do not contain invalid characters for the file system. The set of invalid characters may differ between file systems.
9191
9292

93+
> **NOTE:** If a Default Preset has been set in the Preset Manager, the settings will default to this preset. Otherwise, the settings will default to the settings in Edit > Project Settings... > Fbx Export under Convert to Prefab Options.
94+
However, modifying the settings in the Convert Options window will preserve the changes for the remainder of the Unity session.
95+
9396

9497
<a name="conversion"></a>
9598
### Converting from Linked Prefabs to FBX Prefab Variants

com.unity.formats.fbx/Editor/ConvertToNestedPrefab.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static GameObject[] CreateInstantiatedModelPrefab(
149149
{
150150
var toExport = ModelExporter.RemoveRedundantObjects(unityGameObjectsToConvert);
151151

152-
if (ExportSettings.instance.ShowConvertToPrefabDialog)
152+
if (ExportSettings.instance.DisplayOptionsWindow)
153153
{
154154
if (toExport.Count == 1)
155155
{

0 commit comments

Comments
 (0)