本文整理汇总了Python中sverchok.data_structure.fullList函数的典型用法代码示例。如果您正苦于以下问题:Python fullList函数的具体用法?Python fullList怎么用?Python fullList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fullList函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: process
def process(self):
inputs, outputs = self.inputs, self.outputs
if not outputs[0].is_linked:
return
_noise_type = noise_dict[self.noise_type]
tfunc = turbulence_f[self.out_mode]
verts = inputs['Vertices'].sv_get(deepcopy=False)
maxlen = len(verts)
arguments = [verts]
# gather socket data into arguments
for socket in inputs[1:]:
data = socket.sv_get()[0]
fullList(data, maxlen)
arguments.append(data)
# iterate over vert lists and pass arguments to the turbulence function
out = []
for idx, (vert_list, octaves, hard, amp, freq, seed) in enumerate(zip(*arguments)):
final_vert_list = seed_adjusted(vert_list, seed)
out.append([tfunc(v, octaves, hard, _noise_type, amp, freq) for v in final_vert_list])
if 'Noise V' in outputs:
out = Vector_degenerate(out)
outputs[0].sv_set(out)
开发者ID:elfnor,项目名称:sverchok,代码行数:28,代码来源:turbulence.py
示例2: process
def process(self):
# return if no outputs are connected
if not any(s.is_linked for s in self.outputs):
return
input_num = self.inputs["Num"].sv_get()
input_step = self.inputs["Step"].sv_get()
params = match_long_repeat([input_num, input_step])
stepList = []
for n, s in zip(*params):
num = max(2, n[0]) # sanitize the input
# adjust the step list based on number of verts and steps
steps = s[:(num - 1)] # shorten if needed
fullList(steps, num - 1) # extend if needed
if self.normalize:
size = self.size / sum(steps)
steps = [s * size for s in steps]
stepList.append(steps)
c, d = self.center, self.direction
verts, edges = [ve for ve in zip(*[make_line(s, c, d) for s in stepList])]
# outputs
if self.outputs['Vertices'].is_linked:
self.outputs['Vertices'].sv_set(verts)
if self.outputs['Edges'].is_linked:
self.outputs['Edges'].sv_set(edges)
开发者ID:elfnor,项目名称:sverchok,代码行数:30,代码来源:line_mk2.py
示例3: process
def process(self):
# inputs
if not self.outputs['EvPoint'].is_linked:
return
VerticesA = self.inputs['Vertice A'].sv_get()
VerticesB = self.inputs['Vertice B'].sv_get()
factor = self.inputs['Factor'].sv_get()
# outputs
# match inputs using fullList, longest list matching on A and B
# extend factor list if necessary, it should not control length of output
max_obj = max(len(VerticesA), len(VerticesB))
fullList(VerticesA, max_obj)
fullList(VerticesB, max_obj)
if len(factor) < max_obj:
fullList(factor, max_obj)
points = []
for i in range(max_obj):
points_ = []
max_l = max(len(VerticesA[i]), len(VerticesB[i]))
fullList(VerticesA[i], max_l)
fullList(VerticesB[i], max_l)
for j in range(max_l):
tmp_pts = [(Vector(VerticesA[i][j]).lerp(VerticesB[i][j], factor[i][k]))[:]
for k in range(len(factor[i]))]
points_.extend(tmp_pts)
points.append(points_)
self.outputs['EvPoint'].sv_set(points)
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:34,代码来源:line_evaluate.py
示例4: process
def process(self):
if not any(output.is_linked for output in self.outputs):
return
vertices_s = self.inputs['Vertices'].sv_get(default=[[]])
masks_s = self.inputs['Mask'].sv_get()
radius_s = self.inputs['Radius'].sv_get()
out_coeffs = []
meshes = match_long_repeat([vertices_s, masks_s, radius_s])
for vertices, masks, radius in zip(*meshes):
fullList(masks, len(vertices))
if isinstance(radius, list) and isinstance(radius[0], (int, float)):
radius = radius[0]
# build KDTree
base = [v for v, mask in zip(vertices, masks) if mask]
tree = kdtree.KDTree(len(base))
for i, v in enumerate(base):
tree.insert(v, i)
tree.balance()
coeffs = []
for vertex, mask in zip(vertices, masks):
if mask:
coef = 1.0
else:
_, _, rho = tree.find(vertex)
coef = self.falloff(radius, rho)
coeffs.append(coef)
out_coeffs.append(coeffs)
self.outputs['Coeffs'].sv_set(out_coeffs)
开发者ID:johnyc90,项目名称:sverchok,代码行数:35,代码来源:proportional.py
示例5: make_line
def make_line(integer, step, center):
vertices = [(0.0, 0.0, 0.0)]
integer = [int(integer) if type(integer) is not list else int(integer[0])]
# center the line: offset the starting point of the line by half its size
if center:
Nn = integer[0]-1 # number of steps based on the number of vertices
Ns = len(step) # number of steps given by the step list
# line size (step list & repeated last step if any)
size1 = sum(step[:min(Nn, Ns)]) # step list size
size2 = max(0, (Nn - Ns)) * step[Ns-1] # repeated last step size
size = size1 + size2 # total size
# starting point of the line offset by half its size
vertices = [(-0.5*size, 0.0, 0.0)]
if type(step) is not list:
step = [step]
fullList(step, integer[0])
for i in range(integer[0]-1):
v = Vector(vertices[i]) + Vector((step[i], 0.0, 0.0))
vertices.append(v[:])
edges = []
for i in range(integer[0]-1):
edges.append((i, i+1))
return vertices, edges
开发者ID:elfnor,项目名称:sverchok,代码行数:30,代码来源:line.py
示例6: process
def process(self):
if not (self.outputs['Vers'].is_linked and self.inputs['Vers'].is_linked):
return
vertices = Vector_generate(self.inputs['Vers'].sv_get())
faces = self.inputs['Pols'].sv_get()
offset = self.inputs['Offset'].sv_get()[0]
nsides = self.inputs['N sides'].sv_get()[0][0]
radius = self.inputs['Radius'].sv_get()[0]
outv = []
oute = []
outo = []
outn = []
# for each object
for verts_obj, faces_obj in zip(vertices, faces):
fullList(offset, len(faces_obj))
fullList(radius, len(faces_obj))
verlen = set(range(len(verts_obj)))
bm = bmesh_from_pydata(verts_obj, [], faces_obj, normal_update=True)
result = self.Offset_pols(bm, offset, radius, nsides, verlen)
outv.append(result[0])
oute.append(result[1])
outo.append(result[2])
outn.append(result[3])
self.outputs['Vers'].sv_set(outv)
self.outputs['Edgs'].sv_set(oute)
self.outputs['OutPols'].sv_set(outo)
self.outputs['InPols'].sv_set(outn)
开发者ID:elfnor,项目名称:sverchok,代码行数:33,代码来源:offset.py
示例7: match_points_and_pressures
def match_points_and_pressures(pressure_set, num_points):
num_pressures = len(pressure_set)
if num_pressures < num_points:
fullList(pressure_set, num_points)
elif num_pressures > num_points:
pressure_set = pressure_set[:num_points]
return pressure_set
开发者ID:johnyc90,项目名称:sverchok,代码行数:7,代码来源:viewer_gp.py
示例8: sv_main
def sv_main(p=[],m=[]):
in_sockets = [
['s', 'p', p],
['s', 'm', m]]
if not m:
out_sockets = [
['s', 'out', []],
['s', 'out_not', p],
]
return in_sockets, out_sockets
out = []
out_not = []
for opol,omas in zip(p,m):
fullList(omas, len(opol))
for mas, pol in zip(omas, opol):
if set(mas).intersection(pol):
out.append(pol)
else:
out_not.append(pol)
out_sockets = [
['s', 'out', [out]],
['s', 'out_not', [out_not]],
]
return in_sockets, out_sockets
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:30,代码来源:equal_pols_leave.py
示例9: homogenize_input
def homogenize_input(self, segments, longest):
'''
edit segments in place, extend all to match length of longest
'''
for letter, letter_dict in segments.items():
if letter_dict['length'] < longest:
fullList(letter_dict['data'], longest)
开发者ID:nortikin,项目名称:sverchok,代码行数:7,代码来源:profile.py
示例10: process
def process(self):
if not any(s.is_linked for s in self.outputs):
return
input_num = self.inputs["Num"].sv_get()
input_step = self.inputs["Step"].sv_get()
c, d = self.center, self.direction
stepList = []
res1,res2 = [],[]
normal_size = 1.0
if self.normalize:
self.upgrade_if_needed()
normal_size = self.inputs["Size"].sv_get()[0][0]
for n, s in zip(*match_long_repeat([input_num, input_step])):
for num in n:
num = max(2,num)
s = s[:(num - 1)] # shorten if needed
fullList(s, num - 1) # extend if needed
stepList.append([S * normal_size / sum(s) for S in s] if self.normalize else s)
for s in stepList:
r1,r2 = make_line(s, c, d)
res1.append(r1)
res2.append(r2)
if self.outputs['Vertices'].is_linked:
self.outputs['Vertices'].sv_set(res1)
if self.outputs['Edges'].is_linked:
self.outputs['Edges'].sv_set(res2)
开发者ID:nortikin,项目名称:sverchok,代码行数:28,代码来源:line_mk2.py
示例11: generate_callback
def generate_callback(self, n_id, IV):
inputs = self.inputs
verts, matrices = [], []
text = ''
# gather vertices from input
propv = inputs['vertices'].sv_get()
verts = dataCorrect(propv)
# end early, no point doing anything else.
if not verts:
return
# draw text on locations instead of indices.
text_so = inputs['text'].sv_get(default=[])
text = dataCorrect(text_so)
if text:
fullList(text, len(verts))
for i, t in enumerate(text):
fullList(text[i], len(verts[i]))
# read non vertex inputs in a loop and assign to data_collected
data_collected = []
for socket in ['edges', 'faces', 'matrix']:
propm = inputs[socket].sv_get(default=[])
input_stream = dataCorrect(propm)
data_collected.append(input_stream)
edges, faces, matrices = data_collected
bg = self.draw_bg
settings = self.get_settings()
IV.callback_enable(
n_id, verts, edges, faces, matrices, bg, settings, text)
开发者ID:elfnor,项目名称:sverchok,代码行数:35,代码来源:viewer_indices.py
示例12: define_steplist
def define_steplist(self, step_list, s, n, nor, normal):
for num in n:
num = max(2, num)
s = s[:(num - 1)] # shorten if needed
fullList(s, num - 1) # extend if needed
step_list.append([S * nor / sum(s) for S in s] if normal else s)
开发者ID:nortikin,项目名称:sverchok,代码行数:7,代码来源:line_mk3.py
示例13: joinvers
def joinvers(ver):
''' for joinvers to one object '''
joinvers = []
for ob in ver:
fullList(list(ob), lenvers)
joinvers.extend(ob)
return joinvers
开发者ID:johnyc90,项目名称:sverchok,代码行数:7,代码来源:uv_connect.py
示例14: process
def process(self):
if not (self.inputs['vertices'].is_linked):
return
# perhaps if any of mverts is [] this should already fail.
has_matrices = self.inputs['matrix'].is_linked
mverts, mmatrices = self.get_geometry_from_sockets()
# extend all non empty lists to longest of mverts or *mrest
maxlen = max(len(mverts), len(mmatrices))
if has_matrices:
fullList(mmatrices, maxlen)
for obj_index, Verts in enumerate(mverts):
if not Verts:
continue
curve_name = self.basemesh_name + "_" + str(obj_index)
if has_matrices:
matrix = mmatrices[obj_index]
else:
matrix = []
make_curve_geometry(self, bpy.context, curve_name, Verts, matrix, self.close)
self.remove_non_updated_objects(obj_index)
objs = self.get_children()
if bpy.data.materials.get(self.material):
self.set_corresponding_materials(objs)
开发者ID:elfnor,项目名称:sverchok,代码行数:30,代码来源:viewer_polyline.py
示例15: process
def process(self):
frame = self.inputs[0]
coordinates = self.inputs[1]
if frame.is_linked and coordinates.is_linked:
strokes = frame.sv_get()
coords = coordinates.sv_get()
self.num_strokes = len(coords)
set_correct_stroke_count(strokes, coords)
cyclic_socket_value = self.inputs["draw cyclic"].sv_get()[0]
fullList(cyclic_socket_value, self.num_strokes)
pressures = self.get_pressures()
for idx, (stroke, coord_set) in enumerate(zip(strokes, coords)):
stroke.draw_mode = self.draw_mode
stroke.draw_cyclic = cyclic_socket_value[idx]
num_points = len(coord_set)
pass_data_to_stroke(stroke, coord_set)
flat_pressures = match_points_and_pressures(pressures[idx], num_points)
pass_pressures_to_stroke(stroke, flat_pressures)
# color.fill_alpha
# color.alpha
self.outputs[0].sv_set(strokes)
开发者ID:johnyc90,项目名称:sverchok,代码行数:29,代码来源:viewer_gp.py
示例16: process
def process(self):
inputs = self.inputs
outputs = self.outputs
sizes = inputs['vector_size'].sv_get()[0]
# sizes determines FullLength
num_boxes = len(sizes)
radii = inputs['radius'].sv_get()[0]
arc_divs = inputs['arcdiv'].sv_get()[0]
lin_divs = inputs['lindiv'].sv_get()[0]
div_types = inputs['div_type'].sv_get()[0]
axis_aligns = inputs['odd_axis_align'].sv_get()[0]
fullList(radii, num_boxes)
fullList(arc_divs, num_boxes)
fullList(lin_divs, num_boxes)
fullList(div_types, num_boxes)
fullList(axis_aligns, num_boxes)
multi_dict = []
for i, args in enumerate(sizes):
multi_dict.append({
'radius': radii[i],
'arcdiv': arc_divs[i],
'lindiv': lin_divs[i],
'size': args,
'div_type': div_types[i],
'odd_axis_align': axis_aligns[i]
})
# print(multi_dict[i])
out = list(zip(*[round_cube(**kwargs) for kwargs in multi_dict]))
outputs['Vers'].sv_set(out[0])
outputs['Pols'].sv_set(out[1])
开发者ID:johnyc90,项目名称:sverchok,代码行数:35,代码来源:box_rounded.py
示例17: process
def process(self):
if not self.activate:
return
if not (self.inputs['vertices'].is_linked and self.inputs['edges'].is_linked):
# possible remove any potential existing geometry here too
return
# perhaps if any of mverts is [] this should already fail.
mverts, *mrest = self.get_geometry_from_sockets()
mode = self.selected_mode
single_set = (len(mverts) == 1) and (len(mrest[-1]) > 1)
if single_set and (mode in {'Merge', 'Duplicate'}):
obj_index = 0
self.output_dupe_or_merged_geometry(mode, mverts, *mrest)
if mode == "Duplicate":
obj_index = len(mrest[1]) - 1
print(obj_index, ': len-1')
else:
def get_edges_matrices(obj_index):
for geom in mrest:
yield self.get_structure(geom, obj_index)
# extend all non empty lists to longest of mverts or *mrest
maxlen = max(len(mverts), *(map(len, mrest)))
fullList(mverts, maxlen)
for idx in range(2):
if mrest[idx]:
fullList(mrest[idx], maxlen)
# remade by nikitron for one-object and multyspline solution,
# can be switched in future 2015-12
obj_index = 0
data = mrest # get_edges_matrices(obj_index)
curve_name = self.basemesh_name + "_" + str(obj_index)
make_curve_geometry(self, bpy.context, curve_name, mverts, *data)
'''
for obj_index, Verts in enumerate(mverts):
if not Verts:
continue
data = get_edges_matrices(obj_index)
curve_name = self.basemesh_name + "_" + str(obj_index)
make_curve_geometry(self, bpy.context, curve_name, Verts, *data)
'''
self.remove_non_updated_objects(obj_index)
objs = self.get_children()
if self.grouping:
self.to_group(objs)
if bpy.data.materials.get(self.material):
self.set_corresponding_materials(objs)
开发者ID:nortikin,项目名称:sverchok,代码行数:58,代码来源:viewer_curves_2d.py
示例18: f
def f(self, x, socket):
out = []
fullList(x, len(socket))
for i, obj in enumerate(socket):
if type(obj) not in [int, float]:
out.append(self.f(x[i], obj))
else:
out.append(obj+x[i])
return out
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:9,代码来源:test.py
示例19: process
def process(self):
if not (self.inputs['Vertices'].is_linked and self.inputs['Polygons'].is_linked):
return
if not (any(self.outputs[name].is_linked for name in ['Vertices', 'Edges', 'Polygons', 'NewEdges', 'NewPolys'])):
return
vertices_s = self.inputs['Vertices'].sv_get(default=[[]])
edges_s = self.inputs['Edges'].sv_get(default=[[]])
faces_s = self.inputs['Polygons'].sv_get(default=[[]])
mask_s = self.inputs['Mask'].sv_get(default=[[True]])
result_vertices = []
result_edges = []
result_faces = []
result_new_edges = []
result_new_faces = []
meshes = match_long_repeat([vertices_s, edges_s, faces_s, mask_s])
for vertices, edges, faces, mask in zip(*meshes):
bm = bmesh_from_pydata(vertices, edges, faces)
fullList(mask, len(faces))
b_faces = []
for m, face in zip(mask, bm.faces):
if m:
b_faces.append(face)
res = bmesh.ops.triangulate(
bm, faces=b_faces,
quad_method=int(self.quad_mode),
ngon_method=int(self.ngon_mode))
b_new_edges = [tuple(v.index for v in edge.verts) for edge in res['edges']]
b_new_faces = [[v.index for v in face.verts] for face in res['faces']]
new_vertices, new_edges, new_faces = pydata_from_bmesh(bm)
bm.free()
result_vertices.append(new_vertices)
result_edges.append(new_edges)
result_faces.append(new_faces)
result_new_edges.append(b_new_edges)
result_new_faces.append(b_new_faces)
if self.outputs['Vertices'].is_linked:
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['NewEdges'].is_linked:
self.outputs['NewEdges'].sv_set(result_new_edges)
if self.outputs['NewPolys'].is_linked:
self.outputs['NewPolys'].sv_set(result_new_faces)
开发者ID:TakamitsuNobe,项目名称:myblendercontrib,代码行数:56,代码来源:triangulate.py
示例20: set_loops
def set_loops(loop_count, obj, index_socket, indices, input_colors, colors):
if index_socket.is_linked:
for idx, color in zip(indices, input_colors):
colors[idx] = color
else:
if len(input_colors) < loop_count:
fullList(input_colors, loop_count)
elif len(input_colors) > loop_count:
input_colors = input_colors[:loop_count]
colors[:] = input_colors
开发者ID:elfnor,项目名称:sverchok,代码行数:10,代码来源:vertex_colors_mk3.py
注:本文中的sverchok.data_structure.fullList函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论