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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114 | class CreateTextures(TextureCreator):
"""Create a texture set."""
identifier = "io.ayon.creators.substancedesigner.textureset"
label = "Textures"
product_type = "textureSet"
icon = "picture-o"
default_variant = "Main"
settings_category = "substancedesigner"
review = False
exportFileFormat = "png"
def get_dynamic_data(
self,
project_name,
folder_entity,
task_entity,
variant,
host_name,
instance
):
"""
The default product name templates for Unreal include {asset} and thus
we should pass that along as dynamic data.
"""
dynamic_data = super(CreateTextures, self).get_dynamic_data(
project_name,
folder_entity,
task_entity,
variant,
host_name,
instance
)
dynamic_data["asset"] = folder_entity["name"]
return dynamic_data
def create(self, product_name, instance_data, pre_create_data):
current_graph_name = get_current_graph_name()
if not current_graph_name:
raise CreatorError("Can't create a Texture Set instance without "
"the Substance Designer Graph.")
# Transfer settings from pre create to instance
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
for key in [
"review",
"exportFileFormat",
"exportedGraphs",
"exportedGraphsOutputs"
]:
if key in pre_create_data:
creator_attributes[key] = pre_create_data[key]
instance = self.create_instance_in_context(product_name,
instance_data)
set_instance(
instance_id=instance["instance_id"],
instance_data=instance.data_to_store()
)
def get_instance_attr_defs(self):
return [
BoolDef("review",
label="Review",
tooltip="Mark as reviewable",
default=self.review),
EnumDef("exportFileFormat",
items={
# TODO: Get available extensions from substance API
"bmp": "bmp",
"dds": "dds",
"jpeg": "jpeg",
"jpg": "jpg",
"png": "png",
"tga": "targa",
"tif": "tiff",
"surface": "surface",
"hdr": "hdr",
"exr": "exr",
"jif": "jif",
"jpe": "jpe",
"webp": "webp",
# TODO: File formats that combine the exported textures
# like psd are not correctly supported due to
# publishing only a single file
# "sbsar": "sbsar",
},
default=self.exportFileFormat,
label="File type"),
EnumDef("exportedGraphs",
items=get_sd_graphs_by_package(),
multiselection=True,
default=None,
label="Graphs To be Exported"),
EnumDef("exportedGraphsOutputs",
items=get_output_maps_from_graphs(),
multiselection=True,
default=None,
label="Graph Outputs To be Exported")
]
|