Comments (11)
I don't understand this code well enough to make a fix yet.
from sverchok.
This is in the category of non important errors, still an error.
What happens is that every time you create a socket by calling self.inputs.new() in def init(self, context)
the update function is called.
To fix add check that the 'matrix' key is in self.inputs, like:
if 'Float' in self.inputs and self.inputs['Float'].links:
The update function is furthermore called on every editor change...
Long term we should change sverchok to handle, this and the pynodes interface is also evolving.
from sverchok.
the update
function is quite difficult to read.
from sverchok.
i didn't even looket to update function, to my shame. This difficult part for me
from sverchok.
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.
from sverchok.
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.
from sverchok.
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'] = []
(.....)
from sverchok.
Yes something like that would work.
11 apr 2014 kl. 12:01 skrev "Dealga McArdle" [email protected]:
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'] = []
(.....)
—
Reply to this email directly or view it on GitHub.
from sverchok.
maybe: https://gist.github.com/zeffii/10456412
from sverchok.
Yes it should work fine here.
A potential problem with this as a general solution is that socket.name is not a guaranteed to be unique.
from sverchok.
OK, i'll stick to smaller changes for the time being. Thanks for the review, I understand the reservation.
from sverchok.
Related Issues (20)
- Installation in MacOS + Blender 4.0.2 crashes HOT 1
- Stethoscope is not working in Blender 4.02 HOT 1
- Add a Node center of mass for a one or multiple meshes
- Add index field to Number->List Input
- Add node Generator NGonList. HOT 1
- Blender 4.1 Official and latest SVerchok on macOS not working HOT 9
- Some nodes generate exceptions if output sockets are not connected
- deprecated method mentioned in documentation
- Export to GIST seems to no longer working? HOT 1
- Viewer Draw under Bgl replacement HOT 1
- Mesh Clustering, new Node (Proposal)
- The new "Get Objects Data" node broke backward compatibility and usability HOT 8
- Sverchock build action errors
- Replace params to input sockets of Mesh Clustering node
- Mesh Clustering glitches
- Node Mesh Clustering use to many dependencies.
- Extend functionality of Mesh Clustering Node
- Can't install Cython compiled version of GeomDL or PyMCubes in Blender 4.1 because `--install-option` is depreciated in Python 3.11.7. HOT 3
- Dual Mesh Node Extended Algorithm
- Get Objects Data node. Add output sockets for Seams and Sharp edges HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sverchok.