示例#1
0
    def update(self):
        # inputs
        if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
            Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
        else:
            Vertices = []
        if 'Vert A' in self.inputs and self.inputs['Vert A'].links:
            Vert_A = SvGetSocketAnyType(self, self.inputs['Vert A'])[0]
        else:
            Vert_A = [[0.0, 0.0, 0.0]]
        if 'Vert B' in self.inputs and self.inputs['Vert B'].links:
            Vert_B = SvGetSocketAnyType(self, self.inputs['Vert B'])[0]
        else:
            Vert_B = [[1.0, 0.0, 0.0]]
        if 'Plane' in self.inputs and self.inputs['Plane'].links:
            Plane = SvGetSocketAnyType(self, self.inputs['Plane'])
        else:
            Plane = [Matrix()]

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            if self.mode == 'VERTEX':
                parameters = match_long_repeat([Vertices, Vert_A])
                points = [mirrorPoint(v, a) for v, a in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'AXIS':
                parameters = match_long_repeat([Vertices, Vert_A, Vert_B])
                points = [mirrorAxis(v, a, b) for v, a, b in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'PLANE':
                parameters = match_long_repeat([Vertices, Plane])
                points = [mirrorPlane(v, p) for v, p in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
示例#2
0
    def update(self):
        # inputs
        if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
            Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
        else:
            Vertices = []
        if 'Vert A' in self.inputs and self.inputs['Vert A'].links:
            Vert_A = SvGetSocketAnyType(self, self.inputs['Vert A'])[0]
        else:
            Vert_A = [[0.0, 0.0, 0.0]]
        if 'Vert B' in self.inputs and self.inputs['Vert B'].links:
            Vert_B = SvGetSocketAnyType(self, self.inputs['Vert B'])[0]
        else:
            Vert_B = [[1.0, 0.0, 0.0]]
        if 'Plane' in self.inputs and self.inputs['Plane'].links:
            Plane = SvGetSocketAnyType(self, self.inputs['Plane'])
        else:
            Plane = [Matrix()]

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            if self.mode == 'VERTEX':
                parameters = match_long_repeat([Vertices, Vert_A])
                points = [mirrorPoint(v, a) for v, a in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'AXIS':
                parameters = match_long_repeat([Vertices, Vert_A, Vert_B])
                points = [mirrorAxis(v, a, b) for v, a, b in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'PLANE':
                parameters = match_long_repeat([Vertices, Plane])
                points = [mirrorPlane(v, p) for v, p in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
示例#3
0
文件: random.py 项目: beeka5/sverchok
    def update(self):
        if 'Random' not in self.outputs:
            return
        # inputs
        if 'Count' in self.inputs:
            Coun = self.inputs['Count'].sv_get()[0]

        if 'Seed' in self.inputs:
            Seed = self.inputs['Seed'].sv_get()[0]

        # outputs

        if 'Random' in self.outputs and self.outputs['Random'].links:
            Random = []
            if len(Seed) == 1:
                random.seed(Seed[0])
                for c in Coun:
                    Random.append([random.random() for i in range(int(c))])
            else:
                param = match_long_repeat([Seed, Coun])
                for s, c in zip(*param):
                    random.seed(s)
                    Random.append([random.random() for i in range(int(c))])

            SvSetSocketAnyType(self, 'Random', Random)
示例#4
0
    def update(self):
        if 'Random' not in self.outputs:
            return
        # inputs
        if 'Count' in self.inputs:
            Coun = self.inputs['Count'].sv_get()[0]

        if 'Seed' in self.inputs:
            Seed = self.inputs['Seed'].sv_get()[0]

        # outputs

        if 'Random' in self.outputs and self.outputs['Random'].links:
            Random = []
            if len(Seed) == 1:
                random.seed(Seed[0])
                for c in Coun:
                    Random.append([random.random() for i in range(int(c))])
            else:
                param = match_long_repeat([Seed, Coun])
                for s, c in zip(*param):
                    random.seed(s)
                    Random.append([random.random() for i in range(int(c))])

            SvSetSocketAnyType(self, 'Random', Random)
示例#5
0
    def update(self):
        # inputs
        if 'Radius' in self.inputs and self.inputs['Radius'].links:
            Radius = SvGetSocketAnyType(self, self.inputs['Radius'])[0]
        else:
            Radius = [self.rad_]

        if 'Nº Vertices' in self.inputs and self.inputs['Nº Vertices'].links:
            Vertices = SvGetSocketAnyType(self, self.inputs['Nº Vertices'])[0]
            Vertices = list(map(lambda x: max(3, int(x)), Vertices))
        else:
            Vertices = [self.vert_]

        if 'Degrees' in self.inputs and self.inputs['Degrees'].links:
            Angle = SvGetSocketAnyType(self, self.inputs['Degrees'])[0]
            Angle = list(map(lambda x: min(360, max(0, x)), Angle))
        else:
            # okay this is silly but since the rest was written before this gave degrees.
            Angle = [degrees(self.degr_)]

        parameters = match_long_repeat([Angle, Vertices, Radius])

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            points = [self.make_verts(a, v, r) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Vertices', points)

        if 'Edges' in self.outputs and self.outputs['Edges'].links:
            edg = [self.make_edges(v, a) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Edges', edg)

        if 'Polygons' in self.outputs and self.outputs['Polygons'].links:
            plg = [self.make_faces(a, v) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Polygons', plg)
示例#6
0
    def update(self):
        # inputs
        if 'Radius' in self.inputs and self.inputs['Radius'].links:
            Radius = SvGetSocketAnyType(self, self.inputs['Radius'])[0]
        else:
            Radius = [self.rad_]

        if 'Nº Vertices' in self.inputs and self.inputs['Nº Vertices'].links:
            Vertices = SvGetSocketAnyType(self, self.inputs['Nº Vertices'])[0]
            Vertices = list(map(lambda x: max(3, int(x)), Vertices))
        else:
            Vertices = [self.vert_]

        if 'Degrees' in self.inputs and self.inputs['Degrees'].links:
            Angle = SvGetSocketAnyType(self, self.inputs['Degrees'])[0]
            Angle = list(map(lambda x: min(360, max(0, x)), Angle))
        else:
            # okay this is silly but since the rest was written before this gave degrees.
            Angle = [degrees(self.degr_)]

        parameters = match_long_repeat([Angle, Vertices, Radius])

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            points = [self.make_verts(a, v, r) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Vertices', points)

        if 'Edges' in self.outputs and self.outputs['Edges'].links:
            edg = [self.make_edges(v, a) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Edges', edg)

        if 'Polygons' in self.outputs and self.outputs['Polygons'].links:
            plg = [self.make_faces(a, v) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Polygons', plg)
示例#7
0
    def update(self):
        if "Polygons" not in self.outputs:
            return
        # inputs

        inputs = self.inputs

        RadiusTop = inputs["RadTop"].sv_get()[0]
        RadiusBot = inputs["RadBot"].sv_get()[0]
        Vertices = [max(int(v), 3) for v in inputs["Vertices"].sv_get()[0]]
        Height = inputs["Height"].sv_get()[0]
        Sub = [max(int(s), 0) for s in inputs["Subdivisions"].sv_get()[0]]
        params = match_long_repeat([Sub, Vertices, Height, RadiusBot, RadiusTop])
        # outputs
        if self.outputs["Vertices"].links:

            points = [cylinder_vertices(s, v, h, rb, rt, self.Separate) for s, v, h, rb, rt in zip(*params)]
            SvSetSocketAnyType(self, "Vertices", points)

        if self.outputs["Edges"].links:
            edges = [cylinder_edges(s, v) for s, v, h, rb, rt in zip(*params)]
            SvSetSocketAnyType(self, "Edges", edges)

        if self.outputs["Polygons"].links:
            faces = [cylinder_faces(s, v, self.cap_) for s, v, h, rb, rt in zip(*params)]
            SvSetSocketAnyType(self, "Polygons", faces)
示例#8
0
    def update(self):
        # inputs
        if 'Count' in self.inputs and self.inputs['Count'].links and \
           type(self.inputs['Count'].links[0].from_socket) == bpy.types.StringsSocket:
            Coun = SvGetSocketAnyType(self, self.inputs['Count'])[0]
        else:
            Coun = [self.count_inner]

        if 'Seed' in self.inputs and self.inputs['Seed'].links and \
           type(self.inputs['Seed'].links[0].from_socket) == bpy.types.StringsSocket:
            Seed = SvGetSocketAnyType(self, self.inputs['Seed'])[0]
        else:
            Seed = [self.seed]

        # outputs
        if 'Random' in self.outputs and self.outputs['Random'].links:
            Random = []
            param = match_long_repeat([Coun, Seed])
            # set seed, protect against float input
            # seed = 0 is special value for blender which unsets the seed value
            # and starts to use system time making the random values unrepeatable.
            # So when seed = 0 we use a random value far from 0, generated used random.org
            for c, s in zip(*param):
                int_seed = int(round(s))
                if int_seed:
                    seed_set(int_seed)
                else:
                    seed_set(140230)

                Random.append([
                    random_unit_vector().to_tuple()
                    for i in range(int(max(1, c)))
                ])

            SvSetSocketAnyType(self, 'Random', Random)
示例#9
0
    def update(self):
        if 'Polygons' not in self.outputs:
            return
        # inputs

        inputs = self.inputs

        RadiusTop = inputs['RadTop'].sv_get()[0]
        RadiusBot = inputs['RadBot'].sv_get()[0]
        Vertices = [max(int(v), 3) for v in inputs['Vertices'].sv_get()[0]]
        Height = inputs['Height'].sv_get()[0]
        Sub = [max(int(s), 0) for s in inputs['Subdivisions'].sv_get()[0]]
        params = match_long_repeat(
            [Sub, Vertices, Height, RadiusBot, RadiusTop])
        # outputs
        if self.outputs['Vertices'].links:

            points = [
                cylinder_vertices(s, v, h, rb, rt, self.Separate)
                for s, v, h, rb, rt in zip(*params)
            ]
            SvSetSocketAnyType(self, 'Vertices', points)

        if self.outputs['Edges'].links:
            edges = [cylinder_edges(s, v) for s, v, h, rb, rt in zip(*params)]
            SvSetSocketAnyType(self, 'Edges', edges)

        if self.outputs['Polygons'].links:
            faces = [
                cylinder_faces(s, v, self.cap_)
                for s, v, h, rb, rt in zip(*params)
            ]
            SvSetSocketAnyType(self, 'Polygons', faces)
示例#10
0
    def update(self):
        inputs = self.inputs
        outputs = self.outputs

        # outputs, end early.
        if 'Range' not in outputs or not outputs['Range'].links:
            return

        param = [inputs[i].sv_get()[0] for i in range(3)]
        f = self.func_dict[self.mode]
        out = [f(*args) for args in zip(*match_long_repeat(param))]
        outputs['Range'].sv_set(out)
示例#11
0
 def update(self):
     if not 'Matrix' in self.outputs:
         return
     if not self.outputs['Matrix'].links:
         return
     inputs = self.inputs
     param = [s.sv_get()[0] for s in inputs]
     mats = []
     for angles in zip(*match_long_repeat(param)):
         a_r = [radians(x) for x in angles]
         mat = Euler(a_r, self.order).to_matrix().to_4x4()
         mats.append(mat)
     SvSetSocketAnyType(self, 'Matrix', Matrix_listing(mats))
示例#12
0
文件: line.py 项目: unity2k/sverchok
    def update(self):
        inputs = self.inputs
        outputs = self.outputs

        if not 'Edges' in outputs:
            return

        integer = inputs["Nº Vertices"].sv_get()
        step = inputs["Step"].sv_get()

        params = match_long_repeat([integer, step])
        out = [a for a in (zip(*[make_line(i, s) for i, s in zip(*params)]))]
            
        # outputs
        if self.outputs['Vertices'].links:
            SvSetSocketAnyType(self, 'Vertices', out[0])

        if self.outputs['Edges'].links:
            SvSetSocketAnyType(self, 'Edges', out[1])
示例#13
0
    def update(self):
        inputs = self.inputs
        outputs = self.outputs

        if not 'Edges' in outputs:
            return

        integer = inputs["Nº Vertices"].sv_get()
        step = inputs["Step"].sv_get()

        params = match_long_repeat([integer, step])
        out = [a for a in (zip(*[make_line(i, s) for i, s in zip(*params)]))]

        # outputs
        if outputs['Vertices'].links:
            outputs['Vertices'].sv_set(out[0])

        if outputs['Edges'].links:
            outputs['Edges'].sv_set(out[1])
示例#14
0
    def update(self):
        # inputs
        if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
            Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
        else:
            Vertices = []
        if 'Center' in self.inputs and self.inputs['Center'].links:
            Center = SvGetSocketAnyType(self, self.inputs['Center'])[0]
        else:
            Center = [[0.0, 0.0, 0.0]]
        if 'Factor' in self.inputs and self.inputs['Factor'].links:
            Factor = SvGetSocketAnyType(self, self.inputs['Factor'])[0]
        else:
            Factor = [self.factor_]

        parameters = match_long_repeat([Vertices, Center, Factor])

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            points = [self.vert_scl(v, c, f) for v, c, f in zip(*parameters)]
            SvSetSocketAnyType(self, 'Vertices', points)
示例#15
0
    def update(self):
        # inputs
        if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
            Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
        else:
            Vertices = []
        if 'Center' in self.inputs and self.inputs['Center'].links:
            Center = SvGetSocketAnyType(self, self.inputs['Center'])[0]
        else:
            Center = [[0.0, 0.0, 0.0]]
        if 'Factor' in self.inputs and self.inputs['Factor'].links:
            Factor = SvGetSocketAnyType(self, self.inputs['Factor'])[0]
        else:
            Factor = [self.factor_]

        parameters = match_long_repeat([Vertices, Center, Factor])

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            points = [self.vert_scl(v, c, f) for v, c, f in zip(*parameters)]
            SvSetSocketAnyType(self, 'Vertices', points)
示例#16
0
    def update(self):
        # inputs
        if (
            "Count" in self.inputs
            and self.inputs["Count"].links
            and type(self.inputs["Count"].links[0].from_socket) == bpy.types.StringsSocket
        ):
            Coun = SvGetSocketAnyType(self, self.inputs["Count"])[0]
        else:
            Coun = [self.count_inner]

        if (
            "Seed" in self.inputs
            and self.inputs["Seed"].links
            and type(self.inputs["Seed"].links[0].from_socket) == bpy.types.StringsSocket
        ):
            Seed = SvGetSocketAnyType(self, self.inputs["Seed"])[0]
        else:
            Seed = [self.seed]

        # outputs
        if "Random" in self.outputs and self.outputs["Random"].links:
            Random = []
            param = match_long_repeat([Coun, Seed])
            # set seed, protect against float input
            # seed = 0 is special value for blender which unsets the seed value
            # and starts to use system time making the random values unrepeatable.
            # So when seed = 0 we use a random value far from 0, generated used random.org
            for c, s in zip(*param):
                int_seed = int(round(s))
                if int_seed:
                    seed_set(int_seed)
                else:
                    seed_set(140230)

                Random.append([random_unit_vector().to_tuple() for i in range(int(max(1, c)))])

            SvSetSocketAnyType(self, "Random", Random)
示例#17
0
文件: sphere.py 项目: beeka5/sverchok
    def update(self):
        # inputs
        if 'Polygons' not in self.outputs:
            return

        Radius = self.inputs['Radius'].sv_get()[0]
        U = [max(int(u), 3) for u in self.inputs['U'].sv_get()[0]]
        V = [max(int(v), 3) for v in self.inputs['V'].sv_get()[0]]

        params = match_long_repeat([U, V, Radius])

        # outputs
        if self.outputs['Vertices'].links:
            verts = [sphere_verts(u, v, r) for u, v, r in zip(*params)]
            SvSetSocketAnyType(self, 'Vertices', verts)

        if self.outputs['Edges'].links:
            edges = [sphere_edges(u, v) for u, v, r in zip(*params)]
            SvSetSocketAnyType(self, 'Edges', edges)

        if self.outputs['Polygons'].links:
            faces = [sphere_faces(u, v) for u, v, r in zip(*params)]
            SvSetSocketAnyType(self, 'Polygons', faces)
示例#18
0
    def update(self):
        # inputs
        if 'Polygons' not in self.outputs:
            return

        Radius = self.inputs['Radius'].sv_get()[0]
        U = [max(int(u), 3) for u in self.inputs['U'].sv_get()[0]]
        V = [max(int(v), 3) for v in self.inputs['V'].sv_get()[0]]

        params = match_long_repeat([U, V, Radius])

        # outputs
        if self.outputs['Vertices'].links:
            verts = [sphere_verts(u, v, r, self.Separate) for u, v, r in zip(*params)]
            SvSetSocketAnyType(self, 'Vertices', verts)

        if self.outputs['Edges'].links:
            edges = [sphere_edges(u, v) for u, v, r in zip(*params)]
            SvSetSocketAnyType(self, 'Edges', edges)

        if self.outputs['Polygons'].links:
            faces = [sphere_faces(u, v) for u, v, r in zip(*params)]
            SvSetSocketAnyType(self, 'Polygons', faces)
示例#19
0
文件: plane.py 项目: unity2k/sverchok
    def update(self):
        inputs = self.inputs
        outputs = self.outputs

        if not 'Polygons' in outputs:
            return

        int_x = inputs["Nº Vertices X"].sv_get()
        int_y = inputs["Nº Vertices Y"].sv_get()
        step_x = inputs["Step X"].sv_get()
        step_y = inputs["Step Y"].sv_get()

        params = match_long_repeat([int_x, int_y, step_x, step_y, [self.Separate]])
        out = [a for a in (zip(*[make_plane(i_x, i_y, s_x, s_y, s) for i_x, i_y, s_x, s_y, s in zip(*params)]))]

        # outputs
        if self.outputs['Vertices'].links:
            SvSetSocketAnyType(self, 'Vertices', out[0])

        if self.outputs['Edges'].links:
            SvSetSocketAnyType(self, 'Edges', out[1])

        if self.outputs['Polygons'].links:
            SvSetSocketAnyType(self, 'Polygons', out[2])
示例#20
0
    def process(self):

        SSSAT = SvSetSocketAnyType
        bcsrc = bpy.context.scene.ray_cast
        outputs = self.outputs
        out = []
        OutLoc = []
        OutNorm = []
        INDSucc = []
        OutMatrix = []
        ObjectID = []

        st = Vector_generate(SvGetSocketAnyType(self, self.inputs['start']))
        en = Vector_generate(SvGetSocketAnyType(self, self.inputs['end']))
        start = [Vector(x) for x in st[0]]
        end = [Vector(x) for x in en[0]]
        if self.Iteration == 'match_short':
            temp = match_short([start, end])
            start, end = temp[0], temp[1]
        if self.Iteration == 'match_long_repeat':
            temp = match_long_repeat([start, end])
            start, end = temp[0], temp[1]

        if self.Modes == 'Object' and (self.formula in bpy.data.objects):

            if 'data.object' in outputs:
                outputs.remove(outputs['data.object'])

            if 'hited object matrix' in outputs:
                outputs.remove(outputs['hited object matrix'])

            obj = bpy.data.objects[self.formula]
            i = 0
            while i < len(end):
                out.append(obj.ray_cast(start[i], end[i]))
                i = i + 1
            for i in out:
                OutNorm.append(i[1][:])
                INDSucc.append(i[2])
                OutLoc.append(i[0][:])

        if self.Modes == 'World':

            if 'data.object' not in outputs:
                outputs.new("VerticesSocket", "data.object")
            if 'hited object matrix' not in outputs:
                outputs.new("MatrixSocket", "hited object matrix")

            for i, last in enumerate(end):
                src = bcsrc(start[i], last)
                OutLoc.append(src[3][:])
                OutNorm.append(src[4][:])
                INDSucc.append(src[0])
                OutMatrix.append(src[2][:])
                OutMatrix = [[a[:], b[:], c[:], d[:]]
                             for a, b, c, d in OutMatrix]
                ObjectID.append(src[1])

        if outputs['HitP'].links:
            SSSAT(self, 'HitP', [OutLoc])
        if outputs['HitNorm'].links:
            SSSAT(self, 'HitNorm', [OutNorm])
        if outputs['INDEX/Succes'].links:
            SSSAT(self, 'INDEX/Succes', [INDSucc])
        if 'hited object matrix' in outputs:
            if outputs['hited object matrix'].links:
                SSSAT(self, 'hited object matrix', OutMatrix)
        if 'data.object' in outputs:
            if outputs['data.object'].links:
                SSSAT(self, 'data.object', [ObjectID])
示例#21
0
    def process(self):
        
        SSSAT= SvSetSocketAnyType
        bcsrc= bpy.context.scene.ray_cast
        outputs = self.outputs        
        out=[]
        OutLoc=[]
        OutNorm=[]
        INDSucc=[]
        OutMatrix=[]
        ObjectID=[]

        st = Vector_generate(SvGetSocketAnyType(self, self.inputs['start']))
        en = Vector_generate(SvGetSocketAnyType(self, self.inputs['end']))
        start= [Vector(x) for x in st[0]]
        end= [Vector(x) for x in en[0]]
        if self.Iteration== 'match_short':
            temp= match_short([ start, end ])
            start, end= temp[0], temp[1]
        if self.Iteration== 'match_long_repeat':
            temp= match_long_repeat([ start, end ])
            start, end= temp[0], temp[1]

        if self.Modes== 'Object' and (self.formula in bpy.data.objects):

            if 'data.object' in outputs:
                outputs.remove(outputs['data.object'])
            
            if 'matrix' in outputs:
                outputs.remove(outputs['matrix'])
            
            obj = bpy.data.objects[self.formula]
            i=0
            while i< len(end):
                out.append(obj.ray_cast(start[i],end[i]))
                i= i+1
            for i in out:
                OutNorm.append(i[1][:])
                INDSucc.append(i[2])
                OutLoc.append(i[0][:])

        if self.Modes== 'World':

            if not 'data.object' in outputs:
                outputs.new("VerticesSocket", "data.object")
            if not 'matrix' in outputs:
               outputs.new("MatrixSocket", "matrix")
            
            i=0
            while i< len(end):
                OutLoc.append(bcsrc(start[i],end[i])[3][:])
                OutNorm.append(bcsrc(start[i],end[i])[4][:])
                INDSucc.append(bcsrc(start[i],end[i])[0])
                OutMatrix.append(bcsrc(start[i],end[i])[2][:])
                OutMatrix= [ [a[:],b[:],c[:],d[:]] for a,b,c,d in OutMatrix ]
                ObjectID.append(bcsrc(start[i],end[i])[1])
                i=i+1
        
        if outputs['HitP'].links:
            SSSAT(self, 'HitP', [OutLoc])
        if outputs['HitNorm'].links:
            SSSAT(self, 'HitNorm', [OutNorm])
        if outputs['INDEX/Succes'].links:
            SSSAT(self, 'INDEX/Succes', [INDSucc])
        if 'matrix' in outputs:
                if outputs['matrix'].links:
                    SSSAT(self, 'matrix', OutMatrix)
        if 'data.object' in outputs:
                if outputs['data.object'].links:
                    SSSAT(self, 'data.object', [ObjectID])
示例#22
0
    def update(self):
        # inputs
        if self.mode == 'AXIS':
            if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
                Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
            else:
                Vertices = []
            if 'Angle' in self.inputs and self.inputs['Angle'].links:
                Angle = SvGetSocketAnyType(self, self.inputs['Angle'])[0]
            else:
                Angle = [self.angle_]
            if 'Center' in self.inputs and self.inputs['Center'].links:
                Center = SvGetSocketAnyType(self, self.inputs['Center'])[0]
            else:
                Center = [[0.0, 0.0, 0.0]]
            if 'Axis' in self.inputs and self.inputs['Axis'].links:
                Axis = SvGetSocketAnyType(self, self.inputs['Axis'])[0]
            else:
                Axis = [[0.0, 0.0, 1.0]]

            parameters = match_long_repeat([Vertices, Center, Axis, Angle])

        elif self.mode == 'EULER' or self.mode == 'QUAT':
            if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
                Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
            else:
                Vertices = []
            if 'X' in self.inputs and self.inputs['X'].links:
                X = SvGetSocketAnyType(self, self.inputs['X'])[0]
            else:
                X = [self.x_]
            if 'Y' in self.inputs and self.inputs['Y'].links:
                Y = SvGetSocketAnyType(self, self.inputs['Y'])[0]
            else:
                Y = [self.y_]
            if 'Z' in self.inputs and self.inputs['Z'].links:
                Z = SvGetSocketAnyType(self, self.inputs['Z'])[0]
            else:
                Z = [self.z_]

            parameters = match_long_repeat([Vertices, X, Y, Z, [self.order]])

            if self.mode == 'QUAT':
                if 'W' in self.inputs and self.inputs['W'].links:
                    W = SvGetSocketAnyType(self, self.inputs['W'])[0]
                else:
                    W = [self.w_]

                parameters = match_long_repeat([Vertices, X, Y, Z, W])

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            if self.mode == 'AXIS':
                points = [
                    axis_rotation(v, c, d, a)
                    for v, c, d, a in zip(*parameters)
                ]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'EULER':
                points = [
                    euler_rotation(v, x, y, z, o)
                    for v, x, y, z, o in zip(*parameters)
                ]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'QUAT':
                points = [
                    quat_rotation(m, x, y, z, w)
                    for m, x, y, z, w in zip(*parameters)
                ]
                SvSetSocketAnyType(self, 'Vertices', points)
示例#23
0
    def update(self):
        # inputs
        if self.mode == 'AXIS':
            if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
                Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
            else:
                Vertices = []
            if 'Angle' in self.inputs and self.inputs['Angle'].links:
                Angle = SvGetSocketAnyType(self, self.inputs['Angle'])[0]
            else:
                Angle = [self.angle_]
            if 'Center' in self.inputs and self.inputs['Center'].links:
                Center = SvGetSocketAnyType(self, self.inputs['Center'])[0]
            else:
                Center = [[0.0, 0.0, 0.0]]
            if 'Axis' in self.inputs and self.inputs['Axis'].links:
                Axis = SvGetSocketAnyType(self, self.inputs['Axis'])[0]
            else:
                Axis = [[0.0, 0.0, 1.0]]

            parameters = match_long_repeat([Vertices, Center, Axis, Angle])

        elif self.mode == 'EULER' or self.mode == 'QUAT':
            if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
                Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
            else:
                Vertices = []
            if 'X' in self.inputs and self.inputs['X'].links:
                X = SvGetSocketAnyType(self, self.inputs['X'])[0]
            else:
                X = [self.x_]
            if 'Y' in self.inputs and self.inputs['Y'].links:
                Y = SvGetSocketAnyType(self, self.inputs['Y'])[0]
            else:
                Y = [self.y_]
            if 'Z' in self.inputs and self.inputs['Z'].links:
                Z = SvGetSocketAnyType(self, self.inputs['Z'])[0]
            else:
                Z = [self.z_]

            parameters = match_long_repeat([Vertices, X, Y, Z, [self.order]])

            if self.mode == 'QUAT':
                if 'W' in self.inputs and self.inputs['W'].links:
                    W = SvGetSocketAnyType(self, self.inputs['W'])[0]
                else:
                    W = [self.w_]

                parameters = match_long_repeat([Vertices, X, Y, Z, W])

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
            if self.mode == 'AXIS':
                points = [axis_rotation(v, c, d, a) for v, c, d, a in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'EULER':
                points = [euler_rotation(v, x, y, z, o) for v, x, y, z, o in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)
            elif self.mode == 'QUAT':
                points = [quat_rotation(m, x, y, z, w) for m, x, y, z, w in zip(*parameters)]
                SvSetSocketAnyType(self, 'Vertices', points)