예제 #1
0
    def process(self):
        O, L, S, R, A = self.inputs
        Om = self.outputs[0]
        if Om.is_linked:
            if O.is_linked:
                orig = Matrix_generate(O.sv_get())
            else:
                return
            if L.is_linked:
                loc = Vector_generate(L.sv_get())
            else:
                loc = [[]]
            if S.is_linked:
                scale = Vector_generate(S.sv_get())
            else:
                scale = [[]]
            if R.is_linked:
                rot = Vector_generate(R.sv_get())
            else:
                rot = [[]]

            rotA, angle = [[]], [[0.0]]
            # ability to add vector & vector difference instead of only rotation values
            if A.is_linked:
                if A.links[0].from_socket.bl_idname == 'VerticesSocket':
                    rotA = Vector_generate(A.sv_get())
                    angle = [[]]
                else:
                    angle = A.sv_get()
                    rotA = [[]]
            matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
            matrixes = Matrix_listing(matrixes_)
            Om.sv_set(matrixes)
예제 #2
0
    def process(self):
        L, S, R, A = self.inputs
        Ma = self.outputs[0]
        if not Ma.is_linked:
            return
        loc = Vector_generate(L.sv_get())
        scale = Vector_generate(S.sv_get())
        rot = Vector_generate(R.sv_get())
        rotA, angle = [[]], [[0.0]]

        # ability to add vector & vector difference instead of only rotation values
        if A.is_linked:
            if A.links[0].from_socket.bl_idname == 'VerticesSocket':
                rotA = Vector_generate(A.sv_get())
                angle = [[]]
            elif A.links[0].from_socket.bl_idname == 'StringsSocket':
                angle = A.sv_get()
                rotA = [[]]
        else:
            angle = A.sv_get()
            rotA = [[]]

        max_l = max(len(loc[0]), len(scale[0]), len(rot[0]), len(angle[0]),
                    len(rotA[0]))
        orig = []
        for l in range(max_l):
            M = mathutils.Matrix()
            orig.append(M)
        matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
        Ma.sv_set(matrixes_)
예제 #3
0
    def process(self):
        if not self.outputs['Matrix'].is_linked:
            return

        loc_ = self.inputs['Location'].sv_get()
        loc = Vector_generate(loc_)

        scale_ = self.inputs['Scale'].sv_get()
        scale = Vector_generate(scale_)

        rot_ = self.inputs['Rotation'].sv_get()
        rot = Vector_generate(rot_)

        rotA = [[]]
        angle = [[0.0]]
        # it isn't a good idea to hide things like this
        if self.inputs['Angle'].is_linked:
            other = get_other_socket(self.inputs['Angle'])

            if isinstance(other, StringsSocket):
                angle = self.inputs['Angle'].sv_get()
            elif isinstance(other, VerticesSocket):
                rotA_ = self.inputs['Angle'].sv_get()
                rotA = Vector_generate(rotA_)

        max_l = max(len(loc[0]), len(scale[0]), len(rot[0]), len(angle[0]),
                    len(rotA[0]))
        orig = []
        for l in range(max_l):
            M = mathutils.Matrix()
            orig.append(M)
        matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
        matrixes = Matrix_listing(matrixes_)
        SvSetSocketAnyType(self, 'Matrix', matrixes)
예제 #4
0
    def process(self):
        if not self.outputs['Matrix'].is_linked:
            return
    
        loc_ = self.inputs['Location'].sv_get()
        loc = Vector_generate(loc_)

        scale_ = self.inputs['Scale'].sv_get()
        scale = Vector_generate(scale_)


        rot_ = self.inputs['Rotation'].sv_get()
        rot = Vector_generate(rot_)

        rotA = [[]]
        angle = [[0.0]]
        # it isn't a good idea to hide things like this
        if self.inputs['Angle'].is_linked:
            other = get_other_socket(self.inputs['Angle'])
            
            if isinstance(other, StringsSocket):
                angle = self.inputs['Angle'].sv_get()
            elif isinstance(other, VerticesSocket):
                rotA_ = self.inputs['Angle'].sv_get()
                rotA = Vector_generate(rotA_)

        max_l = max(len(loc[0]), len(scale[0]), len(rot[0]), len(angle[0]), len(rotA[0]))
        orig = []
        for l in range(max_l):
            M = mathutils.Matrix()
            orig.append(M)
        matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
        matrixes = Matrix_listing(matrixes_)
        SvSetSocketAnyType(self, 'Matrix', matrixes)
