(Ab)using a nodes init function

By using a nodes init function in a way that it was probably not meant to be used, it is possible to add a whole set of (already connected) nodes with one click. It is also possible to set the attributes of each node to whatever you need.

In this example I used a node called Meta in a group Meta (thank you @zicklag for https://github.com/armory3d/armory/pull/982. It is awesome!) to add a simple player controller setup. As you can see (hopefully… it seems that my gifs quality is horrible…), all the On Keyboard nodes are set to activate on “Down” instead of the default “Started”. They are also configured to activate with the correct key.
The “Speed” is preconfigured as 1, and the TransformOnLocalAxis nodes are configured accordingly (you can see the invert option enabled on some…). I also framed the nodes and labeled the frame.

This basically allows for full node setups to be added just like any other node. It would also allow armory to include “bundled setups” like it is already doing for scripts.
It would also be great if it would be possible to allow saving of currently selected nodes into a library: just select the nodes you want, hit some “save” button somewhere and it will create a library containing that node setup, or add it to an existing library. This way, node setups can be easily shared and combined into packs (like the logic pack for example).

I was thinking about turning @zicklag 's Playercontroller script WIP Character Controller Suitable for 1st/3rd Person Shooter into a node setup and add it to the logic pack along with a (thoroughly commented) template file.


Oh, that’s cool! And it didn’t even require any changes to Armory. Pretty nifty.

Definitely a start to “Node Libraries” or something like that. Then all we would need is like a “Save Frame as Library” button or something like that. It could save the node setup to a Python Pickle file or a JSON document, that you could even use to share your node setup on the Forums if you wanted.

This looks magnificently useful @zaethan! The only thing is I’m not seeing how you did this… Could you post a bit more of a step-by-step guide?


[Thread hijack begins here]

Hmmm… I’m seeing bundled scripts… and now the possibility of bundled node setups… gosh, it sure would be nice to have some single, easy point of access to find and install these kinds of things… like maybe… an integrated “Armory asset store”? Something built in that helps people find, make, distribute and benefit from creating useful tools and maybe, just maybe get the funding needed up and beyond 100%.

Yeah, yeah, I know… still unstable, international payment providers, tax, hosting, potential for invading hordes of cuttlefish-like aliens etc. etc.

Just throwing it out there and running away before the flamewar… :wink: :popcorn:

[/End Thread Hijack]

I was planning to make a step by step guide, explaining each part of the process, but I wasn’t shure whether I should post all of the code (about 110 lines at the moment) here, or wait until I got something useful into the logic_pack. I thought it would be better to first have a working (and useful) setup as well as a template file that people can start out with ^^

Some integrated Panel where you can browse/download libraries would be pretty useful, once there are more libraries than just the logic pack ^^

1 Like

That would be pretty cool. I’m always hesitant about paid plugins for Open Source stuff, but that’s just my overly only-opensource obsession. :sunglasses: I know some technologies for APIs and web frontends and you could probably make it pretty cool without it requiring a monumental amount of work, but there is a lot of Armory to work on right now and finding the time would be difficult to impossible. :upside_down_face:

You could create a Gist to share what you have so far if you wanted. Its a nice way to get a file up real quick without having to worry about formalities or flooding a forum topic with code.

@zaethan - Personally, I’m a fan of “release early, release often” so everyone can chip in and (ab)use your stuff for new and creative things (and help iron out the missing stuff).

@zicklag - Yeah, I agree with you. I have seen it done well (and badly!) though. I like how Joomla.org do it, where everything offered on their extensions site must be open source, but people are allowed to charge, and it is clealry marked with labels and search filters. The downside to this is that there are a lot of dual free/premium version extensions there, but not so much that it’s out of hand (like with WordpPress extensions).

The other way would be a more “humble bundle” approach. Everything is available “pay what you want” with the choice of splitting how much goes to the uploader and how much to the Armory development fund. Personally, I think that this, combined with an all-FOSS rule, would work really well, as it’s already pretty-much how Armory is released. This way no one is being forced into anything and to get paid people need to make something that others love enough to want to give back.

Even without any payment for anything though, it would still be useful to have a centralized asset centre, although obviously this doesn’t help Lubos financially.

1 Like

Yeah, I like that model the most. When people don’t force me to pay them and I love what they give me for free, then I’m more inspired to support their work.

PS: If we have any more comments on an Armory Marketplace we should create a new topic. :grin:

Thank you for the suggestion.

I created a gist here with the node that I used in the “video”. I commented each section to make it easy for others to comprehend what that part is doing.
Actually, I think that the process of creating such a node set is pretty easy. Handling bigger node setups will probably be a nightmare though, as you need a variable for each node and every node to be able to make connections between them…

Another idea for a marketplace would be to have a look at how most linux distributions handle their repositories. There is one repository that is handled by the distro developers and users can easily add more repositories. This only works if most developers will contribute to the main repository, as it would be annoying if every developer starts to host their own repository and users have to add each of them manually. (Although this might not be true after all. This is pretty much how emacs works at the moment. There is the main elpa repository and a community driven melpa repository which accumulates all the indiviual projects.)
This way, there could be a main armory repository hosting only free stuff. If a developer wants to charge for their work, they could host their own repository which requires a user account/public key/whatever…
The humble bundle approach would probably be more intuitive though…

1 Like

Oh, I think that most folks nowadays understand that “open-source isn’t free.” There are economics to be considered in any project of any importance, and the financial support of users (and, of Foundations) makes a huge difference.

Far from being “free,” [open source and otherwise] software is very, very expensive indeed.

1 Like

Capitalist pig!

(Ahhhhh! I’m joking! I’m joking!!! Dodges bottles and tomatoes being thrown) :wink:

The saving operator is working (mostly).
I opened a PR to merge it into the logic pack.
If you want to try it out, simply clone the logic pack and (unless it’s been merged) add the operator.py (maybe I should have used a more creative name) into the folder logicnode_definitions. It will get picked up automatically and can be used via the F3 menu.
Currently the exported node’s name and library is hardcoded (which is why the naming in the operator has been a little weird sometimes), but I would like to be able to ask the user for
that when running the operator.
It also seems to mess up the position of framed nodes (but not all of them… excluding node frames from the placement phase didn’t help, but didn’t hurt either…)
Also blender has to be restarted to pick up the new node…

Once these issues have been addressed, maybe this could even be included into main armory?
Personally, I really like the idea of being able to save and share node setups this way… You also don’t need to leave the node editor to append something from another blend file.

(Actually, it works in every node editor in blender… thus, you can also save materials this way, although you cannot load them afterwards)

1 Like

Great job @zaethan! I think that, once it is stable, that it would be great to get into main Armory.