[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.

6 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.

I am facing the problem.There are ,“unknown” nodes ,what am I doing wrong here, help

I’m afraid I can’t help, I haven’t used Armory in a long time. There are many things that can cause that, ¿have you switched version after you startes working on that file?
Anyway, I recommend opening a new issue and describing your problem and what you dis aa meticulously as you can, or try with a freah install.
You can alao seek help in the discord.
Good luck.

Ok cool hey.I have a taken a different approach to solve the issue ,that I needed the pack for .

The logic pack is now fixed for the latest SDK: https://github.com/armory3d/logic_pack/pull/34 :slight_smile:

2 Likes

Thank you.It will simplify the camera control process.Let me experiment.

1 Like

This maybe troubling but I am back again ,my case didn’t change.No new nodes showing even with the new category

Is there any error in the Blender console? Also, because the change was merged only very recently, you need to download/clone the repository and not one of the Github releases.

Edit: oh, and you also need to update the Armory submodule (SDK/armory) because the pull request requires some changes in Armory: https://github.com/armory3d/armory/pull/2410.

Yes there are errors in the console about registering.Noted.Its about updating sdk

Read prefs: C:\Users\Flicrows\AppData\Roaming\Blender Foundation\Blender\2.93\config\userpref.blend
Running Armory SDK from C:\Program Files\Blender Foundation\armsdk1/
Proxy objects synchronized
Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\armsdk1/armory\blender\arm\handlers.py”, line 167, in on_load_post
load_libraries()
File “C:\Program Files\Blender Foundation\armsdk1/armory\blender\arm\handlers.py”, line 192, in load_libraries
blender.register()
File “Libraries\logic_pack\blender.py”, line 21, in register
logicnode_definitions.register_all()
File “Libraries\logic_pack\logicnode_definitions_init_.py”, line 8, in register_all
arm.logicnode.init_nodes(path, package)
TypeError: init_nodes() takes 0 positional arguments but 2 were given
Read blend: C:\Users\Flicrows\Desktop\Logic_test\Test.blend
Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\armsdk1/armory\blender\arm\handlers.py”, line 167, in on_load_post
load_libraries()
File “C:\Program Files\Blender Foundation\armsdk1/armory\blender\arm\handlers.py”, line 192, in load_libraries
blender.register()
File “Libraries\logic_pack\blender.py”, line 21, in register
logicnode_definitions.register_all()
File “Libraries\logic_pack\logicnode_definitions_init_.py”, line 8, in register_all
arm.logicnode.init_nodes(path, package)
TypeError: init_nodes() takes 0 positional arguments but 2 were given

Yep, it’s this:

Edit: oh, and you also need to update the Armory submodule (SDK/armory) because the pull request requires some changes in Armory: https://github.com/armory3d/armory/pull/2410 .

1 Like

Perfect.Working now . Thanks ,this is the solution

1 Like