use CreatorError for known issues on artist side

This commit is contained in:
iLLiCiTiT 2021-06-08 16:52:30 +02:00
parent 7b0126944b
commit e003afadf9
2 changed files with 8 additions and 7 deletions

View file

@ -1,3 +1,4 @@
from avalon.api import CreatorError
from avalon.tvpaint import pipeline, lib
from openpype.hosts.tvpaint.api import plugin
from openpype.lib import prepare_template_data
@ -51,16 +52,16 @@ class CreateRenderlayer(plugin.Creator):
# Raise if there is no selection
if not group_ids:
raise AssertionError("Nothing is selected.")
raise CreatorError("Nothing is selected.")
# This creator should run only on one group
if len(group_ids) > 1:
raise AssertionError("More than one group is in selection.")
raise CreatorError("More than one group is in selection.")
group_id = tuple(group_ids)[0]
# If group id is `0` it is `default` group which is invalid
if group_id == 0:
raise AssertionError(
raise CreatorError(
"Selection is not in group. Can't mark selection as Beauty."
)

View file

@ -1,3 +1,4 @@
from avalon.api import CreatorError
from avalon.tvpaint import pipeline, lib
from openpype.hosts.tvpaint.api import plugin
from openpype.lib import prepare_template_data
@ -15,7 +16,6 @@ class CreateRenderPass(plugin.Creator):
icon = "cube"
defaults = ["Main"]
subset_template = "{family}_{render_layer}_{pass}"
dynamic_subset_keys = ["render_pass", "render_layer", "layer"]
@classmethod
@ -46,11 +46,11 @@ class CreateRenderPass(plugin.Creator):
# Raise if nothing is selected
if not selected_layers:
raise AssertionError("Nothing is selected.")
raise CreatorError("Nothing is selected.")
# Raise if layers from multiple groups are selected
if len(group_ids) != 1:
raise AssertionError("More than one group is in selection.")
raise CreatorError("More than one group is in selection.")
group_id = tuple(group_ids)[0]
self.log.debug(f"Selected group id is \"{group_id}\".")
@ -67,7 +67,7 @@ class CreateRenderPass(plugin.Creator):
# Beauty is required for this creator so raise if was not found
if beauty_instance is None:
raise AssertionError("Beauty pass does not exist yet.")
raise CreatorError("Beauty pass does not exist yet.")
subset_name = self.data["subset"]