예제 #5
0
    def process(self):
        O,L,S,R,A = self.inputs
        Om = self.outputs[0]
        if Om.is_linked:
            if O.is_linked:
                orig = Matrix_generate(O.sv_get())
            else:
                return
            if L.is_linked:
                loc = Vector_generate(L.sv_get())
            else:
                loc = [[]]
            if S.is_linked:
                scale = Vector_generate(S.sv_get())
            else:
                scale = [[]]
            if R.is_linked:
                rot = Vector_generate(R.sv_get())
            else:
                rot = [[]]

            rotA, angle = [[]], [[0.0]]
            # ability to add vector & vector difference instead of only rotation values
            if A.is_linked:
                if A.links[0].from_socket.bl_idname == 'VerticesSocket':
                    rotA = Vector_generate(A.sv_get())
                    angle = [[]]
                else:
                    angle = A.sv_get()
                    rotA = [[]]
            matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
            matrixes = Matrix_listing(matrixes_)
            Om.sv_set(matrixes)
예제 #6
0
 def process(self):
     L,S,R,A = self.inputs
     Ma = self.outputs[0]
     if not Ma.is_linked:
         return
     loc = Vector_generate(L.sv_get())
     scale = Vector_generate(S.sv_get())
     rot = Vector_generate(R.sv_get())
     rotA, angle = [[]], [[0.0]]
     # ability to add vector & vector difference instead of only rotation values
     if A.is_linked:
         if A.links[0].from_socket.bl_idname == 'VerticesSocket':
             rotA = Vector_generate(A.sv_get())
             angle = [[]]
         else:
             angle = A.sv_get()
             rotA = [[]]
     max_l = max(len(loc[0]), len(scale[0]), len(rot[0]), len(angle[0]), len(rotA[0]))
     orig = []
     for l in range(max_l):
         M = mathutils.Matrix()
         orig.append(M)
     matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
     matrixes = Matrix_listing(matrixes_)
     Ma.sv_set(matrixes)
예제 #7
0
파일: deform.py 프로젝트: kilon/sverchok
 def process(self):
     O,L,S,R,A = self.inputs
     Om = self.outputs[0]
     if Om.is_linked:
         if O.is_linked:
             orig = Matrix_generate(O.sv_get())
         else:
             return
         if L.is_linked:
             loc = Vector_generate(L.sv_get())
         else:
             loc = [[]]
         if S.is_linked:
             scale = Vector_generate(S.sv_get())
         else:
             scale = [[]]
         if R.is_linked:
             rot = Vector_generate(R.sv_get())
         else:
             rot = [[]]
         rotA, angle = [[]], [[0.0]]
         if A.is_linked:
             angle = A.sv_get()
         matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
         matrixes = Matrix_listing(matrixes_)
         Om.sv_set(matrixes)
예제 #8
0
def matrix_in(params):
    loc, scale, rot, angle, rotA = params
    max_l = max(len(loc), len(scale), len(rot), len(angle), len(rotA))
    orig = []
    for l in range(max_l):
        M = mathutils.Matrix()
        orig.append(M)
    matrixes = matrixdef(orig, [loc], [scale], [rot], [angle], [rotA])
    return matrixes
