Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
99 lines (73 loc) · 2.98 KB

File metadata and controls

99 lines (73 loc) · 2.98 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtCore import Qt
from node_editor.pin import Pin
from node_editor.gui.node_graphics import Node_Graphics
from node_editor.common import Node_Status
class Node(Node_Graphics):
def __init__(self):
super().__init__()
# Override me
def init_widget(self):
pass
def compute(self):
raise NotImplementedError("compute is not implemented")
def execute(self):
# Get the values from the input pins
self.execute_inputs()
# Compute the value
self.compute()
# execute nodes connected to output
self.execute_outputs()
def execute_inputs(self):
pass
def execute_outputs(self):
pass
def delete(self):
"""Deletes the connection.
This function removes any connected pins by calling :any:`Port.remove_connection` for each pin
connected to this connection. After all connections have been removed, the stored :any:`Port`
references are set to None. Finally, :any:`QGraphicsScene.removeItem` is called on the scene to
remove this widget.
Returns:
None
"""
to_delete = [pin.connection for pin in self._pins if pin.connection]
for connection in to_delete:
connection.delete()
self.scene().removeItem(self)
def get_pin(self, name):
for pin in self._pins:
if pin.name == name:
return pin
def add_pin(self, name, is_output=False, execution=False):
"""
Adds a new pin to the node.
Args:
name (str): The name of the new pin.
is_output (bool, optional): True if the new pin is an output pin, False if it's an input pin. Default is False.
flags (int, optional): A set of flags to apply to the new pin. Default is 0.
ptr (Any, optional): A pointer to associate with the new pin. Default is None.
Returns:
None: This method doesn't return anything.
"""
pin = Pin(self, self.scene())
pin.is_output = is_output
pin.set_name(name)
pin.node = self
pin.set_execution(execution)
self._pins.append(pin)
def select_connections(self, value):
"""
Sets the highlighting of all connected pins to the specified value.
This method takes a boolean value `value` as input and sets the `_do_highlight` attribute of all connected pins to
this value. If a pin is not connected, this method does nothing for that pin. After setting the `_do_highlight`
attribute for all connected pins, the `update_path` method is called for each connection.
Args:
value: A boolean value indicating whether to highlight the connected pins or not.
Returns:
None.
"""
for pin in self._pins:
if pin.connection:
pin.connection._do_highlight = value
pin.connection.update_path()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.