Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/node_Viewer.py
Created April 11, 2014 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/10456412 to your computer and use it in GitHub Desktop.
Save zeffii/10456412 to your computer and use it in GitHub Desktop.
def update(self):
global cache_viewer_baker
cache_viewer_baker[self.name+'v'] = []
cache_viewer_baker[self.name+'ep'] = []
cache_viewer_baker[self.name+'m'] = []
inputs = self.inputs
if not all([x in inputs for x in ['vertices', 'edg_pol', 'matrix']]):
return
def links_and_socket_type(input_name, socket_type):
links = inputs[input_name].links
if not links:
return
b = isinstance(links[0].from_socket, socket_type)
return links and b
draw_able = any([inputs[x].links for x in ['vertices', 'matrix']])
if self.activate and draw_able:
callback_disable(self.name)
vert_data, edge_poly_data, matrix_data = [], [], []
if links_and_socket_type('vertices', VerticesSocket):
propv = SvGetSocketAnyType(self, inputs['vertices'])
vert_data = dataCorrect(propv)
if links_and_socket_type('edg_pol', StringsSocket):
prope = SvGetSocketAnyType(self, inputs['edg_pol'])
edge_poly_data = dataCorrect(prope)
if links_and_socket_type('matrix', MatrixSocket):
propm = SvGetSocketAnyType(self, inputs['matrix'])
matrix_data = dataCorrect(propm)
cache_viewer_baker[self.name+'v'] = vert_data
cache_viewer_baker[self.name+'ep'] = edge_poly_data
cache_viewer_baker[self.name+'m'] = matrix_data
else:
callback_disable(self.name)
if cache_viewer_baker[self.name+'v'] or cache_viewer_baker[self.name+'m']:
callback_enable(self.name, cache_viewer_baker[self.name+'v'], cache_viewer_baker[self.name+'ep'], \
cache_viewer_baker[self.name+'m'], self.Vertex_show, self.color_view, 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(self.name)
cache_viewer_baker = {}
@nortikin
Copy link

nice all()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment