mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
Merge branch 'feature/OP-4672_Zbrush-integration' of https://github.com/ynput/ayon-core into feature/OP-4672_Zbrush-integration
This commit is contained in:
commit
c47a4e702b
2 changed files with 11 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Creator plugin for model."""
|
||||
from ayon_core.lib import NumberDef
|
||||
from ayon_core.lib import NumberDef, EnumDef
|
||||
from ayon_core.hosts.zbrush.api import plugin
|
||||
|
||||
|
||||
|
|
@ -10,11 +10,12 @@ class CreateModel(plugin.ZbrushCreator):
|
|||
label = "Model"
|
||||
product_type = "model"
|
||||
icon = "cube"
|
||||
export_format = "obj"
|
||||
|
||||
def create(self, product_name, instance_data, pre_create_data):
|
||||
creator_attributes = instance_data.setdefault(
|
||||
"creator_attributes", dict())
|
||||
for key in ["subd_level"]:
|
||||
for key in ["subd_level", "exportFormat"]:
|
||||
if key in pre_create_data:
|
||||
creator_attributes[key] = pre_create_data[key]
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ class CreateModel(plugin.ZbrushCreator):
|
|||
pre_create_data)
|
||||
|
||||
def get_instance_attr_defs(self):
|
||||
export_format_enum = ["abc", "fbx", "ma", "obj"]
|
||||
return [
|
||||
NumberDef(
|
||||
"subd_level",
|
||||
|
|
@ -37,7 +39,11 @@ class CreateModel(plugin.ZbrushCreator):
|
|||
"A level of -1 or lower subtracts from the highest subdiv,"
|
||||
"\n for example -1 means highest subdiv level."
|
||||
)
|
||||
)
|
||||
),
|
||||
EnumDef("exportFormat",
|
||||
export_format_enum,
|
||||
default=self.export_format,
|
||||
label="Export Format Options")
|
||||
]
|
||||
|
||||
def get_pre_create_attr_defs(self):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
import pyblish.api
|
||||
from ayon_core.lib import EnumDef
|
||||
from ayon_core.pipeline import publish
|
||||
from ayon_core.pipeline.publish import (
|
||||
AYONPyblishPluginMixin
|
||||
|
|
@ -19,16 +18,14 @@ class ExtractModel(publish.Extractor,
|
|||
label = "Extract Model"
|
||||
hosts = ["zbrush"]
|
||||
families = ["model"]
|
||||
export_format = "obj"
|
||||
|
||||
def process(self, instance):
|
||||
creator_attrs = instance.data["creator_attributes"]
|
||||
attr_values = self.get_attr_values_from_data(instance.data)
|
||||
export_format = attr_values.get("exportFormat")
|
||||
subd_level = creator_attrs.get("subd_level")
|
||||
export_format = creator_attrs.get("exportFormat")
|
||||
stagingdir = self.staging_dir(instance)
|
||||
filename = f"{instance.name}.{export_format}"
|
||||
filepath = os.path.join(stagingdir, filename)
|
||||
subd_level = creator_attrs.get("subd_level")
|
||||
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
|
@ -45,13 +42,3 @@ class ExtractModel(publish.Extractor,
|
|||
self.log.info(
|
||||
"Extracted instance '%s' to: %s" % (instance.name, filepath)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_attribute_defs(cls):
|
||||
export_format_enum = ["abc", "fbx", "ma", "obj"]
|
||||
return[
|
||||
EnumDef("exportFormat",
|
||||
export_format_enum,
|
||||
default=cls.export_format,
|
||||
label="Export Format Options")
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue