Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher: Promote information to be shown on instance label #167

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions client/ayon_core/hosts/maya/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@ def get_instance_attr_defs(self):
default=self.render_settings.get("enable_all_lights",
False))
]

def get_extra_label(self):
"""A label that can be made custom for a creator"""
print("get_extra_label() dir(self)", dir(self))
# TODO: How do you get to the instance attributes from here, such as frameStart and frameEnd?
return "{}-{}".format(1001, 1010)
9 changes: 9 additions & 0 deletions client/ayon_core/pipeline/create/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ class CreatedInstance:
creator_identifier (str): Identifier of creator plugin.
creator_label (str): Creator plugin label.
group_label (str): Default group label from creator plugin.
extra_label (str): Extra label that can be made custom for a creator
creator_attr_defs (List[AbstractAttrDef]): Attribute definitions from
creator.
"""
Expand All @@ -897,11 +898,13 @@ def __init__(
creator_identifier=None,
creator_label=None,
group_label=None,
extra_label=None,
creator_attr_defs=None,
):
if creator is not None:
creator_identifier = creator.identifier
group_label = creator.get_group_label()
extra_label = creator.get_extra_label()
creator_label = creator.label
creator_attr_defs = creator.get_instance_attr_defs()

Expand Down Expand Up @@ -949,6 +952,7 @@ def __init__(
self._data["productName"] = product_name
self._data["active"] = data.get("active", True)
self._data["creator_identifier"] = creator_identifier
self._data["extra_label"] = extra_label

# Pop from source data all keys that are defined in `_data` before
# this moment and through their values away
Expand Down Expand Up @@ -1053,6 +1057,11 @@ def group_label(self):
return label
return self._group_label

@property
def extra_label(self):
extra_label = self._data.get("extra_label")
return extra_label

@property
def origin_data(self):
output = copy.deepcopy(self._orig_data)
Expand Down
8 changes: 8 additions & 0 deletions client/ayon_core/pipeline/create/creator_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ def get_pre_create_attr_defs(self):
"""
return self.pre_create_attr_defs

def get_extra_label(self):
"""Extra label that can be made custom for a creator"""
return


class HiddenCreator(BaseCreator):
@abstractmethod
Expand All @@ -809,6 +813,10 @@ def remove_instances(self, instances):
"""Skip removement."""
pass

def get_extra_label(self):
"""Extra label that can be made custom for a creator"""
return


def discover_creator_plugins(*args, **kwargs):
return discover(BaseCreator, *args, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ def _update_product_name(self):
for part in found_parts:
replacement = "<b>{}</b>".format(part)
label = label.replace(part, replacement)

# Add the extra label (if any)
extra_label = self.instance.extra_label
if extra_label:
label = "{} - {}".format(label, extra_label)
self._label_widget.setText(label)
# HTML text will cause that label start catch mouse clicks
# - disabling with changing interaction flag
Expand Down
Loading