-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support to run the workfile template builder on startup and simplify resolve houdini path #74
Add support to run the workfile template builder on startup and simplify resolve houdini path #74
Conversation
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.
Hey, I gave this a test from user perspective.
Here I tested some cases:
- Launch Houdini as usual. I've few workfiles. (Build skipped)
- Launch Houdini while skipping opening last workfile. (Build skipped)
- Launch Houdini (without having any last files) and create first version is enabled. (Build Done)
- Launch Houdini (without having any last files) and create first version is disabled. (didn't build.) (Build didn't continue)
@fabiaserra could you point out - from that list above what your expected behavior would be for each? I'd assume that you'd expect 2) to also still "build", yes? |
Yeah otherwise an artist could be starting a new workfile (even if there's existing ones) without being based on the template scene and we want to reduce the chances of that happening... Although the phrasing of your test cases is a bit confusing as the first two is not clear whether This phrasing is more clear:
Having that said, I would expect the following:
|
This should launch WITH workfile template build right? Because it would initialize to empty scene otherwise? |
You are right yeah, let me update it Create First Version: True and Open last workfile: True Create First Version: True and Open last workfile: False Create First Version: False and Open last workfile: True Create First Version: False and Open last workfile: False |
Great, so in essence: Create First Version: True Basically, whenever an "empty scene" would initialize in Houdini - then use the template
When doing "New scene" (e.g. CTRL+N), run the Workfile Template Build ✅ Create First Version: False |
Hey, As well as the test cases summarized by @BigRoy here #74 (comment) anyways, I did further testing and was able to reproduce the the provided cases by using this PR and (this core PR ynput/ayon-core#871) cases:
Test Runs: 1.b 2.a and 2.b
|
My questions regarding that code of def build_template(
self,
template_path=None,
level_limit=None,
keep_placeholders=None,
create_first_version=None,
workfile_creation_enabled=False
):
# Get default values if not provided
if template_path is None or keep_placeholders is None or create_first_version is None:
preset = self.get_template_preset()
template_path = template_path or preset["path"]
keep_placeholders = keep_placeholders if keep_placeholders is not None else preset["keep_placeholder"]
create_first_version = create_first_version if create_first_version is not None else preset["create_first_version"]
created_version_workfile = self.create_first_workfile_version() if create_first_version else False
# Handle workfile creation if enabled and a new version was created
if workfile_creation_enabled and created_version_workfile:
self.import_template(template_path)
self.populate_scene_placeholders(level_limit, keep_placeholders)
self.save_workfile(created_version_workfile)
return
# If workfile creation is not enabled or no new version was created,
# proceed with template import and population
if not workfile_creation_enabled:
self.import_template(template_path)
self.populate_scene_placeholders(level_limit, keep_placeholders) |
tbh, I'm not sure how to fix that in my PR ynput/ayon-core#871 |
What results are you getting with the code that I shared? To be honest, in my opinion it even makes sense to separate the Create First Version: False And so even if a workfile version isn't created and saved... the template scene is populated, which I think aligns with the code that I shared |
Hmm yes - I think I may have misunderstood the system or whatever. To me, dumbed down it may be best described as:
Tagging @dee-ynput @antirotor for their opinions. Also, Pressing New Scene (CTRL+N) would never 'save'. The create first version is only upon host application launch. (Which should technically never happen anyway, because if Create first version (as I described it here) is enabled it would've already generated it at launch). If def build_template(
self,
template_path=None,
level_limit=None,
keep_placeholders=None,
create_first_version=None,
workfile_creation_enabled=False
):
# NOTE: This function should NOT run when a last workfile was opened. It should only trigger
# on initializing a host to a new scene or on pressing CTRL+N (new file). Pressing CTRL+N
# should enforce `create_first_version` to False
# Get default values if not provided
if template_path is None or keep_placeholders is None or create_first_version is None:
preset = self.get_template_preset()
template_path = template_path or preset["path"]
keep_placeholders = keep_placeholders if keep_placeholders is not None else preset["keep_placeholder"]
create_first_version = create_first_version if create_first_version is not None else preset["create_first_version"]
# Handle workfile creation if enabled, proceed with template import and population
if workfile_creation_enabled:
self.import_template(template_path)
self.populate_scene_placeholders(level_limit, keep_placeholders)
# Save first workfile version
if create_first_version:
self.create_first_workfile_version() |
Thanks @BigRoy for the summary - I think it is exactly like that. Might be worth taking it and put it to the documentation |
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 didn't go deep through the code.
But, it works on my side.
For reference, I was using this PR all the time while testing ynput/ayon-core#871
since this PR allowed running the template builder by default when opening a new scene.
However, we need the core PR to make it work with empty scenes or with the first workfile created by enabling create_first_version
.
since it creates the new file before the building step.
What I like the most about this PR and the core PR. is that they contain good info for documenting the tool.
…` in favor of an upcoming feature in ayon-core
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.
Mustafa approved me, live... watching me.. it was scary!
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.
Made few test runs.
The PR still works as expected.
Updated the path template resolving to match an update in the core PR. Would be good to test again @MustafaJafar |
If it is dependent on ynput/ayon-core#875 then it should bump required ayon-core to |
It is not entirely dependent - because without core So, shall I pin it to |
imo. it's not a necessary. because it'll work perfectly fine with regular paths. |
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.
It works on my side as expected.
Tested along with ynput/ayon-core#871
Just wanted to link this other PR ynput/OpenPype#6286 here which uses some function naming that I think is much nicer. It's all in Maya - which isn't preferred - at best we can make that DCC-agnostic and trigger it somehow in core without having to duplicate the idea everywhere. But, as said.. just wanted to link it. |
Changelog Description
The workfile template builder wasn't running automatically when starting up Houdini, you had to go click the button
Build Workfile from template
in order to trigger it instead. This PR adds the callback on startup so it automatically creates a first version of a workfile with the templated scene.This also refactors the usage of
hou.text.expandString
to expand Houdini variables in the template path. It requires ynput/ayon-core#875 but will work backwards compatible without that (but it will then just not resolve).It also fixes the bug where
hou.text.expandString
would remove the double backslashes from a UNC path by escaping backslashes.Additional info
n/a
Testing notes:
ayon-houdini
settings withCreate first version
enabled and a path to a template scene file