summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp22
-rw-r--r--editor/editor_feature_profile.cpp2
-rw-r--r--editor/editor_settings.cpp7
-rw-r--r--editor/editor_themes.cpp3
-rw-r--r--editor/export_template_manager.cpp4
-rw-r--r--editor/icons/PrismMesh.svg2
-rw-r--r--editor/import/editor_import_collada.cpp4
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h4
-rw-r--r--editor/plugins/editor_preview_plugins.cpp8
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/node_3d_editor_gizmos.h2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/node_3d_editor_plugin.h6
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp16
-rw-r--r--editor/property_selector.cpp47
-rw-r--r--editor/shader_create_dialog.cpp82
-rw-r--r--editor/shader_create_dialog.h2
20 files changed, 118 insertions, 111 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index c9d3df9ce2..f40dc3c64a 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -3418,6 +3418,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
if (bool(EDITOR_DEF("editors/animation/confirm_insert_track", true))) {
//potential new key, does not exist
if (num_tracks == 1) {
+ // TRANSLATORS: %s will be replaced by a phrase describing the target of track.
insert_confirm_text->set_text(vformat(TTR("Create new track for %s and insert key?"), p_id.query));
} else {
insert_confirm_text->set_text(vformat(TTR("Create %d new tracks and insert keys?"), num_tracks));
@@ -3525,7 +3526,8 @@ void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_
id.track_idx = track_idx;
id.value = p_xform;
id.type = Animation::TYPE_TRANSFORM3D;
- id.query = "node '" + p_node->get_name() + "'";
+ // TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
+ id.query = vformat(TTR("node '%s'"), p_node->get_name());
id.advance = false;
//dialog insert
@@ -3547,7 +3549,8 @@ void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant
id.track_idx = i;
id.value = p_value;
id.type = Animation::TYPE_ANIMATION;
- id.query = "animation";
+ // TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
+ id.query = TTR("animation");
id.advance = false;
//dialog insert
_query_insert(id);
@@ -3560,7 +3563,7 @@ void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant
id.track_idx = -1;
id.value = p_value;
id.type = Animation::TYPE_ANIMATION;
- id.query = "animation";
+ id.query = TTR("animation");
id.advance = false;
//dialog insert
_query_insert(id);
@@ -3609,7 +3612,8 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
id.track_idx = i;
id.value = p_value;
id.type = Animation::TYPE_VALUE;
- id.query = "property '" + p_property + "'";
+ // TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
+ id.query = vformat(TTR("property '%s'"), p_property);
id.advance = false;
//dialog insert
_query_insert(id);
@@ -3639,7 +3643,7 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
id.track_idx = i;
id.value = value;
id.type = Animation::TYPE_BEZIER;
- id.query = "property '" + p_property + "'";
+ id.query = vformat(TTR("property '%s'"), p_property);
id.advance = false;
//dialog insert
_query_insert(id);
@@ -3655,7 +3659,7 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
id.track_idx = -1;
id.value = p_value;
id.type = Animation::TYPE_VALUE;
- id.query = "property '" + p_property + "'";
+ id.query = vformat(TTR("property '%s'"), p_property);
id.advance = false;
//dialog insert
_query_insert(id);
@@ -3708,7 +3712,7 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari
id.track_idx = i;
id.value = p_value;
id.type = Animation::TYPE_VALUE;
- id.query = "property '" + p_property + "'";
+ id.query = vformat(TTR("property '%s'"), p_property);
id.advance = p_advance;
//dialog insert
_query_insert(id);
@@ -3733,7 +3737,7 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari
id.track_idx = i;
id.value = value;
id.type = Animation::TYPE_BEZIER;
- id.query = "property '" + p_property + "'";
+ id.query = vformat(TTR("property '%s'"), p_property);
id.advance = p_advance;
//dialog insert
_query_insert(id);
@@ -3747,7 +3751,7 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari
id.track_idx = -1;
id.value = p_value;
id.type = Animation::TYPE_VALUE;
- id.query = "property '" + p_property + "'";
+ id.query = vformat(TTR("property '%s'"), p_property);
id.advance = p_advance;
//dialog insert
_query_insert(id);
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 72a0c353e8..84a9237a96 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -563,7 +563,7 @@ void EditorFeatureProfileManager::_class_list_item_selected() {
int feature_id = md;
String feature_description = EditorFeatureProfile::get_feature_description(EditorFeatureProfile::Feature(feature_id));
- description_bit->set_text(feature_description);
+ description_bit->set_text(TTRGET(feature_description));
return;
} else {
return;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 29ac836834..b1cd53092d 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -374,6 +374,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/display_scale", 0);
// Display what the Auto display scale setting effectively corresponds to.
float scale = get_auto_display_scale();
+
+ _initial_set("interface/editor/enable_debugging_pseudolocalization", false);
+ set_restart_if_changed("interface/editor/enable_debugging_pseudolocalization", true);
+ // Use pseudolocalization in editor.
+
hints["interface/editor/display_scale"] = PropertyInfo(Variant::INT, "interface/editor/display_scale", PROPERTY_HINT_ENUM, vformat("Auto (%d%%),75%%,100%%,125%%,150%%,175%%,200%%,Custom", Math::round(scale * 100)), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/custom_display_scale", 1.0f);
hints["interface/editor/custom_display_scale"] = PropertyInfo(Variant::FLOAT, "interface/editor/custom_display_scale", PROPERTY_HINT_RANGE, "0.5,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
@@ -953,11 +958,11 @@ fail:
}
void EditorSettings::setup_language() {
+ TranslationServer::get_singleton()->set_editor_pseudolocalization(get("interface/editor/enable_debugging_pseudolocalization"));
String lang = get("interface/editor/editor_language");
if (lang == "en") {
return; // Default, nothing to do.
}
-
// Load editor translation for configured/detected locale.
EditorTranslationList *etl = _editor_translations;
while (etl->data) {
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 0d714065e3..08dd37bc73 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -1345,7 +1345,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("folder_icon_modulate", "FileDialog", (dark_theme ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(accent_color, 0.7));
theme->set_color("files_disabled", "FileDialog", font_disabled_color);
- // color picker
+ // ColorPicker
theme->set_constant("margin", "ColorPicker", popup_margin_size);
theme->set_constant("sv_width", "ColorPicker", 256 * EDSCALE);
theme->set_constant("sv_height", "ColorPicker", 256 * EDSCALE);
@@ -1358,6 +1358,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("bar_arrow", "ColorPicker", theme->get_icon("ColorPickerBarArrow", "EditorIcons"));
theme->set_icon("picker_cursor", "ColorPicker", theme->get_icon("PickerCursor", "EditorIcons"));
+ // ColorPickerButton
theme->set_icon("bg", "ColorPickerButton", theme->get_icon("GuiMiniCheckerboard", "EditorIcons"));
// Information on 3D viewport
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 699957897f..b646b3361d 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -889,8 +889,8 @@ ExportTemplateManager::ExportTemplateManager() {
request_mirrors->connect("request_completed", callable_mp(this, &ExportTemplateManager::_refresh_mirrors_completed));
mirror_options_button = memnew(MenuButton);
- mirror_options_button->get_popup()->add_item("Open in Web Browser", VISIT_WEB_MIRROR);
- mirror_options_button->get_popup()->add_item("Copy Mirror URL", COPY_MIRROR_URL);
+ mirror_options_button->get_popup()->add_item(TTR("Open in Web Browser"), VISIT_WEB_MIRROR);
+ mirror_options_button->get_popup()->add_item(TTR("Copy Mirror URL"), COPY_MIRROR_URL);
download_install_hb->add_child(mirror_options_button);
mirror_options_button->get_popup()->connect("id_pressed", callable_mp(this, &ExportTemplateManager::_mirror_options_button_cbk));
diff --git a/editor/icons/PrismMesh.svg b/editor/icons/PrismMesh.svg
index cca52bb7b0..0fd169cc8c 100644
--- a/editor/icons/PrismMesh.svg
+++ b/editor/icons/PrismMesh.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7.9824 1.002a1.0001 1.0001 0 0 0 -.81445.44336l-5.9727 8.9609-.027344.03906a1 1 0 0 0 -.0625.10742 1 1 0 0 0 .44727 1.3418l6 3a1.0001 1.0001 0 0 0 .89453 0l6-3a1 1 0 0 0 .44726-1.3418 1 1 0 0 0 -.0625-.10742l-6-9a1.0001 1.0001 0 0 0 -.84961-.44336zm-.98242 4.3008v7.0801l-3.5391-1.7715zm2 0 3.5391 5.3086-3.5391 1.7715z" fill="#ffca5f"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3.9168678 1.8860265c-.3598509 1.0771598-1.9743383 5.9072035-2.95075512 8.8641335-.15505871.56144.26297692 1.081021.77506042 1.256186 1.9729807.978051 3.9341568 1.98391 5.9144721 2.944682.5872542.201411 1.0933197-.27019 1.6046594-.478049 1.7521944-.878995 3.5092364-1.748814 5.2583944-2.633556.53543-.305954.598247-1.041459.264856-1.51829-.991782-1.9723689-1.966021-3.9544106-2.968743-5.9207481-.320568-.4259931-.882722-.5397422-1.322158-.8066387-1.7413894-.8632626-4.7187151-2.3492561-5.2199521-2.59935915-.501237-.2501031-.9959833-.18552039-1.3558341.89163945zm1.6236276 1.4766588 4.2114703 2.1046892-2.3703904 7.1132625-4.2114703-2.104688zm5.6257546 4.2135626 1.479141 2.9582811-2.9603737 1.481232z" fill="#ffca5f"/></svg>
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index b615c73422..54b93edcdd 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1414,7 +1414,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
//animation->set_loop(true);
//create animation tracks
- Vector<float> base_snapshots;
+ Vector<real_t> base_snapshots;
float f = 0;
float snapshot_interval = 1.0 / bake_fps; //should be customizable somewhere...
@@ -1466,7 +1466,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
animation->track_set_path(track, path);
animation->track_set_imported(track, true); //helps merging later
- Vector<float> snapshots = base_snapshots;
+ Vector<real_t> snapshots = base_snapshots;
if (nm.anim_tracks.size() == 1) {
//use snapshot keys from anim track instead, because this was most likely exported baked
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
index 24c950fdee..fe98a91ab3 100644
--- a/editor/plugins/animation_blend_space_1d_editor.h
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -92,7 +92,7 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
PopupMenu *animations_menu;
Vector<String> animations_to_add;
float add_point_pos;
- Vector<float> points;
+ Vector<real_t> points;
bool dragging_selected_attempt;
bool dragging_selected;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index c440064898..7fe12089c8 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4073,7 +4073,7 @@ void CanvasItemEditor::_popup_warning_depop(Control *p_control) {
info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
}
-void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const float p_duration) {
+void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const double p_duration) {
Timer *timer;
if (!popup_temporarily_timers.has(p_control)) {
timer = memnew(Timer);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 1f59dfbc49..495cd5f515 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -56,7 +56,7 @@ public:
Transform2D pre_drag_xform;
Rect2 pre_drag_rect;
- List<float> pre_drag_bones_length;
+ List<real_t> pre_drag_bones_length;
List<Dictionary> pre_drag_bones_undo_state;
Dictionary undo_state;
@@ -540,7 +540,7 @@ private:
VSplitContainer *bottom_split;
void _update_context_menu_stylebox();
- void _popup_warning_temporarily(Control *p_control, const float p_duration);
+ void _popup_warning_temporarily(Control *p_control, const double p_duration);
void _popup_warning_depop(Control *p_control);
void _set_owner_for_node_and_children(Node *p_node, Node *p_owner);
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index d7618b973e..d47bd2d410 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -386,7 +386,7 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
Vector<Vector3> vertices;
Vector<Vector3> normals;
Vector<Vector2> uvs;
- Vector<float> tangents;
+ Vector<real_t> tangents;
Basis tt = Basis(Vector3(0, 1, 0), Math_PI * 0.5);
for (int i = 1; i <= lats; i++) {
@@ -635,7 +635,7 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const
Ref<AudioStreamPlayback> playback = stream->instance_playback();
ERR_FAIL_COND_V(playback.is_null(), Ref<Texture2D>());
- float len_s = stream->get_length();
+ real_t len_s = stream->get_length();
if (len_s == 0) {
len_s = 60; //one minute audio if no length specified
}
@@ -649,8 +649,8 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const
playback->stop();
for (int i = 0; i < w; i++) {
- float max = -1000;
- float min = 1000;
+ real_t max = -1000;
+ real_t min = 1000;
int from = uint64_t(i) * frame_length / w;
int to = (uint64_t(i) + 1) * frame_length / w;
to = MIN(to, frame_length);
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index 5184e837ce..efec5a709d 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -60,7 +60,7 @@ void GPUParticles2DEditorPlugin::_file_selected(const String &p_file) {
void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
switch (p_idx) {
case MENU_GENERATE_VISIBILITY_RECT: {
- float gen_time = particles->get_lifetime();
+ double gen_time = particles->get_lifetime();
if (gen_time < 1.0) {
generate_seconds->set_value(1.0);
} else {
@@ -100,7 +100,7 @@ void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
}
void GPUParticles2DEditorPlugin::_generate_visibility_rect() {
- float time = generate_seconds->get_value();
+ double time = generate_seconds->get_value();
float running = 0.0;
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
index 8576082597..fff25b6f59 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
@@ -282,9 +282,9 @@ void GPUParticles3DEditor::_menu_option(int p_option) {
}
void GPUParticles3DEditor::_generate_aabb() {
- float time = generate_seconds->get_value();
+ double time = generate_seconds->get_value();
- float running = 0.0;
+ double running = 0.0;
EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time));
diff --git a/editor/plugins/node_3d_editor_gizmos.h b/editor/plugins/node_3d_editor_gizmos.h
index 53f602460c..64f46f2b1a 100644
--- a/editor/plugins/node_3d_editor_gizmos.h
+++ b/editor/plugins/node_3d_editor_gizmos.h
@@ -63,7 +63,7 @@ class EditorNode3DGizmo : public Node3DGizmo {
Vector<Vector3> secondary_handles;
Vector<int> secondary_handle_ids;
- float selectable_icon_size;
+ real_t selectable_icon_size;
bool billboard_handle;
bool valid;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 931c50fc44..4cb11cc5f1 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2735,7 +2735,7 @@ void Node3DEditorViewport::_notification(int p_what) {
if (show_fps) {
cpu_time_history[cpu_time_history_index] = RS::get_singleton()->viewport_get_measured_render_time_cpu(viewport->get_viewport_rid());
cpu_time_history_index = (cpu_time_history_index + 1) % FRAME_TIME_HISTORY;
- float cpu_time = 0.0;
+ double cpu_time = 0.0;
for (int i = 0; i < FRAME_TIME_HISTORY; i++) {
cpu_time += cpu_time_history[i];
}
@@ -2745,7 +2745,7 @@ void Node3DEditorViewport::_notification(int p_what) {
gpu_time_history[gpu_time_history_index] = RS::get_singleton()->viewport_get_measured_render_time_gpu(viewport->get_viewport_rid());
gpu_time_history_index = (gpu_time_history_index + 1) % FRAME_TIME_HISTORY;
- float gpu_time = 0.0;
+ double gpu_time = 0.0;
for (int i = 0; i < FRAME_TIME_HISTORY; i++) {
gpu_time += gpu_time_history[i];
}
@@ -2769,7 +2769,7 @@ void Node3DEditorViewport::_notification(int p_what) {
frame_time_gradient->get_color_at_offset(
Math::range_lerp(gpu_time, 0, 30, 0, 1)));
- const float fps = 1000.0 / gpu_time;
+ const double fps = 1000.0 / gpu_time;
fps_label->set_text(vformat(TTR("FPS: %d"), fps));
// Middle point is at 60 FPS.
fps_label->add_theme_color_override(
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index cb2edbcbc1..0c1456aaf8 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -166,9 +166,9 @@ public:
};
private:
- float cpu_time_history[FRAME_TIME_HISTORY];
+ double cpu_time_history[FRAME_TIME_HISTORY];
int cpu_time_history_index;
- float gpu_time_history[FRAME_TIME_HISTORY];
+ double gpu_time_history[FRAME_TIME_HISTORY];
int gpu_time_history_index;
int index;
@@ -336,7 +336,7 @@ private:
String last_message;
String message;
- float message_time;
+ double message_time;
void set_message(String p_message, float p_time = 5);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 9a41a100bd..f960da6732 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -408,10 +408,14 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
node->connect("dragged", callable_mp(VisualShaderEditor::get_singleton(), &VisualShaderEditor::_node_dragged), varray(p_id));
Control *custom_editor = nullptr;
- int port_offset = 0;
+ int port_offset = 1;
+
+ Control *content_offset = memnew(Control);
+ content_offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE));
+ node->add_child(content_offset);
if (is_group) {
- port_offset += 2;
+ port_offset += 1;
}
if (is_resizable) {
@@ -448,7 +452,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (vsnode->get_input_port_count() == 0 && vsnode->get_output_port_count() == 1 && vsnode->get_output_port_name(0) == "") {
//shortcut
VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0);
- node->set_slot(0, false, VisualShaderNode::PORT_TYPE_SCALAR, Color(), true, port_right, type_color[port_right]);
+ node->set_slot(1, false, VisualShaderNode::PORT_TYPE_SCALAR, Color(), true, port_right, type_color[port_right]);
if (!vsnode->is_use_prop_slots()) {
return;
}
@@ -582,7 +586,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
if (is_curve) {
VisualShaderNode::PortType port_left = vsnode->get_input_port_type(0);
VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0);
- node->set_slot(0, true, port_left, type_color[port_left], true, port_right, type_color[port_right]);
+ node->set_slot(1, true, port_left, type_color[port_left], true, port_right, type_color[port_right]);
VisualShaderEditor::get_singleton()->call_deferred(SNAME("_set_node_size"), (int)p_type, p_id, size);
}
@@ -594,10 +598,6 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
}
if (is_group) {
- offset = memnew(Control);
- offset->set_custom_minimum_size(Size2(0, 6 * EDSCALE));
- node->add_child(offset);
-
if (group_node->is_editable()) {
HBoxContainer *hb2 = memnew(HBoxContainer);
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index a1deae92a4..96fcb4fe29 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -351,51 +351,64 @@ void PropertySelector::_item_selected() {
String class_type;
if (type != Variant::NIL) {
class_type = Variant::get_type_name(type);
-
- } else {
+ } else if (base_type != String()) {
class_type = base_type;
+ } else if (instance) {
+ class_type = instance->get_class();
}
DocTools *dd = EditorHelp::get_doc_data();
String text;
-
if (properties) {
- String at_class = class_type;
-
- while (at_class != String()) {
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
+ while (class_type != String()) {
+ Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
if (E) {
for (int i = 0; i < E->get().properties.size(); i++) {
if (E->get().properties[i].name == name) {
text = DTR(E->get().properties[i].description);
+ break;
}
}
}
- at_class = ClassDB::get_parent_class(at_class);
+ if (text != String()) {
+ break;
+ }
+
+ // The property may be from a parent class, keep looking.
+ class_type = ClassDB::get_parent_class(class_type);
}
} else {
- String at_class = class_type;
-
- while (at_class != String()) {
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
+ while (class_type != String()) {
+ Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
if (E) {
for (int i = 0; i < E->get().methods.size(); i++) {
if (E->get().methods[i].name == name) {
text = DTR(E->get().methods[i].description);
+ break;
}
}
}
- at_class = ClassDB::get_parent_class(at_class);
+ if (text != String()) {
+ break;
+ }
+
+ // The method may be from a parent class, keep looking.
+ class_type = ClassDB::get_parent_class(class_type);
}
}
- if (text == String()) {
- return;
+ if (text != String()) {
+ // Display both property name and description, since the help bit may be displayed
+ // far away from the location (especially if the dialog was resized to be taller).
+ help_bit->set_text(vformat("[b]%s[/b]: %s", name, text));
+ help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 1));
+ } else {
+ // Use nested `vformat()` as translators shouldn't interfere with BBCode tags.
+ help_bit->set_text(vformat(TTR("No description available for %s."), vformat("[b]%s[/b]", name)));
+ help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 0.5));
}
-
- help_bit->set_text(text);
}
void PropertySelector::_hide_requested() {
diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp
index beae0c9c91..7e6f154fab 100644
--- a/editor/shader_create_dialog.cpp
+++ b/editor/shader_create_dialog.cpp
@@ -78,26 +78,18 @@ void ShaderCreateDialog::_update_theme() {
void ShaderCreateDialog::_update_language_info() {
language_data.clear();
- List<StringName> classes;
- classes.push_front(SNAME("Shader"));
- classes.push_front(SNAME("VisualShader"));
-
- for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
- language_data.push_back(ShaderTypeData());
- }
-
- int idx = 0;
- for (List<ShaderTypeData>::Element *E = language_data.front(); E; E = E->next()) {
- if (idx == int(SHADER_TYPE_TEXT)) {
- E->get().use_templates = true;
- E->get().extensions.push_back("gdshader");
- E->get().default_extension = "gdshader";
+ for (int i = 0; i < SHADER_TYPE_MAX; i++) {
+ ShaderTypeData data;
+ if (i == int(SHADER_TYPE_TEXT)) {
+ data.use_templates = true;
+ data.extensions.push_back("gdshader");
+ data.default_extension = "gdshader";
} else {
- E->get().default_extension = "tres";
+ data.default_extension = "tres";
}
- E->get().extensions.push_back("res");
- E->get().extensions.push_back("tres");
- idx++;
+ data.extensions.push_back("res");
+ data.extensions.push_back("tres");
+ language_data.push_back(data);
}
}
@@ -216,6 +208,7 @@ void ShaderCreateDialog::_load_exist() {
}
void ShaderCreateDialog::_language_changed(int p_language) {
+ current_language = p_language;
ShaderTypeData data = language_data[p_language];
String selected_ext = "." + data.default_extension;
@@ -304,20 +297,19 @@ void ShaderCreateDialog::_path_changed(const String &p_path) {
is_path_valid = false;
is_new_shader_created = true;
- String path_error = _validate_path(p_path, false);
+ String path_error = _validate_path(p_path);
if (path_error != "") {
_msg_path_valid(false, path_error);
_update_dialog();
return;
}
- DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ DirAccessRef f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
String p = ProjectSettings::get_singleton()->localize_path(p_path.strip_edges());
if (f->file_exists(p)) {
is_new_shader_created = false;
_msg_path_valid(true, TTR("File exists, it will be reused."));
}
- memdelete(f);
is_path_valid = true;
_update_dialog();
@@ -345,7 +337,7 @@ void ShaderCreateDialog::config(const String &p_base_path, bool p_built_in_enabl
_path_changed(file_path->get_text());
}
-String ShaderCreateDialog::_validate_path(const String &p_path, bool p_file_must_exist) {
+String ShaderCreateDialog::_validate_path(const String &p_path) {
String p = p_path.strip_edges();
if (p == "") {
@@ -360,29 +352,24 @@ String ShaderCreateDialog::_validate_path(const String &p_path, bool p_file_must
return TTR("Path is not local.");
}
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ DirAccessRef d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (d->change_dir(p.get_base_dir()) != OK) {
- memdelete(d);
return TTR("Invalid base path.");
}
- memdelete(d);
- DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ DirAccessRef f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (f->dir_exists(p)) {
- memdelete(f);
return TTR("A directory with the same name exists.");
- } else if (p_file_must_exist && !f->file_exists(p)) {
- memdelete(f);
- return TTR("File does not exist.");
}
- memdelete(f);
String extension = p.get_extension();
- List<String> extensions;
+ Set<String> extensions;
- for (int l = 0; l < SHADER_TYPE_MAX; l++) {
- for (List<String>::Element *E = language_data[l].extensions.front(); E; E = E->next()) {
- extensions.push_back(E->get());
+ for (int i = 0; i < SHADER_TYPE_MAX; i++) {
+ for (const String &ext : language_data[i].extensions) {
+ if (!extensions.has(ext)) {
+ extensions.insert(ext);
+ }
}
}
@@ -390,16 +377,18 @@ String ShaderCreateDialog::_validate_path(const String &p_path, bool p_file_must
bool found = false;
bool match = false;
- int index = 0;
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- if (E->get().nocasecmp_to(extension) == 0) {
+
+ for (const String &ext : extensions) {
+ if (ext.nocasecmp_to(extension) == 0) {
found = true;
- if (E->get() == data.default_extension) {
- match = true;
+ for (const String &lang_ext : language_data[current_language].extensions) {
+ if (lang_ext.nocasecmp_to(extension) == 0) {
+ match = true;
+ break;
+ }
}
break;
}
- index++;
}
if (!found) {
@@ -409,11 +398,6 @@ String ShaderCreateDialog::_validate_path(const String &p_path, bool p_file_must
return TTR("Wrong extension chosen.");
}
- String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
- if (path_error != "") {
- return path_error;
- }
-
return "";
}
@@ -468,7 +452,7 @@ void ShaderCreateDialog::_update_dialog() {
if (is_built_in) {
get_ok_button()->set_text(TTR("Create"));
- _msg_path_valid(true, TTR("Built-in script (into scene file)."));
+ _msg_path_valid(true, TTR("Built-in shader (into scene file)."));
} else if (is_new_shader_created) {
get_ok_button()->set_text(TTR("Create"));
if (is_path_valid) {
@@ -585,8 +569,8 @@ ShaderCreateDialog::ShaderCreateDialog() {
// Modes.
mode_menu = memnew(OptionButton);
- for (const List<String>::Element *E = ShaderTypes::get_singleton()->get_types_list().front(); E; E = E->next()) {
- mode_menu->add_item(E->get().capitalize());
+ for (const String &type_name : ShaderTypes::get_singleton()->get_types_list()) {
+ mode_menu->add_item(type_name.capitalize());
}
gc->add_child(memnew(Label(TTR("Mode:"))));
gc->add_child(mode_menu);
diff --git a/editor/shader_create_dialog.h b/editor/shader_create_dialog.h
index cc338cd6b5..6962fa3d8d 100644
--- a/editor/shader_create_dialog.h
+++ b/editor/shader_create_dialog.h
@@ -94,7 +94,7 @@ class ShaderCreateDialog : public ConfirmationDialog {
void _mode_changed(int p_mode = 0);
void _browse_path();
void _file_selected(const String &p_file);
- String _validate_path(const String &p_path, bool p_file_must_exist);
+ String _validate_path(const String &p_path);
virtual void ok_pressed() override;
void _create_new();
void _load_exist();