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

ERROR in generation #98

Open
cNori opened this issue May 24, 2024 · 0 comments
Open

ERROR in generation #98

cNori opened this issue May 24, 2024 · 0 comments

Comments

@cNori
Copy link

cNori commented May 24, 2024

[ERROR] KX_PythonComponent[Test] - Failed to invoke the start callback.
Traceback (most recent call last):
  File "D:\UPGEProject\Main.blend\nl_test.py", line 85, in start
  File "D:\UPGEProject\Main.blend\nl_test.py", line 18, in __init__
ImportError: cannot import name 'ULFPSFactor' from 'uplogic.nodes.parameters' (D:\upbge-0.36.1-windows-x86_64\3.6\python\lib\site-packages\uplogic\nodes\parameters\__init__.py)
Blender Game Engine Finished
# MACHINE GENERATED
import bge, bpy, sys
import mathutils
import math
from collections import OrderedDict


class TestWrapper():

    def __init__(self, game_object, exec_cond="", startup=False):
        from uplogic import nodes, utils
        from uplogic.nodes.logictree import ULLogicTree
        from uplogic.utils import OPERATORS, LOGIC_OPERATORS
        from uplogic.nodes.actions import ULPrintValue
        from uplogic.nodes.actions import ULApplyMovement
        from uplogic.nodes.conditions import ULKeyPressed
        from uplogic.nodes.conditions import ULOnUpdate
        from uplogic.nodes.parameters import ULFPSFactor
        from uplogic.nodes.parameters import ULMath

        self.condition = exec_cond
        owner = self.owner = game_object
        network = self.network = ULLogicTree()
        ACT0000 = ULPrintValue()
        ACT0001 = ULApplyMovement()
        CON0002 = ULKeyPressed()
        CON0003 = ULOnUpdate()
        PAR0004 = ULFPSFactor()
        PAR0005 = ULMath()
        ACT0000.msg_type = "INFO"
        ACT0000.condition = CON0002
        ACT0000.value = "1"
        ACT0001.local = True
        ACT0001.condition = ACT0000.OUT
        ACT0001.game_object = "NLO:U_O"
        ACT0001.movement = PAR0005.OUT
        CON0002.pulse = True
        CON0002.key_code = bge.events.WKEY
        PAR0005.operator = OPERATORS.get("MUL")
        PAR0005.operand_a = PAR0004.TIMEFACTOR
        PAR0005.operand_b = 2.0
        network.add_cell(CON0002)
        network.add_cell(PAR0004)
        network.add_cell(ACT0000)
        network.add_cell(CON0003)
        network.add_cell(PAR0005)
        network.add_cell(ACT0001)

        owner["IGNLTree_Test"] = network
        network._owner = owner
        network.setup()
        network.stopped = not owner.get('NL__Test')
        self.consumed = startup

    def evaluate(self):
        if self.consumed:
            return
        owner = self.owner
        if self.condition:
            cond = owner[self.condition]
            if not cond: return
        network = self.network
        if network.stopped: return
        shutdown = network.evaluate()
        if shutdown is True:
            self.consumed = True


class Test(bge.types.KX_PythonComponent):
    args = OrderedDict([
        ("Only Run At Startup", False),
        ("Execution Condition", "")
    ])

    def start(self, args):
        self.logictree = TestWrapper(
            self.object,
            exec_cond=args["Execution Condition"],
            startup=args["Only Run At Startup"]
        )
        self.logictree.evaluate()

    def update(self):
        if not self.logictree.consumed:
            self.logictree.evaluate()


def get_tree(obj):
    return TestWrapper(obj)


 Run At Startup", False),
        ("Execution Condition", "")
    ])

    def start(self, args):
        self.logictree = TestWrapper(
            self.object,
            exec_cond=args["Execution Condition"],
            startup=args["Only Run At Startup"]
        )
        self.logictree.evaluate()

    def update(self):
        if not self.logictree.consumed:
            self.logictree.evaluate()


def get_tree(obj):
    return TestWrapper(obj)

nodes
image

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

No branches or pull requests

1 participant