nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.26k stars 233 forks source link

Vectorize Input option in monads/node groups #863

Closed ly29 closed 7 years ago

ly29 commented 8 years ago

skarmavbild 2016-09-06 kl 12 17 08

Since we have many nodes that needs be vectorized and some that can't be easily done without redoing a lot (like 80-90% of nodes). I now introduce a simple option for apply a node group/monad to the input.

This calls the monad on the level 1 input wrapped as separate objects, and the output is extended on the same level not appended and preserving structure.

skarmavbild 2016-09-06 kl 11 15 08 Note that this layout would work if we didn't split the lists as well, but more complex scenarios wouldn't

    def process_split(self):
        monad = self.monad
        in_node = monad.input_node
        out_node = monad.output_node
        ul = make_tree_from_nodes([out_node.name], monad, down=False)

        data_out = [[] for s in self.outputs]

        data = [s.sv_get(deepcopy=False) for s in self.inputs]

        for data in zip(*match_long_repeat(data)):
            for idx, d in enumerate(data):
                in_node.outputs[idx].sv_set([d])
            do_update(ul, monad.nodes)
            for idx, s in enumerate(out_node.inputs[:-1]):
                data_out[idx].extend(s.sv_get(deepcopy=False))

        for idx, socket in enumerate(self.outputs):
            if socket.is_linked:
                socket.sv_set(data_out[idx])
ly29 commented 8 years ago

@enzyme69 I think you will love/like this when you get your head around it, it behaves a bit differently, but I think it is very easy to use. It is something that you have been asking for during a long time. The options etc needs a bit better name. Will try to do some shorter examples.

enzyme69 commented 8 years ago

screen shot 2016-09-08 at 11 46 33 screen shot 2016-09-08 at 11 44 01

I think I started to understand it. Although to take advantage of vectorization, I need to rewire things. I am going to give this a proper study. May create video about it.

enzyme69 commented 8 years ago

I noticed an update, so upgrading and will check your example again. Thanks for the explanation and this Monad Vectorization by the way.

We need to have lots of examples for Monad. Or few simple ones. Feel free to use the Glyph example 💃

I am uploading SV Live Noding on Glyph.

enzyme69 commented 8 years ago

Something telling me that I am getting somewhere but doing it wrong....

screen shot 2016-09-08 at 12 13 26 screen shot 2016-09-08 at 12 13 12 screen shot 2016-09-08 at 12 13 03

Downloading and checking your example...

Logically seed should be outside for [0,1,2,3] >> to goes into, but didn't work.

enzyme69 commented 8 years ago

I noticed sometimes some nodes inside monad got red color. Wonder why. Is that an error?

Still cannot make my glyph thing to work. It's only masking. Checking the data with Viewer Text...

enzyme69 commented 8 years ago

Works, but I think it's still wrong :|

screen shot 2016-09-08 at 12 52 41 screen shot 2016-09-08 at 12 52 34

enzyme69 commented 8 years ago

Ah, I forgot to plug that thing...

IT WORKS!! PERFECTO!

screen shot 2016-09-08 at 12 55 05 screen shot 2016-09-08 at 12 54 51

This makes sense. I will further explore same concept. I like the terminology here like "making different stories" for each thing going into Monad. Very nice.

Currently the glyph has "fixed" row and column for each digit. Generally I think, this is pretty good already 💯 Quiet happy. It saves the usage of List Split and List Repeater.

I should write blog article or video around this Monad. Everything should be built around the Monad!

enzyme69 commented 8 years ago

Exploring Monad + Vectorize + Split

screen shot 2016-09-08 at 15 06 13

enzyme69 commented 8 years ago

BEFORE MONAD: screen shot 2016-09-08 at 15 21 25

enzyme69 commented 8 years ago

AFTER MONAD: (adding more complex stuff is becoming simple)

screen shot 2016-09-08 at 15 28 10

ly29 commented 8 years ago

And then consider what you could do with monads inside of monads.

enzyme69 commented 8 years ago

Still need to think on how to make Circle inside Circle inside Circle with variations of each. But I think that's possible now.

enzyme69 commented 8 years ago

Strange thing this didn't work, maybe I miss something...

