-
Notifications
You must be signed in to change notification settings - Fork 443
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
set_output_val does nothing/ends def update_event #195
Comments
i have realized i need to subclass Data, but I don't understand where |
It's a bit hard for me to help without precisely understanding the problem.
|
Thank you for looking into it! class Data_sub(Data):
def __init__(self, value=None, load_from=None):
super().__init__(value, load_from)
def serialize(self, data):
self.value ={"data": data}
def deserialize(self):
return self.value["data"] After subclassing Data to serialize what I want to transfer to another node into a Data object I can then send via self.set_output_val(index: int, data: Data) To access the sent data via Before being able to use the payload, it needs to be deserialized still: class PrintNode(Node):
title = 'Print'
init_inputs = [NodeInputType()]
def __init__(self, params: Tuple[Flow | Session]):
self.dat= Data_sub()
super().__init__(params)
def update_event(self, inp=-1):
print(self.input(0).payload) #prints my Data_sub object
self.dat=self.input(0)
k = self.dat.deserialize()
print(k) #prints the data With this I managed to transfer a dict between nodes. Unrelated, but before I struggle for another month I'd rather ask: |
I don't fully understand what you intend to use this
So Ryven saves projects in a JSON format that should be easy to work with for further processing. Otherwise, you can build it directly into the nodes. For example: say we have a node "oo:plus:o" (2 in, 1 out) and "oo:minus:o" and they apply "+" and "-" on numeric input values. Now you want to add the ability to instead generate a parameterized expression, e.g."(inp1 + inp2) - (inp3 + inp4)". I would probably define a new data type Footnotes
|
#You can just pass the Data object to set_output_val and retrieve it in the receiving node with input(). My point was that I need to subclass Data in the first place to pass custom data, an info I only found thoroughly searching and reading the source code. For example def update_event(self):
self.arithmatic.serialize
self.set_output_val(0, self.arithmatic) But I guess at that point it would be just as possible to implement this into I will probably use the JSON provided, but thats a great way to explain it :) |
nodes.py:
gui.py:
I can import the nodes just fine and I've checked for errors in the code but it's not that complicated, any use of set_output_val results in nothing.
I put in prints in the "Textbox" node, and they only ever confirm 'ok', which means as soon as self.set_output_val is called, it stops the rest of the update_event def
I'm sorry for messy code. :°
The text was updated successfully, but these errors were encountered: