• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python data_structure.match_long_repeat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sverchok.data_structure.match_long_repeat函数的典型用法代码示例。如果您正苦于以下问题:Python match_long_repeat函数的具体用法?Python match_long_repeat怎么用?Python match_long_repeat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了match_long_repeat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: process

    def process(self):
        if not self.outputs['Vertices'].is_linked:
            return

        Vertices = self.inputs['Vertices'].sv_get(default=[])
        if 'Vert A' in self.inputs:
            Vert_A = self.inputs['Vert A'].sv_get(default=[[[0.0, 0.0, 0.0]]])[0]
        if 'Vert B' in self.inputs:
            Vert_B = self.inputs['Vert B'].sv_get(default=[[[1.0, 0.0, 0.0]]])[0]
        if 'Plane' in self.inputs:
            Plane = self.inputs['Plane'].sv_get(default=[Matrix()])

        # outputs
        if self.mode == 'VERTEX':
            parameters = match_long_repeat([Vertices, Vert_A])
            points = [mirrorPoint(v, a) for v, a in zip(*parameters)]
            self.outputs['Vertices'].sv_set(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)]
            self.outputs['Vertices'].sv_set(points)
        elif self.mode == 'PLANE':
            parameters = match_long_repeat([Vertices, Plane])
            points = [mirrorPlane(v, p) for v, p in zip(*parameters)]
            self.outputs['Vertices'].sv_set(points)
开发者ID:elfnor,项目名称:sverchok,代码行数:25,代码来源:mirror.py


示例2: process

    def process(self):
        # inputs
        if self.mode == 'AXIS':
            Vertices = self.inputs['Vertices'].sv_get()
            Angle = self.inputs['Angle'].sv_get()
            Center = self.inputs['Center'].sv_get(default=[[[0.0, 0.0, 0.0]]])
            Axis = self.inputs['Axis'].sv_get(default=[[[0.0, 0.0, 1.0]]])
            parameters = match_long_repeat([Vertices, Center, Axis, Angle])

        elif self.mode == 'EULER' or self.mode == 'QUAT':
            Vertices = self.inputs['Vertices'].sv_get()
            X = self.inputs['X'].sv_get()[0]
            Y = self.inputs['Y'].sv_get()[0]
            Z = self.inputs['Z'].sv_get()[0]

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

            if self.mode == 'QUAT':
                if 'W' in self.inputs:
                    W = self.inputs['W'].sv_get()[0]
                else:
                    W = [self.w_]

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

        # outputs
        if self.mode == 'AXIS':
            points = [axis_rotation(v, c, d, a) for v, c, d, a in zip(*parameters)]
            self.outputs['Vertices'].sv_set(points)
        elif self.mode == 'EULER':
            points = [euler_rotation(v, x, y, z, o) for v, x, y, z, o in zip(*parameters)]
            self.outputs['Vertices'].sv_set(points)
        elif self.mode == 'QUAT':
            points = [quat_rotation(m, x, y, z, w) for m, x, y, z, w in zip(*parameters)]
            self.outputs['Vertices'].sv_set(points)
开发者ID:elfnor,项目名称:sverchok,代码行数:35,代码来源:rotation.py


示例3: unit_generator

    def unit_generator(self, idx, geometry):
        verts, _, _, radiix, radiiy = geometry
        ntimes = len(verts)
        radiix, _ = match_long_repeat([radiix, verts])
        radiiy, _ = match_long_repeat([radiiy, verts])

        # assign radii after creation
        obj, data_layers = make_bmesh_geometry(self, bpy.context, geometry, idx, [radiix, radiiy])

        if data_layers and self.distance_doubles > 0.0:
            # This sets the modified geometry with radius x and radius y.
            f_r = list(itertools.chain(*zip(data_layers[0], data_layers[1])))
            f_r = [abs(f) for f in f_r]
            obj.data.skin_vertices[0].data.foreach_set('radius', f_r)   
            all_yes = list(itertools.repeat(True, len(obj.data.vertices)))
            obj.data.skin_vertices[0].data.foreach_set('use_root', all_yes)

        elif len(radiix) == len(verts):
            f_r = list(itertools.chain(*zip(radiix, radiiy)))
            f_r = [abs(f) for f in f_r]
            obj.data.skin_vertices[0].data.foreach_set('radius', f_r)

        if self.use_root:        
            # set all to root
            all_yes = list(itertools.repeat(True, ntimes))
            obj.data.skin_vertices[0].data.foreach_set('use_root', all_yes)
        elif self.use_slow_root:
            process_mesh_into_features(obj.data.skin_vertices[0].data, obj.data.edge_keys)

        # truthy if self.material is in .materials
        if bpy.data.materials.get(self.material):
            self.set_corresponding_materials([obj])
开发者ID:elfnor,项目名称:sverchok,代码行数:32,代码来源:viewer_skin_mk1.py


示例4: process

    def process(self):
        outputs = self.outputs
        # return if no outputs are connected
        if not any(s.is_linked for s in outputs):
            return

        inputs = self.inputs

        all_AZ_sockets = list(filter(lambda s: s.name in ABC, inputs))
        connected_AZ_sockets = list(filter(lambda s: s.is_linked, all_AZ_sockets))

        # collect the data inputs from all connected AZ sockets
        I = [s.sv_get()[0] for s in connected_AZ_sockets]

        if self.operation == "PRODUCT":
            R = inputs["Repeat"].sv_get()[0]
            R = list(map(lambda x: max(1, int(x)), R))
            parameters = match_long_repeat([[I], R])
        else:  # PERMUTATIONS / COMBINATIONS
            L = inputs["Length"].sv_get()[0]
            L = list(map(lambda x: max(0, int(x)), L))
            parameters = match_long_repeat([I, L])

        function = operations[self.operation][1]

        resultList = []
        for sequence, v in zip(*parameters):
            if self.operation in {"PERMUTATIONS", "COMBINATIONS"}:
                if v == 0 or v > len(sequence):
                    v = len(sequence)
            result = [list(a) for a in function(sequence, v)]
            resultList.append(result)

        outputs["Result"].sv_set(resultList)
开发者ID:nortikin,项目名称:sverchok,代码行数:34,代码来源:combinatorics.py


示例5: process

    def process(self):
        # inputs
        if 'Vertices' in self.inputs and self.inputs['Vertices'].is_linked:
            Vertices = SvGetSocketAnyType(self, self.inputs['Vertices'])
        else:
            Vertices = []
        if 'Vert A' in self.inputs and self.inputs['Vert A'].is_linked:
            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'].is_linked:
            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'].is_linked:
            Plane = SvGetSocketAnyType(self, self.inputs['Plane'])
        else:
            Plane = [Matrix()]

        # outputs
        if 'Vertices' in self.outputs and self.outputs['Vertices'].is_linked:
            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)
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:33,代码来源:mirror.py


示例6: process

    def process(self):
        outputs = self.outputs
        if not any(s.is_linked for s in outputs):
            return

        inputs = self.inputs

        all_AZ_sockets = list(filter(lambda s: s.name in ABC, inputs))
        connected_AZ_sockets = list(filter(lambda s: s.is_linked, all_AZ_sockets))

        if len(connected_AZ_sockets) == 0:
            return

        # collect the quaternion inputs from all connected AZ sockets
        I = [s.sv_get(default=id_quat)[0] for s in connected_AZ_sockets]

        if self.operation in prepost_operations:
            if self.prePost == "POST":  # A op B : keep input order
                I = I[::-1]

        other_sockets = list(filter(lambda s: s.name not in ABC and not s.hide, inputs))

        # collect the remaning visible inputs
        for socket in other_sockets:
            values = socket.sv_get()[0]
            if socket.name == "Scale":
                qs = []
                for s in values:
                    swxyz = [s if self.scales[i] else 1.0 for i in range(4)]
                    qs.append(Quaternion(swxyz))
                values = qs
            I.append(values)

        operation = self.get_operation()

        if self.operation in NQ_operations:
            parameters = match_long_repeat(I)
            quaternionList = [operation(params) for params in zip(*parameters)]

        elif self.operation in QQ_operations:
            parameters = match_long_repeat(I)
            quaternionList = [operation(*params) for params in zip(*parameters)]

        elif self.operation == "SCALE":
            parameters = match_long_repeat(I)
            quaternionList = [operation(*params) for params in zip(*parameters)]

        else:  # single input operations
            parameters = I[0]  # just quaternion values
            quaternionList = [operation(a) for a in parameters]

        if self.operation in output_S_operations:
            if outputs['Value'].is_linked:
                outputs['Value'].sv_set([quaternionList])
        else:  # output quaternions
            if outputs['Quaternion'].is_linked:
                outputs['Quaternion'].sv_set([quaternionList])
开发者ID:nortikin,项目名称:sverchok,代码行数:57,代码来源:quaternion_math.py


示例7: process

    def process(self):
        if not self.outputs['Quaternions'].is_linked:
            return

        inputs = self.inputs

        quaternionList = []

        if self.mode == "WXYZ":
            I = [inputs[n].sv_get()[0] for n in "WXYZ"]
            params = match_long_repeat(I)
            for wxyz in zip(*params):
                q = Quaternion(wxyz)
                if self.normalize:
                    q.normalize()
                quaternionList.append(q)

        elif self.mode == "SCALARVECTOR":
            I = [inputs[n].sv_get()[0] for n in ["Scalar", "Vector"]]
            params = match_long_repeat(I)
            for scalar, vector in zip(*params):
                q = Quaternion([scalar, *vector])
                if self.normalize:
                    q.normalize()
                quaternionList.append(q)

        elif self.mode == "EULER":
            I = [inputs["Angle " + n].sv_get()[0] for n in "XYZ"]
            params = match_long_repeat(I)
            au = angleConversion[self.angleUnits]
            for angleX, angleY, angleZ in zip(*params):
                euler = Euler((angleX * au, angleY * au, angleZ * au), self.eulerOrder)
                q = euler.to_quaternion()
                if self.normalize:
                    q.normalize()
                quaternionList.append(q)

        elif self.mode == "AXISANGLE":
            I = [inputs[n].sv_get()[0] for n in ["Axis", "Angle"]]
            params = match_long_repeat(I)
            au = angleConversion[self.angleUnits]
            for axis, angle in zip(*params):
                q = Quaternion(axis, angle * au)
                if self.normalize:
                    q.normalize()
                quaternionList.append(q)

        elif self.mode == "MATRIX":
            input_M = inputs["Matrix"].sv_get(default=idMat)
            for m in input_M:
                q = Matrix(m).to_quaternion()
                if self.normalize:
                    q.normalize()
                quaternionList.append(q)

        self.outputs['Quaternions'].sv_set([quaternionList])
开发者ID:nortikin,项目名称:sverchok,代码行数:56,代码来源:quaternion_in.py


示例8: process

    def process(self):
        # return if no outputs are connected
        if not any(s.is_linked for s in self.outputs):
            return

        # input values lists (single or multi value)
        input_RR = self.inputs["R"].sv_get()[0]  # list of MAJOR or EXTERIOR radii
        input_rr = self.inputs["r"].sv_get()[0]  # list of MINOR or INTERIOR radii
        input_n1 = self.inputs["n1"].sv_get()[0]  # list of number of MAJOR sections
        input_n2 = self.inputs["n2"].sv_get()[0]  # list of number of MINOR sections
        input_rP = self.inputs["rP"].sv_get()[0]  # list of REVOLUTION phases
        input_sP = self.inputs["sP"].sv_get()[0]  # list of SPIN phases
        input_sT = self.inputs["sT"].sv_get()[0]  # list of SPIN twists

        # bound check the list values
        input_RR = list(map(lambda x: max(0, x), input_RR))
        input_rr = list(map(lambda x: max(0, x), input_rr))
        input_n1 = list(map(lambda x: max(3, int(x)), input_n1))
        input_n2 = list(map(lambda x: max(3, int(x)), input_n2))

        # convert input radii values to MAJOR/MINOR, based on selected mode
        if self.mode == 'EXT_INT':
            # convert radii from EXTERIOR/INTERIOR to MAJOR/MINOR
            # (extend radii lists to a matching length before conversion)
            input_RR, input_rr = match_long_repeat([input_RR, input_rr])
            input_R = list(map(lambda x, y: (x + y) * 0.5, input_RR, input_rr))
            input_r = list(map(lambda x, y: (x - y) * 0.5, input_RR, input_rr))
        else:  # values already given as MAJOR/MINOR radii
            input_R = input_RR
            input_r = input_rr

        parameters = match_long_repeat([input_R, input_r, input_n1, input_n2, input_rP, input_sP, input_sT])

        if self.outputs['Vertices'].is_linked or self.outputs['Normals'].is_linked:
            vertList = []
            normList = []
            for R, r, n1, n2, rP, sP, sT in zip(*parameters):
                verts, norms = torus_verts(R, r, n1, n2, rP, sP, sT, self.Separate)
                vertList.append(verts)
                normList.append(norms)
            self.outputs['Vertices'].sv_set(vertList)
            self.outputs['Normals'].sv_set(normList)

        if self.outputs['Edges'].is_linked:
            edgeList = []
            for R, r, n1, n2, rP, sP, sT in zip(*parameters):
                edges = torus_edges(n1, n2, sT)
                edgeList.append(edges)
            self.outputs['Edges'].sv_set(edgeList)

        if self.outputs['Polygons'].is_linked:
            polyList = []
            for R, r, n1, n2, rP, sP, sT in zip(*parameters):
                polys = torus_polygons(n1, n2, sT)
                polyList.append(polys)
            self.outputs['Polygons'].sv_set(polyList)