screen shot 2016-09-08 at 15 59 44

enzyme69 commented 8 years ago

Ok, this seems to work as I planned it. Any way to make this more elegant, Ly? Or that's about right?

screen shot 2016-09-08 at 16 08 32

ly29 commented 8 years ago

It depends of what you want to achieve.

enzyme69 commented 8 years ago

Btw, I found bug where the name of Monad attributes / properties are not updating.

ly29 commented 8 years ago

Yeah, I know, it is in my backlog. Sorry about that.

enzyme69 commented 8 years ago

screen shot 2016-09-08 at 17 04 17 screen shot 2016-09-08 at 17 04 11

This could also be a bug.

I tried to make a Line node using Monad. An alternative Line node, just like AN Line Mesh node, basically I provide 2 different Vector and it should create Line.

It didn't work somewhat.

Monad inside Monad, is it possible yet?

ly29 commented 8 years ago

Regarding the line, you need to have the polygon data from the line as output.

Below is an alternative skarmavbild 2016-09-08 kl 09 22 17 skarmavbild 2016-09-08 kl 09 23 04

Monad inside of monad should work, but not recursively.

enzyme69 commented 8 years ago

screen shot 2016-09-08 at 17 35 26

Look what you did :)

I experienced a few cases where the "copies" didn't update and I need to disconnect and connect the Matrix.

enzyme69 commented 8 years ago

This is really fantastic by the way.

Above, I started simple, and soon after, I add this complexity:

I will continue exploring until I got tired of the basic and can make a more solid 3D objects.

I think, even Spider or Bugs or Jelly Fish is possible now.

ly29 commented 8 years ago

Also as a hint, you mentioned in your video loop index for randomization, it is available in Sverhchok also, but as a node like frame info. But it was broken, fixed in latest update, 0.5.6.3

skarmavbild 2016-09-08 kl 10 03 10

ly29 commented 8 years ago

Note to self: getattr doesn't work on id properties unless they are actual blender properties

ly29 commented 8 years ago

But I have to say, watching the videos gives great feedback to what is good and bad currently about Sverchok.

zeffii commented 8 years ago

yeah, the videos are good feedback, I agree with this. But to write blogposts publicly so early in a development cycle kind of gives me mixed feelings,

ly29 commented 8 years ago

Well hopefully the new videos -> more interest -> documentation.

Everything changed with this new feature, I almost feel it deserves a bigger version bump... so likely there are some unintended consequences and things might change, the name bug is higher priority clearly.

zeffii commented 8 years ago

it might be a tip to plan the blogpost a little, run the content/text past us, we might suggest fixes internally or alternative node setups, or offer explanations of a failure.

nortikin commented 8 years ago

OMG, documentation is my duty i think.

ly29 commented 8 years ago

I am a bit surprised how well this abstraction worked out to be honest... Please play around with it @nortikin

And documentation falls on all of us...

zeffii commented 8 years ago

documentation,.. the thing noone likes to do :sunglasses:

zeffii commented 8 years ago

anyway.. this went a bit off topic . my bad

ly29 commented 8 years ago

The documentation needs to be easier to update, also, personally, I keep forgetting rst syntax even though it is a sane choice... Excuses excuses... Way OT.

enzyme69 commented 8 years ago

Sorry bout my over excitement of the Monad and Vectorization. I will be careful with my video and will mention "Experimental" feature of Monad.

Need to have a better documentation to show what Sverchok can do well and cannot do (yet).

Actually converting from normal workflow without Monad to the Monad requires some "sverchok" thinking too.

enzyme69 commented 8 years ago

There are bunch of Sverchok commands when in 3D view and tapping Spacebar. But "Bake Sverchok" does not work.

Thanks @ly29 for mentioning about "loop".

Going back between AN and Sverchok, I also realized that we can do "Delay Time" by just offsetting values. Interesting.

I only figured out that Sverchok has Pipe node and found out what it does from Brussel Workshop. Can be heavy but that thing also works with Monad Vectorization.

Monad and Vectorization can easily be heavy, so in my video when I said: good to bake at some point and pass it for animation using Animation Nodes, it works well.

enzyme69 commented 8 years ago

