-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export: All available materials #1080
Conversation
Also there's a material named "Dots Stroke" in every .blend by default (it's for the grease pencil) that gets exported, which is probably not expected since it doesn't show up in the material select dropdown. Should we check for it somehow in the edit: could maybe check |
@scurest This commit probably resolv your 2 questions about edit: For this situation |
Yeah it does! The rest is just IMO: The new design, where it exports any material assigned to any slot of any object in an exported scene, seems a bit weird to me. The idea of using unused material slots does seem cool (since it would let you control what materials get exported). Seems more consistent to me to only look for unused slots on meshes that actually get exported though (under an option like Geometry > Unused Materials maybe). |
blender_object = _blender_object.proxy if _blender_object.proxy else _blender_object | ||
for slot in blender_object.material_slots: | ||
# Check if this slot as assigned material | ||
if slot.material is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scurest For than i understand, you thing to change if slot.material is None:
to if slot.material is None or slot.material == blender_object.active_material:
?
For exclude active_material in __gather_materials array for better performance ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, no. I was thinking instead of looking in any material slot in any object in an exported scene, only looking in any material slot in an object that gets exported.
Is that what the lastest "Check if this object is exclude from view layer" check is supposed to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You think is better to use bpy.data.objects
directly ?
But i need blender_scene
with gltf2_blender_gather_nodes.gather_node
, i can use users_scene
with Object but it's probably weird code because users_scene
is tuple.
"Check if this object is exclude from view layer" is because if you uncheck collection, all objects associated with this collection are not exported and is not necessary to exported materials assigned to these objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, your code is more efficient.
But probably change setting name like "Variants materials" for KHR_materials_variants
?
Let's merge #1206 first — once that's in, it provides a dropdown that seems like a better place to put this option. Also, I'm not sure "All materials" is the right name for this option. I would expect an option with that name to include unused materials. Perhaps "Linked materials"? |
@donmccurdy Linked materials is not a good name. "Linked" (in blender) means that material come from another .blend file |
Ok — If this were added to the dropdown from #1206, then perhaps:
Or, any other ideas? @StidOfficial would an option to export all materials (whether used in a slot or not) also work for your use case? |
If Slots option was included Applied + Slots, yes it's good idea with dropdown menu. |
Hi, I'm interested in this feature because #1206 has been merged and Applied + Slots options to the dropdown sounds good to me. Can this PR get in if the options are moved to the dropdown menu? @StidOfficial Would you mind if updating the PR for it? If you are busy, I would help. |
You can, i am not currently working on for this moment. |
Thanks, I would like to do. I'm not really sure the right way to take over a PR but I think I locally merge this PR, add some change, and make a new PR. |
FYI. Regarding |
I think we can now close this ticket, as material variants extension is now part of this addon (in Blender 3.3) |
Allow in export settings to export all available materials via
bpy.data.materials
into GLTF for use it in diffrents variants of mesh materials. #231