diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-12 14:24:06 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2020-02-12 14:24:54 -0300 |
commit | cf8c679a23b21d6c6f29cba6a54eaa2eed88bf92 (patch) | |
tree | 52aca947b395362b2addec4843915b15947c32ca /editor/plugins | |
parent | 4aa31a2851e3dd5b67193194f899850239b2669d (diff) |
ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits.
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 30 |
3 files changed, 19 insertions, 20 deletions
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 8dc7e4638d..a729c90160 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -59,7 +59,7 @@ void AnimationTreeEditor::edit(AnimationTree *p_tree) { path = tree->get_meta("_tree_edit_path"); edit_path(path); } else { - current_root = 0; + current_root = ObjectID(); } } @@ -128,7 +128,7 @@ void AnimationTreeEditor::edit_path(const Vector<String> &p_path) { } } } else { - current_root = 0; + current_root = ObjectID(); edited_path = button_path; } @@ -151,7 +151,7 @@ void AnimationTreeEditor::_about_to_show_root() { void AnimationTreeEditor::_notification(int p_what) { if (p_what == NOTIFICATION_PROCESS) { - ObjectID root = 0; + ObjectID root; if (tree && tree->get_tree_root().is_valid()) { root = tree->get_tree_root()->get_instance_id(); } @@ -242,7 +242,6 @@ AnimationTreeEditor::AnimationTreeEditor() { add_child(memnew(HSeparator)); - current_root = 0; singleton = this; editor_base = memnew(PanelContainer); editor_base->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 27ba518f01..f7a3b50052 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3659,7 +3659,7 @@ bool CanvasItemEditor::_build_bones_list(Node *p_node) { // Add a last bone if the Bone2D has no Bone2D child BoneKey bk; bk.from = canvas_item->get_instance_id(); - bk.to = 0; + bk.to = ObjectID(); if (!bone_list.has(bk)) { BoneList b; b.length = 0; diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 88376f6ce6..cf6c8feaed 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -252,7 +252,7 @@ void SpatialEditorViewport::_clear_selected() { void SpatialEditorViewport::_select_clicked(bool p_append, bool p_single, bool p_allow_locked) { - if (!clicked) + if (clicked.is_null()) return; Node *node = Object::cast_to<Node>(ObjectDB::get_instance(clicked)); @@ -309,7 +309,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, Set<Ref<EditorSpatialGizmo> > found_gizmos; Node *edited_scene = get_tree()->get_edited_scene_root(); - ObjectID closest = 0; + ObjectID closest; Node *item = NULL; float closest_dist = 1e20; int selected_handle = -1; @@ -356,7 +356,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, } if (!item) - return 0; + return ObjectID(); if (!editor_selection->is_selected(item) || (r_gizmo_handle && selected_handle >= 0)) { @@ -850,9 +850,9 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) { clicked = selection_results[0].item->get_instance_id(); selection_results.clear(); - if (clicked) { + if (clicked.is_valid()) { _select_clicked(clicked_wants_append, true, spatial_editor->get_tool_mode() != SpatialEditor::TOOL_MODE_LIST_SELECT); - clicked = 0; + clicked = ObjectID(); } } else if (!selection_results.empty()) { @@ -1095,7 +1095,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { if (_gizmo_select(_edit.mouse_pos)) break; - clicked = 0; + clicked = ObjectID(); clicked_includes_current = false; if ((spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SELECT && b->get_control()) || spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_ROTATE) { @@ -1139,7 +1139,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { clicked_wants_append = b->get_shift(); - if (!clicked) { + if (clicked.is_null()) { if (!clicked_wants_append) _clear_selected(); @@ -1150,7 +1150,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { cursor.region_end = b->get_position(); } - if (clicked && gizmo_handle >= 0) { + if (clicked.is_valid() && gizmo_handle >= 0) { Spatial *spa = Object::cast_to<Spatial>(ObjectDB::get_instance(clicked)); if (spa) { @@ -1175,10 +1175,10 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { _edit.gizmo = Ref<EditorSpatialGizmo>(); break; } - if (clicked) { + if (clicked.is_valid()) { _select_clicked(clicked_wants_append, true); // Processing was deferred. - clicked = 0; + clicked = ObjectID(); } if (cursor.region_select) { @@ -1279,7 +1279,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } else if (nav_scheme == NAVIGATION_MODO && m->get_alt()) { nav_mode = NAVIGATION_ORBIT; } else { - if (clicked) { + if (clicked.is_valid()) { if (!clicked_includes_current) { @@ -1288,7 +1288,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } _compute_edit(_edit.mouse_pos); - clicked = 0; + clicked = ObjectID(); _edit.mode = TRANSFORM_TRANSLATE; } @@ -2945,9 +2945,9 @@ void SpatialEditorViewport::_selection_result_pressed(int p_result) { clicked = selection_results[p_result].item->get_instance_id(); - if (clicked) { + if (clicked.is_valid()) { _select_clicked(clicked_wants_append, true, spatial_editor->get_tool_mode() != SpatialEditor::TOOL_MODE_LIST_SELECT); - clicked = 0; + clicked = ObjectID(); } } @@ -3581,7 +3581,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed editor_data = editor->get_scene_tree_dock()->get_editor_data(); editor_selection = editor->get_editor_selection(); undo_redo = editor->get_undo_redo(); - clicked = 0; + clicked_includes_current = false; orthogonal = false; lock_rotation = false; |