开发者ID:elfnor,项目名称:sverchok,代码行数:56,代码来源:torus.py


示例9: process

    def process(self):
        # return if no outputs are connected
        if not any(s.is_linked for s in self.outputs):
            return

        # input values lists
        inputs = self.inputs
        input_level = inputs["Level"].sv_get()[0] if "Level" in inputs else [0]
        input_numx = inputs["NumX"].sv_get()[0] if "NumX" in inputs else [1]
        input_numy = inputs["NumY"].sv_get()[0] if "NumY" in inputs else [1]
        input_radius = inputs["Radius"].sv_get()[0]
        input_angle = inputs["Angle"].sv_get()[0]
        input_scale = inputs["Scale"].sv_get()[0]

        # sanitize the input values
        input_level = list(map(lambda x: max(1, x), input_level))
        input_numx = list(map(lambda x: max(1, x), input_numx))
        input_numy = list(map(lambda x: max(1, x), input_numy))
        input_radius = list(map(lambda x: max(0, x), input_radius))
        input_scale = list(map(lambda x: max(0, x), input_scale))

        # generate the vectorized grids
        paramLists = []
        if self.gridLayout == 'RECTANGLE':
            paramLists.extend([input_radius, input_angle, input_numx, input_numy])
        else:  # TRIANGLE, DIAMOND HEXAGON layouts
            paramLists.extend([input_radius, input_angle, input_level])
        params = match_long_repeat(paramLists)
        gridList = [generate_grid(self.center, self.gridLayout, args) for args in zip(*params)]
        self.outputs['Centers'].sv_set(gridList)

        # generate the vectorized tiles only if any of VEP outputs are linked
        _, V, E, P = self.outputs[:]
        if not any(s.is_linked for s in [V, E, P]):
            return

        params = match_long_repeat([input_radius, input_angle, input_scale, gridList])

        vertList, edgeList, polyList = [[], [], []]
        for r, a, s, grid in zip(*params):
            verts, edges, polys = generate_tiles(r * s, a, self.separate, [grid])
            vertList.extend(verts)
            edgeList.extend(edges)
            polyList.extend(polys)

        self.outputs['Vertices'].sv_set(vertList)
        self.outputs['Edges'].sv_set(edgeList)
        self.outputs['Polygons'].sv_set(polyList)
开发者ID:nortikin,项目名称:sverchok,代码行数:48,代码来源:hexa_grid_mk1.py


示例10: process

    def process(self):
        # 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'].is_linked:

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

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

        if self.outputs['Polygons'].is_linked:
            faces = [cylinder_faces(s, v, self.cap_)
                     for s, v, h, rb, rt in zip(*params)]
            self.outputs['Polygons'].sv_set(faces)
开发者ID:elfnor,项目名称:sverchok,代码行数:27,代码来源:cylinder.py


