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

Fix and improve registration of nodes #1964

Merged
merged 2 commits into from
Oct 28, 2020

Conversation

MoritzBrueckner
Copy link
Collaborator

Fixes #1961.

Previously, the array subpackage for the array category made it impossible to use the python built-in package with the same name. It was a bit tricky to fix it but now the packages are imported correctly.

In addition to that, logic nodes are no longer registered by just importing and executing their modules, but with dedicated on_register and on_unregister functions that can be overridden if required. This makes it even simpler to register nodes and improves the maintainability.

Previously:

class MyNode(ArmLogicTreeNode).
    ...

add_node(MyNode, category="MyCategory")

Now:

class MyNode(ArmLogicTreeNode):
    arm_category = "MyCategory"

Or:

class MyNode(ArmLogicTreeNode):
    arm_category = "MyCategory"

    @classmethod
    def on_register(cls):
        do_something()
        super().on_register()

    @classmethod
    def on_unregister(cls):
        do_something_else()
        super().on_unregister()

@luboslenco luboslenco merged commit 2f76218 into armory3d:master Oct 28, 2020
@MoritzBrueckner MoritzBrueckner deleted the fix-nodes-registering branch October 28, 2020 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FBX import and export error when Armory is activated
2 participants