Py States Add Point slow. How to improve performance?

   164   2   0
User Avatar
Member
573 posts
Joined: Feb. 2016
Offline
The python states add point example uses the Add Point Sop node to create points, but I noticed that after 50 points created the process of adding new points gets slower and slower.
This is due to the Add Point node unable to perform very well when loaded with many points.

My idea for a workaround is to create the points in advance (with point generate sop) and just move them around at mouse position.
Not very elegant, do you a better idea to avoid to use an add point sop?
User Avatar
Member
573 posts
Joined: Feb. 2016
Offline
Andr
My idea for a workaround is to create the points in advance (with point generate sop) and just move them around at mouse position.
I abandoned this idea and built the python state around a geometry data paramater to stash the new points created by left clicking in the viewport.
A python sop eventually copies the geometry from the stash to display it.
This causes little lag if the user click too fast for new points, but only after 1 million points, which is totally fine. It still way faster than using the add sop, already after 50 points.
Edited by Andr - March 11, 2021 06:31:02
User Avatar
Member
49 posts
Joined: June 2019
Offline
Andr
I abandoned this idea and built the python state around a geometry data paramater to stash the new points created by left clicking in the viewport.

I think this is the way to go with many points (it's the same as stroke state works), I'm doing the same with my tools.
Another way is string parm with json for example where you can store points in readable format.

I think performance issues come from the multiparm UI part, it's probably not the best use case for them.
  • Quick Links