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

Maya: Update publish instances via CreateContext + use task attributes instead of folder attributes #358

Conversation

BigRoy
Copy link
Collaborator

@BigRoy BigRoy commented Apr 3, 2024

Changelog Description

Update instances using CreateContext to correctly update product names if needed

  • Also rely on task attributes for resolution and frame ranges instead of folder attributes

Additional info

This will fix the updating the the workfile product name when switching between tasks and 'updating publish instances' along.

Testing notes:

  1. Saving to another context should correctly update workfile product name (and update folder path and task for the new context)
  2. Reset frame range should work (and adhere to task attributes)
  3. Reset resolution should work (and adhere to task attributes)

…mes if needed

- Also rely on task attributes for resolution and frame ranges instead of folder attributes
@ynbot ynbot added size/XS type: enhancement Improvement of existing functionality or minor addition host: Maya labels Apr 3, 2024
@BigRoy
Copy link
Collaborator Author

BigRoy commented Apr 3, 2024

This overlaps a tiny bit with #340 since it touches the resolution reset taking it from the task attributes.

Comment on lines +3252 to +3283
instance_values = {
"folderPath": create_context.get_current_folder_path(),
"task": create_context.get_current_task_name(),
}
creator_attribute_values = {
"frameStart": folder_entity["attrib"]["frameStart"],
"frameEnd": folder_entity["attrib"]["frameEnd"],
}

has_changes = False
for instance in create_context.instances:
for key, value in instance_values.items():
if key not in instance or instance[key] == value:
continue

# Update instance value
print(f"Updating {instance.product_name} {key} to: {value}")
instance[key] = value
has_changes = True

creator_attributes = instance.creator_attributes
for key, value in creator_attribute_values.items():
if (
key not in creator_attributes
or creator_attributes[key] == value
):
continue

# Update instance creator attribute value
print(f"Updating {instance.product_name} {key} to: {value}")
instance[key] = value
has_changes = True
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Any code style tips for this @iLLiCiTiT ? Not sure if the two for loops feel cluttered or whether this makes sense as it is.

Copy link
Member

@moonyuet moonyuet left a comment

Choose a reason for hiding this comment

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

Tested successfully in Maya 2023. Validate Frame Range, Validate Resolution, Validate instance in same context and their repair actions all work. The switch context data and save also works too.
image

@MustafaJafar MustafaJafar added the community Issues and PRs coming from the community members label Apr 3, 2024
Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

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

Besides regular switching of context by workfiles and resaving, I have also tested the Set Frame range and Set Resolution on a task level if set differently as seen here for my FX task
image

And all working predictably and as supposed to! So All good!

@moonyuet moonyuet merged commit 7af860f into ynput:develop Apr 5, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues and PRs coming from the community members host: Maya size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants