[SOLVED] Using custom logic nodes toguether with the logic nodepack?

Hi, I’ve followed the instructions on the armory wiki to learn how to create custom logic nodes, however when I take my new nodes to my actual project where I’m using the nodepack it doesn’t work. It seems like having two blender.py files results in no nodes working.
I took a look into the nodepack files to see if I could figure out a solution, but I’m confused, on the nodepack’s blender.py file doesn’t seem to be any nodes defined, instead they seem to be defined on their own .py files.

I took a loock at this files and tried to follow one of them to create the definition of my own test node, but if I include this file on the definitions folder no node will work.


(My node on the left, existing one on the right)

What would be the right way to implement custom nodes toguether with the nodepack?

Are you trying to add a node into the logic pack or are you trying to put your node into a separate library?
Both are possible.

About the logic packs file structure:
Having all the nodes in the single blender.py file was not optimal. Thus all the nodes were separated into their own files. To load them all, the blender.py file contains “from logicnode_definitions import *”. You will also note that there is a init.py file in the logicnode_definitions folder, which is part of that loading mechanism. This way, it is possible to add a new node to the logic pack by simply dropping the nodes .py file into the logicnode_definitions folder and the nodes .hx into Sources/armory/logicnode.

To fix your issue, have a look at your imports. I guess you copied them from the blender.py in the logic pack. Compare them to the imports of the LerpVectorsNode you posted. The lines “import arm.nodes_logic” and “from logicnode_definitions import *” are not present in the LerpVectorsNode. These two lines are what allow the blender.py file to load all the nodes in the logicnode_definitions folder and register those within blender.

If you want to insert your node into the logic pack, remove these two lines (oh, and you don’t need semicolons in python).

If you want to create your own library, I suggest copying the logic pack and removing all “node”.py files in the logicnode definitions as well as all associated “node”.hx files in Sources/arm/logicnode.
Keep the blender.py and the init.py from the logicnode_definitions folder.
Another thing that you need to do is rename the logicnode_definitions folder into something else and change the line in the blender.py file.
Then you can just add your nodes as seperate .py files into your renamed folder.

5 Likes

Many thanks, that covers all I was missing. I’m new to programing, so a lot of stuff still goes over my head.

@zaethan, may I ask you about almost the same thing?
I git cloned the logic pack into /Libraries near my .blend file but none of the new nodes are available into NodeTree (after I restarted Blender 2.80 of course).
I can’t find an error into Blender Console, so I wonder where to look for a hint.

Are there any ‘Unknown’ nodes on the add menu on the logic editor?
Just in case, have you checked your file structure?
It should be like this (folder with your .blend file on it)>libraries>logic_pack

Thanks @Quartz
I tried with both Libraries/logicnode_definitions and Libraries/logic_pack/logicnode_definitions
As you can see, I don’t have any additional nodes, I shoud see at lease Camera Controller in Action:


Content of logic_pack:
image

I don’t see what might be the cause of the problem, perhaps it would be worth trying redownloading the pack.
I just tried manually placing the current pack and it still works.