本文整理汇总了Python中sverchok.data_structure.node_id函数的典型用法代码示例。如果您正苦于以下问题:Python node_id函数的具体用法?Python node_id怎么用?Python node_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了node_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: process
def process(self):
if not (self.id_data.sv_show and self.activate):
callback_disable(node_id(self))
return
n_id = node_id(self)
global cache_viewer_baker
vertex_ref = n_id + 'v'
poledg_ref = n_id + 'ep'
matrix_ref = n_id + 'm'
cache_viewer_baker[vertex_ref] = []
cache_viewer_baker[poledg_ref] = []
cache_viewer_baker[matrix_ref] = []
callback_disable(n_id)
# every time you hit a dot, you pay a price, so alias and benefit
inputs = self.inputs
# this should catch accidental connections which otherwise will cause
# an unrecoverable crash. It might even be an idea to have step in between
# new connections and processing, it could auto rewire s->s v->v m->m.
def check_origin(to_socket, socket_type):
sock_string = sock_dict.get(socket_type)
return inputs[to_socket].links[0].from_socket.bl_idname == sock_string
vertex_links = inputs['vertices'].is_linked and check_origin('vertices', 'v')
matrix_links = inputs['matrix'].is_linked and check_origin('matrix', 'm')
edgepol_links = inputs['edg_pol'].is_linked and check_origin('edg_pol', 's')
if (vertex_links or matrix_links):
if vertex_links:
propv = inputs['vertices'].sv_get(deepcopy=False, default=[])
if propv:
verts = dataCorrect(propv)
for v in verts:
if any(l != 3 for l in map(len, v)):
raise ValueError
cache_viewer_baker[vertex_ref] = verts
if edgepol_links:
prope = inputs['edg_pol'].sv_get(deepcopy=False, default=[])
if prope:
cache_viewer_baker[poledg_ref] = dataCorrect(prope)
if matrix_links:
propm = inputs['matrix'].sv_get(deepcopy=False, default=[])
if propm:
cache_viewer_baker[matrix_ref] = dataCorrect(propm)
if cache_viewer_baker[vertex_ref] or cache_viewer_baker[matrix_ref]:
config_options = self.get_options()
callback_enable(n_id, cache_viewer_baker, config_options)
开发者ID:rangerBR,项目名称:sverchok,代码行数:55,代码来源:viewer_mk2.py
示例2: process
def process(self):
p = self.inputs['Float'].sv_get()
n_id = node_id(self)
# end early
nvBGL2.callback_disable(n_id)
float_out = self.outputs['Float']
easing_func = easing_dict.get(int(self.selected_mode))
if float_out.is_linked:
out = []
for obj in p:
r = []
for i in obj:
r.append(easing_func(i))
out.append(r)
float_out.sv_set(out)
else:
float_out.sv_set([[None]])
if self.activate:
palette = palette_dict.get(self.selected_theme_mode)[:]
x, y = [int(j) for j in (self.location + Vector((self.width + 20, 0)))[:]]
draw_data = {
'tree_name': self.id_data.name[:],
'mode': 'custom_function',
'custom_function': simple_grid_xy,
'loc': (x, y),
'args': (easing_func, palette)
}
nvBGL2.callback_enable(n_id, draw_data)
开发者ID:elfnor,项目名称:sverchok,代码行数:33,代码来源:easing.py
示例3: update_csv
def update_csv(self):
n_id = node_id(self)
if self.autoreload:
self.reload_csv()
if self.current_text and n_id not in self.csv_data:
self.reload_csv()
if n_id not in self.csv_data:
print("CSV auto reload failed, press update")
self.use_custom_color = True
self.color = FAIL_COLOR
return
self.use_custom_color = True
self.color = READY_COLOR
csv_data = self.csv_data[n_id]
if not self.one_sock:
for name in csv_data.keys():
if name in self.outputs and self.outputs[name].is_linked:
self.outputs[name].sv_set([csv_data[name]])
else:
name = 'one_sock'
self.outputs['one_sock'].sv_set(list(csv_data.values()))
开发者ID:elfnor,项目名称:sverchok,代码行数:25,代码来源:text.py
示例4: reload_json
def reload_json(self):
n_id = node_id(self)
self.load_json_data()
if n_id in self.json_data:
self.use_custom_color = True
self.color = READY_COLOR
开发者ID:elfnor,项目名称:sverchok,代码行数:7,代码来源:text.py
示例5: load_json
def load_json(self):
n_id = node_id(self)
self.load_json_data()
json_data = self.json_data.get(n_id, [])
if not json_data:
self.current_text = ''
return
socket_order = json_data.get('socket_order')
if socket_order:
# avoid arbitrary socket assignment order
def iterate_socket_order():
for named_socket in socket_order:
data = json_data.get(named_socket)
yield named_socket, data
socket_iterator = iterate_socket_order()
else:
socket_iterator = sorted(json_data.items())
for named_socket, data in socket_iterator:
if len(data) == 2 and data[0] in {'v', 's', 'm'}:
new_output_socket(self, named_socket, data[0])
else:
self.use_custom_color = True
self.color = FAIL_COLOR
return
开发者ID:nortikin,项目名称:sverchok,代码行数:27,代码来源:text_in_mk2.py
示例6: free
def free(self):
global cache_viewer_baker
n_id = node_id(self)
callback_disable(n_id)
cache_viewer_baker.pop(n_id + 'v', None)
cache_viewer_baker.pop(n_id + 'ep', None)
cache_viewer_baker.pop(n_id + 'm', None)
开发者ID:johnyc90,项目名称:sverchok,代码行数:7,代码来源:viewer_mk2.py
示例7: sv_init
def sv_init(self, context):
n_id = node_id(self)
self.width = 400
self.color = (0.5, 0.5, 1)
self.use_custom_color = True
self.inputs.new('StringsSocket', "Text In", "Text In")
self.outputs.new('StringsSocket', "Text Out", "Text Out")
开发者ID:elfnor,项目名称:sverchok,代码行数:7,代码来源:note.py
示例8: reset
def reset(self):
n_id = node_id(self)
self.outputs.clear()
self.current_text = ""
self.csv_data.pop(n_id, None)
self.list_data.pop(n_id, None)
self.json_data.pop(n_id, None)
开发者ID:gsp40213,项目名称:sverchok,代码行数:7,代码来源:text.py
示例9: update_csv
def update_csv(self):
n_id = node_id(self)
if self.reload_on_update:
self.reload_csv()
if self.current_text and n_id not in self.csv_data:
self.reload_csv()
if n_id not in self.csv_data:
print("CSV auto reload failed, press update")
self.use_custom_color = True
self.color = FAIL_COLOR
return
self.use_custom_color = True
self.color = READY_COLOR
csv_data = self.csv_data[n_id]
if not self.one_sock:
for name in csv_data.keys():
if name in self.outputs and self.outputs[name].links:
SvSetSocketAnyType(self, name, [csv_data[name]])
else:
name = 'one_sock'
SvSetSocketAnyType(self, 'one_sock', list(csv_data.values()))
开发者ID:drakedarky,项目名称:myblendercontrib,代码行数:25,代码来源:text.py
示例10: process
def process(self):
inputs = self.inputs
n_id = node_id(self)
# end early
nvBGL.callback_disable(n_id)
if self.activate and inputs[0].is_linked:
try:
with sv_preferences() as prefs:
scale = prefs.stethoscope_view_scale
location_theta = prefs.render_location_xy_multiplier
except:
# print('did not find preferences - you need to save user preferences')
scale = 1.0
location_theta = 1.0
# gather vertices from input
data = inputs[0].sv_get(deepcopy=False)
self.num_elements = len(data)
if self.selected_mode == 'text-based':
props = lambda: None
props.line_width = self.line_width
props.compact = self.compact
props.depth = self.depth or None
processed_data = nvBGL.parse_socket(
inputs[0],
self.rounding,
self.element_index,
self.view_by_element,
props
)
else:
# # implement another nvBGL parses for gfx
processed_data = data
node_width = (self.width_hidden + 30.0) if self.hide else self.width
# adjust proposed text location in case node is framed.
# take into consideration the hidden state
_x, _y = recursive_framed_location_finder(self, self.location[:])
_x, _y = Vector((_x, _y)) + Vector((node_width + 20, 0))
# this alters location based on DPI/Scale settings.
location = adjust_location(_x, _y, location_theta)
draw_data = {
'tree_name': self.id_data.name[:],
'content': processed_data,
'location': location,
'color': self.text_color[:],
'scale' : float(scale),
'mode': self.selected_mode[:],
'font_id': int(self.font_id)
}
nvBGL.callback_enable(n_id, draw_data)
开发者ID:nortikin,项目名称:sverchok,代码行数:59,代码来源:stethoscope_mk2.py
示例11: update
def update(self):
if not ("matrix" in self.inputs):
return
try:
if not (self.inputs[0].other or self.inputs[2].other):
callback_disable(node_id(self))
except:
print('vdmk2 update holdout')
开发者ID:johnyc90,项目名称:sverchok,代码行数:8,代码来源:viewer_mk2.py
示例12: update
def update(self):
if not ("Data" in self.inputs):
return
try:
if not self.inputs[0].other:
nvBGL.callback_disable(node_id(self))
except:
print('stethoscope update holdout (not a problem)')
开发者ID:nortikin,项目名称:sverchok,代码行数:8,代码来源:stethoscope_mk2.py
示例13: load_csv
def load_csv(self):
n_id = node_id(self)
self.load_csv_data()
if not n_id in self.csv_data:
print("Error, no data loaded")
else:
for name in self.csv_data[n_id]:
self.outputs.new("StringsSocket", name, name)
开发者ID:gsp40213,项目名称:sverchok,代码行数:8,代码来源:text.py
示例14: load_sv
def load_sv(self):
n_id = node_id(self)
self.load_sv_data()
if n_id in self.list_data:
name_dict = {"m": "Matrix", "s": "Data", "v": "Vertices"}
typ = self.socket_type
new_output_socket(self, name_dict[typ], typ)
开发者ID:gsp40213,项目名称:sverchok,代码行数:9,代码来源:text.py
示例15: process
def process(self):
if not (self.id_data.sv_show and self.activate):
callback_disable(node_id(self))
return
n_id = node_id(self)
global cache_viewer_baker
vertex_ref = n_id + 'v'
poledg_ref = n_id + 'ep'
matrix_ref = n_id + 'm'
cache_viewer_baker[vertex_ref] = []
cache_viewer_baker[poledg_ref] = []
cache_viewer_baker[matrix_ref] = []
callback_disable(n_id)
# every time you hit a dot, you pay a price, so alias and benefit
inputs = self.inputs
vertex_links = inputs['vertices'].is_linked
matrix_links = inputs['matrix'].is_linked
edgepol_links = inputs['edg_pol'].is_linked
if vertex_links or matrix_links:
if vertex_links:
propv = inputs['vertices'].sv_get(deepcopy=False, default=[])
if propv:
cache_viewer_baker[vertex_ref] = dataCorrect(propv)
if edgepol_links:
prope = inputs['edg_pol'].sv_get(deepcopy=False, default=[])
if prope:
cache_viewer_baker[poledg_ref] = dataCorrect(prope)
if matrix_links:
propm = inputs['matrix'].sv_get(deepcopy=False, default=[])
if propm:
cache_viewer_baker[matrix_ref] = dataCorrect(propm)
if cache_viewer_baker[vertex_ref] or cache_viewer_baker[matrix_ref]:
config_options = self.get_options()
callback_enable(n_id, cache_viewer_baker, config_options)
开发者ID:johnyc90,项目名称:sverchok,代码行数:44,代码来源:viewer_mk2.py
示例16: process
def process(self):
global cache_viewer_baker
# node id, used as ref
n_id = node_id(self)
if 'matrix' not in self.inputs:
return
cache_viewer_baker[n_id+'v'] = []
cache_viewer_baker[n_id+'ep'] = []
cache_viewer_baker[n_id+'m'] = []
if not self.id_data.sv_show:
callback_disable(n_id)
return
if self.activate and (self.inputs['vertices'].links or self.inputs['matrix'].links):
callback_disable(n_id)
if self.inputs['vertices'].links and \
type(self.inputs['vertices'].links[0].from_socket) == VerticesSocket:
propv = SvGetSocketAnyType(self, self.inputs['vertices'])
cache_viewer_baker[n_id+'v'] = dataCorrect(propv)
else:
cache_viewer_baker[n_id+'v'] = []
if self.inputs['edg_pol'].links and \
type(self.inputs['edg_pol'].links[0].from_socket) == StringsSocket:
prope = SvGetSocketAnyType(self, self.inputs['edg_pol'])
cache_viewer_baker[n_id+'ep'] = dataCorrect(prope)
#print (prope)
else:
cache_viewer_baker[n_id+'ep'] = []
if self.inputs['matrix'].links and \
type(self.inputs['matrix'].links[0].from_socket) == MatrixSocket:
propm = SvGetSocketAnyType(self, self.inputs['matrix'])
cache_viewer_baker[n_id+'m'] = dataCorrect(propm)
else:
cache_viewer_baker[n_id+'m'] = []
else:
callback_disable(n_id)
if cache_viewer_baker[n_id+'v'] or cache_viewer_baker[n_id+'m']:
callback_enable(n_id, cache_viewer_baker[n_id+'v'], cache_viewer_baker[n_id+'ep'], \
cache_viewer_baker[n_id+'m'], self.Vertex_show, self.color_view.copy(), self.transparant, self.shading)
self.use_custom_color = True
self.color = (1, 0.3, 0)
else:
self.use_custom_color = True
self.color = (0.1, 0.05, 0)
#print ('отражения вершин ',len(cache_viewer_baker['v']), " рёбёры ", len(cache_viewer_baker['ep']), "матрицы",len(cache_viewer_baker['m']))
if not self.inputs['vertices'].links and not self.inputs['matrix'].links:
callback_disable(n_id)
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:56,代码来源:viewer.py
示例17: create_empty
def create_empty(self):
n_id = node_id(self)
scene = bpy.context.scene
objects = bpy.data.objects
empty = objects.new(self.empty_name, None)
scene.objects.link(empty)
scene.update()
empty["SVERCHOK_REF"] = n_id
self.empty_ref_name = empty.name
return empty
开发者ID:johnyc90,项目名称:sverchok,代码行数:10,代码来源:empty_out.py
示例18: process
def process(self):
n_id = node_id(self)
data = self.node_dict.get(n_id)
if not data:
self.node_dict[n_id] = {}
data = self.node_dict.get(n_id)
frame_current = bpy.context.scene.frame_current
out_frame = frame_current - self.cache_offset
data[frame_current] = self.inputs[0].sv_get()
out_data = data.get(out_frame, [])
self.outputs[0].sv_set(out_data)
开发者ID:BitByte01,项目名称:myblendercontrib,代码行数:12,代码来源:cache.py
示例19: load_csv
def load_csv(self):
n_id = node_id(self)
self.load_csv_data()
if not n_id in self.csv_data:
print("Error, no data loaded")
else:
if not self.one_sock:
for name in self.csv_data[n_id]:
self.outputs.new('StringsSocket', name, name)
else:
name = 'one_sock'
self.outputs.new('StringsSocket', name, name)
开发者ID:elfnor,项目名称:sverchok,代码行数:12,代码来源:text.py
示例20: process
def process(self):
if not self.inputs['Float'].is_linked:
return
n_id = node_id(self)
self.delete_texture()
nvBGL2.callback_disable(n_id)
size_tex = 0
width = 0
height = 0
if self.to_image_viewer:
mode = self.color_mode
pixels = np.array(self.inputs['Float'].sv_get(deepcopy=False)).flatten()
width, height = self.texture_width_height
resized_np_array = np.resize(pixels, self.calculate_total_size())
transfer_to_image(resized_np_array, self.texture_name, width, height, mode)
if self.activate:
texture = self.get_buffer()
width, height = self.texture_width_height
x, y = self.xy_offset
gl_color_constant = gl_color_dict.get(self.color_mode)
name = bgl.Buffer(bgl.GL_INT, 1)
bgl.glGenTextures(1, name)
self.texture[n_id] = name[0]
init_texture(width, height, name[0], texture, gl_color_constant)
# adjust render location based on preference multiplier setting
try:
with sv_preferences() as prefs:
multiplier = prefs.render_location_xy_multiplier
scale = prefs.render_scale
except:
# print('did not find preferences - you need to save user preferences')
multiplier = 1.0
scale = 1.0
x, y = [x * multiplier, y * multiplier]
width, height =[width * scale, height * scale]
draw_data = {
'tree_name': self.id_data.name[:],
'mode': 'custom_function',
'custom_function': simple_screen,
'loc': (x, y),
'args': (texture, self.texture[n_id], width, height)
}
nvBGL2.callback_enable(n_id, draw_data)
开发者ID:nortikin,项目名称:sverchok,代码行数:52,代码来源:texture_viewer.py
注:本文中的sverchok.data_structure.node_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论