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

Support for user components directories #290

Merged
merged 8 commits into from
Jun 5, 2024
Merged

Conversation

keianhzo
Copy link
Contributor

@keianhzo keianhzo commented May 23, 2024

This PR adds support for custom user components directories.

The user can add multiple directories and the components found in those directories will be loaded at add-on load time.

We don't do hot reloading as it can get quite complex quickly and Blender already requires reload for it's own scripts paths AFAIK.

Required by https://github.com/MozillaReality/hubs-postprocessing-addon
Closes #288

@keianhzo keianhzo requested a review from Exairnous May 23, 2024 09:42
Copy link
Contributor

@Exairnous Exairnous left a comment

Choose a reason for hiding this comment

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

Thanks for this!
There were a few issues that I found that I think should be addressed, but I think they should be easy to solve. I've left inline comments for them.

I also noticed in a couple places you're using enumerate but discarding the index. Is there a reason why you aren't just looping over stuff regularly in those places?

addons/io_hubs_addon/components/components_registry.py Outdated Show resolved Hide resolved
addons/io_hubs_addon/components/components_registry.py Outdated Show resolved Hide resolved
addons/io_hubs_addon/components/types.py Show resolved Hide resolved
addons/io_hubs_addon/preferences.py Outdated Show resolved Hide resolved
addons/io_hubs_addon/preferences.py Outdated Show resolved Hide resolved
addons/io_hubs_addon/preferences.py Outdated Show resolved Hide resolved
addons/io_hubs_addon/preferences.py Outdated Show resolved Hide resolved
addons/io_hubs_addon/components/components_registry.py Outdated Show resolved Hide resolved
@keianhzo keianhzo requested a review from Exairnous June 4, 2024 08:06
@keianhzo keianhzo force-pushed the user-modules-dirs branch from 1ee3092 to 1db0eb2 Compare June 5, 2024 08:20
@Exairnous
Copy link
Contributor

Exairnous commented Jun 5, 2024

Oh, I just realized, when add/removing directories, the preferences should be marked dirty:
context.preferences.is_dirty = True

This is for when the user has selected that preferences shouldn't auto-save.

Copy link
Contributor

@Exairnous Exairnous left a comment

Choose a reason for hiding this comment

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

The dirty state of the preferences isn't updating when the fields are modified, which is weird. I suppose you could add a lambda to the update argument for the string properties and manually mark them dirty, but not sure why it's not doing it automatically. Anyway, I'll leave it up to you on whether you want to support this right now or not.

LGTM. Thank you for the changes.

@keianhzo keianhzo merged commit 0b96d30 into master Jun 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Definitions Directory
2 participants