feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -423,7 +423,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
//Move the point in a single axis. Should only work when editing a polygon and while holding shift.
if (mode == MODE_EDIT && mm->is_shift_pressed()) {
Vector2 old_point = pre_move_edit.get(selected_point.vertex);
if (ABS(cpoint.x - old_point.x) > ABS(cpoint.y - old_point.y)) {
if (Math::abs(cpoint.x - old_point.x) > Math::abs(cpoint.y - old_point.y)) {
cpoint.y = old_point.y;
} else {
cpoint.x = old_point.x;
@ -707,12 +707,12 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c
const int n_segments = n_points - (_is_line() ? 1 : 0);
for (int i = 0; i < n_segments; i++) {
Vector2 segment[2] = { xform.xform(points[i] + offset),
xform.xform(points[(i + 1) % n_points] + offset) };
const Vector2 segment_a = xform.xform(points[i] + offset);
const Vector2 segment_b = xform.xform(points[(i + 1) % n_points] + offset);
Vector2 cp = Geometry2D::get_closest_point_to_segment(p_pos, segment);
Vector2 cp = Geometry2D::get_closest_point_to_segment(p_pos, segment_a, segment_b);
if (cp.distance_squared_to(segment[0]) < eps2 || cp.distance_squared_to(segment[1]) < eps2) {
if (cp.distance_squared_to(segment_a) < eps2 || cp.distance_squared_to(segment_b) < eps2) {
continue; //not valid to reuse point
}
@ -737,18 +737,21 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) {
button_create = memnew(Button);
button_create->set_theme_type_variation(SceneStringName(FlatButton));
button_create->set_accessibility_name(TTRC("Create Polygon Points"));
add_child(button_create);
button_create->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_CREATE));
button_create->set_toggle_mode(true);
button_edit = memnew(Button);
button_edit->set_theme_type_variation(SceneStringName(FlatButton));
button_edit->set_accessibility_name(TTRC("Edit Polygon Points"));
add_child(button_edit);
button_edit->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_EDIT));
button_edit->set_toggle_mode(true);
button_delete = memnew(Button);
button_delete->set_theme_type_variation(SceneStringName(FlatButton));
button_delete->set_accessibility_name(TTRC("Delete Polygon Points"));
add_child(button_delete);
button_delete->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_DELETE));
button_delete->set_toggle_mode(true);
@ -783,6 +786,3 @@ AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(AbstractPolygon2DEd
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor);
polygon_editor->hide();
}
AbstractPolygon2DEditorPlugin::~AbstractPolygon2DEditorPlugin() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ABSTRACT_POLYGON_2D_EDITOR_H
#define ABSTRACT_POLYGON_2D_EDITOR_H
#pragma once
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/node_2d.h"
@ -163,7 +162,4 @@ public:
virtual void make_visible(bool p_visible) override;
AbstractPolygon2DEditorPlugin(AbstractPolygon2DEditor *p_polygon_editor, const String &p_class);
~AbstractPolygon2DEditorPlugin();
};
#endif // ABSTRACT_POLYGON_2D_EDITOR_H

View file

@ -76,8 +76,8 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
animations_menu->clear();
animations_to_add.clear();
List<StringName> classes;
ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
LocalVector<StringName> classes;
ClassDB::get_inheriters_from_class("AnimationRootNode", classes);
classes.sort_custom<StringName::AlphCompare>();
menu->add_submenu_node_item(TTR("Add Animation"), animations_menu);
@ -667,6 +667,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
top_hb->add_child(tool_blend);
tool_blend->set_pressed(true);
tool_blend->set_tooltip_text(TTR("Set the blending position within the space"));
tool_blend->set_accessibility_name(TTRC("Set Blending Position"));
tool_blend->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(3));
tool_select = memnew(Button);
@ -675,6 +676,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
tool_select->set_button_group(bg);
top_hb->add_child(tool_select);
tool_select->set_tooltip_text(TTR("Select and move points, create points with RMB."));
tool_select->set_accessibility_name(TTRC("Edit Points"));
tool_select->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(0));
tool_create = memnew(Button);
@ -683,6 +685,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
tool_create->set_button_group(bg);
top_hb->add_child(tool_create);
tool_create->set_tooltip_text(TTR("Create points."));
tool_create->set_accessibility_name(TTRC("Create Points"));
tool_create->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(1));
tool_erase_sep = memnew(VSeparator);
@ -691,6 +694,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
tool_erase->set_theme_type_variation(SceneStringName(FlatButton));
top_hb->add_child(tool_erase);
tool_erase->set_tooltip_text(TTR("Erase points."));
tool_erase->set_accessibility_name(TTRC("Erase Points"));
tool_erase->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_erase_selected));
top_hb->add_child(memnew(VSeparator));
@ -701,6 +705,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
top_hb->add_child(snap);
snap->set_pressed(true);
snap->set_tooltip_text(TTR("Enable snap and show grid."));
snap->set_accessibility_name(TTRC("Snap to Grid"));
snap->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_snap_toggled));
snap_value = memnew(SpinBox);
@ -708,6 +713,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
snap_value->set_min(0.01);
snap_value->set_step(0.01);
snap_value->set_max(1000);
snap_value->set_accessibility_name(TTRC("Grid Step"));
top_hb->add_child(memnew(VSeparator));
top_hb->add_child(memnew(Label(TTR("Sync:"))));
@ -732,6 +738,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
edit_value->set_min(-1000);
edit_value->set_max(1000);
edit_value->set_step(0.01);
edit_value->set_accessibility_name(TTRC("Blend Value"));
edit_value->connect(SceneStringName(value_changed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_edit_point_pos));
open_editor = memnew(Button);
@ -768,14 +775,17 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
min_value->set_min(-10000);
min_value->set_max(0);
min_value->set_step(0.01);
min_value->set_accessibility_name(TTRC("Min"));
max_value = memnew(SpinBox);
max_value->set_min(0.01);
max_value->set_max(10000);
max_value->set_step(0.01);
max_value->set_accessibility_name(TTRC("Max"));
label_value = memnew(LineEdit);
label_value->set_expand_to_text_length_enabled(true);
label_value->set_accessibility_name(TTRC("Value"));
// now add

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_BLEND_SPACE_1D_EDITOR_H
#define ANIMATION_BLEND_SPACE_1D_EDITOR_H
#pragma once
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
@ -136,5 +135,3 @@ public:
virtual void edit(const Ref<AnimationNode> &p_node) override;
AnimationNodeBlendSpace1DEditor();
};
#endif // ANIMATION_BLEND_SPACE_1D_EDITOR_H

View file

@ -119,10 +119,10 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
menu->clear(false);
animations_menu->clear();
animations_to_add.clear();
List<StringName> classes;
LocalVector<StringName> classes;
classes.sort_custom<StringName::AlphCompare>();
ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
ClassDB::get_inheriters_from_class("AnimationRootNode", classes);
menu->add_submenu_node_item(TTR("Add Animation"), animations_menu);
List<StringName> names;
@ -886,6 +886,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
top_hb->add_child(tool_blend);
tool_blend->set_pressed(true);
tool_blend->set_tooltip_text(TTR("Set the blending position within the space"));
tool_blend->set_accessibility_name(TTRC("Set Blending Position"));
tool_blend->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(3));
tool_select = memnew(Button);
@ -894,6 +895,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
tool_select->set_button_group(bg);
top_hb->add_child(tool_select);
tool_select->set_tooltip_text(TTR("Select and move points, create points with RMB."));
tool_select->set_accessibility_name(TTRC("Edit Points"));
tool_select->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(0));
tool_create = memnew(Button);
@ -902,6 +904,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
tool_create->set_button_group(bg);
top_hb->add_child(tool_create);
tool_create->set_tooltip_text(TTR("Create points."));
tool_create->set_accessibility_name(TTRC("Create Points"));
tool_create->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(1));
tool_triangle = memnew(Button);
@ -910,6 +913,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
tool_triangle->set_button_group(bg);
top_hb->add_child(tool_triangle);
tool_triangle->set_tooltip_text(TTR("Create triangles by connecting points."));
tool_triangle->set_accessibility_name(TTRC("Create Triangles"));
tool_triangle->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(2));
tool_erase_sep = memnew(VSeparator);
@ -918,6 +922,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
tool_erase->set_theme_type_variation(SceneStringName(FlatButton));
top_hb->add_child(tool_erase);
tool_erase->set_tooltip_text(TTR("Erase points and triangles."));
tool_erase->set_accessibility_name(TTRC("Erase Points"));
tool_erase->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_erase_selected));
tool_erase->set_disabled(true);
@ -929,6 +934,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
auto_triangles->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled));
auto_triangles->set_toggle_mode(true);
auto_triangles->set_tooltip_text(TTR("Generate blend triangles automatically (instead of manually)"));
auto_triangles->set_accessibility_name(TTRC("Generate Triangles"));
top_hb->add_child(memnew(VSeparator));
@ -938,6 +944,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
top_hb->add_child(snap);
snap->set_pressed(true);
snap->set_tooltip_text(TTR("Enable snap and show grid."));
snap->set_accessibility_name(TTRC("Snap to Grid"));
snap->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_snap_toggled));
snap_x = memnew(SpinBox);
@ -946,6 +953,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
snap_x->set_min(0.01);
snap_x->set_step(0.01);
snap_x->set_max(1000);
snap_x->set_accessibility_name(TTRC("Grid X Step"));
snap_y = memnew(SpinBox);
top_hb->add_child(snap_y);
@ -953,6 +961,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
snap_y->set_min(0.01);
snap_y->set_step(0.01);
snap_y->set_max(1000);
snap_y->set_accessibility_name(TTRC("Grid Y Step"));
top_hb->add_child(memnew(VSeparator));
@ -977,12 +986,14 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
edit_x->set_min(-1000);
edit_x->set_step(0.01);
edit_x->set_max(1000);
edit_x->set_accessibility_name(TTRC("Blend X Value"));
edit_x->connect(SceneStringName(value_changed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_edit_point_pos));
edit_y = memnew(SpinBox);
edit_hb->add_child(edit_y);
edit_y->set_min(-1000);
edit_y->set_step(0.01);
edit_y->set_max(1000);
edit_y->set_accessibility_name(TTRC("Blend X Value"));
edit_y->connect(SceneStringName(value_changed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_edit_point_pos));
open_editor = memnew(Button);
edit_hb->add_child(open_editor);
@ -1004,13 +1015,16 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
main_grid->add_child(left_vbox);
left_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
max_y_value = memnew(SpinBox);
max_y_value->set_accessibility_name(TTRC("Max Y"));
left_vbox->add_child(max_y_value);
left_vbox->add_spacer();
label_y = memnew(LineEdit);
label_y->set_accessibility_name(TTRC("Y Value"));
left_vbox->add_child(label_y);
label_y->set_expand_to_text_length_enabled(true);
left_vbox->add_spacer();
min_y_value = memnew(SpinBox);
min_y_value->set_accessibility_name(TTRC("Min Y"));
left_vbox->add_child(min_y_value);
max_y_value->set_max(10000);
@ -1040,13 +1054,16 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
main_grid->add_child(bottom_vbox);
bottom_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
min_x_value = memnew(SpinBox);
min_x_value->set_accessibility_name(TTRC("Min X"));
bottom_vbox->add_child(min_x_value);
bottom_vbox->add_spacer();
label_x = memnew(LineEdit);
label_y->set_accessibility_name(TTRC("X Value"));
bottom_vbox->add_child(label_x);
label_x->set_expand_to_text_length_enabled(true);
bottom_vbox->add_spacer();
max_x_value = memnew(SpinBox);
max_x_value->set_accessibility_name(TTRC("Max Y"));
bottom_vbox->add_child(max_x_value);
max_x_value->set_max(10000);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_BLEND_SPACE_2D_EDITOR_H
#define ANIMATION_BLEND_SPACE_2D_EDITOR_H
#pragma once
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
@ -147,5 +146,3 @@ public:
virtual void edit(const Ref<AnimationNode> &p_node) override;
AnimationNodeBlendSpace2DEditor();
};
#endif // ANIMATION_BLEND_SPACE_2D_EDITOR_H

View file