示例11: process

 def process(self):
     o,s,e = self.inputs
     S,P,N,I = self.outputs
     outfin,OutLoc,obj,sm1,sm2 = [],[],o.sv_get(),self.mode,self.mode2
     st, en = match_long_repeat([s.sv_get()[0], e.sv_get()[0]])
     for OB in obj:
         if sm1:
             obm = OB.matrix_local.inverted()
             outfin.append([OB.ray_cast(obm*Vector(i), obm*Vector(i2)) for i,i2 in zip(st,en)])
         else:
             outfin.append([OB.ray_cast(i,i2) for i,i2 in zip(st,en)])
     if sm2:
         if P.is_linked:
             for i,i2 in zip(obj,outfin):
                 omw = i.matrix_world
                 OutLoc.append([(omw*i[1])[:] for i in i2])
             P.sv_set(OutLoc)
     else:
         if P.is_linked:
             P.sv_set([[i[1][:] for i in i2] for i2 in outfin])
     if S.is_linked:
         S.sv_set([[i[0] for i in i2] for i2 in outfin])
     if N.is_linked:
         N.sv_set([[i[2][:] for i in i2] for i2 in outfin])
     if I.is_linked:
         I.sv_set([[i[3] for i in i2] for i2 in outfin])
开发者ID:johnyc90,项目名称:sverchok,代码行数:26,代码来源:object_raycast2.py


示例12: process

    def process(self):

        if not self.outputs[0].is_linked:
            return

        var_names = self.get_variables()
        inputs = self.get_input()

        results = []

        if var_names:
            input_values = [inputs.get(name, []) for name in var_names]
            parameters = match_long_repeat(input_values)
        else:
            parameters = [[[]]]
        for values in zip(*parameters):
            variables = dict(zip(var_names, values))
            vector = []
            for formula in self.formulas():
                if formula:
                    value = safe_eval(formula, variables)
                    vector.append(value)
            if self.separate:
                results.append(vector)
            else:
                results.extend(vector)
        
        if self.wrap:
            results = [results]

        self.outputs['Result'].sv_set(results)
开发者ID:nortikin,项目名称:sverchok,代码行数:31,代码来源:formula3.py


示例13: process

    def process(self):
        inputs, outputs = self.inputs, self.outputs

        # inputs
        if inputs["Radius"].is_linked:
            Radius = inputs["Radius"].sv_get(deepcopy=False)[0]
        else:
            Radius = [self.rad_]

        if inputs["Nº Vertices"].is_linked:
            Vertices = inputs["Nº Vertices"].sv_get(deepcopy=False)[0]
            Vertices = list(map(lambda x: max(3, int(x)), Vertices))
        else:
            Vertices = [self.vert_]

        Angle = inputs["Degrees"].sv_get(deepcopy=False)[0]
        if inputs["Degrees"].is_linked:
            Angle = list(map(lambda x: min(360, max(0, x)), Angle))

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

        # outputs
        if outputs["Vertices"].is_linked:
            points = [self.make_verts(a, v, r) for a, v, r in zip(*parameters)]
            outputs["Vertices"].sv_set(points)

        if outputs["Edges"].is_linked:
            edg = [self.make_edges(v, a) for a, v, r in zip(*parameters)]
            outputs["Edges"].sv_set(edg)

        if outputs["Polygons"].is_linked:
            plg = [self.make_faces(a, v) for a, v, r in zip(*parameters)]
            outputs["Polygons"].sv_set(plg)
开发者ID:nortikin,项目名称:sverchok,代码行数:33,代码来源:circle.py


示例14: process

    def process(self):
        if not self.activate:
            return

        # only interested in the first
        geometry = self.get_geometry_from_sockets()
        make_bmesh_geometry(self, bpy.context, geometry)

        if not self.live_updates:
            return

        # assign radii after creation
        obj = bpy.data.objects[self.basemesh_name]
        i = self.inputs
        ntimes = len(geometry[0])
        if i['radii'].is_linked:
            radii = i['radii'].sv_get()[0]
            radii, delete = match_long_repeat([radii,geometry[0]])
            # perhaps extend to fullList if given list length doesn't match.
            # maybe also indicate this failure somehow in the UI?
        else:
            radii = list(itertools.repeat(self.general_radius, ntimes))

        # for now don't update unless
        if len(radii) == len(geometry[0]):
            f_r = list(itertools.chain(*zip(radii, radii)))
            obj.data.skin_vertices[0].data.foreach_set('radius', f_r)

            # set all to root
            all_yes = list(itertools.repeat(True, ntimes))
            obj.data.skin_vertices[0].data.foreach_set('use_root', all_yes)

        # truthy if self.material is in .materials
        if bpy.data.materials.get(self.material):
            self.set_corresponding_materials([obj])
