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

Max: Bug fix the "remove items" not working in Scene Inventory Manager #66

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions client/ayon_core/hosts/max/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,26 @@ def get_previous_loaded_object(container: str):
if str(obj) in sel_list:
node_list.append(obj)
return node_list


def remove_container_data(container_node: str):
"""Function to remove container data after updating, switching or deleting it.

Args:
container_node (str): container node
"""
if container_node.modifiers[0].name == "OP Data":
all_set_members_names = [
member.node for member
in container_node.modifiers[0].openPypeData.all_handles]
# clean up the children of alembic dummy objects
for current_set_member in all_set_members_names:
shape_list = [members for members in current_set_member.Children
if rt.ClassOf(members) == rt.AlembicObject
or rt.isValidNode(members)]
if shape_list: # noqa
rt.Delete(shape_list)
rt.Delete(current_set_member)
rt.deleteModifier(container_node, container_node.modifiers[0])

rt.Delete(container_node)
7 changes: 4 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from ayon_core.hosts.max.api import lib, maintained_selection
from ayon_core.hosts.max.api import lib
from ayon_core.hosts.max.api.lib import (
unique_namespace,
get_namespace,
Expand All @@ -9,7 +9,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load

Expand Down Expand Up @@ -96,4 +97,4 @@ def remove(self, container):
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_max_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
)
from ayon_core.hosts.max.api.pipeline import (
containerise, get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load

Expand Down Expand Up @@ -93,6 +94,5 @@ def switch(self, container, representation):

def remove(self, container):
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
7 changes: 4 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from ayon_core.pipeline import load, get_representation_path
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object
get_previous_loaded_object,
remove_container_data
)
from ayon_core.hosts.max.api import lib
from ayon_core.hosts.max.api.lib import (
Expand Down Expand Up @@ -97,9 +98,9 @@ def switch(self, container, representation):

def remove(self, container):
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)


@staticmethod
def get_container_children(parent, type_name):
Expand Down
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_model_fbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from ayon_core.pipeline import load, get_representation_path
from ayon_core.hosts.max.api.pipeline import (
containerise, get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.hosts.max.api import lib
from ayon_core.hosts.max.api.lib import (
Expand Down Expand Up @@ -92,6 +93,5 @@ def switch(self, container, representation):

def remove(self, container):
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_model_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load

Expand Down Expand Up @@ -84,6 +85,5 @@ def switch(self, container, representation):

def remove(self, container):
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
6 changes: 4 additions & 2 deletions client/ayon_core/hosts/max/plugins/load/load_model_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load

Expand Down Expand Up @@ -113,5 +114,6 @@ def switch(self, container, representation):
self.update(container, representation)

def remove(self, container):
from pymxs import runtime as rt
node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
7 changes: 4 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from ayon_core.hosts.max.api.lib import unique_namespace
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object
get_previous_loaded_object,
remove_container_data
)


Expand Down Expand Up @@ -103,9 +104,9 @@ def switch(self, container, representation):

def remove(self, container):
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)


@staticmethod
def get_container_children(parent, type_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)

from ayon_core.hosts.max.api.lib import (
Expand Down Expand Up @@ -104,5 +105,6 @@ def switch(self, container, representation):
self.update(container, representation)

def remove(self, container):
from pymxs import runtime as rt
node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load

Expand Down Expand Up @@ -63,6 +64,5 @@ def switch(self, container, representation):
def remove(self, container):
"""remove the container"""
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
update_custom_attribute_data,
get_previous_loaded_object
get_previous_loaded_object,
remove_container_data
)
from ayon_core.hosts.max.api import lib
from ayon_core.hosts.max.api.lib import (
Expand Down Expand Up @@ -72,6 +73,5 @@ def switch(self, container, representation):

def remove(self, container):
from pymxs import runtime as rt

node = rt.getNodeByName(container["instance_node"])
rt.delete(node)
node = rt.GetNodeByName(container["instance_node"])
remove_container_data(node)
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/max/plugins/load/load_tycache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from ayon_core.hosts.max.api.pipeline import (
containerise,
get_previous_loaded_object,
update_custom_attribute_data
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load

Expand Down Expand Up @@ -59,6 +60,5 @@ def switch(self, container, representation):
def remove(self, container):
"""remove the container"""
from pymxs import runtime as rt

node = rt.GetNodeByName(container["instance_node"])
rt.Delete(node)
remove_container_data(node)
Loading