-
Notifications
You must be signed in to change notification settings - Fork 203
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
EMSUSD-1134 export assigned materials #3786
Conversation
Modify the export command: - Add new export flag "exportAssignedMaterials" (-ama). - Default to be turned on. - Expose it in Python. - Document it. - Add a checkbox UI for it in the export options. Modify how material assignments are found: - Bundle all informations about assignments for a material in a single struct. - Add a flag to the info set if the material is used anywhere, even by meshes not being exported. - Add a flag to the info set if the material is used by something in the selection. - Also check any ancestor of the mesh for the selection inclusion since selection in the viewport selects the parent transform. - Also, by default, the outliner shows the parent transforms, not the shape/mesh, so selection there would also select an ancestor. - Modify the GetAssignments function to fill those flags. Modify how materials are filtered: - In the filter function for materials, add the logic for assigned-materials. - Use the flags about assignments and assignments-in-selection to determine if a material should be exported. - When exporting assigned materials, if the material is not used at all, then the material is not exported. - When exporting the selection, if a material was used by something in the selection, export it even if the user was something not exported, like when the meshes are off. Add unit tests for when assigned materials are off. (The case when it is on was already tested by existing tests.)
for (MDagPath walkUpPath(dagPath); walkUpPath.length() > 0; walkUpPath.pop()) | ||
if (GetExportArgs().fullObjectList.hasItem(walkUpPath)) | ||
ret.hasAnyAssignmentInSelection = true; | ||
|
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.
To support the logic of determining if a material should be exported, we need to know if it is used in the scene and if it used by something that was selected. This is what the new code above does.
// contains the transform above the mesh or a higher-up ancestor, | ||
// so also check the ancestors of the mesh. | ||
for (MDagPath walkUpPath(dagPath); walkUpPath.length() > 0; walkUpPath.pop()) | ||
if (GetExportArgs().fullObjectList.hasItem(walkUpPath)) |
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.
Is there a policy in code guidelines for one line if cases like if they should have {} or not? I couldn't find one. This is minor, anyways
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.
There is no policy for this (no {} is allowed), other than the formatting done by clang-format.
Modify the export command:
Modify how material assignments are found:
Modify how materials are filtered:
Add unit tests for when assigned materials are off. (The case when it is on was already tested by existing tests.)