@ -176,6 +176,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
delete_button->set_flat(true);
delete_button->set_focus_mode(FOCUS_NONE);
delete_button->set_button_icon(get_editor_theme_icon(SNAME("Close")));
delete_button->set_accessibility_name(TTRC("Delete"));
delete_button->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_node_request).bind(E), CONNECT_DEFERRED);
node->get_titlebar_hbox()->add_child(delete_button);
}
@ -1271,9 +1272,6 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
EditorInspector::add_inspector_plugin(animation_node_inspector_plugin);
}
AnimationNodeBlendTreeEditor::~AnimationNodeBlendTreeEditor() {
}
// EditorPluginAnimationNodeAnimation
void AnimationNodeAnimationEditor::_open_set_custom_timeline_from_marker_dialog() {
@ -1370,9 +1368,6 @@ AnimationNodeAnimationEditor::AnimationNodeAnimationEditor(Ref<AnimationNodeAnim
bottom_spacer->set_custom_minimum_size(Size2(0, 2) * EDSCALE);
}
AnimationNodeAnimationEditor::~AnimationNodeAnimationEditor() {
}
void AnimationNodeAnimationEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
@ -1412,6 +1407,7 @@ AnimationNodeAnimationEditorDialog::AnimationNodeAnimationEditorDialog() {
label_start->set_stretch_ratio(1);
select_start = memnew(OptionButton);
select_start->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
select_start->set_accessibility_name(TTRC("Start Marker"));
grid->add_child(select_start);
select_start->set_h_size_flags(Control::SIZE_EXPAND_FILL);
select_start->set_stretch_ratio(2);
@ -1422,10 +1418,8 @@ AnimationNodeAnimationEditorDialog::AnimationNodeAnimationEditorDialog() {
label_end->set_stretch_ratio(1);
select_end = memnew(OptionButton);
select_end->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
select_end->set_accessibility_name(TTRC("End Marker"));
grid->add_child(select_end);
select_end->set_h_size_flags(Control::SIZE_EXPAND_FILL);
select_end->set_stretch_ratio(2);
}
AnimationNodeAnimationEditorDialog::~AnimationNodeAnimationEditorDialog() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
#define ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
#pragma once
#include "core/object/script_language.h"
#include "editor/editor_inspector.h"
@ -169,7 +168,6 @@ public:
void update_graph();
AnimationNodeBlendTreeEditor();
~AnimationNodeBlendTreeEditor();
};
// EditorPluginAnimationNodeAnimation
@ -192,7 +190,6 @@ class AnimationNodeAnimationEditorDialog : public ConfirmationDialog {
public:
AnimationNodeAnimationEditorDialog();
~AnimationNodeAnimationEditorDialog();
};
class AnimationNodeAnimationEditor : public VBoxContainer {
@ -207,10 +204,7 @@ class AnimationNodeAnimationEditor : public VBoxContainer {
public:
AnimationNodeAnimationEditor(Ref<AnimationNodeAnimation> p_animation_node_animation);
~AnimationNodeAnimationEditor();
protected:
void _notification(int p_what);
};
#endif // ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_LIBRARY_EDITOR_H
#define ANIMATION_LIBRARY_EDITOR_H
#pragma once
#include "core/io/config_file.h"
#include "core/templates/vector.h"
@ -128,5 +127,3 @@ public:
void update_tree();
AnimationLibraryEditor();
};
#endif // ANIMATION_LIBRARY_EDITOR_H

View file

@ -503,7 +503,7 @@ void AnimationPlayerEditor::_animation_rename() {
// Remove library prefix if present.
if (selected_name.contains_char('/')) {
selected_name = selected_name.get_slice("/", 1);
selected_name = selected_name.get_slicec('/', 1);
}
name_dialog->set_title(TTR("Rename Animation"));
@ -536,7 +536,7 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
// For names of form lib_name/anim_name, remove library name prefix.
if (current.contains_char('/')) {
current = current.get_slice("/", 1);
current = current.get_slicec('/', 1);
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Remove Animation"));
@ -625,8 +625,8 @@ void AnimationPlayerEditor::_animation_name_edited() {
// Extract library prefix if present.
String new_library_prefix = "";
if (current.contains_char('/')) {
new_library_prefix = current.get_slice("/", 0) + "/";
current = current.get_slice("/", 1);
new_library_prefix = current.get_slicec('/', 0) + "/";
current = current.get_slicec('/', 1);
}
undo_redo->create_action(TTR("Rename Animation"));
@ -655,6 +655,8 @@ void AnimationPlayerEditor::_animation_name_edited() {
if (current_anim.is_valid()) {
new_anim->set_step(current_anim->get_step());
}
} else {
new_anim->set_step(EDITOR_GET("editors/animation/default_animation_step"));
}
String library_name;
@ -923,6 +925,10 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) {
}
}
void AnimationPlayerEditor::clear() {
track_editor->clear();
}
void AnimationPlayerEditor::_animation_resource_edit() {
String current = _get_current();
if (current != String()) {
@ -1340,7 +1346,7 @@ void AnimationPlayerEditor::_animation_duplicate() {
if (new_name.contains_char('/')) {
// Discard library prefix.
new_name = new_name.get_slice("/", 1);
new_name = new_name.get_slicec('/', 1);
}
_update_name_dialog_library_dropdown();
@ -1926,7 +1932,7 @@ AnimationMixer *AnimationPlayerEditor::fetch_mixer_for_library() const {
}
Node *AnimationPlayerEditor::get_cached_root_node() const {
return Object::cast_to<Node>(ObjectDB::get_instance(cached_root_node_id));
return ObjectDB::get_instance<Node>(cached_root_node_id);
}
bool AnimationPlayerEditor::_validate_tracks(const Ref<Animation> p_anim) {
@ -2013,26 +2019,31 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
play_bw_from = memnew(Button);
play_bw_from->set_theme_type_variation(SceneStringName(FlatButton));
play_bw_from->set_tooltip_text(TTR("Play Animation Backwards"));
play_bw_from->set_accessibility_name(TTRC("Play Backwards"));
playback_container->add_child(play_bw_from);
play_bw = memnew(Button);
play_bw->set_theme_type_variation(SceneStringName(FlatButton));
play_bw->set_tooltip_text(TTR("Play Animation Backwards from End"));
play_bw->set_accessibility_name(TTRC("Play Backwards from End"));
playback_container->add_child(play_bw);
stop = memnew(Button);
stop->set_theme_type_variation(SceneStringName(FlatButton));
stop->set_tooltip_text(TTR("Pause/Stop Animation"));
stop->set_accessibility_name(TTRC("Pause/Stop"));
playback_container->add_child(stop);
play = memnew(Button);
play->set_theme_type_variation(SceneStringName(FlatButton));
play->set_tooltip_text(TTR("Play Animation from Start"));
play->set_accessibility_name(TTRC("Play from Start"));
playback_container->add_child(play);
play_from = memnew(Button);
play_from->set_theme_type_variation(SceneStringName(FlatButton));
play_from->set_tooltip_text(TTR("Play Animation"));
play_from->set_accessibility_name(TTRC("Play"));
playback_container->add_child(play_from);
frame = memnew(SpinBox);
@ -2041,6 +2052,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
frame->set_stretch_ratio(2);
frame->set_step(0.0001);
frame->set_tooltip_text(TTR("Animation position (in seconds)."));
frame->set_accessibility_name(TTRC("Frame"));
hb->add_child(memnew(VSeparator));
@ -2049,6 +2061,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
scale->set_h_size_flags(SIZE_EXPAND_FILL);
scale->set_stretch_ratio(1);
scale->set_tooltip_text(TTR("Scale animation playback globally for the node."));
scale->set_accessibility_name(TTRC("Scale"));
scale->hide();
delete_dialog = memnew(ConfirmationDialog);
@ -2076,6 +2089,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
animation = memnew(OptionButton);
hb->add_child(animation);
animation->set_accessibility_name(TTRC("Animation"));
animation->set_h_size_flags(SIZE_EXPAND_FILL);
animation->set_tooltip_text(TTR("Display list of animations in player."));
animation->set_clip_text(true);
@ -2085,6 +2099,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
autoplay->set_theme_type_variation(SceneStringName(FlatButton));
hb->add_child(autoplay);
autoplay->set_tooltip_text(TTR("Autoplay on Load"));
autoplay->set_accessibility_name(TTRC("Autoplay on Load"));
hb->add_child(memnew(VSeparator));
@ -2097,10 +2112,12 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
onion_toggle->set_theme_type_variation(SceneStringName(FlatButton));
onion_toggle->set_toggle_mode(true);
onion_toggle->set_tooltip_text(TTR("Enable Onion Skinning"));
onion_toggle->set_accessibility_name(TTRC("Onion Skinning"));
onion_toggle->connect(SceneStringName(pressed), callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu).bind(ONION_SKINNING_ENABLE));
hb->add_child(onion_toggle);
onion_skinning = memnew(MenuButton);
onion_skinning->set_accessibility_name(TTRC("Onion Skinning Options"));
onion_skinning->set_flat(false);
onion_skinning->set_theme_type_variation("FlatMenuButton");
onion_skinning->set_tooltip_text(TTR("Onion Skinning Options"));
@ -2127,6 +2144,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
pin->set_theme_type_variation(SceneStringName(FlatButton));
pin->set_toggle_mode(true);
pin->set_tooltip_text(TTR("Pin AnimationPlayer"));
pin->set_accessibility_name(TTRC("Pin AnimationPlayer"));
hb->add_child(pin);
pin->connect(SceneStringName(pressed), callable_mp(this, &AnimationPlayerEditor::_pin_pressed));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_PLAYER_EDITOR_PLUGIN_H
#define ANIMATION_PLAYER_EDITOR_PLUGIN_H
#pragma once
#include "editor/animation_track_editor.h"
#include "editor/plugins/animation_library_editor.h"
@ -266,6 +265,7 @@ public:
AnimationTrackEditor *get_track_editor() { return track_editor; }
Dictionary get_state() const;
void set_state(const Dictionary &p_state);
void clear();
void ensure_visibility();
@ -298,6 +298,7 @@ protected:
public:
virtual Dictionary get_state() const override { return anim_editor->get_state(); }
virtual void set_state(const Dictionary &p_state) override { anim_editor->set_state(p_state); }
virtual void clear() override { anim_editor->clear(); }
virtual String get_plugin_name() const override { return "Anim"; }
bool has_main_screen() const override { return false; }
@ -363,5 +364,3 @@ public:
AnimationMarkerKeyEditEditorPlugin();
};
#endif // ANIMATION_PLAYER_EDITOR_PLUGIN_H

View file

@ -39,10 +39,10 @@
#include "editor/gui/editor_file_dialog.h"
#include "editor/themes/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
#include "scene/main/viewport.h"
#include "scene/main/window.h"
#include "scene/resources/style_box_flat.h"
@ -232,11 +232,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
// First find closest lines using point-to-segment distance.
for (int i = 0; i < transition_lines.size(); i++) {
Vector2 s[2] = {
transition_lines[i].from,
transition_lines[i].to
};
Vector2 cpoint = Geometry2D::get_closest_point_to_segment(mb->get_position(), s);
Vector2 cpoint = Geometry2D::get_closest_point_to_segment(mb->get_position(), transition_lines[i].from, transition_lines[i].to);
float d = cpoint.distance_to(mb->get_position());
if (d > transition_lines[i].width) {
@ -464,14 +460,14 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
}
Vector2 npos = state_machine->get_node_position(E);
float d_x = ABS(npos.x - cpos.x);
float d_x = Math::abs(npos.x - cpos.x);
if (d_x < MIN(5, best_d_x)) {
drag_ofs.x -= cpos.x - npos.x;
best_d_x = d_x;
snap_x = E;
}
float d_y = ABS(npos.y - cpos.y);
float d_y = Math::abs(npos.y - cpos.y);
if (d_y < MIN(5, best_d_y)) {
drag_ofs.y -= cpos.y - npos.y;
best_d_y = d_y;
@ -545,11 +541,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
int closest = -1;
float closest_d = 1e20;
for (int i = 0; i < transition_lines.size(); i++) {
Vector2 s[2] = {
transition_lines[i].from,
transition_lines[i].to
};
Vector2 cpoint = Geometry2D::get_closest_point_to_segment(mm->get_position(), s);
Vector2 cpoint = Geometry2D::get_closest_point_to_segment(mm->get_position(), transition_lines[i].from, transition_lines[i].to);
float d = cpoint.distance_to(mm->get_position());
if (d > transition_lines[i].width) {
continue;
@ -639,18 +631,18 @@ void AnimationNodeStateMachineEditor::_open_menu(const Vector2 &p_position) {
}
}
List<StringName> classes;
ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
LocalVector<StringName> classes;
ClassDB::get_inheriters_from_class("AnimationRootNode", classes);
classes.sort_custom<StringName::AlphCompare>();
for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
String name = String(E->get()).replace_first("AnimationNode", "");
for (const StringName &class_name : classes) {
String name = String(class_name).replace_first("AnimationNode", "");
if (name == "Animation" || name == "StartState" || name == "EndState") {
continue; // nope
}
int idx = menu->get_item_count();
menu->add_item(vformat(TTR("Add %s"), name), idx);
menu->set_item_metadata(idx, E->get());
menu->set_item_metadata(idx, class_name);
}
Ref<AnimationNode> clipb = EditorSettings::get_singleton()->get_resource_clipboard();
@ -714,50 +706,6 @@ void AnimationNodeStateMachineEditor::_stop_connecting() {
state_machine_draw->queue_redraw();
}
void AnimationNodeStateMachineEditor::_delete_selected() {
TreeItem *item = delete_tree->get_next_selected(nullptr);
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
while (item) {
if (!updating) {
updating = true;
undo_redo->create_action("Transition(s) Removed");
}
Vector<String> path = item->get_text(0).split(" -> ");
selected_transition_from = path[0];
selected_transition_to = path[1];
_erase_selected(true);
item = delete_tree->get_next_selected(item);
}
if (updating) {
undo_redo->commit_action();
updating = false;
}
}
void AnimationNodeStateMachineEditor::_delete_all() {
updating = true;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action("Transition(s) Removed");
_erase_selected(true);
undo_redo->commit_action();
updating = false;
delete_window->hide();
}
void AnimationNodeStateMachineEditor::_delete_tree_draw() {
TreeItem *item = delete_tree->get_next_selected(nullptr);
while (item) {
delete_window->get_cancel_button()->set_disabled(false);
return;
}
delete_window->get_cancel_button()->set_disabled(true);
}
void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) {
file_loaded = ResourceLoader::load(p_file);
if (file_loaded.is_valid()) {
@ -929,7 +877,7 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
state_machine_draw->draw_line(p_from, p_from.lerp(p_to, p_fade_ratio), fade_line_color, 2);
}
const int ICON_COUNT = sizeof(theme_cache.transition_icons) / sizeof(*theme_cache.transition_icons);
const int ICON_COUNT = std::size(theme_cache.transition_icons);
int icon_index = p_mode + (p_auto_advance ? ICON_COUNT / 2 : 0);
ERR_FAIL_COND(icon_index >= ICON_COUNT);
Ref<Texture2D> icon = theme_cache.transition_icons[icon_index];
@ -1822,6 +1770,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
tool_select->set_button_group(bg);
tool_select->set_pressed(true);
tool_select->set_tooltip_text(TTR("Select and move nodes.\nRMB: Add node at position clicked.\nShift+LMB+Drag: Connects the selected node with another node or creates a new node if you select an area without nodes."));
tool_select->set_accessibility_name(TTRC("Edit Nodes"));
tool_select->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED);
tool_create = memnew(Button);
@ -1830,6 +1779,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
tool_create->set_toggle_mode(true);
tool_create->set_button_group(bg);
tool_create->set_tooltip_text(TTR("Create new nodes."));
tool_create->set_accessibility_name(TTRC("Create Nodes"));
tool_create->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED);
tool_connect = memnew(Button);
@ -1838,6 +1788,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
tool_connect->set_toggle_mode(true);
tool_connect->set_button_group(bg);
tool_connect->set_tooltip_text(TTR("Connect nodes."));
tool_connect->set_accessibility_name(TTRC("Connect Nodes"));
tool_connect->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED);
// Context-sensitive selection tools:
@ -1850,6 +1801,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
tool_erase->set_tooltip_text(TTR("Remove selected node or transition."));
tool_erase->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_erase_selected).bind(false));
tool_erase->set_disabled(true);
tool_erase->set_accessibility_name(TTRC("Erase"));
selection_tools_hb->add_child(tool_erase);
transition_tools_hb = memnew(HBoxContainer);
@ -1865,6 +1817,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
auto_advance->set_tooltip_text(TTR("New Transitions Should Auto Advance"));
auto_advance->set_toggle_mode(true);
auto_advance->set_pressed(true);
auto_advance->set_accessibility_name(TTRC("Transitions Auto Advance"));
transition_tools_hb->add_child(auto_advance);
//
@ -1951,23 +1904,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
delete_window = memnew(ConfirmationDialog);
delete_window->set_flag(Window::FLAG_RESIZE_DISABLED, true);
add_child(delete_window);
delete_tree = memnew(Tree);
delete_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
delete_tree->set_hide_root(true);
delete_tree->connect(SceneStringName(draw), callable_mp(this, &AnimationNodeStateMachineEditor::_delete_tree_draw));
delete_window->add_child(delete_tree);
Button *ok = delete_window->get_cancel_button();
ok->set_text(TTR("Delete Selected"));
ok->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_delete_selected));
Button *delete_all = delete_window->add_button(TTR("Delete All"), true);
delete_all->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_delete_all));
}
void EditorAnimationMultiTransitionEdit::add_transition(const StringName &p_from, const StringName &p_to, Ref<AnimationNodeStateMachineTransition> p_transition) {
@ -2019,16 +1955,16 @@ void EditorAnimationMultiTransitionEdit::_get_property_list(List<PropertyInfo> *
prop_transition_path.name = itos(i) + "/" + "transition_path";
p_list->push_back(prop_transition_path);
for (List<PropertyInfo>::Element *F = plist.front(); F; F = F->next()) {
if (F->get().name == "script" || F->get().name == "resource_name" || F->get().name == "resource_path" || F->get().name == "resource_local_to_scene") {
for (const PropertyInfo &pi : plist) {
if (pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path" || pi.name == "resource_local_to_scene") {
continue;
}
if (F->get().usage != PROPERTY_USAGE_DEFAULT) {
if (pi.usage != PROPERTY_USAGE_DEFAULT) {
continue;
}
PropertyInfo prop = F->get();
PropertyInfo prop = pi;
prop.name = itos(i) + "/" + prop.name;
p_list->push_back(prop);

View file

@ -28,17 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_STATE_MACHINE_EDITOR_H
#define ANIMATION_STATE_MACHINE_EDITOR_H
#pragma once
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "scene/animation/animation_node_state_machine.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
class ConfirmationDialog;
class EditorFileDialog;
class LineEdit;
class OptionButton;
class PanelContainer;
@ -150,9 +149,6 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
Vector2 add_node_pos;
ConfirmationDialog *delete_window = nullptr;
Tree *delete_tree = nullptr;
bool box_selecting = false;
Point2 box_selecting_from;
Point2 box_selecting_to;
@ -253,10 +249,6 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
bool _create_submenu(PopupMenu *p_menu, Ref<AnimationNodeStateMachine> p_nodesm, const StringName &p_name, const StringName &p_path);
void _stop_connecting();
void _delete_selected();
void _delete_all();
void _delete_tree_draw();
bool last_active = false;
StringName last_fading_from_node;
StringName last_current_node;
@ -327,8 +319,4 @@ protected:
public:
void add_transition(const StringName &p_from, const StringName &p_to, Ref<AnimationNodeStateMachineTransition> p_transition);
EditorAnimationMultiTransitionEdit() {}
};
#endif // ANIMATION_STATE_MACHINE_EDITOR_H

View file

@ -308,6 +308,3 @@ AnimationTreeEditorPlugin::AnimationTreeEditorPlugin() {
button = EditorNode::get_bottom_panel()->add_item(TTR("AnimationTree"), anim_tree_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_tree_bottom_panel", TTRC("Toggle AnimationTree Bottom Panel")));
button->hide();
}
AnimationTreeEditorPlugin::~AnimationTreeEditorPlugin() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ANIMATION_TREE_EDITOR_PLUGIN_H
#define ANIMATION_TREE_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
#include "scene/animation/animation_tree.h"
@ -107,7 +106,4 @@ public:
virtual void make_visible(bool p_visible) override;
AnimationTreeEditorPlugin();
~AnimationTreeEditorPlugin();
};
#endif // ANIMATION_TREE_EDITOR_PLUGIN_H

View file

@ -136,6 +136,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
add_child(hb);
icon = memnew(TextureButton);
icon->set_accessibility_name(TTRC("Open asset details"));
icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE);
hb->add_child(icon);
@ -145,11 +146,13 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
title = memnew(LinkButton);
title->set_accessibility_name(TTRC("Title"));
title->set_auto_translate_mode(AutoTranslateMode::AUTO_TRANSLATE_MODE_DISABLED);
title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
vb->add_child(title);
category = memnew(LinkButton);
category->set_accessibility_name(TTRC("Category"));
category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
vb->add_child(category);
@ -159,6 +162,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
author = memnew(LinkButton);
author->set_tooltip_text(TTR("Author"));
author->set_accessibility_name(TTRC("Author"));
author_price_hbox->add_child(author);
author_price_hbox->add_child(memnew(HSeparator));
@ -184,6 +188,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
price = memnew(Label);
price->add_theme_style_override(CoreStringName(normal), label_margin);
price->set_tooltip_text(TTR("License"));
price->set_accessibility_name(TTRC("License"));
price->set_mouse_filter(MOUSE_FILTER_PASS);
author_price_hbox->add_child(price);
@ -579,6 +584,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
dismiss_button = memnew(TextureButton);
dismiss_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::_close));
dismiss_button->set_accessibility_name(TTRC("Close"));
title_hb->add_child(dismiss_button);
title->set_clip_text(true);
@ -708,11 +714,11 @@ void EditorAssetLibrary::_update_repository_options() {
default_urls["godotengine.org (Official)"] = "https://godotengine.org/asset-library/api";
Dictionary available_urls = _EDITOR_DEF("asset_library/available_urls", default_urls, true);
repository->clear();
Array keys = available_urls.keys();
for (int i = 0; i < keys.size(); i++) {
String key = keys[i];
repository->add_item(key);
repository->set_item_metadata(i, available_urls[key]);
int i = 0;
for (const KeyValue<Variant, Variant> &kv : available_urls) {
repository->add_item(kv.key);
repository->set_item_metadata(i, kv.value);
i++;
}
}
@ -907,7 +913,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
for (int i = 0; i < headers.size(); i++) {
if (headers[i].findn("ETag:") == 0) { // Save etag
String cache_filename_base = EditorPaths::get_singleton()->get_cache_dir().path_join("assetimage_" + image_queue[p_queue_id].image_url.md5_text());
String new_etag = headers[i].substr(headers[i].find_char(':') + 1, headers[i].length()).strip_edges();
String new_etag = headers[i].substr(headers[i].find_char(':') + 1).strip_edges();
Ref<FileAccess> file = FileAccess::open(cache_filename_base + ".etag", FileAccess::WRITE);
if (file.is_valid()) {
file->store_line(new_etag);
@ -1069,7 +1075,7 @@ void EditorAssetLibrary::_search(int p_page) {
args += String() + "sort=" + sort_key[sort->get_selected()];
// We use the "branch" version, i.e. major.minor, as patch releases should be compatible
args += "&godot_version=" + String(VERSION_BRANCH);
args += "&godot_version=" + String(GODOT_VERSION_BRANCH);
String support_list;
for (int i = 0; i < SUPPORT_MAX; i++) {
@ -1214,14 +1220,7 @@ void EditorAssetLibrary::_api_request(const String &p_request, RequestType p_req
}
void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) {
String str;
{
int datalen = p_data.size();
const uint8_t *r = p_data.ptr();
str.parse_utf8((const char *)r, datalen);
}
String str = String::utf8((const char *)p_data.ptr(), (int)p_data.size());
bool error_abort = true;
switch (p_status) {
@ -1373,7 +1372,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
// This is typically because the version number changed recently
// and no assets compatible with the new version have been published yet.
_set_library_message(
vformat(TTR("No results compatible with %s %s for support level(s): %s.\nCheck the enabled support levels using the 'Support' button in the top-right corner."), String(VERSION_SHORT_NAME).capitalize(), String(VERSION_BRANCH), support_list));
vformat(TTR("No results compatible with %s %s for support level(s): %s.\nCheck the enabled support levels using the 'Support' button in the top-right corner."), String(GODOT_VERSION_SHORT_NAME).capitalize(), String(GODOT_VERSION_BRANCH), support_list));
}
} else {
library_message_box->hide();
@ -1801,6 +1800,3 @@ AssetLibraryEditorPlugin::AssetLibraryEditorPlugin() {
addon_library->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
addon_library->hide();
}
AssetLibraryEditorPlugin::~AssetLibraryEditorPlugin() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef ASSET_LIBRARY_EDITOR_PLUGIN_H
#define ASSET_LIBRARY_EDITOR_PLUGIN_H
#pragma once
#include "editor/editor_asset_installer.h"
#include "editor/plugins/editor_plugin.h"
@ -339,7 +338,7 @@ class AssetLibraryEditorPlugin : public EditorPlugin {
public:
static bool is_available();
virtual String get_plugin_name() const override { return "AssetLib"; }
virtual String get_plugin_name() const override { return TTRC("AssetLib"); }
bool has_main_screen() const override { return true; }
virtual void edit(Object *p_object) override {}
virtual bool handles(Object *p_object) const override { return false; }
@ -349,7 +348,4 @@ public:
//virtual void set_state(const Dictionary& p_state);
AssetLibraryEditorPlugin();
~AssetLibraryEditorPlugin();
};
#endif // ASSET_LIBRARY_EDITOR_PLUGIN_H

View file

@ -246,12 +246,14 @@ AudioStreamEditor::AudioStreamEditor() {
_play_button->set_focus_mode(Control::FOCUS_NONE);
_play_button->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamEditor::_play));
_play_button->set_shortcut(ED_SHORTCUT("audio_stream_editor/audio_preview_play_pause", TTRC("Audio Preview Play/Pause"), Key::SPACE));
_play_button->set_accessibility_name(TTRC("Play"));
_stop_button = memnew(Button);
hbox->add_child(_stop_button);
_stop_button->set_flat(true);
_stop_button->set_focus_mode(Control::FOCUS_NONE);
_stop_button->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamEditor::_stop));
_stop_button->set_accessibility_name(TTRC("Stop"));
_current_label = memnew(Label);
_current_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef AUDIO_STREAM_EDITOR_PLUGIN_H
#define AUDIO_STREAM_EDITOR_PLUGIN_H
#pragma once
#include "editor/editor_inspector.h"
#include "editor/plugins/editor_plugin.h"
@ -89,5 +88,3 @@ class AudioStreamEditorPlugin : public EditorPlugin {
public:
AudioStreamEditorPlugin();
};
#endif // AUDIO_STREAM_EDITOR_PLUGIN_H

View file

@ -119,5 +119,3 @@ void AudioStreamRandomizerEditorPlugin::_move_stream_array_element(Object *p_und
AudioStreamRandomizerEditorPlugin::AudioStreamRandomizerEditorPlugin() {
EditorNode::get_editor_data().add_move_array_element_function(SNAME("AudioStreamRandomizer"), callable_mp(this, &AudioStreamRandomizerEditorPlugin::_move_stream_array_element));
}
AudioStreamRandomizerEditorPlugin::~AudioStreamRandomizerEditorPlugin() {}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef AUDIO_STREAM_RANDOMIZER_EDITOR_PLUGIN_H
#define AUDIO_STREAM_RANDOMIZER_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
@ -47,7 +46,4 @@ public:
virtual void make_visible(bool p_visible) override;
AudioStreamRandomizerEditorPlugin();
~AudioStreamRandomizerEditorPlugin();
};
#endif // AUDIO_STREAM_RANDOMIZER_EDITOR_PLUGIN_H

View file

@ -30,22 +30,59 @@
#include "bit_map_editor_plugin.h"
#include "editor/editor_string_names.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/aspect_ratio_container.h"
#include "scene/gui/label.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/image_texture.h"
void BitMapEditor::setup(const Ref<BitMap> &p_bitmap) {
texture_rect->set_texture(ImageTexture::create_from_image(p_bitmap->convert_to_image()));
Ref<ImageTexture> bitmap_texture = ImageTexture::create_from_image(p_bitmap->convert_to_image());
texture_rect->set_texture(bitmap_texture);
if (bitmap_texture.is_valid()) {
centering_container->set_custom_minimum_size(Size2(0, 250) * EDSCALE);
centering_container->set_ratio(bitmap_texture->get_size().aspect());
outline_overlay->connect(SceneStringName(draw), callable_mp(this, &BitMapEditor::_draw_outline));
}
size_label->set_text(vformat(U"%s×%s", p_bitmap->get_size().width, p_bitmap->get_size().height));
}
void BitMapEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
cached_outline_color = get_theme_color(SNAME("extra_border_color_1"), EditorStringName(Editor));
} break;
}
}
void BitMapEditor::_draw_outline() {
const float outline_width = Math::round(EDSCALE);
const Rect2 outline_rect = Rect2(Vector2(), texture_rect->get_size()).grow(outline_width * 0.5);
outline_overlay->draw_rect(outline_rect, cached_outline_color, false, outline_width);
}
BitMapEditor::BitMapEditor() {
MarginContainer *margin_container = memnew(MarginContainer);
const float outline_width = Math::round(EDSCALE);
margin_container->add_theme_constant_override("margin_right", outline_width);
margin_container->add_theme_constant_override("margin_top", outline_width);
margin_container->add_theme_constant_override("margin_left", outline_width);
margin_container->add_theme_constant_override("margin_bottom", outline_width);
add_child(margin_container);
centering_container = memnew(AspectRatioContainer);
margin_container->add_child(centering_container);
texture_rect = memnew(TextureRect);
texture_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED);
texture_rect->set_texture_filter(TEXTURE_FILTER_NEAREST);
texture_rect->set_custom_minimum_size(Size2(0, 250) * EDSCALE);
add_child(texture_rect);
texture_rect->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE);
centering_container->add_child(texture_rect);
outline_overlay = memnew(Control);
centering_container->add_child(outline_overlay);
size_label = memnew(Label);
size_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);

View file

@ -28,21 +28,31 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef BIT_MAP_EDITOR_PLUGIN_H
#define BIT_MAP_EDITOR_PLUGIN_H
#pragma once
#include "editor/editor_inspector.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/resources/bit_map.h"
class AspectRatioContainer;
class TextureRect;
class BitMapEditor : public VBoxContainer {
GDCLASS(BitMapEditor, VBoxContainer);
private:
AspectRatioContainer *centering_container = nullptr;
Control *outline_overlay = nullptr;
TextureRect *texture_rect = nullptr;
Label *size_label = nullptr;
Color cached_outline_color;
void _draw_outline();
protected:
void _notification(int p_what);
public:
void setup(const Ref<BitMap> &p_bitmap);
@ -63,5 +73,3 @@ class BitMapEditorPlugin : public EditorPlugin {
public:
BitMapEditorPlugin();
};
#endif // BIT_MAP_EDITOR_PLUGIN_H

View file

@ -104,9 +104,6 @@ BoneMapperButton::BoneMapperButton(const StringName &p_profile_bone_name, bool p
selected = p_selected;
}
BoneMapperButton::~BoneMapperButton() {
}
void BoneMapperItem::create_editor() {
HBoxContainer *hbox = memnew(HBoxContainer);
add_child(hbox);
@ -165,9 +162,6 @@ BoneMapperItem::BoneMapperItem(Ref<BoneMap> &p_bone_map, const StringName &p_pro
profile_bone_name = p_profile_bone_name;
}
BoneMapperItem::~BoneMapperItem() {
}
void BonePicker::create_editors() {
set_title(TTR("Bone Picker:"));
@ -266,9 +260,6 @@ BonePicker::BonePicker(Skeleton3D *p_skeleton) {
skeleton = p_skeleton;
}
BonePicker::~BonePicker() {
}
void BoneMapper::create_editor() {
// Create Bone picker.
picker = memnew(BonePicker(skeleton));
@ -300,6 +291,7 @@ void BoneMapper::create_editor() {
clear_mapping_button = memnew(Button);
clear_mapping_button->set_button_icon(get_editor_theme_icon(SNAME("Clear")));
clear_mapping_button->set_tooltip_text(TTR("Clear mappings in current group."));
clear_mapping_button->set_accessibility_name(TTRC("Clear Mappings"));
clear_mapping_button->connect(SceneStringName(pressed), callable_mp(this, &BoneMapper::_clear_mapping_current_group));
group_hbox->add_child(clear_mapping_button);
@ -674,7 +666,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
search_path.push_back(bone_idx);
bone_idx = skeleton->get_bone_parent(bone_idx);
}
if (search_path.size() == 0) {
if (search_path.is_empty()) {
bone_idx = -1;
} else if (search_path.size() == 1) {
bone_idx = search_path[0]; // It is only one bone which can be root.
@ -1338,7 +1330,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
bone_idx = skeleton->get_bone_parent(bone_idx);
}
search_path.reverse();
if (search_path.size() == 0) {
if (search_path.is_empty()) {
p_bone_map->_set_skeleton_bone_name("Spine", skeleton->get_bone_name(chest_or_upper_chest)); // Maybe chibi model...?
} else if (search_path.size() == 1) {
p_bone_map->_set_skeleton_bone_name("Spine", skeleton->get_bone_name(search_path[0]));
@ -1407,9 +1399,6 @@ BoneMapper::BoneMapper(Skeleton3D *p_skeleton, Ref<BoneMap> &p_bone_map) {
bone_map = p_bone_map;
}
BoneMapper::~BoneMapper() {
}
void BoneMapEditor::create_editors() {
if (!skeleton) {
return;
@ -1457,9 +1446,6 @@ BoneMapEditor::BoneMapEditor(Ref<BoneMap> &p_bone_map) {
bone_map = p_bone_map;
}
BoneMapEditor::~BoneMapEditor() {
}
bool EditorInspectorPluginBoneMap::can_handle(Object *p_object) {
return Object::cast_to<BoneMap>(p_object) != nullptr;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef BONE_MAP_EDITOR_PLUGIN_H
#define BONE_MAP_EDITOR_PLUGIN_H
#pragma once
#include "editor/editor_node.h"
#include "editor/editor_properties.h"
@ -74,7 +73,6 @@ public:
bool is_require() const;
BoneMapperButton(const StringName &p_profile_bone_name, bool p_require, bool p_selected);
~BoneMapperButton();
};
class BoneMapperItem : public VBoxContainer {
@ -101,7 +99,6 @@ public:
void assign_button_id(int p_button_id);
BoneMapperItem(Ref<BoneMap> &p_bone_map, const StringName &p_profile_bone_name = StringName());
~BoneMapperItem();
};
class BonePicker : public AcceptDialog {
@ -125,7 +122,6 @@ private:
public:
BonePicker(Skeleton3D *p_skeleton);
~BonePicker();
};
class BoneMapper : public VBoxContainer {
@ -190,7 +186,6 @@ public:
int get_current_bone_idx() const;
BoneMapper(Skeleton3D *p_skeleton, Ref<BoneMap> &p_bone_map);
~BoneMapper();
};
class BoneMapEditor : public VBoxContainer {
@ -208,7 +203,6 @@ protected:
public:
BoneMapEditor(Ref<BoneMap> &p_bone_map);
~BoneMapEditor();
};
class EditorInspectorPluginBoneMap : public EditorInspectorPlugin {
@ -227,5 +221,3 @@ public:
virtual String get_plugin_name() const override { return "BoneMap"; }
BoneMapEditorPlugin();
};
#endif // BONE_MAP_EDITOR_PLUGIN_H

View file

@ -0,0 +1,165 @@
/**************************************************************************/
/* camera_2d_editor_plugin.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "camera_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
#include "core/config/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/themes/editor_scale.h"
#include "scene/2d/camera_2d.h"
#include "scene/gui/label.h"
#include "scene/gui/menu_button.h"
void Camera2DEditor::edit(Camera2D *p_camera) {
if (p_camera == selected_camera) {
return;
}
selected_camera = p_camera;
}
void Camera2DEditor::_menu_option(int p_option) {
switch (p_option) {
case MENU_SNAP_LIMITS_TO_VIEWPORT: {
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
Rect2 prev_rect = selected_camera->get_limit_rect();
ur->create_action(TTR("Snap the Limits to the Viewport"), UndoRedo::MERGE_DISABLE, selected_camera);
ur->add_do_method(this, "_snap_limits_to_viewport");
ur->add_do_reference(selected_camera);
ur->add_undo_method(this, "_undo_snap_limits_to_viewport", prev_rect);
ur->commit_action();
} break;
}
}
void Camera2DEditor::_snap_limits_to_viewport() {
selected_camera->set_limit(SIDE_LEFT, 0);
selected_camera->set_limit(SIDE_TOP, 0);
selected_camera->set_limit(SIDE_RIGHT, GLOBAL_GET("display/window/size/viewport_width"));
selected_camera->set_limit(SIDE_BOTTOM, GLOBAL_GET("display/window/size/viewport_height"));
}
void Camera2DEditor::_undo_snap_limits_to_viewport(const Rect2 &p_prev_rect) {
Point2 end = p_prev_rect.get_end();
selected_camera->set_limit(SIDE_LEFT, p_prev_rect.position.x);
selected_camera->set_limit(SIDE_TOP, p_prev_rect.position.y);
selected_camera->set_limit(SIDE_RIGHT, end.x);
selected_camera->set_limit(SIDE_BOTTOM, end.y);
}
void Camera2DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
options->set_button_icon(get_editor_theme_icon(SNAME("Camera2D")));
} break;
}
}
void Camera2DEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_snap_limits_to_viewport"), &Camera2DEditor::_snap_limits_to_viewport);
ClassDB::bind_method(D_METHOD("_undo_snap_limits_to_viewport", "prev_rect"), &Camera2DEditor::_undo_snap_limits_to_viewport);
}
Camera2DEditor::Camera2DEditor() {
options = memnew(MenuButton);
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTRC("Camera2D"));
options->get_popup()->add_item(TTRC("Snap the Limits to the Viewport"), MENU_SNAP_LIMITS_TO_VIEWPORT);
options->set_switch_on_hover(true);
options->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &Camera2DEditor::_menu_option));
add_user_signal(MethodInfo("_editor_theme_changed"));
}
void Camera2DEditorPlugin::_update_approach_text_visibility() {
if (camera_2d_editor->selected_camera == nullptr) {
return;
}
approach_to_move_rect->set_visible(camera_2d_editor->selected_camera->is_limit_enabled());
}
void Camera2DEditorPlugin::_editor_theme_changed() {
approach_to_move_rect->remove_theme_color_override(SceneStringName(font_color));
approach_to_move_rect->add_theme_color_override(SceneStringName(font_color), Color(0.6f, 0.6f, 0.6f, 1));
approach_to_move_rect->add_theme_color_override("font_shadow_color", Color(0.2f, 0.2f, 0.2f, 1));
approach_to_move_rect->add_theme_constant_override("shadow_outline_size", 1 * EDSCALE);
approach_to_move_rect->add_theme_constant_override("line_spacing", 0);
}
void Camera2DEditorPlugin::edit(Object *p_object) {
Callable update_text = callable_mp(this, &Camera2DEditorPlugin::_update_approach_text_visibility);
StringName update_signal = SNAME("_camera_limit_enabled_updated");
Camera2D *prev_cam = camera_2d_editor->selected_camera;
if (prev_cam != nullptr && prev_cam->is_connected(update_signal, update_text)) {
prev_cam->disconnect(update_signal, update_text);
}
Camera2D *cam = Object::cast_to<Camera2D>(p_object);
if (cam != nullptr) {
camera_2d_editor->edit(cam);
_update_approach_text_visibility();
if (!cam->is_connected(update_signal, update_text)) {
cam->connect(update_signal, update_text);
}
}
}
bool Camera2DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Camera2D");
}
void Camera2DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
camera_2d_editor->options->show();
approach_to_move_rect->show();
} else {
camera_2d_editor->options->hide();
approach_to_move_rect->hide();
}
}
Camera2DEditorPlugin::Camera2DEditorPlugin() {
camera_2d_editor = memnew(Camera2DEditor);
EditorNode::get_singleton()->get_gui_base()->add_child(camera_2d_editor);
camera_2d_editor->connect(SNAME("_editor_theme_changed"), callable_mp(this, &Camera2DEditorPlugin::_editor_theme_changed));
approach_to_move_rect = memnew(Label);
approach_to_move_rect->set_text(TTRC("In Move Mode: \nHold Ctrl + left mouse button to move the limit rectangle.\nHold left mouse button to move the camera only."));
approach_to_move_rect->hide();
_editor_theme_changed();
CanvasItemEditor::get_singleton()->get_controls_container()->add_child(approach_to_move_rect);
make_visible(false);
}

View file

@ -0,0 +1,80 @@
/**************************************************************************/
/* camera_2d_editor_plugin.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "editor/plugins/editor_plugin.h"
class Camera2D;
class Label;
class MenuButton;
class Camera2DEditor : public Control {
GDCLASS(Camera2DEditor, Control);
enum Menu {
MENU_SNAP_LIMITS_TO_VIEWPORT,
};
Camera2D *selected_camera = nullptr;
friend class Camera2DEditorPlugin;
MenuButton *options = nullptr;
void _menu_option(int p_option);
void _snap_limits_to_viewport();
void _undo_snap_limits_to_viewport(const Rect2 &p_prev_rect);
protected:
static void _bind_methods();
void _notification(int p_what);
public:
void edit(Camera2D *p_camera);
Camera2DEditor();
};
class Camera2DEditorPlugin : public EditorPlugin {
GDCLASS(Camera2DEditorPlugin, EditorPlugin);
Camera2DEditor *camera_2d_editor = nullptr;
Label *approach_to_move_rect = nullptr;
void _editor_theme_changed();
void _update_approach_text_visibility();
public:
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
virtual void make_visible(bool p_visible) override;
Camera2DEditorPlugin();
};

View file

@ -126,6 +126,3 @@ Camera3DEditorPlugin::Camera3DEditorPlugin() {
plugin.instantiate();
add_inspector_plugin(plugin);
}
Camera3DEditorPlugin::~Camera3DEditorPlugin() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CAMERA_3D_EDITOR_PLUGIN_H
#define CAMERA_3D_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/texture_editor_plugin.h"
@ -85,7 +84,4 @@ public:
virtual void make_visible(bool p_visible) override;
Camera3DEditorPlugin();
~Camera3DEditorPlugin();
};
#endif // CAMERA_3D_EDITOR_PLUGIN_H

View file

@ -49,10 +49,10 @@
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
#include "scene/2d/audio_stream_player_2d.h"
#include "scene/2d/physics/touch_screen_button.h"
#include "scene/2d/polygon_2d.h"
#include "scene/2d/skeleton_2d.h"
#include "scene/2d/sprite_2d.h"
#include "scene/2d/touch_screen_button.h"
#include "scene/gui/base_button.h"
#include "scene/gui/flow_container.h"
#include "scene/gui/grid_container.h"
@ -118,6 +118,7 @@ public:
grid_offset_x->set_suffix("px");
grid_offset_x->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grid_offset_x->set_select_all_on_focus(true);
grid_offset_x->set_accessibility_name(TTRC("X Offset"));
child_container->add_child(grid_offset_x);
grid_offset_y = memnew(SpinBox);
@ -128,6 +129,7 @@ public:
grid_offset_y->set_suffix("px");
grid_offset_y->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grid_offset_y->set_select_all_on_focus(true);
grid_offset_y->set_accessibility_name(TTRC("Y Offset"));
child_container->add_child(grid_offset_y);
label = memnew(Label);
@ -142,6 +144,7 @@ public:
grid_step_x->set_suffix("px");
grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grid_step_x->set_select_all_on_focus(true);
grid_step_x->set_accessibility_name(TTRC("X Step"));
child_container->add_child(grid_step_x);
grid_step_y = memnew(SpinBox);
@ -151,6 +154,7 @@ public:
grid_step_y->set_suffix("px");
grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grid_step_y->set_select_all_on_focus(true);
grid_step_y->set_accessibility_name(TTRC("X Step"));
child_container->add_child(grid_step_y);
label = memnew(Label);
@ -166,6 +170,7 @@ public:
primary_grid_step_x->set_suffix("steps");
primary_grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL);
primary_grid_step_x->set_select_all_on_focus(true);
primary_grid_step_x->set_accessibility_name(TTRC("X Primary Step"));
child_container->add_child(primary_grid_step_x);
primary_grid_step_y = memnew(SpinBox);
@ -176,6 +181,7 @@ public:
primary_grid_step_y->set_suffix("steps");
primary_grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL);
primary_grid_step_y->set_select_all_on_focus(true);
primary_grid_step_y->set_accessibility_name(TTRC("Y Primary Step"));
child_container->add_child(primary_grid_step_y);
container->add_child(memnew(HSeparator));
@ -197,6 +203,7 @@ public:
rotation_offset->set_suffix("deg");
rotation_offset->set_h_size_flags(Control::SIZE_EXPAND_FILL);
rotation_offset->set_select_all_on_focus(true);
rotation_offset->set_accessibility_name(TTRC("Rotation Offset"));
child_container->add_child(rotation_offset);
label = memnew(Label);
@ -210,6 +217,7 @@ public:
rotation_step->set_suffix("deg");
rotation_step->set_h_size_flags(Control::SIZE_EXPAND_FILL);
rotation_step->set_select_all_on_focus(true);
rotation_step->set_accessibility_name(TTRC("Rotation Step"));
child_container->add_child(rotation_step);
container->add_child(memnew(HSeparator));
@ -229,6 +237,7 @@ public:
scale_step->set_h_size_flags(Control::SIZE_EXPAND_FILL);
scale_step->set_step(0.01f);
scale_step->set_select_all_on_focus(true);
scale_step->set_accessibility_name(TTRC("Scale Step"));
child_container->add_child(scale_step);
}
@ -770,14 +779,15 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n
bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_pos, bool p_append) {
bool still_selected = true;
if (p_append && !editor_selection->get_selected_node_list().is_empty()) {
const List<Node *> &top_node_list = editor_selection->get_top_selected_node_list();
if (p_append && !top_node_list.is_empty()) {
if (editor_selection->is_selected(item)) {
// Already in the selection, remove it from the selected nodes
editor_selection->remove_node(item);
still_selected = false;
if (editor_selection->get_selected_node_list().size() == 1) {
EditorNode::get_singleton()->push_item(editor_selection->get_selected_node_list().front()->get());
if (top_node_list.size() == 1) {
EditorNode::get_singleton()->push_item(top_node_list.front()->get());
}
} else {
// Add the item to the selection
@ -974,7 +984,7 @@ void CanvasItemEditor::_add_node_pressed(int p_result) {
[[fallthrough]];
}
case ADD_MOVE: {
nodes_to_move = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
nodes_to_move = EditorNode::get_singleton()->get_editor_selection()->get_top_selected_node_list();
if (nodes_to_move.is_empty()) {
return;
}
@ -1116,7 +1126,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
if (m.is_valid() && m->get_position().x < RULER_WIDTH) {
// Check if we are hovering an existing horizontal guide
for (int i = 0; i < hguides.size(); i++) {
if (ABS(xform.xform(Point2(0, hguides[i])).y - m->get_position().y) < MIN(minimum, 8)) {
if (Math::abs(xform.xform(Point2(0, hguides[i])).y - m->get_position().y) < MIN(minimum, 8)) {
is_hovering_h_guide = true;
is_hovering_v_guide = false;
break;
@ -1126,7 +1136,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
} else if (m.is_valid() && m->get_position().y < RULER_WIDTH) {
// Check if we are hovering an existing vertical guide
for (int i = 0; i < vguides.size(); i++) {
if (ABS(xform.xform(Point2(vguides[i], 0)).x - m->get_position().x) < MIN(minimum, 8)) {
if (Math::abs(xform.xform(Point2(vguides[i], 0)).x - m->get_position().x) < MIN(minimum, 8)) {
is_hovering_v_guide = true;
is_hovering_h_guide = false;
break;
@ -1146,7 +1156,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
// Check if we drag an existing horizontal guide
dragged_guide_index = -1;
for (int i = 0; i < hguides.size(); i++) {
if (ABS(xform.xform(Point2(0, hguides[i])).y - b->get_position().y) < MIN(minimum, 8)) {
if (Math::abs(xform.xform(Point2(0, hguides[i])).y - b->get_position().y) < MIN(minimum, 8)) {
dragged_guide_index = i;
}
}
@ -1163,7 +1173,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
// Check if we drag an existing vertical guide
dragged_guide_index = -1;
for (int i = 0; i < vguides.size(); i++) {
if (ABS(xform.xform(Point2(vguides[i], 0)).x - b->get_position().x) < MIN(minimum, 8)) {
if (Math::abs(xform.xform(Point2(vguides[i], 0)).x - b->get_position().x) < MIN(minimum, 8)) {
dragged_guide_index = i;
}
}
@ -1597,7 +1607,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven
if (selection.size() == 1) {
CanvasItem *ci = selection.front()->get();
if (!ci->get_scene_file_path().is_empty() && ci != EditorNode::get_singleton()->get_edited_scene()) {
EditorNode::get_singleton()->open_request(ci->get_scene_file_path());
EditorNode::get_singleton()->load_scene(ci->get_scene_file_path());
return true;
}
}
@ -2220,7 +2230,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
bool single_axis = m->is_shift_pressed();
if (single_axis) {
if (ABS(new_pos.x - previous_pos.x) > ABS(new_pos.y - previous_pos.y)) {
if (Math::abs(new_pos.x - previous_pos.x) > Math::abs(new_pos.y - previous_pos.y)) {
new_pos.y = previous_pos.y;
} else {
new_pos.x = previous_pos.x;
@ -2468,7 +2478,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
break;
}
}
for (Node *node : EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()) {
for (Node *node : EditorNode::get_singleton()->get_editor_selection()->get_top_selected_node_list()) {
if (Object::cast_to<CanvasItem>(node)) {
add_node_menu->add_icon_item(get_editor_theme_icon(SNAME("ToolMove")), TTR("Move Node(s) Here"), ADD_MOVE);
break;
@ -2599,7 +2609,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
}
_find_canvas_items_in_rect(Rect2(bsfrom, bsto - bsfrom), scene, &selitems);
if (selitems.size() == 1 && editor_selection->get_selected_node_list().is_empty()) {
if (selitems.size() == 1 && editor_selection->get_top_selected_node_list().is_empty()) {
EditorNode::get_singleton()->push_item(selitems.front()->get());
}
for (CanvasItem *E : selitems) {
@ -2812,7 +2822,7 @@ void CanvasItemEditor::_update_lock_and_group_button() {
bool all_locked = true;
bool all_group = true;
bool has_canvas_item = false;
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
if (selection.is_empty()) {
all_locked = false;
all_group = false;
@ -2854,14 +2864,14 @@ Control::CursorShape CanvasItemEditor::get_cursor_shape(const Point2 &p_pos) con
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
const double angle = Math::fposmod((double)selection.front()->get()->get_global_transform_with_canvas().get_rotation(), Math_PI);
if (angle > Math_PI * 7.0 / 8.0) {
const double angle = Math::fposmod((double)selection.front()->get()->get_global_transform_with_canvas().get_rotation(), Math::PI);
if (angle > Math::PI * 7.0 / 8.0) {
rotation_array_index = 0;
} else if (angle > Math_PI * 5.0 / 8.0) {
} else if (angle > Math::PI * 5.0 / 8.0) {
rotation_array_index = 1;
} else if (angle > Math_PI * 3.0 / 8.0) {
} else if (angle > Math::PI * 3.0 / 8.0) {
rotation_array_index = 2;
} else if (angle > Math_PI * 1.0 / 8.0) {
} else if (angle > Math::PI * 1.0 / 8.0) {
rotation_array_index = 3;
} else {
rotation_array_index = 0;
@ -3075,7 +3085,7 @@ void CanvasItemEditor::_draw_rulers() {
if (i % (major_subdivision * minor_subdivision) == 0) {
viewport->draw_line(Point2(position.x, 0), Point2(position.x, RULER_WIDTH), graduation_color, Math::round(EDSCALE));
real_t val = (ruler_transform * major_subdivide * minor_subdivide).xform(Point2(i, 0)).x;
viewport->draw_string(font, Point2(position.x + 2, font->get_height(font_size)), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
viewport->draw_string(font, Point2(position.x + 2, font->get_ascent(font_size) + Math::round(EDSCALE)), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
} else {
if (i % minor_subdivision == 0) {
viewport->draw_line(Point2(position.x, RULER_WIDTH * 0.33), Point2(position.x, RULER_WIDTH), graduation_color, Math::round(EDSCALE));
@ -3093,7 +3103,7 @@ void CanvasItemEditor::_draw_rulers() {
viewport->draw_line(Point2(0, position.y), Point2(RULER_WIDTH, position.y), graduation_color, Math::round(EDSCALE));
real_t val = (ruler_transform * major_subdivide * minor_subdivide).xform(Point2(0, i)).y;
Transform2D text_xform = Transform2D(-Math_PI / 2.0, Point2(font->get_height(font_size), position.y - 2));
Transform2D text_xform = Transform2D(-Math::PI / 2.0, Point2(font->get_ascent(font_size) + Math::round(EDSCALE), position.y - 2));
viewport->draw_set_transform_matrix(viewport->get_transform() * text_xform);
viewport->draw_string(font, Point2(), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
viewport->draw_set_transform_matrix(viewport->get_transform());
@ -3200,7 +3210,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
Vector2 length_vector = (begin - end).abs() / zoom;
const real_t horizontal_angle_rad = length_vector.angle();
const real_t vertical_angle_rad = Math_PI / 2.0 - horizontal_angle_rad;
const real_t vertical_angle_rad = Math::PI / 2.0 - horizontal_angle_rad;
Ref<Font> font = get_theme_font(SNAME("bold"), EditorStringName(EditorFonts));
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts));
@ -3236,18 +3246,18 @@ void CanvasItemEditor::_draw_ruler_tool() {
const Vector2 end_to_begin = (end - begin);
real_t arc_1_start_angle = end_to_begin.x < 0
? (end_to_begin.y < 0 ? 3.0 * Math_PI / 2.0 - vertical_angle_rad : Math_PI / 2.0)
: (end_to_begin.y < 0 ? 3.0 * Math_PI / 2.0 : Math_PI / 2.0 - vertical_angle_rad);
? (end_to_begin.y < 0 ? 3.0 * Math::PI / 2.0 - vertical_angle_rad : Math::PI / 2.0)
: (end_to_begin.y < 0 ? 3.0 * Math::PI / 2.0 : Math::PI / 2.0 - vertical_angle_rad);
real_t arc_1_end_angle = arc_1_start_angle + vertical_angle_rad;
// Constrain arc to triangle height & max size.
real_t arc_1_radius = MIN(MIN(arc_radius_max_length_percent * ruler_length, ABS(end_to_begin.y)), arc_max_radius);
real_t arc_1_radius = MIN(MIN(arc_radius_max_length_percent * ruler_length, Math::abs(end_to_begin.y)), arc_max_radius);
real_t arc_2_start_angle = end_to_begin.x < 0
? (end_to_begin.y < 0 ? 0.0 : -horizontal_angle_rad)
: (end_to_begin.y < 0 ? Math_PI - horizontal_angle_rad : Math_PI);
: (end_to_begin.y < 0 ? Math::PI - horizontal_angle_rad : Math::PI);
real_t arc_2_end_angle = arc_2_start_angle + horizontal_angle_rad;
// Constrain arc to triangle width & max size.
real_t arc_2_radius = MIN(MIN(arc_radius_max_length_percent * ruler_length, ABS(end_to_begin.x)), arc_max_radius);
real_t arc_2_radius = MIN(MIN(arc_radius_max_length_percent * ruler_length, Math::abs(end_to_begin.x)), arc_max_radius);
viewport->draw_arc(begin, arc_1_radius, arc_1_start_angle, arc_1_end_angle, arc_point_count, ruler_primary_color, Math::round(EDSCALE * arc_line_width));
viewport->draw_arc(end, arc_2_radius, arc_2_start_angle, arc_2_end_angle, arc_point_count, ruler_primary_color, Math::round(EDSCALE * arc_line_width));
@ -3265,8 +3275,8 @@ void CanvasItemEditor::_draw_ruler_tool() {
viewport->draw_string(font, text_pos, TS->format_number(vformat("%.1f px", length_vector.length())), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
if (draw_secondary_lines) {
const int horizontal_angle = round(180 * horizontal_angle_rad / Math_PI);
const int vertical_angle = round(180 * vertical_angle_rad / Math_PI);
const int horizontal_angle = round(180 * horizontal_angle_rad / Math::PI);
const int vertical_angle = round(180 * vertical_angle_rad / Math::PI);
Point2 text_pos2 = text_pos;
text_pos2.x = begin.x < text_pos.x ? MIN(text_pos.x - text_width, begin.x - text_width / 2) : MAX(text_pos.x + text_width, begin.x - text_width / 2);
@ -3288,13 +3298,13 @@ void CanvasItemEditor::_draw_ruler_tool() {
h_angle_text_pos.x = CLAMP(end.x - angle_text_width / 2, angle_text_width / 2, viewport->get_rect().size.x - angle_text_width);
if (begin.y < end.y) {
h_angle_text_pos.y = end.y + text_height * 1.5;
if (ABS(text_pos2.x - h_angle_text_pos.x) < text_width) {
if (Math::abs(text_pos2.x - h_angle_text_pos.x) < text_width) {
int height_multiplier = 1.5 + (int)grid_snap_active;
h_angle_text_pos.y = MAX(text_pos.y + height_multiplier * text_height, MAX(end.y + text_height * 1.5, text_pos2.y + height_multiplier * text_height));
}
} else {
h_angle_text_pos.y = end.y - text_height * 0.5;
if (ABS(text_pos2.x - h_angle_text_pos.x) < text_width) {
if (Math::abs(text_pos2.x - h_angle_text_pos.x) < text_width) {
int height_multiplier = 1 + (int)grid_snap_active;
h_angle_text_pos.y = MIN(text_pos.y - height_multiplier * text_height, MIN(end.y - text_height * 0.5, text_pos2.y - height_multiplier * text_height));
}
@ -3645,7 +3655,7 @@ void CanvasItemEditor::_draw_selection() {
int next = (i + 1) % 4;
Vector2 ofs = ((endpoints[i] - endpoints[prev]).normalized() + ((endpoints[i] - endpoints[next]).normalized())).normalized();
ofs *= Math_SQRT2 * (select_handle->get_size().width / 2);
ofs *= Math::SQRT2 * (select_handle->get_size().width / 2);
select_handle->draw(vp_ci, (endpoints[i] + ofs - (select_handle->get_size() / 2)).floor());
@ -4127,6 +4137,15 @@ void CanvasItemEditor::_notification(int p_what) {
ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &CanvasItemEditor::_project_settings_changed));
} break;
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
RID ae = get_accessibility_element();
ERR_FAIL_COND(ae.is_null());
//TODO
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Canvas item editor")));
} break;
case NOTIFICATION_PROCESS: {
// Update the viewport if the canvas_item changes
List<CanvasItem *> selection = _get_edited_canvas_items(true);
@ -4238,8 +4257,8 @@ void CanvasItemEditor::_selection_changed() {
}
selected_from_canvas = false;
if (temp_pivot != Vector2(INFINITY, INFINITY)) {
temp_pivot = Vector2(INFINITY, INFINITY);
if (temp_pivot != Vector2(Math::INF, Math::INF)) {
temp_pivot = Vector2(Math::INF, Math::INF);
viewport->queue_redraw();
}
}
@ -4584,7 +4603,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
snap_dialog->popup_centered(Size2(320, 160) * EDSCALE);
} break;
case SKELETON_SHOW_BONES: {
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
// Add children nodes so they are processed
for (int child = 0; child < E->get_child_count(); child++) {
@ -4619,7 +4638,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case LOCK_SELECTED: {
undo_redo->create_action(TTR("Lock Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
if (!ci || !ci->is_inside_tree()) {
@ -4638,7 +4657,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case UNLOCK_SELECTED: {
undo_redo->create_action(TTR("Unlock Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
if (!ci || !ci->is_inside_tree()) {
@ -4657,7 +4676,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case GROUP_SELECTED: {
undo_redo->create_action(TTR("Group Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
if (!ci || !ci->is_inside_tree()) {
@ -4676,7 +4695,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
case UNGROUP_SELECTED: {
undo_redo->create_action(TTR("Ungroup Selected"));
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
CanvasItem *ci = Object::cast_to<CanvasItem>(E);
if (!ci || !ci->is_inside_tree()) {
@ -4739,7 +4758,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->create_action(TTR("Paste Pose"));
for (const PoseClipboard &E : pose_clipboard) {
Node2D *n2d = Object::cast_to<Node2D>(ObjectDB::get_instance(E.id));
Node2D *n2d = ObjectDB::get_instance<Node2D>(E.id);
if (!n2d) {
continue;
}
@ -4872,7 +4891,6 @@ void CanvasItemEditor::_set_owner_for_node_and_children(Node *p_node, Node *p_ow
}
void CanvasItemEditor::_focus_selection(int p_op) {
Vector2 center(0.f, 0.f);
Rect2 rect;
int count = 0;
@ -4882,31 +4900,30 @@ void CanvasItemEditor::_focus_selection(int p_op) {
if (!ci) {
continue;
}
// counting invisible items, for now
//if (!ci->is_visible_in_tree()) continue;
++count;
const Transform2D canvas_item_transform = ci->get_global_transform();
if (!canvas_item_transform.is_finite()) {
continue;
}
Rect2 item_rect;
if (ci->_edit_use_rect()) {
item_rect = ci->_edit_get_rect();
} else {
item_rect = Rect2();
}
Vector2 pos = ci->get_global_transform().get_origin();
Vector2 scale = ci->get_global_transform().get_scale();
real_t angle = ci->get_global_transform().get_rotation();
Vector2 pos = canvas_item_transform.get_origin();
const Vector2 scale = canvas_item_transform.get_scale();
const real_t angle = canvas_item_transform.get_rotation();
pos = ci->get_viewport()->get_popup_base_transform().xform(pos);
Transform2D t(angle, Vector2(0.f, 0.f));
item_rect = t.xform(item_rect);
Rect2 canvas_item_rect(pos + scale * item_rect.position, scale * item_rect.size);
if (count == 1) {
if (count == 0) {
rect = canvas_item_rect;
} else {
rect = rect.merge(canvas_item_rect);
}
count++;
}
if (p_op == VIEW_FRAME_TO_SELECTION && rect.size.x > CMP_EPSILON && rect.size.y > CMP_EPSILON) {
@ -5361,6 +5378,7 @@ CanvasItemEditor::CanvasItemEditor() {
controls_hb->add_child(button_center_view);
button_center_view->set_flat(true);
button_center_view->set_tooltip_text(TTR("Center View"));
button_center_view->set_accessibility_name(TTRC("Center View"));
button_center_view->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(VIEW_CENTER_TO_SELECTION));
zoom_widget = memnew(EditorZoomWidget);
@ -5403,6 +5421,7 @@ CanvasItemEditor::CanvasItemEditor() {
select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTRC("Select Mode"), Key::Q));
select_button->set_shortcut_context(this);
select_button->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Alt+Drag: Scale selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + TTR("(Available in all modes.)") + "\n" + TTR("RMB: Add node at position clicked."));
select_button->set_accessibility_name(TTRC("Select Mode"));
main_menu_hbox->add_child(memnew(VSeparator));
@ -5414,6 +5433,7 @@ CanvasItemEditor::CanvasItemEditor() {
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTRC("Move Mode"), Key::W));
move_button->set_shortcut_context(this);
move_button->set_tooltip_text(TTRC("Move Mode"));
move_button->set_accessibility_name(TTRC("Move Mode"));
rotate_button = memnew(Button);
rotate_button->set_theme_type_variation(SceneStringName(FlatButton));
@ -5423,6 +5443,7 @@ CanvasItemEditor::CanvasItemEditor() {
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTRC("Rotate Mode"), Key::E));
rotate_button->set_shortcut_context(this);
rotate_button->set_tooltip_text(TTRC("Rotate Mode"));
rotate_button->set_accessibility_name(TTRC("Rotate Mode"));
scale_button = memnew(Button);
scale_button->set_theme_type_variation(SceneStringName(FlatButton));
@ -5432,6 +5453,7 @@ CanvasItemEditor::CanvasItemEditor() {
scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTRC("Scale Mode"), Key::S));
scale_button->set_shortcut_context(this);
scale_button->set_tooltip_text(TTRC("Shift: Scale proportionally."));
scale_button->set_accessibility_name(TTRC("Scale Mode"));
main_menu_hbox->add_child(memnew(VSeparator));
@ -5441,6 +5463,7 @@ CanvasItemEditor::CanvasItemEditor() {
list_select_button->set_toggle_mode(true);
list_select_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_LIST_SELECT));
list_select_button->set_tooltip_text(TTR("Show list of selectable nodes at position clicked."));
list_select_button->set_accessibility_name(TTRC("List Selectable Nodes"));
pivot_button = memnew(Button);
pivot_button->set_theme_type_variation(SceneStringName(FlatButton));
@ -5448,6 +5471,7 @@ CanvasItemEditor::CanvasItemEditor() {
pivot_button->set_toggle_mode(true);
pivot_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_EDIT_PIVOT));
pivot_button->set_tooltip_text(TTR("Click to change object's pivot.") + "\n" + TTR("Shift: Set temporary pivot.") + "\n" + TTR("Click this button while holding Shift to put the temporary pivot in the center of the selected nodes."));
pivot_button->set_accessibility_name(TTRC("Change Pivot"));
pan_button = memnew(Button);
pan_button->set_theme_type_variation(SceneStringName(FlatButton));
@ -5457,6 +5481,7 @@ CanvasItemEditor::CanvasItemEditor() {
pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTRC("Pan Mode"), Key::G));
pan_button->set_shortcut_context(this);
pan_button->set_tooltip_text(TTRC("You can also use Pan View shortcut (Space by default) to pan in any mode."));
pan_button->set_accessibility_name(TTRC("Pan View"));
ruler_button = memnew(Button);
ruler_button->set_theme_type_variation(SceneStringName(FlatButton));
@ -5466,6 +5491,7 @@ CanvasItemEditor::CanvasItemEditor() {
ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTRC("Ruler Mode"), Key::R));
ruler_button->set_shortcut_context(this);
ruler_button->set_tooltip_text(TTRC("Ruler Mode"));
ruler_button->set_accessibility_name(TTRC("Ruler Mode"));
main_menu_hbox->add_child(memnew(VSeparator));
@ -5477,6 +5503,7 @@ CanvasItemEditor::CanvasItemEditor() {
smart_snap_button->set_tooltip_text(TTRC("Toggle smart snapping."));
smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTRC("Use Smart Snap"), KeyModifierMask::SHIFT | Key::S));
smart_snap_button->set_shortcut_context(this);
smart_snap_button->set_accessibility_name(TTRC("Smart Snap"));
grid_snap_button = memnew(Button);
grid_snap_button->set_theme_type_variation(SceneStringName(FlatButton));
@ -5486,6 +5513,7 @@ CanvasItemEditor::CanvasItemEditor() {
grid_snap_button->set_tooltip_text(TTRC("Toggle grid snapping."));
grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTRC("Use Grid Snap"), KeyModifierMask::SHIFT | Key::G));
grid_snap_button->set_shortcut_context(this);
grid_snap_button->set_accessibility_name(TTRC("Grid Snap"));
snap_config_menu = memnew(MenuButton);
snap_config_menu->set_flat(false);
@ -5495,6 +5523,7 @@ CanvasItemEditor::CanvasItemEditor() {
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
snap_config_menu->set_tooltip_text(TTR("Snapping Options"));
snap_config_menu->set_switch_on_hover(true);
snap_config_menu->set_accessibility_name(TTRC("Snapping Options"));
PopupMenu *p = snap_config_menu->get_popup();
p->connect(SceneStringName(id_pressed), callable_mp(this, &CanvasItemEditor::_popup_callback));
@ -5522,6 +5551,7 @@ CanvasItemEditor::CanvasItemEditor() {
lock_button = memnew(Button);
lock_button->set_theme_type_variation(SceneStringName(FlatButton));
lock_button->set_accessibility_name(TTRC("Lock"));
main_menu_hbox->add_child(lock_button);
lock_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(LOCK_SELECTED));
@ -5530,6 +5560,7 @@ CanvasItemEditor::CanvasItemEditor() {
lock_button->set_shortcut(ED_GET_SHORTCUT("editor/lock_selected_nodes"));
unlock_button = memnew(Button);
unlock_button->set_accessibility_name(TTRC("Unlock"));
unlock_button->set_theme_type_variation(SceneStringName(FlatButton));
main_menu_hbox->add_child(unlock_button);
unlock_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNLOCK_SELECTED));
@ -5538,6 +5569,7 @@ CanvasItemEditor::CanvasItemEditor() {
unlock_button->set_shortcut(ED_GET_SHORTCUT("editor/unlock_selected_nodes"));
group_button = memnew(Button);
group_button->set_accessibility_name(TTRC("Group"));
group_button->set_theme_type_variation(SceneStringName(FlatButton));
main_menu_hbox->add_child(group_button);
group_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(GROUP_SELECTED));
@ -5546,6 +5578,7 @@ CanvasItemEditor::CanvasItemEditor() {
group_button->set_shortcut(ED_GET_SHORTCUT("editor/group_selected_nodes"));
ungroup_button = memnew(Button);
ungroup_button->set_accessibility_name(TTRC("Ungroup"));
ungroup_button->set_theme_type_variation(SceneStringName(FlatButton));
main_menu_hbox->add_child(ungroup_button);
ungroup_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNGROUP_SELECTED));
@ -5562,6 +5595,7 @@ CanvasItemEditor::CanvasItemEditor() {
main_menu_hbox->add_child(skeleton_menu);
skeleton_menu->set_tooltip_text(TTR("Skeleton Options"));
skeleton_menu->set_switch_on_hover(true);
skeleton_menu->set_accessibility_name(TTRC("Skeleton Options"));
p = skeleton_menu->get_popup();
p->set_hide_on_checkable_item_selection(false);
@ -5653,6 +5687,7 @@ CanvasItemEditor::CanvasItemEditor() {
key_loc_button->set_focus_mode(FOCUS_NONE);
key_loc_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_POS));
key_loc_button->set_tooltip_text(TTR("Translation mask for inserting keys."));
key_loc_button->set_accessibility_name(TTRC("Translation Mask"));
animation_hb->add_child(key_loc_button);
key_rot_button = memnew(Button);
@ -5662,6 +5697,7 @@ CanvasItemEditor::CanvasItemEditor() {
key_rot_button->set_focus_mode(FOCUS_NONE);
key_rot_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_ROT));
key_rot_button->set_tooltip_text(TTR("Rotation mask for inserting keys."));
key_rot_button->set_accessibility_name(TTRC("Rotation Mask"));
animation_hb->add_child(key_rot_button);
key_scale_button = memnew(Button);
@ -5670,6 +5706,7 @@ CanvasItemEditor::CanvasItemEditor() {
key_scale_button->set_focus_mode(FOCUS_NONE);
key_scale_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_SCALE));
key_scale_button->set_tooltip_text(TTR("Scale mask for inserting keys."));
key_scale_button->set_accessibility_name(TTRC("Scale Mask"));
animation_hb->add_child(key_scale_button);
key_insert_button = memnew(Button);
@ -5678,6 +5715,7 @@ CanvasItemEditor::CanvasItemEditor() {
key_insert_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_KEY));
key_insert_button->set_tooltip_text(TTRC("Insert keys (based on mask)."));
key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTRC("Insert Key"), Key::INSERT));
key_insert_button->set_accessibility_name(TTRC("Insert Keys"));
key_insert_button->set_shortcut_context(this);
animation_hb->add_child(key_insert_button);
@ -5687,6 +5725,7 @@ CanvasItemEditor::CanvasItemEditor() {
key_auto_insert_button->set_focus_mode(FOCUS_NONE);
key_auto_insert_button->set_tooltip_text(TTRC("Auto insert keys when objects are translated, rotated or scaled (based on mask).\nKeys are only added to existing tracks, no new tracks will be created.\nKeys must be inserted manually for the first time."));
key_auto_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_auto_insert_key", TTRC("Auto Insert Key")));
key_auto_insert_button->set_accessibility_name(TTRC("Auto Insert Keys"));
key_auto_insert_button->set_shortcut_context(this);
animation_hb->add_child(key_auto_insert_button);
@ -5695,6 +5734,7 @@ CanvasItemEditor::CanvasItemEditor() {
animation_menu->set_theme_type_variation("FlatMenuButton");
animation_menu->set_shortcut_context(this);
animation_menu->set_tooltip_text(TTR("Animation Key and Pose Options"));
animation_menu->set_accessibility_name(TTRC("Animation Key and Pose"));
animation_hb->add_child(animation_menu);
animation_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &CanvasItemEditor::_popup_callback));
animation_menu->set_switch_on_hover(true);
@ -5794,9 +5834,6 @@ CanvasItemEditorPlugin::CanvasItemEditorPlugin() {
canvas_item_editor->hide();
}
CanvasItemEditorPlugin::~CanvasItemEditorPlugin() {
}
void CanvasItemEditorViewport::_on_mouse_exit() {
if (!texture_node_type_selector->is_visible()) {
_remove_preview();
@ -6067,7 +6104,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *p_parent, const String &p_
}
void CanvasItemEditorViewport::_perform_drop_data() {
ERR_FAIL_COND(selected_files.size() <= 0);
ERR_FAIL_COND(selected_files.is_empty());
_remove_preview();
@ -6138,6 +6175,9 @@ void CanvasItemEditorViewport::_perform_drop_data() {
}
bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
if (p_point == Vector2(Math::INF, Math::INF)) {
return false;
}
Dictionary d = p_data;
if (!d.has("type") || (String(d["type"]) != "files")) {
label->hide();
@ -6269,6 +6309,9 @@ bool CanvasItemEditorViewport::_is_any_texture_selected() const {
}
void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p_data) {
if (p_point == Vector2(Math::INF, Math::INF)) {
return;
}
bool is_shift = Input::get_singleton()->is_key_pressed(Key::SHIFT);
bool is_alt = Input::get_singleton()->is_key_pressed(Key::ALT);
@ -6277,11 +6320,11 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p
if (d.has("type") && String(d["type"]) == "files") {
selected_files = d["files"];
}
if (selected_files.size() == 0) {
if (selected_files.is_empty()) {
return;
}
List<Node *> selected_nodes = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
List<Node *> selected_nodes = EditorNode::get_singleton()->get_editor_selection()->get_top_selected_node_list();
Node *root_node = EditorNode::get_singleton()->get_edited_scene();
if (selected_nodes.size() > 0) {
Node *selected_node = selected_nodes.front()->get();

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CANVAS_ITEM_EDITOR_PLUGIN_H
#define CANVAS_ITEM_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
@ -68,8 +67,6 @@ public:
List<Dictionary> pre_drag_bones_undo_state;
Dictionary undo_state;
CanvasItemEditorSelectedItem() {}
};
class CanvasItemEditor : public VBoxContainer {
@ -255,7 +252,7 @@ private:
bool key_scale = false;
bool pan_pressed = false;
Vector2 temp_pivot = Vector2(INFINITY, INFINITY);
Vector2 temp_pivot = Vector2(Math::INF, Math::INF);
bool ruler_tool_active = false;
Point2 ruler_tool_origin;
@ -603,7 +600,7 @@ protected:
void _notification(int p_what);
public:
virtual String get_plugin_name() const override { return "2D"; }
virtual String get_plugin_name() const override { return TTRC("2D"); }
bool has_main_screen() const override { return true; }
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
@ -615,7 +612,6 @@ public:
CanvasItemEditor *get_canvas_item_editor() { return canvas_item_editor; }
CanvasItemEditorPlugin();
~CanvasItemEditorPlugin();
};
class CanvasItemEditorViewport : public Control {
@ -665,5 +661,3 @@ public:
CanvasItemEditorViewport(CanvasItemEditor *p_canvas_item_editor);
~CanvasItemEditorViewport();
};
#endif // CANVAS_ITEM_EDITOR_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CAST_2D_EDITOR_PLUGIN_H
#define CAST_2D_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/node_2d.h"
@ -73,5 +72,3 @@ public:
Cast2DEditorPlugin();
};
#endif // CAST_2D_EDITOR_PLUGIN_H

View file

@ -38,8 +38,6 @@ void CollisionPolygon2DEditor::_set_node(Node *p_polygon) {
node = Object::cast_to<CollisionPolygon2D>(p_polygon);
}
CollisionPolygon2DEditor::CollisionPolygon2DEditor() {}
CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin() :
AbstractPolygon2DEditorPlugin(memnew(CollisionPolygon2DEditor), "CollisionPolygon2D") {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COLLISION_POLYGON_2D_EDITOR_PLUGIN_H
#define COLLISION_POLYGON_2D_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/physics/collision_polygon_2d.h"
@ -42,9 +41,6 @@ class CollisionPolygon2DEditor : public AbstractPolygon2DEditor {
protected:
virtual Node2D *_get_node() const override;
virtual void _set_node(Node *p_polygon) override;
public:
CollisionPolygon2DEditor();
};
class CollisionPolygon2DEditorPlugin : public AbstractPolygon2DEditorPlugin {
@ -53,5 +49,3 @@ class CollisionPolygon2DEditorPlugin : public AbstractPolygon2DEditorPlugin {
public:
CollisionPolygon2DEditorPlugin();
};
#endif // COLLISION_POLYGON_2D_EDITOR_PLUGIN_H

View file

@ -664,6 +664,3 @@ CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin() {
collision_shape_2d_editor = memnew(CollisionShape2DEditor);
EditorNode::get_singleton()->get_gui_base()->add_child(collision_shape_2d_editor);
}
CollisionShape2DEditorPlugin::~CollisionShape2DEditorPlugin() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COLLISION_SHAPE_2D_EDITOR_PLUGIN_H
#define COLLISION_SHAPE_2D_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/physics/collision_shape_2d.h"
@ -112,7 +111,4 @@ public:
virtual void make_visible(bool visible) override;
CollisionShape2DEditorPlugin();
~CollisionShape2DEditorPlugin();
};
#endif // COLLISION_SHAPE_2D_EDITOR_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COLOR_CHANNEL_SELECTOR_H
#define COLOR_CHANNEL_SELECTOR_H
#pragma once
#include "scene/gui/box_container.h"
@ -61,5 +60,3 @@ private:
PanelContainer *panel = nullptr;
Button *toggle_button = nullptr;
};
#endif // COLOR_CHANNEL_SELECTOR_H

View file

@ -104,7 +104,8 @@ void ControlPositioningWarning::gui_input(const Ref<InputEvent> &p_event) {
void ControlPositioningWarning::_notification(int p_notification) {
switch (p_notification) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_THEME_CHANGED:
_update_warning();
_update_toggler();
@ -329,7 +330,7 @@ void EditorPropertySizeFlags::update_property() {
void EditorPropertySizeFlags::setup(const Vector<String> &p_options, bool p_vertical) {
vertical = p_vertical;
if (p_options.size() == 0) {
if (p_options.is_empty()) {
flag_presets->clear();
flag_presets->add_item(TTR("Container Default"));
flag_presets->set_disabled(true);
@ -551,6 +552,7 @@ void ControlEditorPresetPicker::_add_row_button(HBoxContainer *p_row, const int
b->set_custom_minimum_size(Size2i(36, 36) * EDSCALE);
b->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER);
b->set_tooltip_text(p_name);
b->set_accessibility_name(p_name);
b->set_flat(true);
p_row->add_child(b);
b->connect(SceneStringName(pressed), callable_mp(this, &ControlEditorPresetPicker::_preset_button_pressed).bind(p_preset));
@ -740,7 +742,7 @@ SizeFlagPresetPicker::SizeFlagPresetPicker(bool p_vertical) {
void ControlEditorToolbar::_anchors_preset_selected(int p_preset) {
LayoutPreset preset = (LayoutPreset)p_preset;
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Change Anchors, Offsets, Grow Direction"));
@ -761,7 +763,7 @@ void ControlEditorToolbar::_anchors_preset_selected(int p_preset) {
}
void ControlEditorToolbar::_anchors_to_current_ratio() {
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Change Anchors, Offsets (Keep Ratio)"));
@ -812,7 +814,7 @@ void ControlEditorToolbar::_anchor_mode_toggled(bool p_status) {
}
void ControlEditorToolbar::_container_flags_selected(int p_flags, bool p_vertical) {
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
if (p_vertical) {
@ -839,7 +841,7 @@ void ControlEditorToolbar::_container_flags_selected(int p_flags, bool p_vertica
}
void ControlEditorToolbar::_expand_flag_toggled(bool p_expand, bool p_vertical) {
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
if (p_vertical) {
@ -973,7 +975,7 @@ void ControlEditorToolbar::_selection_changed() {
int nb_valid_controls = 0;
int nb_anchors_mode = 0;
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
Control *control = Object::cast_to<Control>(E);
if (!control) {
@ -1023,7 +1025,7 @@ void ControlEditorToolbar::_selection_changed() {
int nb_h_expand = 0;
int nb_v_expand = 0;
List<Node *> selection = editor_selection->get_selected_node_list();
List<Node *> selection = editor_selection->get_top_selected_node_list();
for (Node *E : selection) {
Control *control = Object::cast_to<Control>(E);
if (!control) {
@ -1084,6 +1086,7 @@ ControlEditorToolbar::ControlEditorToolbar() {
anchor_mode_button->set_theme_type_variation(SceneStringName(FlatButton));
anchor_mode_button->set_toggle_mode(true);
anchor_mode_button->set_tooltip_text(TTR("When active, moving Control nodes changes their anchors instead of their offsets."));
anchor_mode_button->set_accessibility_name(TTRC("Change Anchors"));
add_child(anchor_mode_button);
anchor_mode_button->connect(SceneStringName(toggled), callable_mp(this, &ControlEditorToolbar::_anchor_mode_toggled));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CONTROL_EDITOR_PLUGIN_H
#define CONTROL_EDITOR_PLUGIN_H
#pragma once
#include "editor/editor_inspector.h"
#include "editor/plugins/editor_plugin.h"
@ -171,9 +170,6 @@ protected:
void _add_row_button(HBoxContainer *p_row, const int p_preset, const String &p_name);
void _add_separator(BoxContainer *p_box, Separator *p_separator);
public:
ControlEditorPresetPicker() {}
};
class AnchorPresetPicker : public ControlEditorPresetPicker {
@ -259,5 +255,3 @@ public:
ControlEditorPlugin();
};
#endif // CONTROL_EDITOR_PLUGIN_H

View file

@ -128,6 +128,14 @@ void CurveEdit::_notification(int p_what) {
tangent_hover_radius = Math::round(BASE_TANGENT_HOVER_RADIUS * get_theme_default_base_scale() * gizmo_scale);
tangent_length = Math::round(BASE_TANGENT_LENGTH * get_theme_default_base_scale());
} break;
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
RID ae = get_accessibility_element();
ERR_FAIL_COND(ae.is_null());
//TODO
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Curve editor")));
} break;
case NOTIFICATION_DRAW: {
_redraw();
} break;
@ -989,6 +997,7 @@ CurveEditor::CurveEditor() {
snap_button = memnew(Button);
snap_button->set_tooltip_text(TTR("Toggle Grid Snap"));
snap_button->set_accessibility_name(TTRC("Grid Snap"));
snap_button->set_toggle_mode(true);
toolbar->add_child(snap_button);
snap_button->connect(SceneStringName(toggled), callable_mp(this, &CurveEditor::_set_snap_enabled));
@ -998,6 +1007,7 @@ CurveEditor::CurveEditor() {
snap_count_edit = memnew(EditorSpinSlider);
snap_count_edit->set_min(2);
snap_count_edit->set_max(100);
snap_count_edit->set_accessibility_name(TTRC("Snap Step"));
snap_count_edit->set_value(DEFAULT_SNAP);
snap_count_edit->set_custom_minimum_size(Size2(65 * EDSCALE, 0));
toolbar->add_child(snap_count_edit);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CURVE_EDITOR_PLUGIN_H
#define CURVE_EDITOR_PLUGIN_H
#pragma once
#include "editor/editor_inspector.h"
#include "editor/editor_resource_preview.h"
@ -198,5 +197,3 @@ public:
virtual bool handles(const String &p_type) const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
};
#endif // CURVE_EDITOR_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DEBUGGER_EDITOR_PLUGIN_H
#define DEBUGGER_EDITOR_PLUGIN_H
#pragma once
#include "editor/plugins/editor_plugin.h"
@ -73,5 +72,3 @@ public:
DebuggerEditorPlugin(PopupMenu *p_menu);
~DebuggerEditorPlugin();
};
#endif // DEBUGGER_EDITOR_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DEDICATED_SERVER_EXPORT_PLUGIN_H
#define DEDICATED_SERVER_EXPORT_PLUGIN_H
#pragma once
#include "editor/export/editor_export_plugin.h"
@ -54,5 +53,3 @@ protected:
void _end_customize_scenes() override;
void _end_customize_resources() override;
};
#endif // DEDICATED_SERVER_EXPORT_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_CONTEXT_MENU_PLUGIN_H
#define EDITOR_CONTEXT_MENU_PLUGIN_H
#pragma once
#include "core/object/gdvirtual.gen.inc"
#include "core/object/ref_counted.h"
@ -113,5 +112,3 @@ public:
static void create();
static void cleanup();
};
#endif // EDITOR_CONTEXT_MENU_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_DEBUGGER_PLUGIN_H
#define EDITOR_DEBUGGER_PLUGIN_H
#pragma once
#include "scene/gui/control.h"
@ -103,5 +102,3 @@ public:
EditorDebuggerPlugin();
~EditorDebuggerPlugin();
};
#endif // EDITOR_DEBUGGER_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_PLUGIN_H
#define EDITOR_PLUGIN_H
#pragma once
#include "core/io/config_file.h"
#include "editor/plugins/editor_context_menu_plugin.h"
@ -255,9 +254,6 @@ public:
void enable_plugin();
void disable_plugin();
EditorPlugin() {}
virtual ~EditorPlugin() {}
};
VARIANT_ENUM_CAST(EditorPlugin::CustomControlContainer);
@ -296,5 +292,3 @@ public:
creation_funcs[creation_func_count++] = p_func;
}
};
#endif // EDITOR_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_PLUGIN_SETTINGS_H
#define EDITOR_PLUGIN_SETTINGS_H
#pragma once
#include "editor/plugins/plugin_config_dialog.h"
@ -73,5 +72,3 @@ public:
EditorPluginSettings();
};
#endif // EDITOR_PLUGIN_SETTINGS_H

View file

@ -182,9 +182,6 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from,
return ImageTexture::create_from_image(img);
}
EditorTexturePreviewPlugin::EditorTexturePreviewPlugin() {
}
////////////////////////////////////////////////////////////////////////////
bool EditorImagePreviewPlugin::handles(const String &p_type) const {
@ -222,9 +219,6 @@ Ref<Texture2D> EditorImagePreviewPlugin::generate(const Ref<Resource> &p_from, c
return ImageTexture::create_from_image(img);
}
EditorImagePreviewPlugin::EditorImagePreviewPlugin() {
}
bool EditorImagePreviewPlugin::generate_small_preview_automatically() const {
return true;
}
@ -287,9 +281,6 @@ bool EditorBitmapPreviewPlugin::generate_small_preview_automatically() const {
return true;
}
EditorBitmapPreviewPlugin::EditorBitmapPreviewPlugin() {
}
///////////////////////////////////////////////////////////////////////////
bool EditorPackedScenePreviewPlugin::handles(const String &p_type) const {
@ -325,9 +316,6 @@ Ref<Texture2D> EditorPackedScenePreviewPlugin::generate_from_path(const String &
}
}
EditorPackedScenePreviewPlugin::EditorPackedScenePreviewPlugin() {
}
//////////////////////////////////////////////////////////////////
void EditorMaterialPreviewPlugin::abort() {
@ -405,22 +393,22 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
int lats = 32;
int lons = 32;
const double lat_step = Math_TAU / lats;
const double lon_step = Math_TAU / lons;
const double lat_step = Math::TAU / lats;
const double lon_step = Math::TAU / lons;
real_t radius = 1.0;
Vector<Vector3> vertices;
Vector<Vector3> normals;
Vector<Vector2> uvs;
Vector<real_t> tangents;
Basis tt = Basis(Vector3(0, 1, 0), Math_PI * 0.5);
Basis tt = Basis(Vector3(0, 1, 0), Math::PI * 0.5);
for (int i = 1; i <= lats; i++) {
double lat0 = lat_step * (i - 1) - Math_TAU / 4;
double lat0 = lat_step * (i - 1) - Math::TAU / 4;
double z0 = Math::sin(lat0);
double zr0 = Math::cos(lat0);
double lat1 = lat_step * i - Math_TAU / 4;
double lat1 = lat_step * i - Math::TAU / 4;
double z1 = Math::sin(lat1);
double zr1 = Math::cos(lat1);
@ -445,7 +433,7 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
vertices.push_back(v[m_idx] * radius); \
{ \
Vector2 uv(Math::atan2(v[m_idx].x, v[m_idx].z), Math::atan2(-v[m_idx].y, v[m_idx].z)); \
uv /= Math_PI; \
uv /= Math::PI; \
uv *= 4.0; \
uv = uv * 0.5 + Vector2(0.5, 0.5); \
uvs.push_back(uv); \
@ -649,9 +637,6 @@ Ref<Texture2D> EditorScriptPreviewPlugin::_generate_from_source_code(const Scrip
return ImageTexture::create_from_image(img);
}
EditorScriptPreviewPlugin::EditorScriptPreviewPlugin() {
}
///////////////////////////////////////////////////////////////////
bool EditorAudioStreamPreviewPlugin::handles(const String &p_type) const {
@ -731,9 +716,6 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const Ref<Resource> &p_f
return ImageTexture::create_from_image(image);
}
EditorAudioStreamPreviewPlugin::EditorAudioStreamPreviewPlugin() {
}
///////////////////////////////////////////////////////////////////////////
void EditorMeshPreviewPlugin::abort() {
@ -754,8 +736,8 @@ Ref<Texture2D> EditorMeshPreviewPlugin::generate(const Ref<Resource> &p_from, co
Vector3 ofs = aabb.get_center();
aabb.position -= ofs;
Transform3D xform;
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.125);
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.125) * xform.basis;
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math::PI * 0.125);
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math::PI * 0.125) * xform.basis;
AABB rot_aabb = xform.xform(aabb);
real_t m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
if (m == 0) {
@ -952,6 +934,3 @@ Ref<Texture2D> EditorGradientPreviewPlugin::generate(const Ref<Resource> &p_from
}
return Ref<Texture2D>();
}
EditorGradientPreviewPlugin::EditorGradientPreviewPlugin() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_PREVIEW_PLUGINS_H
#define EDITOR_PREVIEW_PLUGINS_H
#pragma once
#include "editor/editor_resource_preview.h"
@ -44,8 +43,6 @@ public:
virtual bool handles(const String &p_type) const override;
virtual bool generate_small_preview_automatically() const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorTexturePreviewPlugin();
};
class EditorImagePreviewPlugin : public EditorResourcePreviewGenerator {
@ -55,8 +52,6 @@ public:
virtual bool handles(const String &p_type) const override;
virtual bool generate_small_preview_automatically() const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorImagePreviewPlugin();
};
class EditorBitmapPreviewPlugin : public EditorResourcePreviewGenerator {
@ -66,8 +61,6 @@ public:
virtual bool handles(const String &p_type) const override;
virtual bool generate_small_preview_automatically() const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorBitmapPreviewPlugin();
};
class EditorPackedScenePreviewPlugin : public EditorResourcePreviewGenerator {
@ -77,8 +70,6 @@ public:
virtual bool handles(const String &p_type) const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
virtual Ref<Texture2D> generate_from_path(const String &p_path, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorPackedScenePreviewPlugin();
};
class EditorMaterialPreviewPlugin : public EditorResourcePreviewGenerator {
@ -116,8 +107,6 @@ public:
virtual bool handles(const String &p_type) const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
virtual Ref<Texture2D> generate_from_path(const String &p_path, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorScriptPreviewPlugin();
};
class EditorAudioStreamPreviewPlugin : public EditorResourcePreviewGenerator {
@ -126,8 +115,6 @@ class EditorAudioStreamPreviewPlugin : public EditorResourcePreviewGenerator {
public:
virtual bool handles(const String &p_type) const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorAudioStreamPreviewPlugin();
};
class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator {
@ -180,8 +167,4 @@ public:
virtual bool handles(const String &p_type) const override;
virtual bool generate_small_preview_automatically() const override;
virtual Ref<Texture2D> generate(const Ref<Resource> &p_from, const Size2 &p_size, Dictionary &p_metadata) const override;
EditorGradientPreviewPlugin();
};
#endif // EDITOR_PREVIEW_PLUGINS_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_RESOURCE_CONVERSION_PLUGIN_H
#define EDITOR_RESOURCE_CONVERSION_PLUGIN_H
#pragma once
#include "core/io/resource.h"
#include "core/object/gdvirtual.gen.inc"
@ -49,5 +48,3 @@ public:
virtual bool handles(const Ref<Resource> &p_resource) const;
virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
#endif // EDITOR_RESOURCE_CONVERSION_PLUGIN_H

View file

@ -30,6 +30,7 @@
#include "editor_resource_tooltip_plugins.h"
#include "editor/editor_file_system.h"
#include "editor/editor_resource_preview.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/box_container.h"
@ -38,7 +39,7 @@
void EditorResourceTooltipPlugin::_thumbnail_ready(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) {
ObjectID trid = p_udata;
TextureRect *tr = Object::cast_to<TextureRect>(ObjectDB::get_instance(trid));
TextureRect *tr = ObjectDB::get_instance<TextureRect>(trid);
if (!tr) {
return;
@ -63,6 +64,12 @@ VBoxContainer *EditorResourceTooltipPlugin::make_default_tooltip(const String &p
vb->add_child(label);
}
ResourceUID::ID id = EditorFileSystem::get_singleton()->get_file_uid(p_resource_path);
if (id != ResourceUID::INVALID_ID) {
Label *label = memnew(Label(ResourceUID::get_singleton()->id_to_text(id)));
vb->add_child(label);
}
{
Ref<FileAccess> f = FileAccess::open(p_resource_path, FileAccess::READ);
Label *label = memnew(Label(vformat(TTR("Size: %s"), String::humanize_size(f->get_length()))));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_RESOURCE_TOOLTIP_PLUGINS_H
#define EDITOR_RESOURCE_TOOLTIP_PLUGINS_H
#pragma once
#include "core/object/gdvirtual.gen.inc"
#include "core/object/ref_counted.h"
@ -73,5 +72,3 @@ public:
virtual bool handles(const String &p_resource_type) const override;
virtual Control *make_tooltip_for_path(const String &p_resource_path, const Dictionary &p_metadata, Control *p_base) const override;
};
#endif // EDITOR_RESOURCE_TOOLTIP_PLUGINS_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EMBEDDED_PROCESS_H
#define EMBEDDED_PROCESS_H
#pragma once
#include "scene/gui/control.h"
@ -94,5 +93,3 @@ public:
EmbeddedProcess();
~EmbeddedProcess();
};
#endif // EMBEDDED_PROCESS_H

View file

@ -158,7 +158,7 @@ void EditorPropertyFontMetaOverride::_notification(int p_what) {
void EditorPropertyFontMetaOverride::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) {
if (p_property.begins_with("keys")) {
Dictionary dict = object->get_dict();
String key = p_property.get_slice("/", 1);
String key = p_property.get_slicec('/', 1);
dict[key] = (bool)p_value;
emit_changed(get_edited_property(), dict, "", true);
@ -295,6 +295,7 @@ void EditorPropertyFontMetaOverride::update_property() {
hbox->add_child(prop);
prop->set_h_size_flags(SIZE_EXPAND_FILL);
Button *remove = memnew(Button);
remove->set_accessibility_name(TTRC("Remove"));
remove->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
hbox->add_child(remove);
remove->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyFontMetaOverride::_remove).bind(remove, name));
@ -349,6 +350,7 @@ EditorPropertyFontMetaOverride::EditorPropertyFontMetaOverride(bool p_script) {
page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page"));
edit = memnew(Button);
edit->set_accessibility_name(TTRC("Edit"));
edit->set_h_size_flags(SIZE_EXPAND_FILL);
edit->set_clip_text(true);
edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyFontMetaOverride::_edit_pressed));
@ -378,7 +380,7 @@ EditorPropertyFontMetaOverride::EditorPropertyFontMetaOverride(bool p_script) {
void EditorPropertyOTVariation::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) {
if (p_property.begins_with("keys")) {
Dictionary dict = object->get_dict();
int key = p_property.get_slice("/", 1).to_int();
int key = p_property.get_slicec('/', 1).to_int();
dict[key] = (int)p_value;
emit_changed(get_edited_property(), dict, "", true);
@ -407,9 +409,9 @@ void EditorPropertyOTVariation::update_property() {
Dictionary supported = (fd.is_valid()) ? fd->get_supported_variation_list() : Dictionary();
for (int i = 0; i < supported.size(); i++) {
int name_tag = supported.get_key_at_index(i);
Vector3i range = supported.get_value_at_index(i);
for (const KeyValue<Variant, Variant> &kv : supported) {
const int &name_tag = kv.key;
const Vector3i &range = kv.value;
if ((dict.has(name_tag) && dict[name_tag].get_type() == Variant::NIL) || !dict.has(name_tag)) {
dict[name_tag] = range.z;
}
@ -476,7 +478,7 @@ void EditorPropertyOTVariation::update_property() {
String name = TS->tag_to_name(name_tag);
String name_cap;
{
String aux = name.replace("_", " ").strip_edges();
String aux = name.replace_char('_', ' ').strip_edges();
for (int j = 0; j < aux.get_slice_count(" "); j++) {
String slice = aux.get_slicec(' ', j);
if (slice.length() > 0) {
@ -535,6 +537,7 @@ EditorPropertyOTVariation::EditorPropertyOTVariation() {
page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page"));
edit = memnew(Button);
edit->set_accessibility_name(TTRC("Edit"));
edit->set_h_size_flags(SIZE_EXPAND_FILL);
edit->set_clip_text(true);
edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyOTVariation::_edit_pressed));
@ -561,7 +564,7 @@ void EditorPropertyOTFeatures::_notification(int p_what) {
void EditorPropertyOTFeatures::_property_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) {
if (p_property.begins_with("keys")) {
Dictionary dict = object->get_dict();
int key = p_property.get_slice("/", 1).to_int();
int key = p_property.get_slicec('/', 1).to_int();
dict[key] = (int)p_value;
emit_changed(get_edited_property(), dict, "", true);
@ -789,6 +792,7 @@ void EditorPropertyOTFeatures::update_property() {
hbox->add_child(prop);
prop->set_h_size_flags(SIZE_EXPAND_FILL);
Button *remove = memnew(Button);
remove->set_accessibility_name(TTRC("Remove"));
remove->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
hbox->add_child(remove);
remove->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyOTFeatures::_remove).bind(remove, name_tag));
@ -838,6 +842,7 @@ EditorPropertyOTFeatures::EditorPropertyOTFeatures() {
page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page"));
edit = memnew(Button);
edit->set_accessibility_name(TTRC("Edit"));
edit->set_h_size_flags(SIZE_EXPAND_FILL);
edit->set_clip_text(true);
edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyOTFeatures::_edit_pressed));
@ -973,9 +978,6 @@ void FontPreview::_preview_changed() {
queue_redraw();
}
FontPreview::FontPreview() {
}
/*************************************************************************/
/* EditorInspectorPluginFontPreview */
/*************************************************************************/

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FONT_CONFIG_PLUGIN_H
#define FONT_CONFIG_PLUGIN_H
#pragma once
#include "editor/editor_properties.h"
#include "editor/editor_properties_array_dict.h"
@ -49,8 +48,6 @@ protected:
public:
void set_dict(const Dictionary &p_dict);
Dictionary get_dict();
EditorPropertyFontMetaObject() {}
};
/*************************************************************************/
@ -73,8 +70,6 @@ public:
void set_defaults(const Dictionary &p_dict);
Dictionary get_defaults();
EditorPropertyFontOTObject() {}
};
/*************************************************************************/
@ -229,8 +224,6 @@ public:
virtual Size2 get_minimum_size() const override;
void set_data(const Ref<Font> &p_f);
FontPreview();
};
/*************************************************************************/
@ -281,5 +274,3 @@ public:
virtual String get_plugin_name() const override { return "Font"; }
};
#endif // FONT_CONFIG_PLUGIN_H

View file

@ -35,7 +35,6 @@
#include "core/string/translation_server.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/script_editor_debugger.h"
#include "editor/editor_command_palette.h"
#include "editor/editor_feature_profile.h"
#include "editor/editor_interface.h"
#include "editor/editor_main_screen.h"
@ -58,14 +57,30 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
return;
}
Array setup_data;
Dictionary settings;
settings["debugger/max_node_selection"] = EDITOR_GET("debugger/max_node_selection");
settings["editors/panning/2d_editor_panning_scheme"] = EDITOR_GET("editors/panning/2d_editor_panning_scheme");
settings["editors/panning/simple_panning"] = EDITOR_GET("editors/panning/simple_panning");
settings["editors/panning/warped_mouse_panning"] = EDITOR_GET("editors/panning/warped_mouse_panning");
settings["editors/panning/2d_editor_pan_speed"] = EDITOR_GET("editors/panning/2d_editor_pan_speed");
settings["editors/polygon_editor/point_grab_radius"] = EDITOR_GET("editors/polygon_editor/point_grab_radius");
settings["canvas_item_editor/pan_view"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/pan_view"));
settings["box_selection_fill_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_fill_color"), EditorStringName(Editor));
settings["box_selection_stroke_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor));
settings["editors/3d/default_fov"] = EDITOR_GET("editors/3d/default_fov");
settings["editors/3d/default_z_near"] = EDITOR_GET("editors/3d/default_z_near");
settings["editors/3d/default_z_far"] = EDITOR_GET("editors/3d/default_z_far");
settings["editors/3d/navigation/invert_x_axis"] = EDITOR_GET("editors/3d/navigation/invert_x_axis");
settings["editors/3d/navigation/invert_y_axis"] = EDITOR_GET("editors/3d/navigation/invert_y_axis");
settings["editors/3d/navigation/warped_mouse_panning"] = EDITOR_GET("editors/3d/navigation/warped_mouse_panning");
settings["editors/3d/freelook/freelook_base_speed"] = EDITOR_GET("editors/3d/freelook/freelook_base_speed");
settings["editors/3d/freelook/freelook_sensitivity"] = EDITOR_GET("editors/3d/freelook/freelook_sensitivity");
settings["editors/3d/navigation_feel/orbit_sensitivity"] = EDITOR_GET("editors/3d/navigation_feel/orbit_sensitivity");
settings["editors/3d/navigation_feel/translation_sensitivity"] = EDITOR_GET("editors/3d/navigation_feel/translation_sensitivity");
settings["editors/3d/selection_box_color"] = EDITOR_GET("editors/3d/selection_box_color");
settings["editors/3d/freelook/freelook_base_speed"] = EDITOR_GET("editors/3d/freelook/freelook_base_speed");
Array setup_data;
setup_data.append(settings);
p_session->send_message("scene:runtime_node_select_setup", setup_data);
@ -78,6 +93,9 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
Array mode;
mode.append(select_mode);
p_session->send_message("scene:runtime_node_select_set_mode", mode);
Array mute_audio_data;
mute_audio_data.append(mute_audio);
p_session->send_message("scene:debug_mute_audio", mute_audio_data);
emit_signal(SNAME("session_started"));
}
@ -90,10 +108,6 @@ void GameViewDebugger::_session_stopped() {
emit_signal(SNAME("session_stopped"));
}
void GameViewDebugger::set_is_feature_enabled(bool p_enabled) {
is_feature_enabled = p_enabled;
}
void GameViewDebugger::set_suspend(bool p_enabled) {
Array message;
message.append(p_enabled);
@ -152,6 +166,11 @@ void GameViewDebugger::set_select_mode(int p_mode) {
}
}
void GameViewDebugger::set_debug_mute_audio(bool p_enabled) {
mute_audio = p_enabled;
EditorDebuggerNode::get_singleton()->set_debug_mute_audio(p_enabled);
}
void GameViewDebugger::set_camera_override(bool p_enabled) {
EditorDebuggerNode::get_singleton()->set_camera_override(p_enabled ? camera_override_mode : EditorDebuggerNode::OVERRIDE_NONE);
}
@ -190,11 +209,20 @@ void GameViewDebugger::setup_session(int p_session_id) {
session->connect("stopped", callable_mp(this, &GameViewDebugger::_session_stopped));
}
void GameViewDebugger::_feature_profile_changed() {
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
is_feature_enabled = profile.is_null() || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME);
}
void GameViewDebugger::_bind_methods() {
ADD_SIGNAL(MethodInfo("session_started"));
ADD_SIGNAL(MethodInfo("session_stopped"));
}
GameViewDebugger::GameViewDebugger() {
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &GameViewDebugger::_feature_profile_changed));
}
///////
void GameView::_sessions_changed() {
@ -225,6 +253,7 @@ void GameView::_instance_starting(int p_idx, List<String> &r_arguments) {
if (!is_feature_enabled) {
return;
}
if (p_idx == 0 && embed_on_play && make_floating_on_play && window_wrapper->is_window_available() && !window_wrapper->get_window_enabled() && _get_embed_available() == EMBED_AVAILABLE) {
// Set the Floating Window default title. Always considered in DEBUG mode, same as in Window::set_title.
String appname = GLOBAL_GET("application/config/name");
@ -337,6 +366,9 @@ void GameView::_stop_pressed() {
void GameView::_embedding_completed() {
_attach_script_debugger();
_update_ui();
if (make_floating_on_play) {
get_window()->set_flag(Window::FLAG_ALWAYS_ON_TOP, bool(GLOBAL_GET("display/window/size/always_on_top")));
}
}
void GameView::_embedding_failed() {
@ -406,11 +438,17 @@ void GameView::_node_type_pressed(int p_option) {
void GameView::_select_mode_pressed(int p_option) {
RuntimeNodeSelect::SelectMode mode = (RuntimeNodeSelect::SelectMode)p_option;
if (!select_mode_button[mode]->is_visible()) {
return;
}
for (int i = 0; i < RuntimeNodeSelect::SELECT_MODE_MAX; i++) {
select_mode_button[i]->set_pressed_no_signal(i == mode);
}
debugger->set_select_mode(mode);
EditorSettings::get_singleton()->set_project_metadata("game_view", "select_mode", mode);
}
void GameView::_embed_options_menu_menu_id_pressed(int p_id) {
@ -506,13 +544,13 @@ void GameView::_update_ui() {
state_label->set_text(vformat(TTR("Game embedding not available for the Display Server: '%s'.\nDisplay Server can be modified in the Project Settings (Display > Display Server > Driver)."), GLOBAL_GET("display/display_server/driver")));
break;
case EMBED_NOT_AVAILABLE_MINIMIZED:
state_label->set_text(TTR("Game embedding not available when the game starts minimized.\nConsider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
state_label->set_text(TTR("Game embedding not available when the game starts minimized.") + "\n" + TTR("Consider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
break;
case EMBED_NOT_AVAILABLE_MAXIMIZED:
state_label->set_text(TTR("Game embedding not available when the game starts maximized.\nConsider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
state_label->set_text(TTR("Game embedding not available when the game starts maximized.") + "\n" + TTR("Consider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
break;
case EMBED_NOT_AVAILABLE_FULLSCREEN:
state_label->set_text(TTR("Game embedding not available when the game starts in fullscreen.\nConsider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
state_label->set_text(TTR("Game embedding not available when the game starts in fullscreen.") + "\n" + TTR("Consider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
break;
case EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE:
state_label->set_text(TTR("Game embedding not available in single window mode."));
@ -570,6 +608,15 @@ void GameView::_hide_selection_toggled(bool p_pressed) {
hide_selection->set_button_icon(get_editor_theme_icon(p_pressed ? SNAME("GuiVisibilityHidden") : SNAME("GuiVisibilityVisible")));
debugger->set_selection_visible(!p_pressed);
EditorSettings::get_singleton()->set_project_metadata("game_view", "hide_selection", p_pressed);
}
void GameView::_debug_mute_audio_button_pressed() {
debug_mute_audio = !debug_mute_audio;
debug_mute_audio_button->set_button_icon(get_editor_theme_icon(debug_mute_audio ? SNAME("AudioMute") : SNAME("AudioStreamPlayer")));
debug_mute_audio_button->set_tooltip_text(debug_mute_audio ? TTRC("Unmute game audio.") : TTRC("Mute game audio."));
debugger->set_debug_mute_audio(debug_mute_audio);
}
void GameView::_camera_override_button_toggled(bool p_pressed) {
@ -598,12 +645,16 @@ void GameView::_camera_override_menu_id_pressed(int p_id) {
menu->set_item_checked(menu->get_item_index(p_id), true);
_update_debugger_buttons();
EditorSettings::get_singleton()->set_project_metadata("game_view", "camera_override_mode", p_id);
} break;
case CAMERA_MODE_EDITORS: {
debugger->set_camera_manipulate_mode(EditorDebuggerNode::OVERRIDE_EDITORS);
menu->set_item_checked(menu->get_item_index(p_id), true);
_update_debugger_buttons();
EditorSettings::get_singleton()->set_project_metadata("game_view", "camera_override_mode", p_id);
} break;
}
}
@ -616,9 +667,7 @@ void GameView::_notification(int p_what) {
node_type_button[RuntimeNodeSelect::NODE_TYPE_NONE]->set_button_icon(get_editor_theme_icon(SNAME("InputEventJoypadMotion")));
node_type_button[RuntimeNodeSelect::NODE_TYPE_2D]->set_button_icon(get_editor_theme_icon(SNAME("2DNodes")));
#ifndef _3D_DISABLED
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_button_icon(get_editor_theme_icon(SNAME("Node3D")));
#endif // _3D_DISABLED
select_mode_button[RuntimeNodeSelect::SELECT_MODE_SINGLE]->set_button_icon(get_editor_theme_icon(SNAME("ToolSelect")));
select_mode_button[RuntimeNodeSelect::SELECT_MODE_LIST]->set_button_icon(get_editor_theme_icon(SNAME("ListSelect")));
@ -629,6 +678,8 @@ void GameView::_notification(int p_what) {
stretch_button->set_button_icon(get_editor_theme_icon(SNAME("Stretch")));
embed_options_menu->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
debug_mute_audio_button->set_button_icon(get_editor_theme_icon(debug_mute_audio ? SNAME("AudioMute") : SNAME("AudioStreamPlayer")));
camera_override_button->set_button_icon(get_editor_theme_icon(SNAME("Camera")));
camera_override_menu->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
} break;
@ -685,45 +736,6 @@ void GameView::_notification(int p_what) {
}
}
void GameView::set_is_feature_enabled(bool p_enabled) {
is_feature_enabled = p_enabled;
}
void GameView::set_state(const Dictionary &p_state) {
if (p_state.has("hide_selection")) {
hide_selection->set_pressed(p_state["hide_selection"]);
_hide_selection_toggled(hide_selection->is_pressed());
}
if (p_state.has("select_mode")) {
_select_mode_pressed(p_state["select_mode"]);
}
if (p_state.has("camera_override_mode")) {
_camera_override_menu_id_pressed(p_state["camera_override_mode"]);
}
}
Dictionary GameView::get_state() const {
Dictionary d;
d["hide_selection"] = hide_selection->is_pressed();
for (int i = 0; i < RuntimeNodeSelect::SELECT_MODE_MAX; i++) {
if (select_mode_button[i]->is_pressed()) {
d["select_mode"] = i;
break;
}
}
PopupMenu *menu = camera_override_menu->get_popup();
for (int i = CAMERA_MODE_INGAME; i < CAMERA_MODE_EDITORS + 1; i++) {
if (menu->is_item_checked(menu->get_item_index(i))) {
d["camera_override_mode"] = i;
break;
}
}
return d;
}
void GameView::set_window_layout(Ref<ConfigFile> p_layout) {
floating_window_rect = p_layout->get_value("GameView", "floating_window_rect", Rect2i());
floating_window_screen = p_layout->get_value("GameView", "floating_window_screen", -1);
@ -881,6 +893,19 @@ void GameView::_debugger_breaked(bool p_breaked, bool p_can_debug) {
_update_embed_window_size();
}
void GameView::_feature_profile_changed() {
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
bool is_profile_null = profile.is_null();
is_feature_enabled = is_profile_null || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME);
bool is_3d_enabled = is_profile_null || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D);
if (!is_3d_enabled && node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->is_pressed()) {
_node_type_pressed(RuntimeNodeSelect::NODE_TYPE_NONE);
}
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_visible(is_3d_enabled);
}
GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
singleton = this;
@ -904,12 +929,14 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
suspend_button->set_theme_type_variation(SceneStringName(FlatButton));
suspend_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_suspend_button_toggled));
suspend_button->set_tooltip_text(TTR("Suspend"));
suspend_button->set_accessibility_name(TTRC("Suspend"));
next_frame_button = memnew(Button);
main_menu_hbox->add_child(next_frame_button);
next_frame_button->set_theme_type_variation(SceneStringName(FlatButton));
next_frame_button->connect(SceneStringName(pressed), callable_mp(*debugger, &GameViewDebugger::next_frame));
next_frame_button->set_tooltip_text(TTR("Next Frame"));
next_frame_button->set_accessibility_name(TTRC("Next Frame"));
main_menu_hbox->add_child(memnew(VSeparator));
@ -930,7 +957,6 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
node_type_button[RuntimeNodeSelect::NODE_TYPE_2D]->connect(SceneStringName(pressed), callable_mp(this, &GameView::_node_type_pressed).bind(RuntimeNodeSelect::NODE_TYPE_2D));
node_type_button[RuntimeNodeSelect::NODE_TYPE_2D]->set_tooltip_text(TTR("Disable game input and allow to select Node2Ds, Controls, and manipulate the 2D camera."));
#ifndef _3D_DISABLED
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D] = memnew(Button);
main_menu_hbox->add_child(node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]);
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_text(TTR("3D"));
@ -938,7 +964,6 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_theme_type_variation(SceneStringName(FlatButton));
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->connect(SceneStringName(pressed), callable_mp(this, &GameView::_node_type_pressed).bind(RuntimeNodeSelect::NODE_TYPE_3D));
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_tooltip_text(TTR("Disable game input and allow to select Node3Ds and manipulate the 3D camera."));
#endif // _3D_DISABLED
main_menu_hbox->add_child(memnew(VSeparator));
@ -948,6 +973,8 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
hide_selection->set_theme_type_variation(SceneStringName(FlatButton));
hide_selection->connect(SceneStringName(toggled), callable_mp(this, &GameView::_hide_selection_toggled));
hide_selection->set_tooltip_text(TTR("Toggle Selection Visibility"));
hide_selection->set_accessibility_name(TTRC("Selection Visibility"));
hide_selection->set_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "hide_selection", false));
main_menu_hbox->add_child(memnew(VSeparator));
@ -968,14 +995,25 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
select_mode_button[RuntimeNodeSelect::SELECT_MODE_LIST]->connect(SceneStringName(pressed), callable_mp(this, &GameView::_select_mode_pressed).bind(RuntimeNodeSelect::SELECT_MODE_LIST));
select_mode_button[RuntimeNodeSelect::SELECT_MODE_LIST]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked."));
_select_mode_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "select_mode", 0));
main_menu_hbox->add_child(memnew(VSeparator));
debug_mute_audio_button = memnew(Button);
main_menu_hbox->add_child(debug_mute_audio_button);
debug_mute_audio_button->set_theme_type_variation("FlatButton");
debug_mute_audio_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_debug_mute_audio_button_pressed));
debug_mute_audio_button->set_tooltip_text(debug_mute_audio ? TTRC("Unmute game audio.") : TTRC("Mute game audio."));
main_menu_hbox->add_child(memnew(VSeparator));
camera_override_button = memnew(Button);
main_menu_hbox->add_child(camera_override_button);
camera_override_button->set_toggle_mode(true);
camera_override_button->set_theme_type_variation(SceneStringName(FlatButton));
camera_override_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_camera_override_button_toggled));
camera_override_button->set_tooltip_text(TTR("Override the in-game camera."));
camera_override_button->set_accessibility_name(TTRC("Override In-game Camera"));
camera_override_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_camera_override_button_toggled));
camera_override_menu = memnew(MenuButton);
main_menu_hbox->add_child(camera_override_menu);
@ -983,6 +1021,8 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
camera_override_menu->set_theme_type_variation("FlatMenuButton");
camera_override_menu->set_h_size_flags(SIZE_SHRINK_END);
camera_override_menu->set_tooltip_text(TTR("Camera Override Options"));
camera_override_menu->set_accessibility_name(TTRC("Camera Override Options"));
_camera_override_menu_id_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "camera_override_mode", 0));
PopupMenu *menu = camera_override_menu->get_popup();
menu->connect(SceneStringName(id_pressed), callable_mp(this, &GameView::_camera_override_menu_id_pressed));
@ -1001,6 +1041,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
fixed_size_button->set_toggle_mode(true);
fixed_size_button->set_theme_type_variation("FlatButton");
fixed_size_button->set_tooltip_text(TTR("Embedded game size is based on project settings.\nThe 'Keep Aspect' mode is used when the Game Workspace is smaller than the desired size."));
fixed_size_button->set_accessibility_name(TTRC("Fixed Size"));
fixed_size_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_FIXED));
keep_aspect_button = memnew(Button);
@ -1008,6 +1049,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
keep_aspect_button->set_toggle_mode(true);
keep_aspect_button->set_theme_type_variation("FlatButton");
keep_aspect_button->set_tooltip_text(TTR("Keep the aspect ratio of the embedded game."));
keep_aspect_button->set_accessibility_name(TTRC("Keep Aspect Ratio"));
keep_aspect_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_KEEP_ASPECT));
stretch_button = memnew(Button);
@ -1015,6 +1057,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
stretch_button->set_toggle_mode(true);
stretch_button->set_theme_type_variation("FlatButton");
stretch_button->set_tooltip_text(TTR("Embedded game size stretches to fit the Game Workspace."));
stretch_button->set_accessibility_name(TTRC("Stretch"));
stretch_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_STRETCH));
embed_options_menu = memnew(MenuButton);
@ -1023,6 +1066,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
embed_options_menu->set_theme_type_variation("FlatMenuButton");
embed_options_menu->set_h_size_flags(SIZE_SHRINK_END);
embed_options_menu->set_tooltip_text(TTR("Embedding Options"));
embed_options_menu->set_accessibility_name(TTRC("Embedding Options"));
menu = embed_options_menu->get_popup();
menu->connect(SceneStringName(id_pressed), callable_mp(this, &GameView::_embed_options_menu_menu_id_pressed));
@ -1077,6 +1121,8 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
p_wrapper->connect("window_size_changed", callable_mp(this, &GameView::_update_floating_window_settings));
EditorDebuggerNode::get_singleton()->connect("breaked", callable_mp(this, &GameView::_debugger_breaked));
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &GameView::_feature_profile_changed));
}
///////
@ -1087,7 +1133,7 @@ void GameViewPlugin::selected_notify() {
notify_main_screen_changed(get_plugin_name());
#else
window_wrapper->grab_window_focus();
#endif
#endif // ANDROID_ENABLED
_focus_another_editor();
}
}
@ -1108,19 +1154,7 @@ void GameViewPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
void GameViewPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
game_view->get_window_layout(p_layout);
}
void GameViewPlugin::set_state(const Dictionary &p_state) {
game_view->set_state(p_state);
}
Dictionary GameViewPlugin::get_state() const {
return game_view->get_state();
}
void GameViewPlugin::_window_visibility_changed(bool p_visible) {
_focus_another_editor();
}
#endif
#endif // ANDROID_ENABLED
void GameViewPlugin::_notification(int p_what) {
switch (p_what) {
@ -1135,24 +1169,6 @@ void GameViewPlugin::_notification(int p_what) {
}
}
void GameViewPlugin::_feature_profile_changed() {
bool is_feature_enabled = true;
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
if (profile.is_valid()) {
is_feature_enabled = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME);
}
if (debugger.is_valid()) {
debugger->set_is_feature_enabled(is_feature_enabled);
}
#ifndef ANDROID_ENABLED
if (game_view) {
game_view->set_is_feature_enabled(is_feature_enabled);
}
#endif
}
void GameViewPlugin::_save_last_editor(const String &p_editor) {
if (p_editor != get_plugin_name()) {
last_editor = p_editor;
@ -1174,7 +1190,7 @@ bool GameViewPlugin::_is_window_wrapper_enabled() const {
return true;
#else
return window_wrapper->get_window_enabled();
#endif
#endif // ANDROID_ENABLED
}
GameViewPlugin::GameViewPlugin() {
@ -1193,11 +1209,6 @@ GameViewPlugin::GameViewPlugin() {
EditorNode::get_singleton()->get_editor_main_screen()->get_control()->add_child(window_wrapper);
window_wrapper->set_v_size_flags(Control::SIZE_EXPAND_FILL);
window_wrapper->hide();
window_wrapper->connect("window_visibility_changed", callable_mp(this, &GameViewPlugin::_window_visibility_changed));
#endif
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &GameViewPlugin::_feature_profile_changed));
}
GameViewPlugin::~GameViewPlugin() {
window_wrapper->connect("window_visibility_changed", callable_mp(this, &GameViewPlugin::_focus_another_editor).unbind(1));
#endif // ANDROID_ENABLED
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GAME_VIEW_PLUGIN_H
#define GAME_VIEW_PLUGIN_H
#pragma once
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_main_screen.h"
@ -53,17 +52,18 @@ private:
int node_type = RuntimeNodeSelect::NODE_TYPE_NONE;
bool selection_visible = true;
int select_mode = RuntimeNodeSelect::SELECT_MODE_SINGLE;
bool mute_audio = false;
EditorDebuggerNode::CameraOverride camera_override_mode = EditorDebuggerNode::OVERRIDE_INGAME;
void _session_started(Ref<EditorDebuggerSession> p_session);
void _session_stopped();
void _feature_profile_changed();
protected:
static void _bind_methods();
public:
void set_is_feature_enabled(bool p_enabled);
void set_suspend(bool p_enabled);
void next_frame();
@ -72,6 +72,8 @@ public:
void set_selection_visible(bool p_visible);
void set_debug_mute_audio(bool p_enabled);
void set_camera_override(bool p_enabled);
void set_camera_manipulate_mode(EditorDebuggerNode::CameraOverride p_mode);
@ -80,7 +82,7 @@ public:
virtual void setup_session(int p_session_id) override;
GameViewDebugger() {}
GameViewDebugger();
};
class GameView : public VBoxContainer {
@ -130,6 +132,8 @@ class GameView : public VBoxContainer {
Rect2i floating_window_rect;
int floating_window_screen = -1;
bool debug_mute_audio = false;
Button *suspend_button = nullptr;
Button *next_frame_button = nullptr;
@ -138,6 +142,8 @@ class GameView : public VBoxContainer {
Button *hide_selection = nullptr;
Button *debug_mute_audio_button = nullptr;
Button *camera_override_button = nullptr;
MenuButton *camera_override_menu = nullptr;
@ -181,6 +187,8 @@ class GameView : public VBoxContainer {
void _hide_selection_toggled(bool p_pressed);
void _debug_mute_audio_button_pressed();
void _camera_override_button_toggled(bool p_pressed);
void _camera_override_menu_id_pressed(int p_id);
@ -192,12 +200,12 @@ class GameView : public VBoxContainer {
void _debugger_breaked(bool p_breaked, bool p_can_debug);
void _feature_profile_changed();
protected:
void _notification(int p_what);
public:
void set_is_feature_enabled(bool p_enabled);
void set_state(const Dictionary &p_state);
Dictionary get_state() const;
@ -213,16 +221,15 @@ class GameViewPlugin : public EditorPlugin {
#ifndef ANDROID_ENABLED
GameView *game_view = nullptr;
WindowWrapper *window_wrapper = nullptr;
#endif
#endif // ANDROID_ENABLED
Ref<GameViewDebugger> debugger;
String last_editor;
void _feature_profile_changed();
#ifndef ANDROID_ENABLED
void _window_visibility_changed(bool p_visible);
#endif
#endif // ANDROID_ENABLED
void _save_last_editor(const String &p_editor);
void _focus_another_editor();
bool _is_window_wrapper_enabled() const;
@ -231,7 +238,7 @@ protected:
void _notification(int p_what);
public:
virtual String get_plugin_name() const override { return "Game"; }
virtual String get_plugin_name() const override { return TTRC("Game"); }
bool has_main_screen() const override { return true; }
virtual void edit(Object *p_object) override {}
virtual bool handles(Object *p_object) const override { return false; }
@ -244,13 +251,7 @@ public:
virtual void set_window_layout(Ref<ConfigFile> p_layout) override;
virtual void get_window_layout(Ref<ConfigFile> p_layout) override;
virtual void set_state(const Dictionary &p_state) override;
virtual Dictionary get_state() const override;
#endif
#endif // ANDROID_ENABLED
GameViewPlugin();
~GameViewPlugin();
};
#endif // GAME_VIEW_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GDEXTENSION_EXPORT_PLUGIN_H
#define GDEXTENSION_EXPORT_PLUGIN_H
#pragma once
#include "core/extension/gdextension_library_loader.h"
#include "editor/export/editor_export.h"
@ -169,5 +168,3 @@ void GDExtensionExportPlugin::_export_file(const String &p_path, const String &p
}
}
}
#endif // GDEXTENSION_EXPORT_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef AUDIO_LISTENER_3D_GIZMO_PLUGIN_H
#define AUDIO_LISTENER_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -45,5 +44,3 @@ public:
AudioListener3DGizmoPlugin();
};
#endif // AUDIO_LISTENER_3D_GIZMO_PLUGIN_H

View file

@ -158,26 +158,50 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
// or a soft distance cap with the Unit Size property (sound never reaches true zero).
// When Max Distance is 0.0, `r` represents the distance above which the
// sound can't be heard in *most* (but not all) scenarios.
float r;
float radius = player->get_unit_size() * soft_multiplier;
if (player->get_max_distance() > CMP_EPSILON) {
r = MIN(player->get_unit_size() * soft_multiplier, player->get_max_distance());
} else {
r = player->get_unit_size() * soft_multiplier;
radius = MIN(radius, player->get_max_distance());
}
#define PUSH_QUARTER_XY(m_from_x, m_from_y, m_to_x, m_to_y, m_y) \
points_ptrw[index++] = Vector3(m_from_x, -m_from_y - m_y, 0); \
points_ptrw[index++] = Vector3(m_to_x, -m_to_y - m_y, 0); \
points_ptrw[index++] = Vector3(m_from_x, m_from_y + m_y, 0); \
points_ptrw[index++] = Vector3(m_to_x, m_to_y + m_y, 0); \
points_ptrw[index++] = Vector3(-m_from_x, -m_from_y - m_y, 0); \
points_ptrw[index++] = Vector3(-m_to_x, -m_to_y - m_y, 0); \
points_ptrw[index++] = Vector3(-m_from_x, m_from_y + m_y, 0); \
points_ptrw[index++] = Vector3(-m_to_x, m_to_y + m_y, 0);
// Number of points in an octant. So there will be 8 * points_in_octant points in total.
// This corresponds to the smoothness of the circle.
const uint32_t points_in_octant = 15;
const real_t octant_angle = Math::PI / 4;
const real_t inc = (Math::PI / (4 * points_in_octant));
const real_t radius_squared = radius * radius;
real_t r = 0;
Vector<Vector3> points_billboard;
points_billboard.resize(8 * points_in_octant * 2);
Vector3 *points_ptrw = points_billboard.ptrw();
for (int i = 0; i < 120; i++) {
// Create a circle.
const float ra = Math::deg_to_rad((float)(i * 3));
const float rb = Math::deg_to_rad((float)((i + 1) * 3));
const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
uint32_t index = 0;
float previous_x = radius;
float previous_y = 0.f;
// Draw a billboarded circle.
points_billboard.push_back(Vector3(a.x, a.y, 0));
points_billboard.push_back(Vector3(b.x, b.y, 0));
for (uint32_t i = 0; i < points_in_octant; i++) {
r += inc;
real_t x = Math::cos((i == points_in_octant - 1) ? octant_angle : r) * radius;
real_t y = Math::sqrt(radius_squared - (x * x));
PUSH_QUARTER_XY(previous_x, previous_y, x, y, 0);
PUSH_QUARTER_XY(previous_y, previous_x, y, x, 0);
previous_x = x;
previous_y = y;
}
#undef PUSH_QUARTER_XY
Color color;
switch (player->get_attenuation_model()) {
// Pick cold colors for all attenuation models (except Disabled),
@ -210,44 +234,76 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
if (player->is_emission_angle_enabled()) {
const float pc = player->get_emission_angle();
const float ofs = -Math::cos(Math::deg_to_rad(pc));
const float radius = Math::sin(Math::deg_to_rad(pc));
const float ha = Math::deg_to_rad(player->get_emission_angle());
const float ofs = -Math::cos(ha);
const float radius = Math::sin(ha);
const uint32_t points_in_octant = 7;
const real_t octant_angle = Math::PI / 4;
const real_t inc = (Math::PI / (4 * points_in_octant));
const real_t radius_squared = radius * radius;
real_t r = 0;
Vector<Vector3> points_primary;
points_primary.resize(200);
points_primary.resize(8 * points_in_octant * 2);
Vector3 *points_ptrw = points_primary.ptrw();
real_t step = Math_TAU / 100.0;
for (int i = 0; i < 100; i++) {
const float a = i * step;
const float an = (i + 1) * step;
uint32_t index = 0;
float previous_x = radius;
float previous_y = 0.f;
#define PUSH_QUARTER(m_from_x, m_from_y, m_to_x, m_to_y, m_y) \
points_ptrw[index++] = Vector3(m_from_x, -m_from_y, m_y); \
points_ptrw[index++] = Vector3(m_to_x, -m_to_y, m_y); \
points_ptrw[index++] = Vector3(m_from_x, m_from_y, m_y); \
points_ptrw[index++] = Vector3(m_to_x, m_to_y, m_y); \
points_ptrw[index++] = Vector3(-m_from_x, -m_from_y, m_y); \
points_ptrw[index++] = Vector3(-m_to_x, -m_to_y, m_y); \
points_ptrw[index++] = Vector3(-m_from_x, m_from_y, m_y); \
points_ptrw[index++] = Vector3(-m_to_x, m_to_y, m_y);
const Vector3 from(Math::sin(a) * radius, Math::cos(a) * radius, ofs);
const Vector3 to(Math::sin(an) * radius, Math::cos(an) * radius, ofs);
for (uint32_t i = 0; i < points_in_octant; i++) {
r += inc;
real_t x = Math::cos((i == points_in_octant - 1) ? octant_angle : r) * radius;
real_t y = Math::sqrt(radius_squared - (x * x));
points_primary.write[i * 2 + 0] = from;
points_primary.write[i * 2 + 1] = to;
PUSH_QUARTER(previous_x, previous_y, x, y, ofs);
PUSH_QUARTER(previous_y, previous_x, y, x, ofs);
previous_x = x;
previous_y = y;
}
#undef PUSH_QUARTER
const Ref<Material> material_primary = get_material("stream_player_3d_material_primary", p_gizmo);
p_gizmo->add_lines(points_primary, material_primary);
Vector<Vector3> points_secondary;
points_secondary.resize(16);
for (int i = 0; i < 8; i++) {
const float a = i * (Math_TAU / 8.0);
const Vector3 from(Math::sin(a) * radius, Math::cos(a) * radius, ofs);
points_secondary.write[i * 2 + 0] = from;
points_secondary.write[i * 2 + 1] = Vector3();
}
Vector3 *points_second_ptrw = points_secondary.ptrw();
uint32_t index2 = 0;
// Lines to the circle.
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(radius, 0, ofs);
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(-radius, 0, ofs);
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(0, radius, ofs);
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(0, -radius, ofs);
real_t octant_value = Math::cos(octant_angle) * radius;
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(octant_value, octant_value, ofs);
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(-octant_value, octant_value, ofs);
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(-octant_value, -octant_value, ofs);
points_second_ptrw[index2++] = Vector3();
points_second_ptrw[index2++] = Vector3(octant_value, -octant_value, ofs);
const Ref<Material> material_secondary = get_material("stream_player_3d_material_secondary", p_gizmo);
p_gizmo->add_lines(points_secondary, material_secondary);
Vector<Vector3> handles;
const float ha = Math::deg_to_rad(player->get_emission_angle());
handles.push_back(Vector3(Math::sin(ha), 0, -Math::cos(ha)));
p_gizmo->add_handles(handles, get_material("handles"));
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef AUDIO_STREAM_PLAYER_3D_GIZMO_PLUGIN_H
#define AUDIO_STREAM_PLAYER_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -49,5 +48,3 @@ public:
AudioStreamPlayer3DGizmoPlugin();
};
#endif // AUDIO_STREAM_PLAYER_3D_GIZMO_PLUGIN_H

View file

@ -180,7 +180,13 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
const float hsize = Math::sin(Math::deg_to_rad(fov));
const float depth = -Math::cos(Math::deg_to_rad(fov));
Vector3 side = Vector3(hsize * size_factor.x, 0, depth);
Vector3 side;
if (camera->get_keep_aspect_mode() == Camera3D::KEEP_WIDTH) {
side = Vector3(hsize * size_factor.x, 0, depth * size_factor.x);
} else {
side = Vector3(hsize * size_factor.x, 0, depth * size_factor.y);
}
Vector3 nside = Vector3(-side.x, side.y, side.z);
Vector3 up = Vector3(0, hsize * size_factor.y, 0);
@ -204,7 +210,6 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector3 right, up;
Vector3 back(0, 0, -1.0);
Vector3 front(0, 0, 0);
if (aspect == Camera3D::KeepAspect::KEEP_WIDTH) {
right = Vector3(keep_size, 0, 0);
@ -266,8 +271,8 @@ float Camera3DGizmoPlugin::_find_closest_angle_to_half_pi_arc(const Vector3 &p_f
Vector3 min_p;
for (int i = 0; i < arc_test_points; i++) {
float a = i * Math_PI * 0.5 / arc_test_points;
float an = (i + 1) * Math_PI * 0.5 / arc_test_points;
float a = i * Math::PI * 0.5 / arc_test_points;
float an = (i + 1) * Math::PI * 0.5 / arc_test_points;
Vector3 p = Vector3(Math::cos(a), 0, -Math::sin(a)) * p_arc_radius;
Vector3 n = Vector3(Math::cos(an), 0, -Math::sin(an)) * p_arc_radius;
@ -282,6 +287,6 @@ float Camera3DGizmoPlugin::_find_closest_angle_to_half_pi_arc(const Vector3 &p_f
}
//min_p = p_arc_xform.affine_inverse().xform(min_p);
float a = (Math_PI * 0.5) - Vector2(min_p.x, -min_p.z).angle();
float a = (Math::PI * 0.5) - Vector2(min_p.x, -min_p.z).angle();
return Math::rad_to_deg(a);
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CAMERA_3D_GIZMO_PLUGIN_H
#define CAMERA_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -52,5 +51,3 @@ public:
Camera3DGizmoPlugin();
};
#endif // CAMERA_3D_GIZMO_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COLLISION_OBJECT_3D_GIZMO_PLUGIN_H
#define COLLISION_OBJECT_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -44,5 +43,3 @@ public:
CollisionObject3DGizmoPlugin();
};
#endif // COLLISION_OBJECT_3D_GIZMO_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COLLISION_POLYGON_3D_GIZMO_PLUGIN_H
#define COLLISION_POLYGON_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -45,5 +44,3 @@ public:
void redraw(EditorNode3DGizmo *p_gizmo) override;
CollisionPolygon3DGizmoPlugin();
};
#endif // COLLISION_POLYGON_3D_GIZMO_PLUGIN_H

View file

@ -58,9 +58,6 @@ CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() {
create_handle_material("handles");
}
CollisionShape3DGizmoPlugin::~CollisionShape3DGizmoPlugin() {
}
void CollisionShape3DGizmoPlugin::create_collision_material(const String &p_name, float p_alpha) {
Vector<Ref<StandardMaterial3D>> mats;
@ -118,7 +115,7 @@ String CollisionShape3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_g
}
if (Object::cast_to<CapsuleShape3D>(*s)) {
return p_id == 0 ? "Radius" : "Height";
return helper->capsule_get_handle_name(p_id);
}
if (Object::cast_to<CylinderShape3D>(*s)) {
@ -157,7 +154,7 @@ Variant CollisionShape3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p
if (Object::cast_to<CylinderShape3D>(*s)) {
Ref<CylinderShape3D> cs2 = s;
return p_id == 0 ? cs2->get_radius() : cs2->get_height();
return Vector2(cs2->get_radius(), cs2->get_height());
}
if (Object::cast_to<SeparationRayShape3D>(*s)) {
@ -225,26 +222,15 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
}
if (Object::cast_to<CapsuleShape3D>(*s)) {
Vector3 axis;
axis[p_id == 0 ? 0 : 1] = 1.0;
Ref<CapsuleShape3D> cs2 = s;
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}
if (d < 0.001) {
d = 0.001;
}
if (p_id == 0) {
cs2->set_radius(d);
} else if (p_id == 1) {
cs2->set_height(d * 2.0);
}
real_t height = cs2->get_height();
real_t radius = cs2->get_radius();
Vector3 position;
helper->capsule_set_handle(sg, p_id, height, radius, position);
cs2->set_height(height);
cs2->set_radius(radius);
cs->set_global_position(position);
}
if (Object::cast_to<CylinderShape3D>(*s)) {
@ -288,26 +274,7 @@ void CollisionShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo
if (Object::cast_to<CapsuleShape3D>(*s)) {
Ref<CapsuleShape3D> ss = s;
Vector2 values = p_restore;
if (p_cancel) {
ss->set_radius(values[0]);
ss->set_height(values[1]);
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
if (p_id == 0) {
ur->create_action(TTR("Change Capsule Shape Radius"));
ur->add_do_method(ss.ptr(), "set_radius", ss->get_radius());
} else {
ur->create_action(TTR("Change Capsule Shape Height"));
ur->add_do_method(ss.ptr(), "set_height", ss->get_height());
}
ur->add_undo_method(ss.ptr(), "set_radius", values[0]);
ur->add_undo_method(ss.ptr(), "set_height", values[1]);
ur->commit_action();
helper->cylinder_commit_handle(p_id, TTR("Change Capsule Shape Radius"), TTR("Change Capsule Shape Height"), p_cancel, cs, *ss, *ss);
}
if (Object::cast_to<CylinderShape3D>(*s)) {
@ -357,42 +324,77 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
if (Object::cast_to<SphereShape3D>(*s)) {
Ref<SphereShape3D> sp = s;
float r = sp->get_radius();
float radius = sp->get_radius();
#define PUSH_QUARTER(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(from_x, y, from_y); \
points_ptrw[index++] = Vector3(to_x, y, to_y); \
points_ptrw[index++] = Vector3(from_x, y, -from_y); \
points_ptrw[index++] = Vector3(to_x, y, -to_y); \
points_ptrw[index++] = Vector3(-from_x, y, from_y); \
points_ptrw[index++] = Vector3(-to_x, y, to_y); \
points_ptrw[index++] = Vector3(-from_x, y, -from_y); \
points_ptrw[index++] = Vector3(-to_x, y, -to_y);
#define PUSH_QUARTER_XY(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(from_x, -from_y - y, 0); \
points_ptrw[index++] = Vector3(to_x, -to_y - y, 0); \
points_ptrw[index++] = Vector3(from_x, from_y + y, 0); \
points_ptrw[index++] = Vector3(to_x, to_y + y, 0); \
points_ptrw[index++] = Vector3(-from_x, -from_y - y, 0); \
points_ptrw[index++] = Vector3(-to_x, -to_y - y, 0); \
points_ptrw[index++] = Vector3(-from_x, from_y + y, 0); \
points_ptrw[index++] = Vector3(-to_x, to_y + y, 0);
#define PUSH_QUARTER_YZ(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(0, -from_y - y, from_x); \
points_ptrw[index++] = Vector3(0, -to_y - y, to_x); \
points_ptrw[index++] = Vector3(0, from_y + y, from_x); \
points_ptrw[index++] = Vector3(0, to_y + y, to_x); \
points_ptrw[index++] = Vector3(0, -from_y - y, -from_x); \
points_ptrw[index++] = Vector3(0, -to_y - y, -to_x); \
points_ptrw[index++] = Vector3(0, from_y + y, -from_x); \
points_ptrw[index++] = Vector3(0, to_y + y, -to_x);
// Number of points in an octant. So there will be 8 * points_in_octant * 2 points in total for one circle.
// This Corresponds to the smoothness of the circle.
const uint32_t points_in_octant = 16;
const real_t inc = (Math::PI / (4 * points_in_octant));
const real_t radius_squared = radius * radius;
real_t r = 0;
Vector<Vector3> points;
uint32_t index = 0;
// 3 full circles.
points.resize(3 * 8 * points_in_octant * 2);
Vector3 *points_ptrw = points.ptrw();
for (int i = 0; i <= 360; i++) {
float ra = Math::deg_to_rad((float)i);
float rb = Math::deg_to_rad((float)i + 1);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
float previous_x = radius;
float previous_y = 0.f;
points.push_back(Vector3(a.x, 0, a.y));
points.push_back(Vector3(b.x, 0, b.y));
points.push_back(Vector3(0, a.x, a.y));
points.push_back(Vector3(0, b.x, b.y));
points.push_back(Vector3(a.x, a.y, 0));
points.push_back(Vector3(b.x, b.y, 0));
}
Vector<Vector3> collision_segments;
for (int i = 0; i < 64; i++) {
float ra = i * (Math_TAU / 64.0);
float rb = (i + 1) * (Math_TAU / 64.0);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
collision_segments.push_back(Vector3(a.x, 0, a.y));
collision_segments.push_back(Vector3(b.x, 0, b.y));
collision_segments.push_back(Vector3(0, a.x, a.y));
collision_segments.push_back(Vector3(0, b.x, b.y));
collision_segments.push_back(Vector3(a.x, a.y, 0));
collision_segments.push_back(Vector3(b.x, b.y, 0));
for (uint32_t i = 0; i < points_in_octant; ++i) {
r += inc;
real_t x = Math::cos(r) * radius;
real_t y = Math::sqrt(radius_squared - (x * x));
PUSH_QUARTER(previous_x, previous_y, x, y, 0);
PUSH_QUARTER(previous_y, previous_x, y, x, 0);
PUSH_QUARTER_XY(previous_x, previous_y, x, y, 0);
PUSH_QUARTER_XY(previous_y, previous_x, y, x, 0);
PUSH_QUARTER_YZ(previous_x, previous_y, x, y, 0);
PUSH_QUARTER_YZ(previous_y, previous_x, y, x, 0)
previous_x = x;
previous_y = y;
}
#undef PUSH_QUARTER
#undef PUSH_QUARTER_XY
#undef PUSH_QUARTER_YZ
p_gizmo->add_lines(points, material, false, collision_color);
p_gizmo->add_collision_segments(collision_segments);
p_gizmo->add_collision_segments(points);
Vector<Vector3> handles;
handles.push_back(Vector3(r, 0, 0));
p_gizmo->add_handles(handles, handles_material);
@ -424,69 +426,98 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
float radius = cs2->get_radius();
float height = cs2->get_height();
// Number of points in an octant. So there will be 8 * points_in_octant points in total.
// This corresponds to the smoothness of the circle.
const uint32_t points_in_octant = 16;
const real_t octant_angle = Math::PI / 4;
const real_t inc = (Math::PI / (4 * points_in_octant));
const real_t radius_squared = radius * radius;
real_t r = 0;
Vector<Vector3> points;
// 4 vertical lines and 4 full circles.
points.resize(4 * 2 + 4 * 8 * points_in_octant * 2);
Vector3 *points_ptrw = points.ptrw();
Vector3 d(0, height * 0.5 - radius, 0);
for (int i = 0; i < 360; i++) {
float ra = Math::deg_to_rad((float)i);
float rb = Math::deg_to_rad((float)i + 1);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
uint32_t index = 0;
float y_value = height * 0.5 - radius;
points.push_back(Vector3(a.x, 0, a.y) + d);
points.push_back(Vector3(b.x, 0, b.y) + d);
// Vertical Lines.
points_ptrw[index++] = Vector3(0.f, y_value, radius);
points_ptrw[index++] = Vector3(0.f, -y_value, radius);
points_ptrw[index++] = Vector3(0.f, y_value, -radius);
points_ptrw[index++] = Vector3(0.f, -y_value, -radius);
points_ptrw[index++] = Vector3(radius, y_value, 0.f);
points_ptrw[index++] = Vector3(radius, -y_value, 0.f);
points_ptrw[index++] = Vector3(-radius, y_value, 0.f);
points_ptrw[index++] = Vector3(-radius, -y_value, 0.f);
points.push_back(Vector3(a.x, 0, a.y) - d);
points.push_back(Vector3(b.x, 0, b.y) - d);
#define PUSH_QUARTER(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(from_x, y, from_y); \
points_ptrw[index++] = Vector3(to_x, y, to_y); \
points_ptrw[index++] = Vector3(from_x, y, -from_y); \
points_ptrw[index++] = Vector3(to_x, y, -to_y); \
points_ptrw[index++] = Vector3(-from_x, y, from_y); \
points_ptrw[index++] = Vector3(-to_x, y, to_y); \
points_ptrw[index++] = Vector3(-from_x, y, -from_y); \
points_ptrw[index++] = Vector3(-to_x, y, -to_y);
if (i % 90 == 0) {
points.push_back(Vector3(a.x, 0, a.y) + d);
points.push_back(Vector3(a.x, 0, a.y) - d);
}
#define PUSH_QUARTER_XY(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(from_x, -from_y - y, 0); \
points_ptrw[index++] = Vector3(to_x, -to_y - y, 0); \
points_ptrw[index++] = Vector3(from_x, from_y + y, 0); \
points_ptrw[index++] = Vector3(to_x, to_y + y, 0); \
points_ptrw[index++] = Vector3(-from_x, -from_y - y, 0); \
points_ptrw[index++] = Vector3(-to_x, -to_y - y, 0); \
points_ptrw[index++] = Vector3(-from_x, from_y + y, 0); \
points_ptrw[index++] = Vector3(-to_x, to_y + y, 0);
Vector3 dud = i < 180 ? d : -d;
#define PUSH_QUARTER_YZ(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(0, -from_y - y, from_x); \
points_ptrw[index++] = Vector3(0, -to_y - y, to_x); \
points_ptrw[index++] = Vector3(0, from_y + y, from_x); \
points_ptrw[index++] = Vector3(0, to_y + y, to_x); \
points_ptrw[index++] = Vector3(0, -from_y - y, -from_x); \
points_ptrw[index++] = Vector3(0, -to_y - y, -to_x); \
points_ptrw[index++] = Vector3(0, from_y + y, -from_x); \
points_ptrw[index++] = Vector3(0, to_y + y, -to_x);
points.push_back(Vector3(0, a.x, a.y) + dud);
points.push_back(Vector3(0, b.x, b.y) + dud);
points.push_back(Vector3(a.y, a.x, 0) + dud);
points.push_back(Vector3(b.y, b.x, 0) + dud);
float previous_x = radius;
float previous_y = 0.f;
for (uint32_t i = 0; i < points_in_octant; ++i) {
r += inc;
real_t x = Math::cos((i == points_in_octant - 1) ? octant_angle : r) * radius;
real_t y = Math::sqrt(radius_squared - (x * x));
// High circle ring.
PUSH_QUARTER(previous_x, previous_y, x, y, y_value);
PUSH_QUARTER(previous_y, previous_x, y, x, y_value);
// Low circle ring.
PUSH_QUARTER(previous_x, previous_y, x, y, -y_value);
PUSH_QUARTER(previous_y, previous_x, y, x, -y_value);
// Up and Low circle in X-Y plane.
PUSH_QUARTER_XY(previous_x, previous_y, x, y, y_value);
PUSH_QUARTER_XY(previous_y, previous_x, y, x, y_value);
// Up and Low circle in Y-Z plane.
PUSH_QUARTER_YZ(previous_x, previous_y, x, y, y_value);
PUSH_QUARTER_YZ(previous_y, previous_x, y, x, y_value)
previous_x = x;
previous_y = y;
}
#undef PUSH_QUARTER
#undef PUSH_QUARTER_XY
#undef PUSH_QUARTER_YZ
p_gizmo->add_lines(points, material, false, collision_color);
p_gizmo->add_collision_segments(points);
Vector<Vector3> collision_segments;
for (int i = 0; i < 64; i++) {
float ra = i * (Math_TAU / 64.0);
float rb = (i + 1) * (Math_TAU / 64.0);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
collision_segments.push_back(Vector3(a.x, 0, a.y) + d);
collision_segments.push_back(Vector3(b.x, 0, b.y) + d);
collision_segments.push_back(Vector3(a.x, 0, a.y) - d);
collision_segments.push_back(Vector3(b.x, 0, b.y) - d);
if (i % 16 == 0) {
collision_segments.push_back(Vector3(a.x, 0, a.y) + d);
collision_segments.push_back(Vector3(a.x, 0, a.y) - d);
}
Vector3 dud = i < 32 ? d : -d;
collision_segments.push_back(Vector3(0, a.x, a.y) + dud);
collision_segments.push_back(Vector3(0, b.x, b.y) + dud);
collision_segments.push_back(Vector3(a.y, a.x, 0) + dud);
collision_segments.push_back(Vector3(b.y, b.x, 0) + dud);
}
p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles = {
Vector3(cs2->get_radius(), 0, 0),
Vector3(0, cs2->get_height() * 0.5, 0)
};
Vector<Vector3> handles = helper->capsule_get_handles(cs2->get_height(), cs2->get_radius());
p_gizmo->add_handles(handles, handles_material);
}
@ -495,50 +526,63 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
float radius = cs2->get_radius();
float height = cs2->get_height();
#define PUSH_QUARTER(from_x, from_y, to_x, to_y, y) \
points_ptrw[index++] = Vector3(from_x, y, from_y); \
points_ptrw[index++] = Vector3(to_x, y, to_y); \
points_ptrw[index++] = Vector3(from_x, y, -from_y); \
points_ptrw[index++] = Vector3(to_x, y, -to_y); \
points_ptrw[index++] = Vector3(-from_x, y, from_y); \
points_ptrw[index++] = Vector3(-to_x, y, to_y); \
points_ptrw[index++] = Vector3(-from_x, y, -from_y); \
points_ptrw[index++] = Vector3(-to_x, y, -to_y);
// Number of points in an octant. So there will be 8 * points_in_octant * 2 points in total for one circle.
// This corresponds to the smoothness of the circle.
const uint32_t points_in_octant = 16;
const real_t inc = (Math::PI / (4 * points_in_octant));
const real_t radius_squared = radius * radius;
real_t r = 0;
Vector<Vector3> points;
uint32_t index = 0;
// 4 vertical lines and 2 full circles.
points.resize(4 * 2 + 2 * 8 * points_in_octant * 2);
Vector3 *points_ptrw = points.ptrw();
float y_value = height * 0.5;
Vector3 d(0, height * 0.5, 0);
for (int i = 0; i < 360; i++) {
float ra = Math::deg_to_rad((float)i);
float rb = Math::deg_to_rad((float)i + 1);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
// Vertical lines.
points_ptrw[index++] = Vector3(0.f, y_value, radius);
points_ptrw[index++] = Vector3(0.f, -y_value, radius);
points_ptrw[index++] = Vector3(0.f, y_value, -radius);
points_ptrw[index++] = Vector3(0.f, -y_value, -radius);
points_ptrw[index++] = Vector3(radius, y_value, 0.f);
points_ptrw[index++] = Vector3(radius, -y_value, 0.f);
points_ptrw[index++] = Vector3(-radius, y_value, 0.f);
points_ptrw[index++] = Vector3(-radius, -y_value, 0.f);
points.push_back(Vector3(a.x, 0, a.y) + d);
points.push_back(Vector3(b.x, 0, b.y) + d);
float previous_x = radius;
float previous_y = 0.f;
points.push_back(Vector3(a.x, 0, a.y) - d);
points.push_back(Vector3(b.x, 0, b.y) - d);
for (uint32_t i = 0; i < points_in_octant; ++i) {
r += inc;
real_t x = Math::cos(r) * radius;
real_t y = Math::sqrt(radius_squared - (x * x));
if (i % 90 == 0) {
points.push_back(Vector3(a.x, 0, a.y) + d);
points.push_back(Vector3(a.x, 0, a.y) - d);
}
// High circle ring.
PUSH_QUARTER(previous_x, previous_y, x, y, y_value);
PUSH_QUARTER(previous_y, previous_x, y, x, y_value);
// Low circle ring.
PUSH_QUARTER(previous_x, previous_y, x, y, -y_value);
PUSH_QUARTER(previous_y, previous_x, y, x, -y_value);
previous_x = x;
previous_y = y;
}
#undef PUSH_QUARTER
p_gizmo->add_lines(points, material, false, collision_color);
Vector<Vector3> collision_segments;
for (int i = 0; i < 64; i++) {
float ra = i * (Math_TAU / 64.0);
float rb = (i + 1) * (Math_TAU / 64.0);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
collision_segments.push_back(Vector3(a.x, 0, a.y) + d);
collision_segments.push_back(Vector3(b.x, 0, b.y) + d);
collision_segments.push_back(Vector3(a.x, 0, a.y) - d);
collision_segments.push_back(Vector3(b.x, 0, b.y) - d);
if (i % 16 == 0) {
collision_segments.push_back(Vector3(a.x, 0, a.y) + d);
collision_segments.push_back(Vector3(a.x, 0, a.y) - d);
}
}
p_gizmo->add_collision_segments(collision_segments);
p_gizmo->add_collision_segments(points);
Vector<Vector3> handles = helper->cylinder_get_handles(cs2->get_height(), cs2->get_radius());
p_gizmo->add_handles(handles, handles_material);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COLLISION_SHAPE_3D_GIZMO_PLUGIN_H
#define COLLISION_SHAPE_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -55,7 +54,4 @@ public:
void commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel = false) override;
CollisionShape3DGizmoPlugin();
~CollisionShape3DGizmoPlugin();
};
#endif // COLLISION_SHAPE_3D_GIZMO_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CPU_PARTICLES_3D_GIZMO_PLUGIN_H
#define CPU_PARTICLES_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -44,5 +43,3 @@ public:
void redraw(EditorNode3DGizmo *p_gizmo) override;
CPUParticles3DGizmoPlugin();
};
#endif // CPU_PARTICLES_3D_GIZMO_PLUGIN_H

View file

@ -47,9 +47,6 @@ DecalGizmoPlugin::DecalGizmoPlugin() {
create_handle_material("handles");
}
DecalGizmoPlugin::~DecalGizmoPlugin() {
}
bool DecalGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<Decal>(p_spatial) != nullptr;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DECAL_GIZMO_PLUGIN_H
#define DECAL_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -53,7 +52,4 @@ public:
void commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel = false) override;
DecalGizmoPlugin();
~DecalGizmoPlugin();
};
#endif // DECAL_GIZMO_PLUGIN_H

View file

@ -48,9 +48,6 @@ FogVolumeGizmoPlugin::FogVolumeGizmoPlugin() {
create_handle_material("handles");
}
FogVolumeGizmoPlugin::~FogVolumeGizmoPlugin() {
}
bool FogVolumeGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return (Object::cast_to<FogVolume>(p_spatial) != nullptr);
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FOG_VOLUME_GIZMO_PLUGIN_H
#define FOG_VOLUME_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -53,7 +52,4 @@ public:
void commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel = false) override;
FogVolumeGizmoPlugin();
~FogVolumeGizmoPlugin();
};
#endif // FOG_VOLUME_GIZMO_PLUGIN_H

View file

@ -33,9 +33,6 @@
#include "editor/editor_settings.h"
#include "scene/3d/visual_instance_3d.h"
GeometryInstance3DGizmoPlugin::GeometryInstance3DGizmoPlugin() {
}
bool GeometryInstance3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<GeometryInstance3D>(p_spatial) != nullptr;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GEOMETRY_INSTANCE_3D_GIZMO_PLUGIN_H
#define GEOMETRY_INSTANCE_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -42,8 +41,4 @@ public:
virtual int get_priority() const override;
virtual void redraw(EditorNode3DGizmo *p_gizmo) override;
GeometryInstance3DGizmoPlugin();
};
#endif // GEOMETRY_INSTANCE_3D_GIZMO_PLUGIN_H

View file

@ -156,7 +156,10 @@ String Gizmo3DHelper::cylinder_get_handle_name(int p_id) const {
}
}
void Gizmo3DHelper::cylinder_set_handle(const Vector3 p_segment[2], int p_id, real_t &r_height, real_t &r_radius, Vector3 &r_cylinder_position) {
void Gizmo3DHelper::_cylinder_or_capsule_set_handle(const Vector3 p_segment[2], int p_id, real_t &r_height, real_t &r_radius, Vector3 &r_cylinder_position, bool p_is_capsule) {
real_t initial_radius = initial_value.operator Vector2().x;
real_t initial_height = initial_value.operator Vector2().y;
int sign = p_id == 2 ? -1 : 1;
int axis = p_id == 0 ? 0 : 1;
@ -178,9 +181,13 @@ void Gizmo3DHelper::cylinder_set_handle(const Vector3 p_segment[2], int p_id, re
}
r_radius = d;
r_cylinder_position = initial_transform.get_origin();
} else if (p_id == 1 || p_id == 2) {
real_t initial_height = initial_value;
if (p_is_capsule) {
r_height = MAX(initial_height, r_radius * 2.0);
} else {
r_height = initial_height;
}
} else if (p_id == 1 || p_id == 2) {
// Adjust height.
if (Input::get_singleton()->is_key_pressed(Key::ALT)) {
r_height = d * 2.0;
@ -200,6 +207,12 @@ void Gizmo3DHelper::cylinder_set_handle(const Vector3 p_segment[2], int p_id, re
offset[axis] = (r_height - initial_height) * 0.5 * sign;
r_cylinder_position = initial_transform.xform(offset);
}
if (p_is_capsule) {
r_radius = MIN(initial_radius, r_height / 2.0);
} else {
r_radius = initial_radius;
}
}
}
@ -212,25 +225,19 @@ void Gizmo3DHelper::cylinder_commit_handle(int p_id, const String &p_radius_acti
}
if (p_cancel) {
if (p_id == 0) {
p_radius_object->set(p_radius_property, initial_value);
} else {
p_height_object->set(p_height_property, initial_value);
}
p_radius_object->set(p_radius_property, initial_value.operator Vector2().x);
p_height_object->set(p_height_property, initial_value.operator Vector2().y);
p_position_object->set(p_position_property, initial_transform.get_origin());
return;
}
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
ur->create_action(p_id == 0 ? p_radius_action_name : p_height_action_name);
if (p_id == 0) {
ur->add_do_property(p_radius_object, p_radius_property, p_radius_object->get(p_radius_property));
ur->add_undo_property(p_radius_object, p_radius_property, initial_value);
} else {
ur->add_do_property(p_height_object, p_height_property, p_height_object->get(p_height_property));
ur->add_do_property(p_position_object, p_position_property, p_position_object->get(p_position_property));
ur->add_undo_property(p_height_object, p_height_property, initial_value);
ur->add_undo_property(p_position_object, p_position_property, initial_transform.get_origin());
}
ur->add_do_property(p_radius_object, p_radius_property, p_radius_object->get(p_radius_property));
ur->add_undo_property(p_radius_object, p_radius_property, initial_value.operator Vector2().x);
ur->add_do_property(p_height_object, p_height_property, p_height_object->get(p_height_property));
ur->add_undo_property(p_height_object, p_height_property, initial_value.operator Vector2().y);
ur->add_do_property(p_position_object, p_position_property, p_position_object->get(p_position_property));
ur->add_undo_property(p_position_object, p_position_property, initial_transform.get_origin());
ur->commit_action();
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GIZMO_3D_HELPER_H
#define GIZMO_3D_HELPER_H
#pragma once
#include "core/object/ref_counted.h"
@ -42,19 +41,44 @@ class Gizmo3DHelper : public RefCounted {
Variant initial_value;
Transform3D initial_transform;
private:
void _cylinder_or_capsule_set_handle(const Vector3 p_segment[2], int p_id, real_t &r_height, real_t &r_radius, Vector3 &r_cylinder_position, bool p_is_capsule);
public:
/**
* Initializes a new action involving a handle.
*
* Depending on the type of gizmo that will be used, different formats for the `p_initial_value` are required:
* Box: The size of the box as `Vector3`
* Cylinder or Capsule: A `Vector2` of the form `Vector2(radius, height)`
*/
void initialize_handle_action(const Variant &p_initial_value, const Transform3D &p_initial_transform);
void get_segment(Camera3D *p_camera, const Point2 &p_point, Vector3 *r_segment);
// Box
Vector<Vector3> box_get_handles(const Vector3 &p_box_size);
String box_get_handle_name(int p_id) const;
void box_set_handle(const Vector3 p_segment[2], int p_id, Vector3 &r_box_size, Vector3 &r_box_position);
void box_commit_handle(const String &p_action_name, bool p_cancel, Object *p_position_object, Object *p_size_object = nullptr, const StringName &p_position_property = "global_position", const StringName &p_size_property = "size");
// Cylinder
Vector<Vector3> cylinder_get_handles(real_t p_height, real_t p_radius);
String cylinder_get_handle_name(int p_id) const;
void cylinder_set_handle(const Vector3 p_segment[2], int p_id, real_t &r_height, real_t &r_radius, Vector3 &r_cylinder_position);
_FORCE_INLINE_ void cylinder_set_handle(const Vector3 p_segment[2], int p_id, real_t &r_height, real_t &r_radius, Vector3 &r_cylinder_position) {
_cylinder_or_capsule_set_handle(p_segment, p_id, r_height, r_radius, r_cylinder_position, false);
}
void cylinder_commit_handle(int p_id, const String &p_radius_action_name, const String &p_height_action_name, bool p_cancel, Object *p_position_object, Object *p_height_object = nullptr, Object *p_radius_object = nullptr, const StringName &p_position_property = "global_position", const StringName &p_height_property = "height", const StringName &p_radius_property = "radius");
};
#endif // GIZMO_3D_HELPER_H
// Capsule
_FORCE_INLINE_ Vector<Vector3> capsule_get_handles(real_t p_height, real_t p_radius) { return cylinder_get_handles(p_height, p_radius); }
_FORCE_INLINE_ String capsule_get_handle_name(int p_id) { return cylinder_get_handle_name(p_id); }
_FORCE_INLINE_ void capsule_set_handle(const Vector3 p_segment[2], int p_id, real_t &r_height, real_t &r_radius, Vector3 &r_capsule_position) {
_cylinder_or_capsule_set_handle(p_segment, p_id, r_height, r_radius, r_capsule_position, true);
}
_FORCE_INLINE_ void capsule_commit_handle(int p_id, const String &p_radius_action_name, const String &p_height_action_name, bool p_cancel, Object *p_position_object, Object *p_height_object = nullptr, Object *p_radius_object = nullptr, const StringName &p_position_property = "global_position", const StringName &p_height_property = "height", const StringName &p_radius_property = "radius") {
cylinder_commit_handle(p_id, p_radius_action_name, p_height_action_name, p_cancel, p_position_object, p_height_object, p_radius_object, p_position_property, p_height_property, p_radius_property);
}
};

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GPU_PARTICLES_3D_GIZMO_PLUGIN_H
#define GPU_PARTICLES_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -45,5 +44,3 @@ public:
GPUParticles3DGizmoPlugin();
};
#endif // GPU_PARTICLES_3D_GIZMO_PLUGIN_H

View file

@ -52,9 +52,6 @@ GPUParticlesCollision3DGizmoPlugin::GPUParticlesCollision3DGizmoPlugin() {
create_handle_material("handles");
}
GPUParticlesCollision3DGizmoPlugin::~GPUParticlesCollision3DGizmoPlugin() {
}
bool GPUParticlesCollision3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return (Object::cast_to<GPUParticlesCollision3D>(p_spatial) != nullptr) || (Object::cast_to<GPUParticlesAttractor3D>(p_spatial) != nullptr);
}
@ -168,45 +165,81 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
const Ref<Material> handles_material = get_material("handles");
if (Object::cast_to<GPUParticlesCollisionSphere3D>(cs) || Object::cast_to<GPUParticlesAttractorSphere3D>(cs)) {
float r = cs->call("get_radius");
float radius = cs->call("get_radius");
#define PUSH_QUARTER(m_from_x, m_from_y, m_to_x, m_to_y, m_y) \
points_ptrw[index++] = Vector3(m_from_x, m_y, m_from_y); \
points_ptrw[index++] = Vector3(m_to_x, m_y, m_to_y); \
points_ptrw[index++] = Vector3(m_from_x, m_y, -m_from_y); \
points_ptrw[index++] = Vector3(m_to_x, m_y, -m_to_y); \
points_ptrw[index++] = Vector3(-m_from_x, m_y, m_from_y); \
points_ptrw[index++] = Vector3(-m_to_x, m_y, m_to_y); \
points_ptrw[index++] = Vector3(-m_from_x, m_y, -m_from_y); \
points_ptrw[index++] = Vector3(-m_to_x, m_y, -m_to_y);
#define PUSH_QUARTER_XY(m_from_x, m_from_y, m_to_x, m_to_y) \
points_ptrw[index++] = Vector3(m_from_x, -m_from_y, 0); \
points_ptrw[index++] = Vector3(m_to_x, -m_to_y, 0); \
points_ptrw[index++] = Vector3(m_from_x, m_from_y, 0); \
points_ptrw[index++] = Vector3(m_to_x, m_to_y, 0); \
points_ptrw[index++] = Vector3(-m_from_x, -m_from_y, 0); \
points_ptrw[index++] = Vector3(-m_to_x, -m_to_y, 0); \
points_ptrw[index++] = Vector3(-m_from_x, m_from_y, 0); \
points_ptrw[index++] = Vector3(-m_to_x, m_to_y, 0);
#define PUSH_QUARTER_YZ(m_from_x, m_from_y, m_to_x, m_to_y) \
points_ptrw[index++] = Vector3(0, -m_from_y, m_from_x); \
points_ptrw[index++] = Vector3(0, -m_to_y, m_to_x); \
points_ptrw[index++] = Vector3(0, m_from_y, m_from_x); \
points_ptrw[index++] = Vector3(0, m_to_y, m_to_x); \
points_ptrw[index++] = Vector3(0, -m_from_y, -m_from_x); \
points_ptrw[index++] = Vector3(0, -m_to_y, -m_to_x); \
points_ptrw[index++] = Vector3(0, m_from_y, -m_from_x); \
points_ptrw[index++] = Vector3(0, m_to_y, -m_to_x);
// Number of points in an octant. So there will be 8 * points_in_octant points in total.
// This corresponds to the smoothness of the circle.
const uint32_t points_in_octant = 16;
const real_t octant_angle = Math::PI / 4;
const real_t inc = (Math::PI / (4 * points_in_octant));
const real_t radius_squared = radius * radius;
real_t r = 0;
Vector<Vector3> points;
points.resize(3 * 8 * points_in_octant * 2);
Vector3 *points_ptrw = points.ptrw();
for (int i = 0; i <= 360; i++) {
float ra = Math::deg_to_rad((float)i);
float rb = Math::deg_to_rad((float)i + 1);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
uint32_t index = 0;
float previous_x = radius;
float previous_y = 0.f;
points.push_back(Vector3(a.x, 0, a.y));
points.push_back(Vector3(b.x, 0, b.y));
points.push_back(Vector3(0, a.x, a.y));
points.push_back(Vector3(0, b.x, b.y));
points.push_back(Vector3(a.x, a.y, 0));
points.push_back(Vector3(b.x, b.y, 0));
}
for (uint32_t i = 0; i < points_in_octant; ++i) {
r += inc;
real_t x = Math::cos((i == points_in_octant - 1) ? octant_angle : r) * radius;
real_t y = Math::sqrt(radius_squared - (x * x));
Vector<Vector3> collision_segments;
PUSH_QUARTER(previous_x, previous_y, x, y, 0);
PUSH_QUARTER(previous_y, previous_x, y, x, 0);
for (int i = 0; i < 64; i++) {
float ra = i * (Math_TAU / 64.0);
float rb = (i + 1) * (Math_TAU / 64.0);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
PUSH_QUARTER_XY(previous_x, previous_y, x, y);
PUSH_QUARTER_XY(previous_y, previous_x, y, x);
collision_segments.push_back(Vector3(a.x, 0, a.y));
collision_segments.push_back(Vector3(b.x, 0, b.y));
collision_segments.push_back(Vector3(0, a.x, a.y));
collision_segments.push_back(Vector3(0, b.x, b.y));
collision_segments.push_back(Vector3(a.x, a.y, 0));
collision_segments.push_back(Vector3(b.x, b.y, 0));
PUSH_QUARTER_YZ(previous_x, previous_y, x, y);
PUSH_QUARTER_YZ(previous_y, previous_x, y, x);
previous_x = x;
previous_y = y;
}
p_gizmo->add_lines(points, material);
p_gizmo->add_collision_segments(collision_segments);
p_gizmo->add_collision_segments(points);
Vector<Vector3> handles;
handles.push_back(Vector3(r, 0, 0));
p_gizmo->add_handles(handles, handles_material);
#undef PUSH_QUARTER
#undef PUSH_QUARTER_XY
#undef PUSH_QUARTER_YZ
}
if (Object::cast_to<GPUParticlesCollisionBox3D>(cs) || Object::cast_to<GPUParticlesAttractorBox3D>(cs) || Object::cast_to<GPUParticlesAttractorVectorField3D>(cs) || Object::cast_to<GPUParticlesCollisionSDF3D>(cs) || Object::cast_to<GPUParticlesCollisionHeightField3D>(cs)) {

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GPU_PARTICLES_COLLISION_3D_GIZMO_PLUGIN_H
#define GPU_PARTICLES_COLLISION_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -53,7 +52,4 @@ public:
void commit_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel = false) override;
GPUParticlesCollision3DGizmoPlugin();
~GPUParticlesCollision3DGizmoPlugin();
};
#endif // GPU_PARTICLES_COLLISION_3D_GIZMO_PLUGIN_H

View file

@ -179,8 +179,8 @@ void JointGizmosDrawer::draw_circle(Vector3::Axis p_axis, real_t p_radius, const
} else {
if (p_limit_lower > p_limit_upper) {
p_limit_lower = -Math_PI;
p_limit_upper = Math_PI;
p_limit_lower = -Math::PI;
p_limit_upper = Math::PI;
}
const int points = 32;

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef JOINT_3D_GIZMO_PLUGIN_H
#define JOINT_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -95,5 +94,3 @@ public:
static void draw_circle(Vector3::Axis p_axis, real_t p_radius, const Transform3D &p_offset, const Basis &p_base, real_t p_limit_lower, real_t p_limit_upper, Vector<Vector3> &r_points, bool p_inverse = false);
static void draw_cone(const Transform3D &p_offset, const Basis &p_base, real_t p_swing, real_t p_twist, Vector<Vector3> &r_points);
};
#endif // JOINT_3D_GIZMO_PLUGIN_H

View file

@ -32,9 +32,6 @@
#include "scene/3d/label_3d.h"
Label3DGizmoPlugin::Label3DGizmoPlugin() {
}
bool Label3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<Label3D>(p_spatial) != nullptr;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LABEL_3D_GIZMO_PLUGIN_H
#define LABEL_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -42,8 +41,4 @@ public:
int get_priority() const override;
bool can_be_hidden() const override;
void redraw(EditorNode3DGizmo *p_gizmo) override;
Label3DGizmoPlugin();
};
#endif // LABEL_3D_GIZMO_PLUGIN_H

