You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Allow method binds to take Object subclasses as arguments
This commit adds a condition to VariantCaster that casts Variants of type OBJECT to any type T, if T is derived from Object. This change enables a fair bit of code cleanup. First, the Variant implicit cast operators for Node and Control can be removed, which allows for some invalid includes to be removed. Second, helper methods in Tree whose sole purpose was to cast arguments to TreeItem * are no longer necessary. A few small changes also had to be made to other files, due to the changes cascading down all the includes.
This commit is contained in:
@@ -6623,7 +6623,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
|
||||
// For snapping to be performed, there must be solid geometry under at least one of the selected nodes.
|
||||
// We need to check this before snapping to register the undo/redo action only if needed.
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
Node *node = keys[i];
|
||||
Node *node = Object::cast_to<Node>(keys[i]);
|
||||
Node3D *sp = Object::cast_to<Node3D>(node);
|
||||
Dictionary d = snap_data[node];
|
||||
Vector3 from = d["from"];
|
||||
@@ -6645,7 +6645,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
|
||||
|
||||
// Perform snapping if at least one node can be snapped
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
Node *node = keys[i];
|
||||
Node *node = Object::cast_to<Node>(keys[i]);
|
||||
Node3D *sp = Object::cast_to<Node3D>(node);
|
||||
Dictionary d = snap_data[node];
|
||||
Vector3 from = d["from"];
|
||||
|
||||
Reference in New Issue
Block a user