@@ -453,7 +453,7 @@ bool ModelTool::ImportData(const String& path, ModelData& data, Options& options
|
||||
options.FramesRange.Y = Math::Max(options.FramesRange.Y, options.FramesRange.X);
|
||||
options.DefaultFrameRate = Math::Max(0.0f, options.DefaultFrameRate);
|
||||
options.SamplingRate = Math::Max(0.0f, options.SamplingRate);
|
||||
if (options.SplitObjects)
|
||||
if (options.SplitObjects || options.Type == ModelType::Prefab)
|
||||
options.MergeMeshes = false; // Meshes merging doesn't make sense when we want to import each mesh individually
|
||||
// TODO: maybe we could update meshes merger to collapse meshes within the same name if splitting is enabled?
|
||||
|
||||
@@ -808,6 +808,13 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option
|
||||
case ModelType::Animation:
|
||||
options.ImportTypes = ImportDataTypes::Animations;
|
||||
break;
|
||||
case ModelType::Prefab:
|
||||
options.ImportTypes = ImportDataTypes::Geometry | ImportDataTypes::Nodes | ImportDataTypes::Animations;
|
||||
if (options.ImportMaterials)
|
||||
options.ImportTypes |= ImportDataTypes::Materials;
|
||||
if (options.ImportTextures)
|
||||
options.ImportTypes |= ImportDataTypes::Textures;
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
@@ -1279,7 +1286,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option
|
||||
!
|
||||
#endif
|
||||
}
|
||||
if (EnumHasAnyFlags(options.ImportTypes, ImportDataTypes::Geometry))
|
||||
if (EnumHasAnyFlags(options.ImportTypes, ImportDataTypes::Geometry) && options.Type != ModelType::Prefab)
|
||||
{
|
||||
// Perform simple nodes mapping to single node (will transform meshes to model local space)
|
||||
SkeletonMapping<ModelDataNode> skeletonMapping(data.Nodes, nullptr);
|
||||
|
||||
@@ -114,6 +114,8 @@ public:
|
||||
SkinnedModel = 1,
|
||||
// The animation asset.
|
||||
Animation = 2,
|
||||
// The prefab scene.
|
||||
Prefab = 3,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -282,10 +284,10 @@ public:
|
||||
public: // Splitting
|
||||
|
||||
// If checked, the imported mesh/animations are split into separate assets. Used if ObjectIndex is set to -1.
|
||||
API_FIELD(Attributes="EditorOrder(2000), EditorDisplay(\"Splitting\")")
|
||||
API_FIELD(Attributes="EditorOrder(2000), EditorDisplay(\"Splitting\"), VisibleIf(nameof(ShowSplitting))")
|
||||
bool SplitObjects = false;
|
||||
// The zero-based index for the mesh/animation clip to import. If the source file has more than one mesh/animation it can be used to pick a desired object. Default -1 imports all objects.
|
||||
API_FIELD(Attributes="EditorOrder(2010), EditorDisplay(\"Splitting\")")
|
||||
API_FIELD(Attributes="EditorOrder(2010), EditorDisplay(\"Splitting\"), VisibleIf(nameof(ShowSplitting))")
|
||||
int32 ObjectIndex = -1;
|
||||
|
||||
public: // Other
|
||||
|
||||
Reference in New Issue
Block a user