-
Notifications
You must be signed in to change notification settings - Fork 128
Blender: Set --python-use-system-env from PreLaunchHook #5565
Blender: Set --python-use-system-env from PreLaunchHook #5565
Conversation
We didn't add it automatically because someone wanted to launch it using rez or script (.bat/.sh) where it caused issues... (not saying I'm against). EDITED: It would nice to have option to turn the prelaunch hook off.
It make sense only for |
Thanks - yes, then I suspect instead having a toggle somewhere in settings might be the decent other solution? But I was expecting this might've been the case. Any good place you think this could work? Should it somehow be a part of the Blender-specific application versions? or more globally?
Thanks - I'll just make it the first three just in preparation of what might come; will save some debugging for those cases maybe? |
Not needed, that's unrelated to the launch hook itself. |
@iLLiCiTiT any insight for aformentioned things? thx |
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.
Code LGTM!
About the UI, I'd move it right before the custom arguments list, before the executables, it is confusing.
@Tilix4 This unfortunately wasn't as trivial because it builds that section using a template which is the full environment section - so I've opted to just add it at the end. |
@BigRoy This is fine for me! |
app = self.launch_context.application | ||
group_name = app.group.name | ||
app_name = app.name | ||
return ( | ||
self.data["system_settings"]["applications"][group_name] | ||
["variants"][app_name].get(key, default) | ||
) |
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.
This likely moves in AYON? Is there a better approach to this @iLLiCiTiT ?
Basically I'm trying to get an extra key from the variant setting.
(I'd also need to update the settings + defaults in AYON of course - if I know where those are)
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.
Yep this will need to be made forward compatible with AYON. Settings and their defaults are here ;) https://github.com/ynput/OpenPype/tree/develop/server_addon/applications/server
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.
app = self.launch_context.application | ||
group_name = app.group.name | ||
app_name = app.name | ||
return ( | ||
self.data["system_settings"]["applications"][group_name] | ||
["variants"][app_name].get(key, default) | ||
) |
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.
Yep this will need to be made forward compatible with AYON. Settings and their defaults are here ;) https://github.com/ynput/OpenPype/tree/develop/server_addon/applications/server
Because we're splitting OpenPype into ayon-core and individual host addons, this PR would have to be re-created to target one of those. It will need to be AYON compatible for it to get merged. We're closing it down, but we'll he happy for a new PRs to ynput/ayon-blender repository once it's up. |
Changelog Description
Automatically add
--python-use-system-env
when running Blender when it's not pre-configured in the application settings for Blender (In Studio Settings > System Settings > Applications > Blender > {version} > arguments.Additional info
It often happens that admins add a new Blender version in the applications but don't also apply the
--python-use-system-env
arguments meaning OpenPype will not be loaded for Blender plus won't be available in Blender onPYTHONPATH
.This avoids that issue by always enforcing the argument is added on launch plus updates the defaults so that
--python-use-system-env
isn't there by default either.@iLLiCiTiT I've set it to run on
launch_types = set()
so it always runs. I basically want it to run on ANY Blender launch where prior to this it'd have also been applied due to being in the arguments settings for the application. (I feel like that's likely more than just 'local', right?)Before:
After:
See this reference discussion on Discord for somebody who was hitting this issue. Although there have also been reports that it should be working without the flag.
Note: For those who were already succsesfully launching blender without
--python-use-system-env
this PR might be giving unexpected results if - for whatever reason - they don't actually use the system env in Blender.Testing notes:
--python-use-system-env
argument in settings--python-use-system-env
argument in settings (this is just to ensure it's backwards compatible with any settings a studio might currently have for custom versions.)