View file

@ -179,7 +179,7 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
for (int i = 0; i < arrow_sides; i++) {
for (int j = 0; j < arrow_points; j++) {
Basis ma(Vector3(0, 0, 1), Math_PI * i / arrow_sides);
Basis ma(Vector3(0, 0, 1), Math::PI * i / arrow_sides);
Vector3 v1 = arrow[j] - Vector3(0, 0, arrow_length);
Vector3 v2 = arrow[(j + 1) % arrow_points] - Vector3(0, 0, arrow_length);
@ -295,8 +295,8 @@ float Light3DGizmoPlugin::_find_closest_angle_to_half_pi_arc(const Vector3 &p_fr
Vector3 min_p;
for (int i = 0; i < arc_test_points; i++) {
float a = i * Math_PI * 0.5 / arc_test_points;
float an = (i + 1) * Math_PI * 0.5 / arc_test_points;
float a = i * Math::PI * 0.5 / arc_test_points;
float an = (i + 1) * Math::PI * 0.5 / arc_test_points;
Vector3 p = Vector3(Math::cos(a), 0, -Math::sin(a)) * p_arc_radius;
Vector3 n = Vector3(Math::cos(an), 0, -Math::sin(an)) * p_arc_radius;
@ -311,6 +311,6 @@ float Light3DGizmoPlugin::_find_closest_angle_to_half_pi_arc(const Vector3 &p_fr
}
//min_p = p_arc_xform.affine_inverse().xform(min_p);
float a = (Math_PI * 0.5) - Vector2(min_p.x, -min_p.z).angle();
float a = (Math::PI * 0.5) - Vector2(min_p.x, -min_p.z).angle();
return Math::rad_to_deg(a);
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LIGHT_3D_GIZMO_PLUGIN_H
#define LIGHT_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -52,5 +51,3 @@ public:
Light3DGizmoPlugin();
};
#endif // LIGHT_3D_GIZMO_PLUGIN_H

View file

@ -88,7 +88,7 @@ void LightmapGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
HashSet<Vector2i> lines_found;
Vector<Vector3> points = data->get_capture_points();
if (points.size() == 0) {
if (points.is_empty()) {
return;
}
Vector<Color> sh = data->get_capture_sh();
@ -123,8 +123,8 @@ void LightmapGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
int stack_count = 8;
int sector_count = 16;
float sector_step = (Math_PI * 2.0) / sector_count;
float stack_step = Math_PI / stack_count;
float sector_step = (Math::PI * 2.0) / sector_count;
float stack_step = Math::PI / stack_count;
Vector<Vector3> vertices;
Vector<Color> colors;
@ -141,7 +141,7 @@ void LightmapGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
for (int i = 0; i <= stack_count; ++i) {
float stack_angle = Math_PI / 2 - i * stack_step; // starting from pi/2 to -pi/2
float stack_angle = Math::PI / 2 - i * stack_step; // starting from pi/2 to -pi/2
float xy = radius * Math::cos(stack_angle); // r * cos(u)
float z = radius * Math::sin(stack_angle); // r * sin(u)

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LIGHTMAP_GI_GIZMO_PLUGIN_H
#define LIGHTMAP_GI_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -44,5 +43,3 @@ public:
LightmapGIGizmoPlugin();
};
#endif // LIGHTMAP_GI_GIZMO_PLUGIN_H

View file

@ -66,14 +66,14 @@ void LightmapProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
int stack_count = 8;
int sector_count = 16;
float sector_step = (Math_PI * 2.0) / sector_count;
float stack_step = Math_PI / stack_count;
float sector_step = (Math::PI * 2.0) / sector_count;
float stack_step = Math::PI / stack_count;
Vector<Vector3> vertices;
float radius = 0.2;
for (int i = 0; i <= stack_count; ++i) {
float stack_angle = Math_PI / 2 - i * stack_step; // starting from pi/2 to -pi/2
float stack_angle = Math::PI / 2 - i * stack_step; // starting from pi/2 to -pi/2
float xy = radius * Math::cos(stack_angle); // r * cos(u)
float z = radius * Math::sin(stack_angle); // r * sin(u)

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LIGHTMAP_PROBE_GIZMO_PLUGIN_H
#define LIGHTMAP_PROBE_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -44,5 +43,3 @@ public:
LightmapProbeGizmoPlugin();
};
#endif // LIGHTMAP_PROBE_GIZMO_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef MARKER_3D_GIZMO_PLUGIN_H
#define MARKER_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -46,5 +45,3 @@ public:
Marker3DGizmoPlugin();
};
#endif // MARKER_3D_GIZMO_PLUGIN_H

View file

@ -32,12 +32,9 @@
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/soft_body_3d.h"
#include "scene/3d/physics/soft_body_3d.h"
#include "scene/resources/3d/primitive_meshes.h"
MeshInstance3DGizmoPlugin::MeshInstance3DGizmoPlugin() {
}
bool MeshInstance3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<MeshInstance3D>(p_spatial) != nullptr && Object::cast_to<SoftBody3D>(p_spatial) == nullptr;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef MESH_INSTANCE_3D_GIZMO_PLUGIN_H
#define MESH_INSTANCE_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -42,8 +41,4 @@ public:
int get_priority() const override;
bool can_be_hidden() const override;
void redraw(EditorNode3DGizmo *p_gizmo) override;
MeshInstance3DGizmoPlugin();
};
#endif // MESH_INSTANCE_3D_GIZMO_PLUGIN_H

View file

@ -32,7 +32,7 @@
#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/navigation_link_3d.h"
#include "scene/3d/navigation/navigation_link_3d.h"
#include "servers/navigation_server_3d.h"
NavigationLink3DGizmoPlugin::NavigationLink3DGizmoPlugin() {
@ -70,10 +70,10 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear();
// Number of points in an octant. So there ill be 8 * points_in_octant points in total.
// Number of points in an octant. So there will be 8 * points_in_octant points in total.
// Correspond to the smoothness of the circle.
const uint32_t points_in_octant = 4;
real_t inc = (Math_PI / (4 * points_in_octant));
const uint32_t points_in_octant = 8;
real_t inc = (Math::PI / (4 * points_in_octant));
Vector<Vector3> lines;
// points_in_octant * 8 * 2 per circle * 2 circles. 2 for the start-end. 4 for the arrow, and another 4 if bidirectionnal.

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef NAVIGATION_LINK_3D_GIZMO_PLUGIN_H
#define NAVIGATION_LINK_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -49,5 +48,3 @@ public:
NavigationLink3DGizmoPlugin();
};
#endif // NAVIGATION_LINK_3D_GIZMO_PLUGIN_H

View file

@ -30,7 +30,8 @@
#include "navigation_region_3d_gizmo_plugin.h"
#include "scene/3d/navigation_region_3d.h"
#include "core/math/random_pcg.h"
#include "scene/3d/navigation/navigation_region_3d.h"
#include "servers/navigation_server_3d.h"
NavigationRegion3DGizmoPlugin::NavigationRegion3DGizmoPlugin() {

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef NAVIGATION_REGION_3D_GIZMO_PLUGIN_H
#define NAVIGATION_REGION_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -57,5 +56,3 @@ public:
NavigationRegion3DGizmoPlugin();
};
#endif // NAVIGATION_REGION_3D_GIZMO_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef OCCLUDER_INSTANCE_3D_GIZMO_PLUGIN_H
#define OCCLUDER_INSTANCE_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -49,5 +48,3 @@ public:
OccluderInstance3DGizmoPlugin();
};
#endif // OCCLUDER_INSTANCE_3D_GIZMO_PLUGIN_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PARTICLES_3D_EMISSION_SHAPE_GIZMO_PLUGIN_H
#define PARTICLES_3D_EMISSION_SHAPE_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/gizmos/gizmo_3d_helper.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -53,5 +52,3 @@ public:
Particles3DEmissionShapeGizmoPlugin();
};
#endif // PARTICLES_3D_EMISSION_SHAPE_GIZMO_PLUGIN_H

View file

@ -32,8 +32,8 @@
#include "editor/editor_settings.h"
#include "editor/plugins/gizmos/joint_3d_gizmo_plugin.h"
#include "scene/3d/physical_bone_simulator_3d.h"
#include "scene/3d/physics/physical_bone_3d.h"
#include "scene/3d/physics/physical_bone_simulator_3d.h"
PhysicalBone3DGizmoPlugin::PhysicalBone3DGizmoPlugin() {
create_material("joint_material", EDITOR_GET("editors/3d_gizmos/gizmo_colors/joint"));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PHYSICS_BONE_3D_GIZMO_PLUGIN_H
#define PHYSICS_BONE_3D_GIZMO_PLUGIN_H
#pragma once
#include "editor/plugins/node_3d_editor_gizmos.h"
@ -44,5 +43,3 @@ public:
PhysicalBone3DGizmoPlugin();
};
#endif // PHYSICS_BONE_3D_GIZMO_PLUGIN_H

Some files were not shown because too many files have changed in this diff Show more