You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-02 16:48:55 +00:00
Add metadata for slots in GraphNode
This commit is contained in:
@@ -130,6 +130,20 @@
|
|||||||
Returns the right (output) custom [Texture2D] of the slot with the given [param slot_index].
|
Returns the right (output) custom [Texture2D] of the slot with the given [param slot_index].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="get_slot_metadata_left" qualifiers="const">
|
||||||
|
<return type="Variant" />
|
||||||
|
<param index="0" name="slot_index" type="int" />
|
||||||
|
<description>
|
||||||
|
Returns the left (input) metadata of the slot with the given [param slot_index].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
|
<method name="get_slot_metadata_right" qualifiers="const">
|
||||||
|
<return type="Variant" />
|
||||||
|
<param index="0" name="slot_index" type="int" />
|
||||||
|
<description>
|
||||||
|
Returns the right (output) metadata of the slot with the given [param slot_index].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_slot_type_left" qualifiers="const">
|
<method name="get_slot_type_left" qualifiers="const">
|
||||||
<return type="int" />
|
<return type="int" />
|
||||||
<param index="0" name="slot_index" type="int" />
|
<param index="0" name="slot_index" type="int" />
|
||||||
@@ -249,6 +263,22 @@
|
|||||||
Toggles the right (output) side of the slot with the given [param slot_index]. If [param enable] is [code]true[/code], a port will appear on the right side and the slot will be able to be connected from this side.
|
Toggles the right (output) side of the slot with the given [param slot_index]. If [param enable] is [code]true[/code], a port will appear on the right side and the slot will be able to be connected from this side.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="set_slot_metadata_left">
|
||||||
|
<return type="void" />
|
||||||
|
<param index="0" name="slot_index" type="int" />
|
||||||
|
<param index="1" name="value" type="Variant" />
|
||||||
|
<description>
|
||||||
|
Sets the custom metadata for the left (input) side of the slot with the given [param slot_index] to [param value].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
|
<method name="set_slot_metadata_right">
|
||||||
|
<return type="void" />
|
||||||
|
<param index="0" name="slot_index" type="int" />
|
||||||
|
<param index="1" name="value" type="Variant" />
|
||||||
|
<description>
|
||||||
|
Sets the custom metadata for the right (output) side of the slot with the given [param slot_index] to [param value].
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="set_slot_type_left">
|
<method name="set_slot_type_left">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="slot_index" type="int" />
|
<param index="0" name="slot_index" type="int" />
|
||||||
|
|||||||
@@ -838,6 +838,19 @@ Ref<Texture2D> GraphNode::get_slot_custom_icon_left(int p_slot_index) const {
|
|||||||
return slot_table[p_slot_index].custom_port_icon_left;
|
return slot_table[p_slot_index].custom_port_icon_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphNode::set_slot_metadata_left(int p_slot_index, const Variant &p_value) {
|
||||||
|
ERR_FAIL_COND_MSG(!slot_table.has(p_slot_index), vformat("Cannot set left metadata for the slot with index '%d' because it hasn't been enabled.", p_slot_index));
|
||||||
|
slot_table[p_slot_index].metadata_left = p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant GraphNode::get_slot_metadata_left(int p_slot_index) const {
|
||||||
|
const Slot *slot = slot_table.getptr(p_slot_index);
|
||||||
|
if (slot == nullptr) {
|
||||||
|
return Variant();
|
||||||
|
}
|
||||||
|
return slot->metadata_left;
|
||||||
|
}
|
||||||
|
|
||||||
bool GraphNode::is_slot_enabled_right(int p_slot_index) const {
|
bool GraphNode::is_slot_enabled_right(int p_slot_index) const {
|
||||||
if (!slot_table.has(p_slot_index)) {
|
if (!slot_table.has(p_slot_index)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -926,6 +939,19 @@ Ref<Texture2D> GraphNode::get_slot_custom_icon_right(int p_slot_index) const {
|
|||||||
return slot_table[p_slot_index].custom_port_icon_right;
|
return slot_table[p_slot_index].custom_port_icon_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphNode::set_slot_metadata_right(int p_slot_index, const Variant &p_value) {
|
||||||
|
ERR_FAIL_COND_MSG(!slot_table.has(p_slot_index), vformat("Cannot set right metadata for the slot with index '%d' because it hasn't been enabled.", p_slot_index));
|
||||||
|
slot_table[p_slot_index].metadata_right = p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant GraphNode::get_slot_metadata_right(int p_slot_index) const {
|
||||||
|
const Slot *slot = slot_table.getptr(p_slot_index);
|
||||||
|
if (slot == nullptr) {
|
||||||
|
return Variant();
|
||||||
|
}
|
||||||
|
return slot->metadata_right;
|
||||||
|
}
|
||||||
|
|
||||||
bool GraphNode::is_slot_draw_stylebox(int p_slot_index) const {
|
bool GraphNode::is_slot_draw_stylebox(int p_slot_index) const {
|
||||||
if (!slot_table.has(p_slot_index)) {
|
if (!slot_table.has(p_slot_index)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1232,6 +1258,9 @@ void GraphNode::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_slot_custom_icon_left", "slot_index", "custom_icon"), &GraphNode::set_slot_custom_icon_left);
|
ClassDB::bind_method(D_METHOD("set_slot_custom_icon_left", "slot_index", "custom_icon"), &GraphNode::set_slot_custom_icon_left);
|
||||||
ClassDB::bind_method(D_METHOD("get_slot_custom_icon_left", "slot_index"), &GraphNode::get_slot_custom_icon_left);
|
ClassDB::bind_method(D_METHOD("get_slot_custom_icon_left", "slot_index"), &GraphNode::get_slot_custom_icon_left);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_slot_metadata_left", "slot_index", "value"), &GraphNode::set_slot_metadata_left);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_slot_metadata_left", "slot_index"), &GraphNode::get_slot_metadata_left);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("is_slot_enabled_right", "slot_index"), &GraphNode::is_slot_enabled_right);
|
ClassDB::bind_method(D_METHOD("is_slot_enabled_right", "slot_index"), &GraphNode::is_slot_enabled_right);
|
||||||
ClassDB::bind_method(D_METHOD("set_slot_enabled_right", "slot_index", "enable"), &GraphNode::set_slot_enabled_right);
|
ClassDB::bind_method(D_METHOD("set_slot_enabled_right", "slot_index", "enable"), &GraphNode::set_slot_enabled_right);
|
||||||
|
|
||||||
@@ -1244,6 +1273,9 @@ void GraphNode::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_slot_custom_icon_right", "slot_index", "custom_icon"), &GraphNode::set_slot_custom_icon_right);
|
ClassDB::bind_method(D_METHOD("set_slot_custom_icon_right", "slot_index", "custom_icon"), &GraphNode::set_slot_custom_icon_right);
|
||||||
ClassDB::bind_method(D_METHOD("get_slot_custom_icon_right", "slot_index"), &GraphNode::get_slot_custom_icon_right);
|
ClassDB::bind_method(D_METHOD("get_slot_custom_icon_right", "slot_index"), &GraphNode::get_slot_custom_icon_right);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_slot_metadata_right", "slot_index", "value"), &GraphNode::set_slot_metadata_right);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_slot_metadata_right", "slot_index"), &GraphNode::get_slot_metadata_right);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("is_slot_draw_stylebox", "slot_index"), &GraphNode::is_slot_draw_stylebox);
|
ClassDB::bind_method(D_METHOD("is_slot_draw_stylebox", "slot_index"), &GraphNode::is_slot_draw_stylebox);
|
||||||
ClassDB::bind_method(D_METHOD("set_slot_draw_stylebox", "slot_index", "enable"), &GraphNode::set_slot_draw_stylebox);
|
ClassDB::bind_method(D_METHOD("set_slot_draw_stylebox", "slot_index", "enable"), &GraphNode::set_slot_draw_stylebox);
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,13 @@ class GraphNode : public GraphElement {
|
|||||||
int type_left = 0;
|
int type_left = 0;
|
||||||
Color color_left = Color(1, 1, 1, 1);
|
Color color_left = Color(1, 1, 1, 1);
|
||||||
Ref<Texture2D> custom_port_icon_left;
|
Ref<Texture2D> custom_port_icon_left;
|
||||||
|
Variant metadata_left;
|
||||||
|
|
||||||
bool enable_right = false;
|
bool enable_right = false;
|
||||||
int type_right = 0;
|
int type_right = 0;
|
||||||
Color color_right = Color(1, 1, 1, 1);
|
Color color_right = Color(1, 1, 1, 1);
|
||||||
Ref<Texture2D> custom_port_icon_right;
|
Ref<Texture2D> custom_port_icon_right;
|
||||||
|
Variant metadata_right;
|
||||||
|
|
||||||
bool draw_stylebox = true;
|
bool draw_stylebox = true;
|
||||||
};
|
};
|
||||||
@@ -150,6 +152,9 @@ public:
|
|||||||
void set_slot_custom_icon_left(int p_slot_index, const Ref<Texture2D> &p_custom_icon);
|
void set_slot_custom_icon_left(int p_slot_index, const Ref<Texture2D> &p_custom_icon);
|
||||||
Ref<Texture2D> get_slot_custom_icon_left(int p_slot_index) const;
|
Ref<Texture2D> get_slot_custom_icon_left(int p_slot_index) const;
|
||||||
|
|
||||||
|
void set_slot_metadata_left(int p_slot_index, const Variant &p_value);
|
||||||
|
Variant get_slot_metadata_left(int p_slot_index) const;
|
||||||
|
|
||||||
bool is_slot_enabled_right(int p_slot_index) const;
|
bool is_slot_enabled_right(int p_slot_index) const;
|
||||||
void set_slot_enabled_right(int p_slot_index, bool p_enable);
|
void set_slot_enabled_right(int p_slot_index, bool p_enable);
|
||||||
|
|
||||||
@@ -162,6 +167,9 @@ public:
|
|||||||
void set_slot_custom_icon_right(int p_slot_index, const Ref<Texture2D> &p_custom_icon);
|
void set_slot_custom_icon_right(int p_slot_index, const Ref<Texture2D> &p_custom_icon);
|
||||||
Ref<Texture2D> get_slot_custom_icon_right(int p_slot_index) const;
|
Ref<Texture2D> get_slot_custom_icon_right(int p_slot_index) const;
|
||||||
|
|
||||||
|
void set_slot_metadata_right(int p_slot_index, const Variant &p_value);
|
||||||
|
Variant get_slot_metadata_right(int p_slot_index) const;
|
||||||
|
|
||||||
bool is_slot_draw_stylebox(int p_slot_index) const;
|
bool is_slot_draw_stylebox(int p_slot_index) const;
|
||||||
void set_slot_draw_stylebox(int p_slot_index, bool p_enable);
|
void set_slot_draw_stylebox(int p_slot_index, bool p_enable);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user