Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
29e2c73
add get publish families function
moonyuet Sep 4, 2026
38c340f
add custom.frame.range as families
moonyuet Sep 4, 2026
263af34
Update client/ayon_max/api/plugin.py
moonyuet Sep 4, 2026
ced533e
Update client/ayon_max/api/plugin.py
moonyuet Sep 4, 2026
a268268
fix syntax error
moonyuet Sep 4, 2026
41e0b0e
remove the duplicated code
moonyuet Sep 4, 2026
b826969
Update client/ayon_max/api/plugin.py
moonyuet Sep 5, 2026
dc60d89
Update client/ayon_max/api/plugin.py
moonyuet Sep 5, 2026
0a79936
not to storing the publish_families during updating instances but ins…
moonyuet Sep 5, 2026
7e7402f
pop the families data during the imprint data
moonyuet Sep 7, 2026
cc9af7c
pop the families data before the imprint data
moonyuet Sep 7, 2026
ef92bf8
Update client/ayon_max/api/plugin.py
moonyuet Sep 7, 2026
91f641e
clean up
moonyuet Sep 7, 2026
57eb83f
implement the imprint instance node
moonyuet Sep 7, 2026
8c89f14
remove unused import
moonyuet Sep 7, 2026
699f17a
return empty list for get_pre_create_attr_defs()
moonyuet Sep 7, 2026
d4a13eb
Update client/ayon_max/api/plugin.py
moonyuet Sep 7, 2026
199abdb
Update client/ayon_max/api/plugin.py
moonyuet Sep 7, 2026
34b6642
clean up the line
moonyuet Sep 7, 2026
3ee228c
clean up the line
moonyuet Sep 7, 2026
c9d2b0f
add instance_data['families'] for general MaxCreator
moonyuet Sep 7, 2026
4b98064
Update client/ayon_max/api/plugin.py
moonyuet Sep 7, 2026
3430a3b
do not pop instance_node
moonyuet Sep 8, 2026
12d4206
wrong camera argument for local rendering
moonyuet Sep 8, 2026
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
68 changes: 23 additions & 45 deletions client/ayon_max/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
except ImportError:
rt = None


from ayon_core.lib import BoolDef
from ayon_core.pipeline import (
CreatedInstance,
Expand Down Expand Up @@ -357,6 +356,8 @@ def create(self, product_name, instance_data, pre_create_data):

instance_node = self.create_instance_node(product_name)
instance_data["instance_node"] = instance_node.name
if families := self.get_published_families():
instance_data["families"] = families
product_type = instance_data.get("productType")
if not product_type:
product_type = self.product_base_type
Expand Down Expand Up @@ -385,16 +386,18 @@ def create(self, product_name, instance_data, pre_create_data):
"sel_list", sel_list)

self._add_instance_to_context(instance)
imprint(instance_node.name, instance.data_to_store())
self.imprint_instance_node(instance_node.name, instance.data_to_store())
Comment on lines 388 to +389

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does indeed seem to be lacking. The publish families is lacking to be applied around line 358?


return instance

def collect_instances(self):
self.cache_instance_data(self.collection_shared_data)
for instance in self.collection_shared_data["max_cached_instances"].get(self.identifier, []): # noqa
created_instance = CreatedInstance.from_existing(
read(rt.GetNodeByName(instance)), self
)
data = read(rt.GetNodeByName(instance))
families = self.get_published_families()
if families:
Comment thread
BigRoy marked this conversation as resolved.
data["families"] = families
created_instance = CreatedInstance.from_existing(data, self)
self._add_instance_to_context(created_instance)

def update_instances(self, update_list):
Expand All @@ -416,10 +419,7 @@ def update_instances(self, update_list):
created_inst["instance_node"] = instance_node
node.name = instance_node

imprint(
instance_node,
created_inst.data_to_store(),
)
self.imprint_instance_node(instance_node, created_inst.data_to_store())

def remove_instances(self, instances):
"""Remove specified instance from the scene.
Expand All @@ -444,9 +444,15 @@ def get_pre_create_attr_defs(self):
]


class MaxCacheCreator(Creator, MaxTyFlowDataCreatorBase):
skip_discovery = True
settings_category = "max"
def get_published_families(self) -> list[str]:
return []

def imprint_instance_node(self, node, data):
data.pop("families", None)
return imprint(node, data)


class MaxCacheCreator(MaxCreator, MaxTyFlowDataCreatorBase):

def create(self, product_name, instance_data, pre_create_data):
tyflow_op_nodes = get_tyflow_export_operators()
Expand All @@ -455,6 +461,7 @@ def create(self, product_name, instance_data, pre_create_data):
" found in tyCache Editor.")
instance_node = self.create_instance_node(product_name)
instance_data["instance_node"] = instance_node.name
instance_data["families"] = self.get_published_families()
product_type = instance_data.get("productType")
if not product_type:
product_type = self.product_base_type
Expand All @@ -471,42 +478,10 @@ def create(self, product_name, instance_data, pre_create_data):
instance_node.modifiers[0].AYONTyCacheData,
"tyc_handles", node_list)
self._add_instance_to_context(instance)
imprint(instance_node.name, instance.data_to_store())
self.imprint_instance_node(instance_node.name, instance.data_to_store())

return instance

def collect_instances(self):
self.cache_instance_data(self.collection_shared_data)
for instance in self.collection_shared_data["max_cached_instances"].get(self.identifier, []): # noqa
created_instance = CreatedInstance.from_existing(
read(rt.GetNodeByName(instance)), self
)
self._add_instance_to_context(created_instance)

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
}
product_name = new_values.get("productName", "")
if product_name and instance_node != product_name:
node = rt.getNodeByName(instance_node)
new_product_name = new_values["productName"]
if rt.getNodeByName(new_product_name):
raise CreatorError(
"The product '{}' already exists.".format(
new_product_name))
instance_node = new_product_name
created_inst["instance_node"] = instance_node
node.name = instance_node

imprint(
instance_node,
created_inst.data_to_store(),
)

def remove_instances(self, instances):
"""Remove specified instance from the scene.

Expand All @@ -524,3 +499,6 @@ def remove_instances(self, instances):
rt.Delete(instance_node)

self._remove_instance_from_context(instance)

def get_pre_create_attr_defs(self):
return []
4 changes: 4 additions & 0 deletions client/ayon_max/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def create(self, product_name, instance_data, pre_create_data):
filename, _ = os.path.splitext(file)
instance_data["original_workfile_pattern"] = filename.strip(".")
instance_data["multiCamera"] = pre_create_data.get("multi_cam")
instance_data["families"] = self.get_published_families()
num_of_renderlayer = rt.batchRenderMgr.numViews
if num_of_renderlayer > 0:
rt.batchRenderMgr.DeleteView(num_of_renderlayer)
Expand Down Expand Up @@ -81,3 +82,6 @@ def get_pre_create_attr_defs(self):
label="Multiple Cameras Submission",
default=False),
]

def get_published_families(self):
return ["maxrender", "custom.frame.range"]
2 changes: 1 addition & 1 deletion client/ayon_max/plugins/publish/extract_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def process(self, instance):
if camera else rt.viewport.GetCamera()
)
kwargs = {
"camera_node": camera_node,
"camera": camera_node,
"cancelled": pymxs.byref(None),
"vfb": False,
}
Expand Down