Closed zeffii closed 10 years ago
I wrote an image decomposer a while back for Sverchok, so the tricky bit is solved already.. it just won't be very fast. It might be faster to call a javascript routine from Sverchok and read the output as a 1D array, which we can reshape to a 2D array of grayscale values.
Paper.js , CAD_utils and image decomposer. too many awesome staff to digest in such late hour :) difenetly will try all of them tomorrow. Again Thank you for what you are doing here, respect.
heres a SN1 script for a spiral
import math
def sv_main(num=3100, radius=8.95):
verts_out = []
in_sockets = [
['s', 'num', num],
['s', 'radius', radius]
]
out_sockets = [
['v', 'verts', verts_out]
]
c = 0.1 # scale factor
av = verts_out.append
for i in range(0, num):
r = c * math.sqrt(i) * radius
theta = i * math.radians(137.5/(r+0.001))
amp = r / 6
av((math.cos(theta) * amp, math.sin(theta) * amp, 0.0))
return in_sockets, out_sockets
Thanks, i will try it, actually i managed to do it with Line node and Rotation Node, but this will be much easier i think .
By the way, how can i read the existing nodes script to fork it ? i will learn faster by reading those scripts than manuals.
i'm not sure I follow, you want to be able to fork a loaded SN script, and load the fork automatically? Not a bad idea, but not currently implemented. I doubt we will implement a version control system in the near future, mostly because it's not the way I work with SN and I doubt the others of the group do either. If we want to preserve a file in TextEditor, simply make a copy of the good one and paste it into a new bpy.data.text
, and go back to the file you copied from and continue to work on that file. It's rare that I do that, but it does happen, a forking mechanism would be useful
If you load Scripts using the built in drop-down, those scripts are loaded from disk into bpy.data.texts[] you never actually overwrite them if you make changes, if you were afraid of persistent changes.
A short term solution would be to add an operator to 'duplicate current text into a new bpy.data.text' and keep showing the current text. Before duplication i would then write as a comment at the top of the good file something like "this version works" .. and then remove it again after the duplication so as to not get confused between what works and what doesn't .
I was asking how can i read the actual scripts of the implemented nodes, (line, circles, vectors in ... etc.) so i can learn about scripting faster, so may i will be able to create my own nodes in the future.
For instance, i would like to read the Line Node script to figure ot if i can adjust it to take different inputs : ( length, divisions) , as i think this is more useful.
Ok, start a new issue with that question "how to study the code of nodes".
Probably time to make a lathe Node, similar to Screw modifier or Spin tool. I already have workhorse code written just need to relocate it.
input (optional arguments have defaults and will use last provided if found)
Ui switches
output
No ETA, but probably today