-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node_Viewer.py / Viewer draw #66
Comments
I don't understand this code well enough to make a fix yet. |
This is in the category of non important errors, still an error. The update function is furthermore called on every editor change... |
the |
i didn't even looket to update function, to my shame. This difficult part for me |
Some notes on the general problem of the update function: Note that this error is due to general problem with how blender calls the update function on editor changes, also before the init functon finishes. So update should be able to handle a state where, for example, only half the sockets that are created in init are created... Once the node is created update is called on every node update, either from the general update function in node_s or from the updateNode function that we attach to changing number fields for example. In conclusion, this should be fixed so the update function verifies that the socket exist before trying to access it. However this error is non critical in the way that once the node is created it does not happen again and nothing actually breakes because of this error. If you want some further pointers on how the update system works I can try explain it better. |
thank you nortikin and ly29 getting sverchok this far, and acknowledging + explaining the scenario.of the error. It's good to document these things concretely..I've noticed other non critical errors cascade from them. |
can't we stick a if not all([x in self.inputs for x in ['vertices', 'edg_pol', 'matrix']]):
return in the update, before checking the link presence. This way also the various separate checks on self.inputs for vertices edg_pol and matrix can be skipped. like snippet: 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'] = []
if not all([x in self.inputs for x in ['vertices', 'edg_pol', 'matrix']]):
return
if self.activate and (self.inputs['vertices'].links or self.inputs['matrix'].links):
callback_disable(self.name)
if self.inputs['vertices'].links and \
type(self.inputs['vertices'].links[0].from_socket) == VerticesSocket:
propv = SvGetSocketAnyType(self, self.inputs['vertices'])
cache_viewer_baker[self.name+'v'] = dataCorrect(propv)
else:
cache_viewer_baker[self.name+'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[self.name+'ep'] = dataCorrect(prope)
#print (prope)
else:
cache_viewer_baker[self.name+'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[self.name+'m'] = dataCorrect(propm)
else:
cache_viewer_baker[self.name+'m'] = []
(.....) |
Yes something like that would work.
|
Yes it should work fine here. |
OK, i'll stick to smaller changes for the time being. Thanks for the review, I understand the reservation. |
fresh blend file, add node_Viewer.py
The text was updated successfully, but these errors were encountered: