Bases: LoaderPlugin
Load rps files with Render Preset
Source code in client/ayon_max/plugins/load/load_renderpreset.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | class RenderPresetLoader(load.LoaderPlugin):
"""Load rps files with Render Preset"""
label = "Load Render Preset"
product_base_types = {"renderpreset"}
product_types = product_base_types
representations = {"*"}
extensions = {"rps"}
order = -9
icon = "code-fork"
color = "white"
def load(self, context, name=None, namespace=None, data=None):
# adding os.path.normpath to fix
# special FileName typeError in 3dsMax
filepath = os.path.normpath(self.filepath_from_context(context))
folder_name = context["folder"]["name"]
namespace = lib.unique_namespace(
name + "_",
prefix=f"{folder_name}_",
suffix="_",
)
rt.renderpresets.LoadAll(0, filepath)
return containerise(
name, [], context,
namespace, loader=self.__class__.__name__)
def update(self, container, context):
# adding os.path.normpath to fix
# special FileName typeError in 3dsMax
path = os.path.normpath(self.filepath_from_context(context))
rt.renderpresets.LoadAll(0, path)
lib.imprint(container["instance_node"], {
"representation": context["representation"]["id"],
"project_name": context["project"]["name"]
})
def switch(self, container, context):
self.update(container, context)
def remove(self, container):
node = rt.GetNodeByName(container["instance_node"])
remove_container_data(node)
|