Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are Node Presets Available in AN? #1309

Open
OiledEluer opened this issue Feb 5, 2020 · 23 comments
Open

Are Node Presets Available in AN? #1309

OiledEluer opened this issue Feb 5, 2020 · 23 comments
Labels

Comments

@OiledEluer
Copy link

General question- are node presets available in AN, i.e. the ability to import node trees within AN? I have attached a a screenshot of the Sverchok preset system which works quite nice. Thanks.

anq

@OmarEmaraDev
Copy link
Collaborator

You can use subprograms as presets described here. Is this what you are looking for?

@OiledEluer
Copy link
Author

No as that involves appending a Blender file and that gets very wonky if you have a large number of presets. It also appears you have to creates a subprogam within the tree which is an extra step. In Sverchok, after one creates a node tree it simply can be saved as a preset in the N-Panel, with the option to manage the presets (categorize, add, delete, etc). To invoke the preset on just needs to click and drag.

@OmarEmaraDev
Copy link
Collaborator

There were some efforts around providing support for templates in AN, but non was completed. I guess we can start working on that again. But we will have to make some design decisions first.

@Gerstmann-Bradley
Copy link

Gerstmann-Bradley commented Feb 5, 2020

No as that involves appending a Blender file and that gets very wonky if you have a large number of presets. It also appears you have to creates a subprogam within the tree which is an extra step. In Sverchok, after one creates a node tree it simply can be saved as a preset in the N-Panel, with the option to manage the presets (categorize, add, delete, etc). To invoke the preset on just needs to click and drag.

I agree with the proposal, but I want to add some notes.
What I usually do, is to create a preset subprogram tree within my startup file. In a single tree obviously you can have as many subprogram tree as you wish. (Or if you want to separate them it's fine.)
Overall I don't append a node tree. The subprogram can be easily searched through "Ctrl + A".
I think this method definitely is better than appending the node tree.

@OiledEluer
Copy link
Author

Thanks for your efforts in developing.

@OmarEmaraDev
Copy link
Collaborator

@OiledEluer @Gerstmann-Bradley It would be helpful if you can aid with the design of the task first. In particular, what do you think should happen when nodes reference Blender IDs? For instance, an Object Input node can reference an Object in the scene. When importing the template, it is probable that the object will not exist in the scene, so should the node reference nothing in this case?

@OiledEluer
Copy link
Author

I say yes it should not reference an Object. I "clean" the node tree of Object references before saving the template. However, all other info in the node tree should be preserved as shown in the screenshot below.

an

@OmarEmaraDev
Copy link
Collaborator

Ok, thanks @OiledEluer ! We will finish the tasks at hand and get to this.

@OiledEluer
Copy link
Author

Great. Would also be very useful with this addition is a pure "note" node that could be attached to the tree that is imported. By that I mean something that is akin to a sticky note where one can simply add text to a node that displays text, with no inputs or outputs. For example, in the the example in the tree above a "node note" would display "add text object". Annotations are problematic especially as one moves the node tree around. If there is a way to do this in AN already I have not figured out. I do recall some mention of this feature along the way but cant find the reference.

@OmarEmaraDev
Copy link
Collaborator

Blender already provide such note system using frames. So we can just support those.

@Gerstmann-Bradley
Copy link

Gerstmann-Bradley commented Feb 6, 2020

There were some efforts around providing support for templates in AN, but non was completed. I guess we can start working on that again. But we will have to make some design decisions first.

Some notes/thinking about presetting/possible designs. Be aware that I am not a technician at all.
1. Subprogram preset.
In terms of subprogram preset, as I said I currently save all programs within the startup files.
But I wish to achieve what Jacques is doing in BParticles. He made a separate file, and blender will refer to that file and load the "node group" within. He uses these node group to replace many default node. I don't know why he does that (instead of keeping the default nodes), but "asking blender to refer another blender file for append the node group" seems an interesting approach, and it maybe very helpful in easily loading subprograms in such a way. Although AN may not achieve this as easy as in BParticle?

This post was originally designed for the second approach, but I want to say that this first approach is still important.
Building a customized subprogram can help shorten the usage of nodes in general so that it improve the maintenance of node tree if everything has been done properly.
Also I want to re-cap the "pre-hidden socket" concept mentioned at (1) in #1266.

2. Node-tree preset.
There are some advantages doing so. Mostly the issue is that subprogram can't achieve some basic function that native nodes does:
a) subprogram can't really distinguish vectorized input. [such as object and object list; mentioned in (2) in #1266]
b) object instancer node can't be in the subprogram. [mentioned in (3)]
c) pre-hidden sockets in native nodes but not in subprogram preset. [again back to (1)]
d) subprogram can't "generate an object" as done by "mesh object output" "curve object output".

Up to this moment, this seems another approach to solve the problems in approach 1.
[Although I think to achieve these in subprograms are also important for shortening the node tree, if these are unrealistic from a technical standpoint {mainly (2) and (3)}, then this approach 2 should be considered for this purpose...]
I may think about other advantages of having template of node tree instead of subprogram:

d) subprogram is just like a fixed group of tree, if it needs to be edited, we have to goes to the parent tree.
On one side, if I have to switch back and forth between the node trees, it feels "the flow of information" will be so broken that I lost myself.
On the other side, it changes all of its potential child subprograms. this may not be preferred.
These may not be too big problems, we can just copy and paste node group and reconnect them? But somehow I feel copy paste content in subprogram may not be a preferred way of doing things...

e) In short, I don't expect I can use a single subprogram for every project. It's unrealistic. Thus a template system should be considered equally important to developing subprogram preset.

@OiledEluer @Gerstmann-Bradley It would be helpful if you can aid with the design of the task first. In particular, what do you think should happen when nodes reference Blender IDs? For instance, an Object Input node can reference an Object in the scene. When importing the template, it is probable that the object will not exist in the scene, so should the node reference nothing in this case?

Back to Omar's following question: I am with @OiledEluer, setting that refers to actual objects in the scene should be unlinked, but other settings should be preserved.

@OmarEmaraDev
Copy link
Collaborator

@Gerstmann-Bradley

  1. I believe you are thinking of node tree linking. This proved difficult for technical reasons, so we probably won't consider it for now.
  2. I was actually working on Some proposals/? of subprogram: pre-hiding sockets, vectorized input, object instancer? #1266 today. But I don't want to promise anything. I will give you a definitive answer for all your points soon.

@Gerstmann-Bradley
Copy link

Gerstmann-Bradley commented Feb 6, 2020

@Gerstmann-Bradley

  1. I believe you are thinking of node tree linking. This proved difficult for technical reasons, so we probably won't consider it for now.
  2. I was actually working on Some proposals/? of subprogram: pre-hiding sockets, vectorized input, object instancer? #1266 today. But I don't want to promise anything. I will give you a definitive answer for all your points soon.

It's ok. Either approach can work for the same goal (speeding up workflow...), so you can choose one which works easier from a technical standpoint. In terms of #1266, personally I am looking forward to solve [1], the rest can be solve by templating node trees as suggested in this post, so it may not matter that much.

@Gerstmann-Bradley
Copy link

Today I have found a paid add-on (15$) called "Node Kits".
It supports template for shader node and animation nodes.
https://blendermarket.com/products/node-kit
A demonstration video from their webpage is attached: https://youtu.be/ZSsdBMH2aVE
Currently I don't want to comment on this. Just post for people who are interested in.

@aiayou
Copy link

aiayou commented Mar 23, 2020

I think good node tree import-export system will tremendously help AN and Blender as a mograph tool in general. There are people on Youtube recreating stuff from Cinema4D in AN (BlueFox channel in particular) and if there is an easy way to share this custom node trees available, AN can catch up with Cinema4D and other tools in certain areas very fast. Paid add-on can help one person to organize their own presets but it won't help community in general. Thank you Omar Emara, Kuldeep Singh and everyone else for you hard work!

@harisreedhar
Copy link
Contributor

Any progress on this topic?

@OmarEmaraDev
Copy link
Collaborator

@harisreedhar I will pick it up once I am done with college. Sorry for the delay.

@harisreedhar
Copy link
Contributor

Take your time. Just asked out of curiosity nothing to sorry about. 😊

@dapa5900
Copy link

@Gerstmann-Bradley

Blender itself comes with this addon, that basically does what you described above: https://docs.blender.org/manual/en/2.91/addons/node/node_presets.html

I put all my node presets as separate trees in a library file that get's referenced in this addon. You can then just add easily the AN trees you really need for your current project. For some reason though this addon always displays an error when loading an AN template but it does work anyways. It also always adds another scene to the project which can be deleted right away. Hope this helps.

@OmarEmaraDev
Copy link
Collaborator

@dapa5900 Interesting. What is the displayed error if I may ask?

@dapa5900
Copy link

@OmarEmaraDev

this one:

presetError

@Gerstmann-Bradley
Copy link

Gerstmann-Bradley commented Jan 12, 2021

@Gerstmann-Bradley

Blender itself comes with this addon, that basically does what you described above: https://docs.blender.org/manual/en/2.91/addons/node/node_presets.html

Thanks to mention it! I didn't know about it.
I just roughly checked its function. I think the add-on is very nice to simplify the original work about appending the node tree. But there are still issues.

  1. I suppose the animation node is linked to the scene. That's why each time you add a template, you always append a new scene. From what was discussed earlier, I think neither the original poster @OiledEluer nor me agree about this issue. This add-on doesn't seem to prevent this issue either.
  2. This add-on appends tree, it's not like you actually put a template into an already existed node tree. This is very different if you thinking about how easy to call a node group in shader editor. Thus I think this part is also not desired, or should be improved for users.
  3. No Search Function for this template add-on. If there are lots of files or lots of trees it will be messy. (I think this can be easily added though.)
  4. If the node tree of what I wish to import already contains a "subprogram" linked from elsewhere, it will break. Solution is either retry and leave a unknown subprogram in the node tree, Or import the node tree that contains the mother of "subprogram" used. (this kind of situation is definitely tricky though, but this can really happen if "subprogram preset" is being used)
  5. I was asking for what Jacques did in his node-based particle branch long time ago, that was completely different from appending. Unfortunately this add-on is more like simplify "appending the node tree". On the other hand, this add-on is very close to what this initial poster is looking for, instead of my proposal.

But knowing this add-on is still definitely helpful. Perhaps Omar or others can improve this already existing add-on instead of making everything from scratch. This way it can also benefit users who is not tied to AN as well.

At the end, I personally am not very interested in this post anymore, since I have already found and used "saving startup" method for years. I will leave the discussion to the others.

@Durman
Copy link

Durman commented Jun 12, 2021

I've recently finish with a module for Sverchok which can convert node trees into json files and add nodes from json files into a tree. Probably you could reuse something

https://github.com/nortikin/sverchok/blob/70701ad1ea8c0585108015bb053483351737c65a/utils/sv_json_struct.py

import json
from sv_json_struct import FileStruct

json_file = json.dump(FileStruct().export_tree(an_tree))
FileStruct(struct=json.load(json_file)).duild_into_tree(an_tree)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants