Implemented model material/texture import and reuse on model/scene load#667
Implemented model material/texture import and reuse on model/scene load#667Gopmyc wants to merge 17 commits intoOverload-Technologies:mainfrom
Conversation
adriengivry
left a comment
There was a problem hiding this comment.
Thanks for submitting this PR!
I can see a few major issues with this work:
-
Assimp is being used directly in
OvEditor. Implementation details related to model loading should remain hidden from the application behind theIModelParserinterface. Additional model data (i.e., material and texture information) should be fully handled by theAssimpParser. -
Project file pollution. This PR assumes that the user wants to place automatically generated materials and textures in
Materials/{model_name}/andModels/{model_name}/, respectively. -
Imported materials and models collision. In some cases, if the user has multiple models with the same name in different folders, only the first imported model will properly generate materials and textures.
Ultimately, my vision for this feature is to offer something similar to what Unity does. I see models (FBX, OBJ, etc.) as “folders” that can be expanded to reveal all their embedded assets, including materials and potentially textures, if any.
These embedded assets would be non-modifiable, as they would be generated when the model is loaded. They could then be dragged and dropped anywhere a material or texture is required. Paths for embedded assets could look like:
path/to/model.fbx:embedded_material.ovmat
path/to/model.fbx:embedded_texture.jpeg
In the model asset properties, we could add a toggle (above the model parsing flags) to determine whether embedded materials and textures should be generated.
This would also require updating the PropagateFileRename implementation to properly handle embedded assets.
Once this is fully implemented, I believe the “Generate materials” option in the model contextual menu could be safely removed.
The final step would be to add support for externally linked textures. Some models reference textures using relative paths, and it would be beneficial to support these as well. Generated materials should be able to reference linked textures correctly.
Given the scope of this work, I understand if it’s not manageable for you at the moment. We’ve postponed this effort for many years because it’s fairly complex and has a lot of dependencies.
|
Challenge accepted |
|
Yep, this is a pretty massive change. Totally agree about breaking it down.
|
Great question. By “loading materials virtually through the parser”, I mean:
Then, “assigning them at runtime” means |
# Conflicts: # Sources/OvEditor/src/OvEditor/Core/EditorActions.cpp

Description
This PR implements automatic material/texture import and reuse for models, both when adding a model to the scene and when loading a
.ovscene.Main changes:
Assets/Materials/<ModelName>/Assets/Textures/<ModelName>/.ovscene).IMeshusage).Related Issue(s)
Fixes #303
Review Guidance
.fbx, etc.) into the scene:.ovscenecontaining models:Screenshots/GIFs
Checklist
I have commented my code, particularly in hard-to-understand areasI have updated the documentation accordingly