开发者ID:elfnor,项目名称:sverchok,代码行数:35,代码来源:viewer_skin.py


示例15: process

    def process(self):
        so = self.outputs
        OutLoc = []
        OutNorm = []
        Succ = []
        ObjectID = []
        OutMatrix = []
        st = self.inputs['start'].sv_get()[0]
        en = self.inputs['end'].sv_get()[0]
        st, en = match_long_repeat([st, en])

        for i, last in enumerate(en):
            rc = bpy.context.scene.ray_cast(st[i], last)
            OutLoc.append(rc[3][:])
            OutNorm.append(rc[4][:])
            Succ.append(rc[0])
            ObjectID.append(rc[1])
            if so['hited object matrix'].is_linked:
                OutMatrix.append([[a[:], b[:], c[:], d[:]] for a, b, c, d in [rc[2][:]]])

        so['HitP'].sv_set([OutLoc])
        so['HitNorm'].sv_set([OutNorm])
        so['Succes'].sv_set([Succ])
        so['Objects'].sv_set(ObjectID)
        so['hited object matrix'].sv_set(OutMatrix)
开发者ID:juantresde,项目名称:sverchok,代码行数:25,代码来源:scene_raycast.py


示例16: process

    def process(self):
        # VerticesR & EdgesR or Vertex1 & Vertex2 are necessary anyway
        # to define recipient edge
        if self.input_mode == "edge":
            if not (self.inputs["VerticesR"].is_linked and self.inputs["EdgesR"].is_linked):
                return
        elif self.input_mode == "fixed":
            if not (self.inputs["Vertex1"].is_linked and self.inputs["Vertex2"].is_linked):
                return
        # Input vertices are used now to define count of objects.
        # Theoretically it is possible to not use them in "Count" mode.
        if not self.inputs["Vertices"].is_linked:
            return

        vertices_s = self.inputs["Vertices"].sv_get(default=[[]])
        vertices_s = Vector_generate(vertices_s)
        edges_s = self.inputs["Edges"].sv_get(default=[[]])
        faces_s = self.inputs["Polygons"].sv_get(default=[[]])
        inp_vertices1_s = self.inputs["Vertex1"].sv_get(default=[[]])
        inp_vertices1_s = Vector_generate(inp_vertices1_s)[0]
        inp_vertices2_s = self.inputs["Vertex2"].sv_get(default=[[]])
        inp_vertices2_s = Vector_generate(inp_vertices2_s)[0]
        vertices_r = self.inputs["VerticesR"].sv_get(default=[[]])
        vertices_r = Vector_generate(vertices_r)[0]
        edges_r = self.inputs["EdgesR"].sv_get(default=[[]])[0]
        counts = self.inputs["Count"].sv_get()[0]
        paddings = self.inputs["Padding"].sv_get()[0]

        vertices1_s, vertices2_s = self.get_recipient_vertices(inp_vertices1_s, inp_vertices2_s, vertices_r, edges_r)

        # It may be also useful to output just matrices, without vertices or edges/faces
        if self.outputs["Vertices"].is_linked or self.outputs["Matrices"].is_linked:

            result_matrices = []
            result_vertices = []
            result_edges = []
            result_faces = []

            meshes = match_long_repeat([vertices_s, edges_s, faces_s, vertices1_s, vertices2_s, counts, paddings])

            for vertices, edges, faces, vertex1, vertex2, inp_count, padding in zip(*meshes):
                count = self.get_count(vertex1, vertex2, vertices, inp_count, padding)
                count = max(count, 1)
                new_matrices, new_vertices = self.duplicate_vertices(
                    vertex1, vertex2, vertices, edges, faces, count, padding
                )
                result_edges.extend([edges] * count)
                result_faces.extend([faces] * count)
                result_vertices.extend(new_vertices)
                result_matrices.extend(new_matrices)

            result_vertices = Vector_degenerate(result_vertices)
            result_matrices = Matrix_degenerate(result_matrices)
            self.outputs["Vertices"].sv_set(result_vertices)
            if self.outputs["Edges"].is_linked:
                self.outputs["Edges"].sv_set(result_edges)
            if self.outputs["Polygons"].is_linked:
                self.outputs["Polygons"].sv_set(result_faces)
            if self.outputs["Matrices"].is_linked:
                self.outputs["Matrices"].sv_set(result_matrices)
