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: Display overridden vs default values of attributes #982

4 changes: 4 additions & 0 deletions client/ayon_core/style/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
"icon-alert-tools": "#AA5050",
"icon-entity-default": "#bfccd6",
"icon-entity-disabled": "#808080",

"font-entity-deprecated": "#666666",

"font-overridden": "#91CDFC",

"overlay-messages": {
"close-btn": "#D3D8DE",
"bg-success": "#458056",
Expand Down
4 changes: 4 additions & 0 deletions client/ayon_core/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ QLabel {
background: transparent;
}

QLabel[overriden="1"] {
color: {color:font-overridden};
}

/* Inputs */
QAbstractSpinBox, QLineEdit, QPlainTextEdit, QTextEdit {
border: 1px solid {color:border};
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/tools/publisher/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def get_existing_product_names(self, folder_path: str) -> List[str]:
@abstractmethod
def get_creator_attribute_definitions(
self, instance_ids: Iterable[str]
) -> List[Tuple[AbstractAttrDef, List[str], List[Any]]]:
) -> List[Tuple[AbstractAttrDef, Dict[str, Dict[str, Any]]]]:
pass

@abstractmethod
Expand All @@ -383,7 +383,7 @@ def get_publish_attribute_definitions(
) -> List[Tuple[
str,
List[AbstractAttrDef],
Dict[str, List[Tuple[str, Any]]]
Dict[str, List[Tuple[str, Any, Any]]]
]]:
pass

Expand Down
37 changes: 24 additions & 13 deletions client/ayon_core/tools/publisher/models/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def set_instances_create_attr_values(self, instance_ids, key, value):

def get_creator_attribute_definitions(
self, instance_ids: List[str]
) -> List[Tuple[AbstractAttrDef, List[str], List[Any]]]:
) -> List[Tuple[AbstractAttrDef, Dict[str, Dict[str, Any]]]]:
"""Collect creator attribute definitions for multuple instances.

Args:
Expand All @@ -796,12 +796,23 @@ def get_creator_attribute_definitions(

if found_idx is None:
idx = len(output)
output.append((attr_def, [instance_id], [value]))
output.append((
attr_def,
{
instance_id: {
"value": value,
"default": attr_def.default
}
}
))
_attr_defs[idx] = attr_def
else:
_, ids, values = output[found_idx]
ids.append(instance_id)
values.append(value)
_, info_by_id = output[found_idx]
info_by_id[instance_id] = {
"value": value,
"default": attr_def.default
}

return output

def set_instances_publish_attr_values(
Expand Down Expand Up @@ -835,7 +846,7 @@ def get_publish_attribute_definitions(
) -> List[Tuple[
str,
List[AbstractAttrDef],
Dict[str, List[Tuple[str, Any]]]
Dict[str, List[Tuple[str, Any, Any]]]
]]:
"""Collect publish attribute definitions for passed instances.

Expand Down Expand Up @@ -865,21 +876,21 @@ def get_publish_attribute_definitions(
attr_defs = attr_val.attr_defs
if not attr_defs:
continue

plugin_attr_defs = all_defs_by_plugin_name.setdefault(
plugin_name, []
)
plugin_attr_defs.append(attr_defs)

plugin_values = all_plugin_values.setdefault(plugin_name, {})

plugin_attr_defs.append(attr_defs)

for attr_def in attr_defs:
if isinstance(attr_def, UIDef):
continue

attr_values = plugin_values.setdefault(attr_def.key, [])

value = attr_val[attr_def.key]
attr_values.append((item_id, value))
attr_values.append(
(item_id, attr_val[attr_def.key], attr_def.default)
)

attr_defs_by_plugin_name = {}
for plugin_name, attr_defs in all_defs_by_plugin_name.items():
Expand All @@ -893,7 +904,7 @@ def get_publish_attribute_definitions(
output.append((
plugin_name,
attr_defs_by_plugin_name[plugin_name],
all_plugin_values
all_plugin_values[plugin_name],
))
return output

Expand Down
Loading