Skip to content
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

Arch: adapt materials to new Materials path scheme #13830

Merged
merged 3 commits into from
May 6, 2024

Conversation

furgo16
Copy link
Contributor

@furgo16 furgo16 commented May 5, 2024

Fixes #13821 by adapting the old material paths to the new scheme:

  1. Update the materials filesystem path when reading them
  2. Materials can now be in subfolders: traverse directories to read all materials

I'm aware of #13821 (comment). I've addressed this as a quicker way to get back the Materials function before #13783 gets merged, which might take longer. The intention is certainly not to step on anyone's toes, so if this is already being worked on, or can be fixed in a better way, feel free to close this PR.

@github-actions github-actions bot added WB BIM Related to the BIM/Arch Workbench Materials Materials related labels May 5, 2024
Copy link
Contributor

@davesrocketshop davesrocketshop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should only be necessary to change the path. The other changes will break other workbenches.

src/Mod/Material/importFCMat.py Outdated Show resolved Hide resolved
src/Mod/Arch/ArchMaterial.py Outdated Show resolved Hide resolved
@furgo16
Copy link
Contributor Author

furgo16 commented May 5, 2024

@davesrocketshop thanks again for doing the review. I believe the new changes address your review comments. Let me know if that looks ok.

@davesrocketshop
Copy link
Contributor

@davesrocketshop thanks again for doing the review. I believe the new changes address your review comments. Let me know if that looks ok.

It does. You might also want to look at materialtools.cardutils.get_material_resources() that builds the path for you including user materials, custom folders, and any added by add on workbenches. The need goes away though as the module transitions to the new materials system so that may not be necessary immediately.

@furgo16
Copy link
Contributor Author

furgo16 commented May 5, 2024

Thanks. I'll look into get_material_resources() for the next iteration. I had wondered if there was a dedicated function, but I had not found it. I'll look at the code examples I see in the cardutils.py comments in more detail, then.

@furgo16 furgo16 marked this pull request as ready for review May 5, 2024 15:40
@yorikvanhavre
Copy link
Member

Thanks @furgo16 ! This can go already I guess. I'll rebase #13783 on it

@yorikvanhavre yorikvanhavre merged commit cf59ec5 into FreeCAD:main May 6, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Materials Materials related WB BIM Related to the BIM/Arch Workbench
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Materials tool crashes on Arch workbench
3 participants