开发者ID:gsp40213,项目名称:sverchok,代码行数:60,代码来源:objects_along_edge.py


示例17: process

    def process(self):

        if not (self.inputs[0].is_linked and self.inputs[2].is_linked):
            return
        if not any(self.outputs[name].is_linked for name in ['Vertices', 'Edges', 'Polygons', 'NewPolys']):
            return

        out, result_bevel_faces = [], []

        meshes = match_long_repeat(self.get_socket_data())
        for vertices, edges, faces, bevel_edges, offset, segments, profile in zip(*meshes):
            bm = bmesh_from_pydata(vertices, edges, faces)
            b_edges = get_bevel_edges(bm, bevel_edges)

            geom = list(bm.verts) + list(b_edges) + list(bm.faces)
            bevel_faces = bmesh.ops.bevel(
                bm, geom=geom, offset=offset,
                offset_type=int(self.offsetType), segments=segments,
                profile=profile, vertex_only=self.vertexOnly, material=-1)['faces']

            new_bevel_faces = [[v.index for v in face.verts] for face in bevel_faces]
            out.append(pydata_from_bmesh(bm))
            bm.free()
            result_bevel_faces.append(new_bevel_faces)

        Vertices, Edges, Polygons, NewPolygons = self.outputs
        Vertices.sv_set([i[0] for i in out])
        Edges.sv_set([i[1] for i in out])
        Polygons.sv_set([i[2] for i in out])
        NewPolygons.sv_set(result_bevel_faces)
开发者ID:johnyc90,项目名称:sverchok,代码行数:30,代码来源:bevel.py


示例18: process

    def process(self):
        # inputs
        if self.inputs['Radius'].links:
            Radius = SvGetSocketAnyType(self, self.inputs['Radius'])[0]
        else:
            Radius = [self.rad_]

        if 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 self.inputs['Degrees'].links:
            Angle = SvGetSocketAnyType(self, self.inputs['Degrees'])[0]
            Angle = list(map(lambda x: min(360, max(0, x)), Angle))
        else:
            Angle = [self.degr_]

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

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

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

        if self.outputs['Polygons'].links:
            plg = [self.make_faces(a, v) for a, v, r in zip(*parameters)]
            SvSetSocketAnyType(self, 'Polygons', plg)
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:32,代码来源:circle.py


示例19: process

    def process(self):
        outputs = self.outputs

        if outputs['Value'].is_linked:
            params = [self.inputs[i].sv_get()[0] for i in range(4)]
            out = [self.produce_range(*args) for args in zip(*match_long_repeat(params))]
            outputs['Value'].sv_set(out)
开发者ID:elfnor,项目名称:sverchok,代码行数:7,代码来源:random_num_gen.py


示例20: process

    def process(self):

        V1 = self.inputs["times"].sv_get()
        V2 = self.inputs["time offset"].sv_get()

        if len(V1) == len(V2):
            # all times have an offset
            pass
        elif len(V1) == len(V2[0]):
            V2 = [[v] for v in V2[0]]
        elif len(V1) > len(V2) and len(V2):
            V1, V2 = match_long_repeat([V1, V2])
        else:
            print("see source code to show why execution is displaying this message")
            return

        VC_main = []
        for V, offset in zip(V1, V2):
            VC = []
            ordinal_offset = datetime.datetime.strptime(offset[0], self.date_pattern).toordinal()
            for value in V:
                value = value if not self.float_to_int else str(int(value))
                t = datetime.datetime.strptime(value, self.date_pattern).toordinal()
                m = t - ordinal_offset
                if self.calc_subordinal:
                    m = m + self.sub_ordinal(value)
                VC.append(m)
            VC_main.append(VC)

        self.outputs['times'].sv_set(VC_main)
开发者ID:nortikin,项目名称:sverchok,代码行数:30,代码来源:datetime_strings.py



注:本文中的sverchok.data_structure.match_long_repeat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python data_structure.node_id函数代码示例发布时间:2022-05-27
下一篇:
Python data_structure.fullList函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap