[Scene] Add SceneStringNames::item_selected

This commit is contained in:
A Thousand Ships 2024-05-14 14:21:31 +02:00
parent 0a83e7c5da
commit d9e2fc74c7
No known key found for this signature in database
GPG key ID: 2033189A662F8BD7
58 changed files with 135 additions and 131 deletions

View file

@ -876,7 +876,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
OptionButton *op = memnew(OptionButton);
hbox->add_child(op);
op->set_h_size_flags(Control::SIZE_EXPAND_FILL);
op->connect("item_selected", callable_mp(editor, &VisualShaderEditor::_set_custom_node_option).bind(p_id, i), CONNECT_DEFERRED);
op->connect(SceneStringName(item_selected), callable_mp(editor, &VisualShaderEditor::_set_custom_node_option).bind(p_id, i), CONNECT_DEFERRED);
for (const String &s : dp.options) {
op->add_item(s);
@ -1124,7 +1124,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
type_box->add_item(TTR("Sampler"));
type_box->select(group_node->get_input_port_type(j));
type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
type_box->connect("item_selected", callable_mp(editor, &VisualShaderEditor::_change_input_port_type).bind(p_id, j), CONNECT_DEFERRED);
type_box->connect(SceneStringName(item_selected), callable_mp(editor, &VisualShaderEditor::_change_input_port_type).bind(p_id, j), CONNECT_DEFERRED);
LineEdit *name_box = memnew(LineEdit);
hb->add_child(name_box);
@ -1188,7 +1188,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
type_box->add_item(TTR("Transform"));
type_box->select(group_node->get_output_port_type(i));
type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
type_box->connect("item_selected", callable_mp(editor, &VisualShaderEditor::_change_output_port_type).bind(p_id, i), CONNECT_DEFERRED);
type_box->connect(SceneStringName(item_selected), callable_mp(editor, &VisualShaderEditor::_change_output_port_type).bind(p_id, i), CONNECT_DEFERRED);
} else {
Label *label = memnew(Label);
label->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_DISABLED); // TODO: Implement proper translation switch.
@ -6150,24 +6150,24 @@ VisualShaderEditor::VisualShaderEditor() {
edit_type_standard->add_item(TTR("Fragment"));
edit_type_standard->add_item(TTR("Light"));
edit_type_standard->select(1);
edit_type_standard->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_standard->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_particles = memnew(OptionButton);
edit_type_particles->add_item(TTR("Start"));
edit_type_particles->add_item(TTR("Process"));
edit_type_particles->add_item(TTR("Collide"));
edit_type_particles->select(0);
edit_type_particles->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_particles->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_sky = memnew(OptionButton);
edit_type_sky->add_item(TTR("Sky"));
edit_type_sky->select(0);
edit_type_sky->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_sky->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_fog = memnew(OptionButton);
edit_type_fog->add_item(TTR("Fog"));
edit_type_fog->select(0);
edit_type_fog->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type_fog->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_mode_selected));
edit_type = edit_type_standard;
@ -6300,7 +6300,7 @@ VisualShaderEditor::VisualShaderEditor() {
members->set_hide_folding(false);
members->set_custom_minimum_size(Size2(180 * EDSCALE, 200 * EDSCALE));
members->connect("item_activated", callable_mp(this, &VisualShaderEditor::_member_create));
members->connect("item_selected", callable_mp(this, &VisualShaderEditor::_member_selected));
members->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_member_selected));
members->connect("nothing_selected", callable_mp(this, &VisualShaderEditor::_member_unselected));
HBoxContainer *desc_hbox = memnew(HBoxContainer);
@ -6403,7 +6403,7 @@ VisualShaderEditor::VisualShaderEditor() {
varyings->set_hide_folding(false);
varyings->set_custom_minimum_size(Size2(180 * EDSCALE, 200 * EDSCALE));
varyings->connect("item_activated", callable_mp(this, &VisualShaderEditor::_varying_deleted));
varyings->connect("item_selected", callable_mp(this, &VisualShaderEditor::_varying_selected));
varyings->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_varying_selected));
varyings->connect("nothing_selected", callable_mp(this, &VisualShaderEditor::_varying_unselected));
}
@ -7133,7 +7133,7 @@ public:
void _notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
connect("item_selected", callable_mp(this, &VisualShaderNodePluginInputEditor::_item_selected));
connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderNodePluginInputEditor::_item_selected));
} break;
}
}
@ -7183,7 +7183,7 @@ class VisualShaderNodePluginVaryingEditor : public OptionButton {
public:
void _notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
connect("item_selected", callable_mp(this, &VisualShaderNodePluginVaryingEditor::_item_selected));
connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderNodePluginVaryingEditor::_item_selected));
}
}
@ -7262,7 +7262,7 @@ public:
void _notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
connect("item_selected", callable_mp(this, &VisualShaderNodePluginParameterRefEditor::_item_selected));
connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderNodePluginParameterRefEditor::_item_selected));
} break;
}
}
@ -7648,7 +7648,7 @@ EditorPropertyVisualShaderMode::EditorPropertyVisualShaderMode() {
options->set_clip_text(true);
add_child(options);
add_focusable(options);
options->connect("item_selected", callable_mp(this, &EditorPropertyVisualShaderMode::_option_selected));
options->connect(SceneStringName(item_selected), callable_mp(this, &EditorPropertyVisualShaderMode::_option_selected));
}
bool EditorInspectorVisualShaderModePlugin::can_handle(Object *p_object) {