
import bpy
from ...utils import generateIdFromString


def string_to_hash(string) -> int:
    return generateIdFromString(string)


def trySetActionActive(node: bpy.types.Node, action: bpy.types.Action):
    # TODO: how can we figure out on which object we want the animation to play / set active
    if not node or not action:
        return False
    # tree = node.id_data
    # if not tree:
    #     return False
    # users = tree.users
    # if users == 0:
    #     return False
    # id = tree.user_of_id(tree)
    # for user in tree.user_of_id(tree):
    #     print(user)
    

            # if self.select:
            #     print(self.action)
            #     tree = self.id_data
            #     if tree:
            #         users = tree.user
            #         userById = tree.userById