Beispiel #1
0
    def process(self):
        if not (self.id_data.sv_show and self.activate):
            callback_disable(node_id(self))
            return

        n_id = node_id(self)

        global cache_viewer_baker
        vertex_ref = n_id + 'v'
        poledg_ref = n_id + 'ep'
        matrix_ref = n_id + 'm'
        cache_viewer_baker[vertex_ref] = []
        cache_viewer_baker[poledg_ref] = []
        cache_viewer_baker[matrix_ref] = []

        callback_disable(n_id)

        # every time you hit a dot, you pay a price, so alias and benefit
        inputs = self.inputs

        # this should catch accidental connections which otherwise will cause
        # an unrecoverable crash. It might even be an idea to have step in between
        # new connections and processing, it could auto rewire s->s v->v m->m.
        def check_origin(to_socket, socket_type):
            origin_socket_bl_idname = inputs[to_socket].other.bl_idname

            if isinstance(socket_type, str):
                return origin_socket_bl_idname == sock_dict.get(socket_type)
            else:
                return reverse_sock_dict.get(origin_socket_bl_idname) in socket_type

        vertex_links = inputs['vertices'].is_linked and check_origin('vertices', ('v', 'm'))
        matrix_links = inputs['matrix'].is_linked and check_origin('matrix', ('m', 'v'))
        edgepol_links = inputs['edg_pol'].is_linked and check_origin('edg_pol', 's')

        if vertex_links or matrix_links:

            if vertex_links:
                propv = inputs['vertices'].sv_get(deepcopy=False, default=[])
                if propv:
                    cache_viewer_baker[vertex_ref] = dataCorrect(propv)

            if edgepol_links:
                prope = inputs['edg_pol'].sv_get(deepcopy=False, default=[])
                if prope:
                    cache_viewer_baker[poledg_ref] = dataCorrect(prope)

            if matrix_links:
                propm = inputs['matrix'].sv_get(deepcopy=False, default=[])
                if propm:
                    cache_viewer_baker[matrix_ref] = dataCorrect(propm)

        if cache_viewer_baker[vertex_ref] or cache_viewer_baker[matrix_ref]:
            config_options = self.get_options()
            callback_enable(n_id, cache_viewer_baker, config_options)
Beispiel #2
0
    def process(self):
        if not (self.id_data.sv_show and self.activate):
            callback_disable(node_id(self))
            return

        n_id = node_id(self)

        global cache_viewer_baker
        vertex_ref = n_id + 'v'
        poledg_ref = n_id + 'ep'
        matrix_ref = n_id + 'm'
        cache_viewer_baker[vertex_ref] = []
        cache_viewer_baker[poledg_ref] = []
        cache_viewer_baker[matrix_ref] = []

        callback_disable(n_id)

        # every time you hit a dot, you pay a price, so alias and benefit
        inputs = self.inputs

        # this should catch accidental connections which otherwise will cause
        # an unrecoverable crash. It might even be an idea to have step in between
        # new connections and processing, it could auto rewire s->s v->v m->m.
        def check_origin(to_socket, socket_type):
            sock_string = sock_dict.get(socket_type)
            return inputs[to_socket].links[0].from_socket.bl_idname == sock_string

        vertex_links = inputs['vertices'].is_linked and check_origin('vertices', 'v')
        matrix_links = inputs['matrix'].is_linked and check_origin('matrix', 'm')
        edgepol_links = inputs['edg_pol'].is_linked and check_origin('edg_pol', 's')

        if (vertex_links or matrix_links):

            if vertex_links:
                propv = inputs['vertices'].sv_get(deepcopy=False, default=[])
                if propv:
                    verts = dataCorrect(propv)
                    for v in verts:
                        if any(l != 3 for l in map(len, v)):
                            raise ValueError
                    cache_viewer_baker[vertex_ref] = verts

            if edgepol_links:
                prope = inputs['edg_pol'].sv_get(deepcopy=False, default=[])
                if prope:
                    cache_viewer_baker[poledg_ref] = dataCorrect(prope)

            if matrix_links:
                propm = inputs['matrix'].sv_get(deepcopy=False, default=[])
                if propm:
                    cache_viewer_baker[matrix_ref] = dataCorrect(propm)

        if cache_viewer_baker[vertex_ref] or cache_viewer_baker[matrix_ref]:
            config_options = self.get_options()
            callback_enable(n_id, cache_viewer_baker, config_options)
Beispiel #3
0
    def process(self):
        if not (self.id_data.sv_show and self.activate):
            callback_disable(node_id(self))
            return

        n_id = node_id(self)

        global cache_viewer_baker
        vertex_ref = n_id + 'v'
        poledg_ref = n_id + 'ep'
        matrix_ref = n_id + 'm'
        cache_viewer_baker[vertex_ref] = []
        cache_viewer_baker[poledg_ref] = []
        cache_viewer_baker[matrix_ref] = []

        callback_disable(n_id)

        # every time you hit a dot, you pay a price, so alias and benefit
        inputs = self.inputs

        vertex_links = inputs['vertices'].is_linked
        matrix_links = inputs['matrix'].is_linked
        edgepol_links = inputs['edg_pol'].is_linked

        if vertex_links or matrix_links:

            if vertex_links:
                propv = inputs['vertices'].sv_get(deepcopy=False, default=[])
                if propv:
                    cache_viewer_baker[vertex_ref] = dataCorrect(propv)

            if edgepol_links:
                prope = inputs['edg_pol'].sv_get(deepcopy=False, default=[])
                if prope:
                    cache_viewer_baker[poledg_ref] = dataCorrect(prope)

            if matrix_links:
                propm = inputs['matrix'].sv_get(deepcopy=False, default=[])
                if propm:
                    cache_viewer_baker[matrix_ref] = dataCorrect(propm)

        if cache_viewer_baker[vertex_ref] or cache_viewer_baker[matrix_ref]:
            config_options = self.get_options()
            callback_enable(n_id, cache_viewer_baker, config_options)
Beispiel #4
0
    def process(self):
        if not (self.id_data.sv_show and self.activate):
            callback_disable(node_id(self))
            return

        n_id = node_id(self)

        global cache_viewer_baker
        vertex_ref = n_id + 'v'
        poledg_ref = n_id + 'ep'
        matrix_ref = n_id + 'm'
        cache_viewer_baker[vertex_ref] = []
        cache_viewer_baker[poledg_ref] = []
        cache_viewer_baker[matrix_ref] = []

        callback_disable(n_id)

        # every time you hit a dot, you pay a price, so alias and benefit
        inputs = self.inputs

        vertex_links = inputs['vertices'].is_linked
        matrix_links = inputs['matrix'].is_linked
        edgepol_links = inputs['edg_pol'].is_linked

        if vertex_links or matrix_links:

            if vertex_links:
                propv = inputs['vertices'].sv_get(deepcopy=False, default=[])
                if propv:
                    cache_viewer_baker[vertex_ref] = dataCorrect(propv)

            if edgepol_links:
                prope = inputs['edg_pol'].sv_get(deepcopy=False, default=[])
                if prope:
                    cache_viewer_baker[poledg_ref] = dataCorrect(prope)

            if matrix_links:
                propm = inputs['matrix'].sv_get(deepcopy=False, default=[])
                if propm:
                    cache_viewer_baker[matrix_ref] = dataCorrect(propm)

        if cache_viewer_baker[vertex_ref] or cache_viewer_baker[matrix_ref]:
            config_options = self.get_options()
            callback_enable(n_id, cache_viewer_baker, config_options)