예제 #9
0
    def process(self):
        # inputs
        if 'Matrix' in self.outputs and self.outputs['Matrix'].links:
            if self.inputs['Original'].links and \
               type(self.inputs['Original'].links[0].from_socket) == MatrixSocket:

                orig_ = SvGetSocketAnyType(self, self.inputs['Original'])
                orig = Matrix_generate(orig_)
            else:
                return

            if 'Location' in self.inputs and self.inputs['Location'].links and \
               type(self.inputs['Location'].links[0].from_socket) == VerticesSocket:

                loc_ = SvGetSocketAnyType(self, self.inputs['Location'])
                loc = Vector_generate(loc_)
            else:
                loc = [[]]

            if 'Scale' in self.inputs and self.inputs['Scale'].links and \
               type(self.inputs['Scale'].links[0].from_socket) == VerticesSocket:

                scale_ = SvGetSocketAnyType(self, self.inputs['Scale'])
                scale = Vector_generate(scale_)
            else:
                scale = [[]]

            if 'Rotation' in self.inputs and self.inputs['Rotation'].links and \
               type(self.inputs['Rotation'].links[0].from_socket) == VerticesSocket:

                rot_ = SvGetSocketAnyType(self, self.inputs['Rotation'])
                rot = Vector_generate(rot_)
                #print ('matrix_def', str(rot_))
            else:
                rot = [[]]

            rotA = [[]]
            angle = [[0.0]]
            if 'Angle' in self.inputs and self.inputs['Angle'].links:

                if type(self.inputs['Angle'].links[0].from_socket
                        ) == StringsSocket:
                    angle = SvGetSocketAnyType(self, self.inputs['Angle'])

                elif type(self.inputs['Angle'].links[0].from_socket
                          ) == VerticesSocket:
                    rotA_ = SvGetSocketAnyType(self, self.inputs['Angle'])
                    rotA = Vector_generate(rotA_)

            # outputs
            #print(loc)
            matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
            matrixes = Matrix_listing(matrixes_)
            SvSetSocketAnyType(self, 'Matrix', matrixes)
예제 #10
0
    def process(self):
        # inputs
        if 'Matrix' in self.outputs and self.outputs['Matrix'].links:
            if self.inputs['Original'].links and \
               type(self.inputs['Original'].links[0].from_socket) == MatrixSocket:

                orig_ = SvGetSocketAnyType(self, self.inputs['Original'])
                orig = Matrix_generate(orig_)
            else:
                return

            if 'Location' in self.inputs and self.inputs['Location'].links and \
               type(self.inputs['Location'].links[0].from_socket) == VerticesSocket:

                loc_ = SvGetSocketAnyType(self, self.inputs['Location'])
                loc = Vector_generate(loc_)
            else:
                loc = [[]]

            if 'Scale' in self.inputs and self.inputs['Scale'].links and \
               type(self.inputs['Scale'].links[0].from_socket) == VerticesSocket:

                scale_ = SvGetSocketAnyType(self, self.inputs['Scale'])
                scale = Vector_generate(scale_)
            else:
                scale = [[]]

            if 'Rotation' in self.inputs and self.inputs['Rotation'].links and \
               type(self.inputs['Rotation'].links[0].from_socket) == VerticesSocket:

                rot_ = SvGetSocketAnyType(self, self.inputs['Rotation'])
                rot = Vector_generate(rot_)
                #print ('matrix_def', str(rot_))
            else:
                rot = [[]]

            rotA = [[]]
            angle = [[0.0]]
            if 'Angle' in self.inputs and self.inputs['Angle'].links:

                if type(self.inputs['Angle'].links[0].from_socket) == StringsSocket:
                    angle = SvGetSocketAnyType(self, self.inputs['Angle'])

                elif type(self.inputs['Angle'].links[0].from_socket) == VerticesSocket:
                    rotA_ = SvGetSocketAnyType(self, self.inputs['Angle'])
                    rotA = Vector_generate(rotA_)

            # outputs
            #print(loc)
            matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
            matrixes = Matrix_listing(matrixes_)
            SvSetSocketAnyType(self, 'Matrix', matrixes)
예제 #11
0
파일: generator.py 프로젝트: kilon/sverchok
 def process(self):
     L, S, R, A = self.inputs
     Ma = self.outputs[0]
     if not Ma.is_linked:
         return
     loc = Vector_generate(L.sv_get())
     scale = Vector_generate(S.sv_get())
     rot = Vector_generate(R.sv_get())
     rotA, angle = [[]], [[0.0]]
     if A.is_linked:
         angle = A.sv_get()
     max_l = max(len(loc[0]), len(scale[0]), len(rot[0]), len(angle[0]), len(rotA[0]))
     orig = []
     for l in range(max_l):
         M = mathutils.Matrix()
         orig.append(M)
     matrixes_ = matrixdef(orig, loc, scale, rot, angle, rotA)
     matrixes = Matrix_listing(matrixes_)
     Ma.sv_set(matrixes)