Merge pull request #5911 from ynput/bugfix/The-context-data-not-being-updated-correctly-when-the-variant-data-has-been-changed

Max: fix the subset name not changing accordingly after the variant name changes
This commit is contained in:
Kayla Man 2023-11-17 17:46:32 +08:00 committed by GitHub
commit 6cefe85e65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -359,8 +359,6 @@ def reset_colorspace():
colorspace_mgr.Mode = rt.Name("OCIO_Custom")
colorspace_mgr.OCIOConfigPath = ocio_config_path
colorspace_mgr.OCIOConfigPath = ocio_config_path
def check_colorspace():
parent = get_main_window()

View file

@ -204,6 +204,8 @@ class MaxCreator(Creator, MaxCreatorBase):
def create(self, subset_name, instance_data, pre_create_data):
if pre_create_data.get("use_selection"):
self.selected_nodes = rt.GetCurrentSelection()
if rt.getNodeByName(subset_name):
raise CreatorError(f"'{subset_name}' is already created..")
instance_node = self.create_instance_node(subset_name)
instance_data["instance_node"] = instance_node.name
@ -246,14 +248,25 @@ class MaxCreator(Creator, MaxCreatorBase):
def update_instances(self, update_list):
for created_inst, changes in update_list:
instance_node = created_inst.get("instance_node")
new_values = {
key: changes[key].new_value
for key in changes.changed_keys
}
subset = new_values.get("subset", "")
if subset and instance_node != subset:
node = rt.getNodeByName(instance_node)
new_subset_name = new_values["subset"]
if rt.getNodeByName(new_subset_name):
raise CreatorError(
"The subset '{}' already exists.".format(
new_subset_name))
instance_node = new_subset_name
created_inst["instance_node"] = instance_node
node.name = instance_node
imprint(
instance_node,
new_values,
created_inst.data_to_store(),
)
def remove_instances(self, instances):