Communication between objects


#21

It is dynamic. You can add and remove as many as necessary.


#22

Can you explain how you would create functions in nodes. Would you just set up a node tree that works like a blender material node group? There would have to be a way to send the arg in and arg out of the “Group”. I assume you already thought of this. I have been thinking alot about how this could work. This seems like a create start for what I think of as “Subroutines” Animation nodes uses them. If you able to look at that code it might help you work it into a system. But then I may be way off on that.


#23

I won’t behave exactly like a material node group. The Function node is essentially just like a On Event node. I want it to compile to a function in the generated Haxe which will will let you call it with the Call Function node. You will also need a Function Output node that can be used to set the return value of the function. There technically won’t inherently be anything grouping the nodes in the function, but you can use Frames to create a visual grouping. A gun fire function might look like this ( this function doesn’t need to output anything so I don’t have that in there ):

Sometime I’m going to check out the Animation Nodes plugin that you linked to earlier. I might be able to borrow some ideas from that.


#24

Check out the animation nodes playlist for this guy. I think it would give you a quick idea if studying would be helpful.


#25

I already made a way to create functions in nodes, it is here in logic_pakc:https://github.com/armory3d/logic_pack/pull/22#issue-222248950
you have 2 nodes between which you make your function/method, and two nodes to call and return those functions (return not necessary for it to work, only if you want it to return values)
Or do I understand it wrong, do you want to use the function you made in a Haxe script to be called by your node with the nodes parameters? Then your node would really be a cool addition.


#26

Oh, cool. I wasn’t aware that anybody had done something like that before. I just finished my setup yesterday. It looks like it is a bit different from yours.

Calling a Function:
image

Defining a function:
image

I repurposed the Call Haxe Function node as a Call Function node and added dynamic number of arguments. The more special part is that the Function and Function Output nodes actually compile to functions in the LogicTree trait. That means that functions defined with nodes and Haxe can be called from either; there is no barrier between the two. It wasn’t as simple as writing new nodes, I had to modify the node compiler a little bit to get the Function and Function Output nodes to work right, but I think the result is awesome. :slight_smile: It adds a seamless way to communicate between objects though traits, regardless of whether or not they are Node or Haxe traits.

I’m going to review my code a little bit more and then submit a PR for Armory. Tell me if you have any suggestions.


Some node usability suggestions
#27

@zicklag and @Simonrazer

I talked about this in another thread but it seems you two have the coding ability to take it on. Could we create a node that has an object AND the ability to add multiple properties? It would be awesome to put a object into a node tree and automatically have access to all its properties from that node. Maybe, you would need two nodes one to set the object and properties up and one to call it and pull the properties from.

Does this make sense?


#28

I just opened a PR to Armory core for Node Functions. It requires changes to the node compiler so I couldn’t add it to the LogicPack.


#29

What kind of object properties. Like native properties from the Haxe API or ones set through the Blender interface?


#30

No, just properties the way Armory nodes uses them. For example one node that when you add say the player object you would have outputs of what ever properties are attached to that player. ( Health, power, mana or what ever) That way you don’t have to add get properties for everything you want to use and also could use a boolean variable as a type of tag as discussed in another thread.

Not sure if this is possible or if using the functionality of nodes linked above would be a better way, but it would seem to solve a bunch of “spaghetti” and repetitive nodes in a tree. Just putting the idea out there.


#31

Ah, I get it. So you would want a Object Properties node that will show a value output for every property that is added to a given object in Blender. So with a search box to select the object and an output for every property set in Blender.

I think technically that would be possible. It couldn’t use a Object input socket to select the object, because that is determined at runtime, but if you used a Blender object searchbox that should be possible. I’m not sure how well that would work for objects that you have multiples or duplicates of, though, because it could only get the properties of a specific object in Blender. We’re limited because the node can only determine the properties of objects that exist in Blender, not ones that are spawned or determined at runtime.

Right now I’m working on a more intuitive way to handle variables.


#32

I think you get the basic idea. If your way of handling variable solves the problem great. Lets see what that brings and I will check back then.


#33

This looks like Property, instead it has many variable inputs and outputs ?
Like some structure ?


#34

Yes I think that is a good way to say it. It would be awesome if it all the info came right with the object. Especially, as you discussed before, for player and things like walls and other objects what would have the same properties even if they were not “prefabs.”


#35

My node functions PR got merged. Yay! :slight_smile: