Esempio n. 1
0
    def process(self):
        if not (self.inputs['vertices'].is_linked):
            return

        has_matrices = self.inputs['matrix'].is_linked
        mverts, mradii, mtwist, mmatrices = self.get_geometry_from_sockets(has_matrices)

        out_objects = []
        for obj_index, Verts in enumerate(mverts):
            if not Verts:
                continue

            matrix = mmatrices[obj_index] if has_matrices else []

            if self.selected_mode == 'Multi':
                curve_args = obj_index, self, Verts, matrix, mradii[obj_index], mtwist[obj_index]
                new_obj = make_curve_geometry(*curve_args)
                out_objects.append(new_obj)
            else:
                if matrix:
                    mverts = [multiply_vectors(*mv) for mv in zip(mmatrices, mverts)]
                new_obj = make_curve_geometry(0, self, mverts, [], mradii, mtwist)
                out_objects.append(new_obj)
                break

        # warning: uses possibly undefined index..
        remove_non_updated_objects(self, obj_index, kind='CURVE')
        self.set_corresponding_materials()

        self.outputs['object'].sv_set(out_objects)
Esempio n. 2
0
    def process(self):
        if not (self.inputs['vertices'].is_linked):
            return

        has_matrices = self.inputs['matrix'].is_linked
        mverts, mradii, mtwist, mmatrices = self.get_geometry_from_sockets(
            has_matrices)

        out_objects = []
        for obj_index, Verts in enumerate(mverts):
            if not Verts:
                continue

            matrix = mmatrices[obj_index] if has_matrices else []

            if self.selected_mode == 'Multi':
                curve_args = obj_index, self, Verts, matrix, mradii[
                    obj_index], mtwist[obj_index]
                new_obj = make_curve_geometry(*curve_args)
                out_objects.append(new_obj)
            else:
                if matrix:
                    mverts = [
                        multiply_vectors(*mv) for mv in zip(mmatrices, mverts)
                    ]
                new_obj = make_curve_geometry(0, self, mverts, [], mradii,
                                              mtwist)
                out_objects.append(new_obj)
                break

        # warning: uses possibly undefined index..
        remove_non_updated_objects(self, obj_index, kind='CURVE')
        self.set_corresponding_materials()

        self.outputs['object'].sv_set(out_objects)
Esempio n. 3
0
    def process(self):
        if not self.live_updates:
            return

        # only interested in the first
        geometry_full = self.get_geometry_from_sockets()

        # pad all input to longest
        maxlen = max(*(map(len, geometry_full)))
        fullList(geometry_full[0], maxlen)
        fullList(geometry_full[1], maxlen)
        fullList(geometry_full[2], maxlen)
        fullList(geometry_full[3], maxlen)
        fullList(geometry_full[4], maxlen)

        catch_idx = 0
        for idx, (geometry) in enumerate(zip(*geometry_full)):
            catch_idx = idx
            self.unit_generator(idx, geometry)

        # remove stail objects
        remove_non_updated_objects(self, catch_idx)