Closed zeffii closed 10 years ago
some demo examples of how to make Eval confused, generously provided by jimmy (https://github.com/nortikin/sverchok/pull/281#issuecomment-48074737, https://github.com/nortikin/sverchok/pull/281#issuecomment-48074788 )
blah = { x }; print(blah);
if ({x}): print("I am inside!")
but this works:
print({x}); blah = {x}
This could be better explained by the code the node uses to establish what it should do.
t = self.eval_str.split("=")
right_to_left = len(t[0]) > len(t[1])
self.mode = 'input' if right_to_left else 'output'
That's crazy right? it's a massive assumption but it keeps the node dynamic
I could make the node work only if the is is at the end or start of the string
some.variables.to.set=
=some.variables.to.get
# and the convenience functions
so no {x} in either case, but that sort of restricts the capacity a little.
Another approach which i'm trying hard to resist is to make it determined by a toggle mode. In the back of my mind i get these messages to go this route anyway. These are the kinds of messages I often ignore at first, but more often than not eventually listen to.
Yes, I don't mind the {x}. Kind of.
the benefit of {x} is that you can have that variable easily in several parts of the eval string
If i make the toggle mode there will be no automatic determination depended on =
. It will not accept =
. The mode switches would be Set | Get | Do
. It doesn't become a different node but it certainly wont look the same.
i've started a branch with a mode version, no ETA
no more {x}
Ok, I have to update my blog writing about Eval Knieval that I just wrote yesterday.
Yeah, perhaps wait a while before writing about it, because a few more things will change. Like the Do mode will have a selection of pre-filled function strings or something - i dunno, it's fluid still.
quantize (animations can be annoying)
but i'm not happy about the jump of the Enum property.. maybe put a fake spacer in draw_buttons for Do and Set
Well, I think a separate input/output would be a good idea, but I guess it best to make input/output dynamic things.
I'm not opposed to having separate nodes for [input / output] mode, of the nearly 600 lines of code, not much is shared between the modes.
i'll need to stick some debug traceback the try / except
why Blender will accept one matrix on a property, but not on a different property is confusion.
.matrix_world
== no goTraceback (most recent call last):
File "C:\blender_trunk\2.71\scripts\addons\sverchok\nodes\basic\eval_knieval.py", line 207, i
ss_input_to_bpy
exec(fxed)
File "<string>", line 1
objs['Cube'].matrix_world = <Matrix 4x4 (1.0000, 0.0000, 0.0000, 0.0000)
^
SyntaxError: invalid syntax
haha. w000t.
at least I know what to fix now
for now this works:
of course the with x
appendix is superfluous syntax, but I think it's a nice indicator
Works now too
There's something not very Zen about the current implementation. Why have 3 hyper modes, when there are only 2 modes. in or out. in into bpy, out into Sverchok.
i'll reopen this if I start working on it again
I'm a little bored with the Arc code, so some light entertainment. The node nickname is a play on the name famous American stunt devil. Doing really stupid things in the hope it will impress people. http://en.wikipedia.org/wiki/Evel_Knievel
Sometimes we want to do stupid or dangerous things, and right now there's just SN which is fine but it's overkill for certain things. For example if I wanted to control the 3d cursor, why not have a Node which can take arbitrary sockets in and assign values to whatever string the user inserts into the string field.
This node is like formula2 node, but it is specifically for scene/data properties. It will be a nice exercise in dynamic sockets and error handling. This will happen even if it doesn't end up in Sverchok ;)