Merge pull request #111837 from bruvzg/objid_select

Use ObjectID to store nodes in the editor selection.
This commit is contained in:
Rémi Verschelde
2025-12-18 23:30:54 +01:00
8 changed files with 127 additions and 85 deletions

View File

@@ -673,12 +673,12 @@ Transform3D Node3DEditorViewport::to_camera_transform(const Cursor &p_cursor) co
}
int Node3DEditorViewport::get_selected_count() const {
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
const HashMap<ObjectID, Object *> &selection = editor_selection->get_selection();
int count = 0;
for (const KeyValue<Node *, Object *> &E : selection) {
Node3D *sp = Object::cast_to<Node3D>(E.key);
for (const KeyValue<ObjectID, Object *> &E : selection) {
Node3D *sp = ObjectDB::get_instance<Node3D>(E.key);
if (!sp) {
continue;
}
@@ -3349,13 +3349,13 @@ void Node3DEditorViewport::_notification(int p_what) {
_update_camera(delta);
}
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
const HashMap<ObjectID, Object *> &selection = editor_selection->get_selection();
bool changed = false;
bool exist = false;
for (const KeyValue<Node *, Object *> &E : selection) {
Node3D *sp = Object::cast_to<Node3D>(E.key);
for (const KeyValue<ObjectID, Object *> &E : selection) {
Node3D *sp = ObjectDB::get_instance<Node3D>(E.key);
if (!sp) {
continue;
}
@@ -8497,10 +8497,10 @@ void Node3DEditor::update_grid() {
void Node3DEditor::_selection_changed() {
_refresh_menu_icons();
const HashMap<Node *, Object *> &selection = editor_selection->get_selection();
const HashMap<ObjectID, Object *> &selection = editor_selection->get_selection();
for (const KeyValue<Node *, Object *> &E : selection) {
Node3D *sp = Object::cast_to<Node3D>(E.key);
for (const KeyValue<ObjectID, Object *> &E : selection) {
Node3D *sp = ObjectDB::get_instance<Node3D>(E.key);
if (!sp) {
continue;
}