Skip to content
Open
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
29 changes: 27 additions & 2 deletions animation_nodes/ui/node_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,33 @@ def drawNodeColorPanel(self, context):
# Register
##################################

PANEL_CANDIDATES = (
"NODE_PT_active_node_color",
"NODE_PT_active_node",
"NODE_PT_node_color",
"NODE_PT_node",
)


def _get_node_color_panel():
for name in PANEL_CANDIDATES:
panel = getattr(bpy.types, name, None)
if panel is not None:
return panel
return None


def register():
bpy.types.NODE_PT_active_node_color.append(drawNodeColorPanel)
panel = _get_node_color_panel()
if panel is not None:
panel.append(drawNodeColorPanel)
else:
print("animation_nodes: UI panel for active node color not found; skip register")


def unregister():
bpy.types.NODE_PT_active_node_color.remove(drawNodeColorPanel)
panel = _get_node_color_panel()
if panel is not None:
panel.remove(drawNodeColorPanel)
else:
print("animation_nodes: UI panel for active node color not found; skip unregister")