In fact, my "Phyllotaxis" Live Noding video should all be done to show off Sverchok Monad and Vectorization of Sunflower creation. Just to say.

ly29 commented 8 years ago

Looking forward to seeing them, as I mentioned I really liked seeing the video, both parts where you struggled a bit and the final result. It is very easy to build some really heavy stuff now, it has always been easy of course...

ly29 commented 8 years ago

We should make one 1-2 minute video demonstrating the workflow.

@enzyme69 I like the dandelion video. I think this feature will stay, it feels very natural to use it and I keep wondering where it has been.

enzyme69 commented 8 years ago

You sure 1-2 minutes will be enough?

10-15 minutes maybe.

On Friday, 9 September 2016, ly29 notifications@github.com wrote:

We should make one 1-2 minute video demonstrating the workflow

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nortikin/sverchok/issues/863#issuecomment-245826207, or mute the thread https://github.com/notifications/unsubscribe-auth/ADxQL8lf12Aa8FjXvzStHA5h6fvrpPyrks5qoPURgaJpZM4J1oFv .


ly29 commented 8 years ago

Well the video would only show the monad concept and assume a certain knowledge about Sverchok and be supported by text/blog.

I like your videos, they are very instructive since they show the complete reasoning and creative process, this would be something different however.

zeffii commented 8 years ago

@enzyme69

Sorry bout my over excitement of the Monad and Vectorization. I will be careful with my video and will mention "Experimental" feature of Monad.

you have every right to be excited, it means you can vectorize almost any collection of nodes (within reason) and vectorize in ways that are hard to include in the nodes themselves. gives you a lot of power and i'm sure you will break it in new and interesting ways.

just be careful to call stuff a bug.. like you did with the lathe on randomized profile points. they seemed to be generating lines (prior to hitting the lathe) that where already self intersecting, thus the result of the lathe would self intersect. If you think stuff's a bug , stop. save. send it to us. if it's a bug we have the fun task of fixing it or explaining it.

ghost commented 8 years ago

Not sure this is the right place to make the question, but since as I understand the feature is still under development I will put it here. I am trying to create a monad that takes an object from the scene and apply some modifications to it (at the moment a twist, I put a question about it on Blender Stack Exchange and zeffii kindly answered). I would then like to displace each monad on a grid matrix, each one with a different angle of rotation, but unfortunately I'm not able to do so. I've looked at the previous examples posted here and tried in different ways but still is not working: when I give as an input a list of different seeds, the monad returns always the same output. What am I doing wrong please?

Gist

image

image

image

enzyme69 commented 8 years ago

​Following your note tree map, I tried to recreate this, but I cannot get the spinning tower thing to happen. What did you source from 3D view? Is that a Cube with multiple splits along the Z axis? Equivalent to Box?

I kind of know what you are trying to do, but I think it is a bit confusing somewhere when you want to rotate the edge.

Maybe this can be done differently...

I may try again but I think Ly probably got the answer?

ly29 commented 8 years ago

Don't apply the split option when dealing with input vector kind. This leads to a need to a split the seed option, the way around this is using the monad info node an using the loop idx as a factor for seed. I know this is totally lacking documentation right now, because it is still in flux. skarmavbild 2016-09-10 kl 08 37 45 Broken file removed

Slight misreading about the random ness perhaps. Side note to @zeffii importing that gist gives an error.

zeffii commented 8 years ago

ok @ly29 am on it.

zeffii commented 8 years ago

@ly29 the blend opens with the monad in red here..

ly29 commented 8 years ago

@zeffii Yeah I noticed and it is causing me a headache. Basically the current way of generating the monad isn't totally stable...

zeffii commented 8 years ago

it loads if i remove the seed input from the monad IO interface..

zeffii commented 8 years ago

why does this have to be so complicated :)

ly29 commented 8 years ago

The reason for this is some, in retrospect, less than sensible choices when implementing the monad. It needs to be fixed asap. It ties together with #798

Second attempt, look below. skarmavbild 2016-09-10 kl 10 04 01 twist2.zip

zeffii commented 8 years ago

https://gist.github.com/b32bca31f19c3f7652625de9ee9e7aea loads...