-
-
Save zeffii/10456412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice all()