mirror of
https://github.com/Relintai/codot.git
synced 2025-02-18 03:24:20 +01:00
Updated the base engine.
This commit is contained in:
parent
d424e12f44
commit
fc0be5f8b5
@ -40,13 +40,13 @@
|
||||
<member name="access" type="int" setter="set_access" getter="get_access" enum="EditorFileDialog.Access" default="0">
|
||||
The location from which the user may select a file, including [code]res://[/code], [code]user://[/code], and the local file system.
|
||||
</member>
|
||||
<member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir" default=""res://"">
|
||||
<member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir">
|
||||
The currently occupied directory.
|
||||
</member>
|
||||
<member name="current_file" type="String" setter="set_current_file" getter="get_current_file" default="""">
|
||||
<member name="current_file" type="String" setter="set_current_file" getter="get_current_file">
|
||||
The currently selected file.
|
||||
</member>
|
||||
<member name="current_path" type="String" setter="set_current_path" getter="get_current_path" default=""res://"">
|
||||
<member name="current_path" type="String" setter="set_current_path" getter="get_current_path">
|
||||
The file system path in the address bar.
|
||||
</member>
|
||||
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" overrides="AcceptDialog" default="false" />
|
||||
|
@ -56,13 +56,13 @@
|
||||
The file system access scope. See enum [code]Access[/code] constants.
|
||||
[b]Warning:[/b] Currently, in sandboxed environments such as HTML5 builds or sandboxed macOS apps, FileDialog cannot access the host file system. See [url=https://github.com/godotengine/godot-proposals/issues/1123]godot-proposals#1123[/url].
|
||||
</member>
|
||||
<member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir" default=""res://"">
|
||||
<member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir">
|
||||
The current working directory of the file dialog.
|
||||
</member>
|
||||
<member name="current_file" type="String" setter="set_current_file" getter="get_current_file" default="""">
|
||||
<member name="current_file" type="String" setter="set_current_file" getter="get_current_file">
|
||||
The currently selected file of the file dialog.
|
||||
</member>
|
||||
<member name="current_path" type="String" setter="set_current_path" getter="get_current_path" default=""res://"">
|
||||
<member name="current_path" type="String" setter="set_current_path" getter="get_current_path">
|
||||
The currently selected file path of the file dialog.
|
||||
</member>
|
||||
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" overrides="AcceptDialog" default="false" />
|
||||
|
@ -1402,9 +1402,9 @@ void EditorFileDialog::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List"), "set_display_mode", "get_display_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*"), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR, "", 0), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*", 0), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path", PROPERTY_HINT_NONE, "", 0), "set_current_path", "get_current_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled");
|
||||
|
||||
|
@ -835,7 +835,7 @@ void EditorProperty::_menu_option(int p_option) {
|
||||
emit_changed(property, EditorNode::get_singleton()->get_inspector()->get_property_clipboard());
|
||||
} break;
|
||||
case MENU_COPY_PROPERTY_PATH: {
|
||||
OS::get_singleton()->set_clipboard(property);
|
||||
OS::get_singleton()->set_clipboard(property_path);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@ -1325,6 +1325,7 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit
|
||||
if (F->get().properties.size() == 1) {
|
||||
//since it's one, associate:
|
||||
ep->property = F->get().properties[0];
|
||||
ep->property_path = property_prefix + F->get().properties[0];
|
||||
ep->property_usage = 0;
|
||||
}
|
||||
|
||||
@ -1705,6 +1706,7 @@ void EditorInspector::update_tree() {
|
||||
if (F->get().properties.size() == 1) {
|
||||
//since it's one, associate:
|
||||
ep->property = F->get().properties[0];
|
||||
ep->property_path = property_prefix + F->get().properties[0];
|
||||
ep->property_usage = p.usage;
|
||||
//and set label?
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
friend class EditorInspector;
|
||||
Object *object;
|
||||
StringName property;
|
||||
String property_path;
|
||||
|
||||
int property_usage;
|
||||
|
||||
|
@ -2757,27 +2757,29 @@ void SpatialEditorViewport::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_indicator_bar(Control &surface, real_t fill, const Ref<Texture> icon, const Ref<Font> font, const String &text) {
|
||||
static void draw_indicator_bar(Control &p_surface, real_t p_fill, const Ref<Texture> p_icon, const Ref<Font> p_font, const String &p_text, const Color &p_color) {
|
||||
// Adjust bar size from control height
|
||||
const Vector2 surface_size = surface.get_size();
|
||||
const Vector2 surface_size = p_surface.get_size();
|
||||
const real_t h = surface_size.y / 2.0;
|
||||
const real_t y = (surface_size.y - h) / 2.0;
|
||||
|
||||
const Rect2 r(10 * EDSCALE, y, 6 * EDSCALE, h);
|
||||
const real_t sy = r.size.y * fill;
|
||||
const real_t sy = r.size.y * p_fill;
|
||||
|
||||
// Note: because this bar appears over the viewport, it has to stay readable for any background color
|
||||
// Draw both neutral dark and bright colors to account this
|
||||
surface.draw_rect(r, Color(1, 1, 1, 0.2));
|
||||
surface.draw_rect(Rect2(r.position.x, r.position.y + r.size.y - sy, r.size.x, sy), Color(1, 1, 1, 0.6));
|
||||
surface.draw_rect(r.grow(1), Color(0, 0, 0, 0.7), false, Math::round(EDSCALE));
|
||||
p_surface.draw_rect(r, p_color * Color(1, 1, 1, 0.2));
|
||||
p_surface.draw_rect(Rect2(r.position.x, r.position.y + r.size.y - sy, r.size.x, sy), p_color * Color(1, 1, 1, 0.6));
|
||||
p_surface.draw_rect(r.grow(1), Color(0, 0, 0, 0.7), false, Math::round(EDSCALE));
|
||||
|
||||
const Vector2 icon_size = icon->get_size();
|
||||
const Vector2 icon_size = p_icon->get_size();
|
||||
const Vector2 icon_pos = Vector2(r.position.x - (icon_size.x - r.size.x) / 2, r.position.y + r.size.y + 2 * EDSCALE);
|
||||
surface.draw_texture(icon, icon_pos);
|
||||
p_surface.draw_texture(p_icon, icon_pos, p_color);
|
||||
|
||||
// Draw a shadow for the text to make it easier to read.
|
||||
p_surface.draw_string(p_font, Vector2(icon_pos.x + EDSCALE, icon_pos.y + icon_size.y + 17 * EDSCALE), p_text, Color(0, 0, 0));
|
||||
// Draw text below the bar (for speed/zoom information).
|
||||
surface.draw_string(font, Vector2(icon_pos.x, icon_pos.y + icon_size.y + 16 * EDSCALE), text);
|
||||
p_surface.draw_string(p_font, Vector2(icon_pos.x, icon_pos.y + icon_size.y + 16 * EDSCALE), p_text, p_color);
|
||||
}
|
||||
|
||||
void SpatialEditorViewport::_draw() {
|
||||
@ -2894,7 +2896,8 @@ void SpatialEditorViewport::_draw() {
|
||||
1.0 - logscale_t,
|
||||
get_icon("ViewportSpeed", "EditorIcons"),
|
||||
get_font("font", "Label"),
|
||||
vformat("%s u/s", String::num(freelook_speed).pad_decimals(precision)));
|
||||
vformat("%s u/s", String::num(freelook_speed).pad_decimals(precision)),
|
||||
Color(1.0, 0.95, 0.7));
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -2915,7 +2918,8 @@ void SpatialEditorViewport::_draw() {
|
||||
logscale_t,
|
||||
get_icon("ViewportZoom", "EditorIcons"),
|
||||
get_font("font", "Label"),
|
||||
vformat("%s u", String::num(cursor.distance).pad_decimals(precision)));
|
||||
vformat("%s u", String::num(cursor.distance).pad_decimals(precision)),
|
||||
Color(0.7, 0.95, 1.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -832,9 +832,12 @@ void TileMapEditor::_draw_grid(Control *p_viewport, const Rect2 &p_rect) const {
|
||||
const Size2 screen_size = p_viewport->get_size();
|
||||
Rect2 rect;
|
||||
rect.position = node->world_to_map(xform_inv.xform(Vector2()));
|
||||
rect.expand_to(node->world_to_map(xform_inv.xform(Vector2(0, screen_size.height))));
|
||||
rect.expand_to(node->world_to_map(xform_inv.xform(Vector2(screen_size.width, 0))));
|
||||
rect.expand_to(node->world_to_map(xform_inv.xform(screen_size)));
|
||||
rect.expand_to(node->world_to_map(xform_inv.xform(Vector2(0, screen_size.height))) + Vector2(0, 1));
|
||||
rect.expand_to(node->world_to_map(xform_inv.xform(Vector2(screen_size.width, 0))) + Vector2(1, 0));
|
||||
rect.expand_to(node->world_to_map(xform_inv.xform(screen_size)) + Vector2(1, 1));
|
||||
if (node->get_half_offset() != TileMap::HALF_OFFSET_DISABLED) {
|
||||
rect.grow_by(1); // So it won't matter whether corners are on an odd or even row/column.
|
||||
}
|
||||
clipped = rect.clip(si);
|
||||
}
|
||||
clipped.position -= si.position; // Relative to the fade rect, in grid unit.
|
||||
@ -878,15 +881,16 @@ void TileMapEditor::_draw_grid(Control *p_viewport, const Rect2 &p_rect) const {
|
||||
const Color color = (x + si.position.x == 0) ? axis_color : grid_color;
|
||||
const float line_opacity = _lerp_fade(si.size.x, fade, x);
|
||||
|
||||
for (int y = clipped.position.y; y < cell_count; y++) {
|
||||
for (int y = clipped.position.y; y < clipped_end.y; y++) {
|
||||
Vector2 ofs;
|
||||
if (ABS(si.position.y + y) & 1) {
|
||||
ofs = cell_xf[0] * half_offset;
|
||||
}
|
||||
points.write[y * 2 + 0] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x, y), true));
|
||||
points.write[y * 2 + 1] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x, y + 1), true));
|
||||
colors.write[y * 2 + 0] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.y, fade, y));
|
||||
colors.write[y * 2 + 1] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.y, fade, y + 1));
|
||||
const int index = (y - clipped.position.y) * 2;
|
||||
points.write[index + 0] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x, y), true));
|
||||
points.write[index + 1] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x, y + 1), true));
|
||||
colors.write[index + 0] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.y, fade, y));
|
||||
colors.write[index + 1] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.y, fade, y + 1));
|
||||
}
|
||||
p_viewport->draw_multiline_colors(points, colors, 1);
|
||||
}
|
||||
@ -923,15 +927,16 @@ void TileMapEditor::_draw_grid(Control *p_viewport, const Rect2 &p_rect) const {
|
||||
const Color color = (y + si.position.y == 0) ? axis_color : grid_color;
|
||||
const float line_opacity = _lerp_fade(si.size.y, fade, y);
|
||||
|
||||
for (int x = clipped.position.x; x < cell_count; x++) {
|
||||
for (int x = clipped.position.x; x < clipped_end.x; x++) {
|
||||
Vector2 ofs;
|
||||
if (ABS(si.position.x + x) & 1) {
|
||||
ofs = cell_xf[1] * half_offset;
|
||||
}
|
||||
points.write[x * 2 + 0] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x, y), true));
|
||||
points.write[x * 2 + 1] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x + 1, y), true));
|
||||
colors.write[x * 2 + 0] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.x, fade, x));
|
||||
colors.write[x * 2 + 1] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.x, fade, x + 1));
|
||||
const int index = (x - clipped.position.x) * 2;
|
||||
points.write[index + 0] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x, y), true));
|
||||
points.write[index + 1] = xform.xform(ofs + node->map_to_world(si.position + Vector2(x + 1, y), true));
|
||||
colors.write[index + 0] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.x, fade, x));
|
||||
colors.write[index + 1] = Color(color.r, color.g, color.b, color.a * line_opacity * _lerp_fade(si.size.x, fade, x + 1));
|
||||
}
|
||||
p_viewport->draw_multiline_colors(points, colors, 1);
|
||||
}
|
||||
|
@ -509,7 +509,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (!nc) {
|
||||
err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "').";
|
||||
if (obj_B) {
|
||||
err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "').";
|
||||
} else {
|
||||
err_text = "Right operand of 'is' is null.";
|
||||
}
|
||||
OPCODE_BREAK;
|
||||
}
|
||||
#endif
|
||||
|
@ -175,7 +175,7 @@ int detect_prime() {
|
||||
close(fdset[0]);
|
||||
|
||||
} else {
|
||||
// In child, exit() here will not quit the engine.
|
||||
// In child, killing this process will not quit the engine.
|
||||
|
||||
char string[201];
|
||||
|
||||
@ -203,7 +203,7 @@ int detect_prime() {
|
||||
print_verbose("Couldn't write vendor/renderer string.");
|
||||
}
|
||||
close(fdset[1]);
|
||||
exit(0);
|
||||
raise(SIGINT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -822,9 +822,9 @@ void FileDialog::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "filters"), "set_filters", "get_filters");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir"), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file"), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR, "", 0), "set_current_dir", "get_current_dir");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*", 0), "set_current_file", "get_current_file");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path", PROPERTY_HINT_NONE, "", 0), "set_current_path", "get_current_path");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("file_selected", PropertyInfo(Variant::STRING, "path")));
|
||||
ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::POOL_STRING_ARRAY, "paths")));
|
||||
|
@ -591,21 +591,24 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
|
||||
draw_rect(Rect2(p_ofs.x + pofs, p_ofs.y + y, cw, lh), selection_bg);
|
||||
}
|
||||
|
||||
if (p_font_color_shadow.a > 0) {
|
||||
const Color char_color = selected && override_selected_font_color ? selection_fg : fx_color;
|
||||
const Color shadow_color = p_font_color_shadow * Color(1, 1, 1, char_color.a);
|
||||
|
||||
if (shadow_color.a > 0) {
|
||||
const Point2 shadow_base_pos = p_ofs + Point2(align_ofs + pofs, y + lh - line_descent);
|
||||
font->draw_char(ci, shadow_base_pos + shadow_ofs + fx_offset, fx_char, c[i + 1], p_font_color_shadow);
|
||||
font->draw_char(ci, shadow_base_pos + shadow_ofs + fx_offset, fx_char, c[i + 1], shadow_color);
|
||||
|
||||
if (p_shadow_as_outline) {
|
||||
font->draw_char(ci, shadow_base_pos + Vector2(-shadow_ofs.x, shadow_ofs.y) + fx_offset, fx_char, c[i + 1], p_font_color_shadow);
|
||||
font->draw_char(ci, shadow_base_pos + Vector2(shadow_ofs.x, -shadow_ofs.y) + fx_offset, fx_char, c[i + 1], p_font_color_shadow);
|
||||
font->draw_char(ci, shadow_base_pos + Vector2(-shadow_ofs.x, -shadow_ofs.y) + fx_offset, fx_char, c[i + 1], p_font_color_shadow);
|
||||
font->draw_char(ci, shadow_base_pos + Vector2(-shadow_ofs.x, shadow_ofs.y) + fx_offset, fx_char, c[i + 1], shadow_color);
|
||||
font->draw_char(ci, shadow_base_pos + Vector2(shadow_ofs.x, -shadow_ofs.y) + fx_offset, fx_char, c[i + 1], shadow_color);
|
||||
font->draw_char(ci, shadow_base_pos + Vector2(-shadow_ofs.x, -shadow_ofs.y) + fx_offset, fx_char, c[i + 1], shadow_color);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), fx_char, c[i + 1], override_selected_font_color ? selection_fg : fx_color);
|
||||
drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), fx_char, c[i + 1], char_color);
|
||||
} else {
|
||||
cw = drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent) + fx_offset, fx_char, c[i + 1], fx_color);
|
||||
cw = drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent) + fx_offset, fx_char, c[i + 1], char_color);
|
||||
}
|
||||
} else if (previously_visible && c[i] != '\t') {
|
||||
backtrack += font->get_char_size(fx_char, c[i + 1]).x;
|
||||
|
Loading…
Reference in New Issue
Block a user