From af734f9c56b0276276d43eaf5bd2abb10325c71e Mon Sep 17 00:00:00 2001 From: wijnand Date: Thu, 3 May 2018 10:56:28 +0200 Subject: [PATCH] added get_additional_data for inventory --- colorbleed/fusion/lib.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/colorbleed/fusion/lib.py b/colorbleed/fusion/lib.py index 7186cd2cac..7c6b6dbdda 100644 --- a/colorbleed/fusion/lib.py +++ b/colorbleed/fusion/lib.py @@ -38,3 +38,27 @@ def update_frame_range(start, end, comp=None, set_render_range=True): with avalon.fusion.comp_lock_and_undo_chunk(comp): comp.SetAttrs(attrs) + + +def get_additional_data(container): + """Get Fusion related data for the container + + Args: + container(dict): the container found by the ls() function + + Returns: + dict + """ + + def clamp(value): + return int(value * 255) + + tool = container["_tool"] + tile_color = tool.TileColor + if tile_color is None: + return container + + tile_color.pop("__flags", None) + rgb = {key: clamp(value) for key, value in tile_color.items()} + + return {"color": "#{R:02x}{G:02x}{B:02x}".format(**rgb)}