| 262 | } |
| 263 | |
| 264 | StringName MultiNodeEdit::get_edited_class_name() const { |
| 265 | Node *es = EditorNode::get_singleton()->get_edited_scene(); |
| 266 | if (!es) { |
| 267 | return SNAME("Node"); |
| 268 | } |
| 269 | |
| 270 | // Get the class name of the first node. |
| 271 | StringName class_name; |
| 272 | for (const NodePath &E : nodes) { |
| 273 | Node *node = es->get_node_or_null(E); |
| 274 | if (!node) { |
| 275 | continue; |
| 276 | } |
| 277 | |
| 278 | class_name = node->get_class_name(); |
| 279 | break; |
| 280 | } |
| 281 | |
| 282 | if (class_name == StringName()) { |
| 283 | return SNAME("Node"); |
| 284 | } |
| 285 | |
| 286 | bool check_again = true; |
| 287 | while (check_again) { |
| 288 | check_again = false; |
| 289 | |
| 290 | if (class_name == SNAME("Node") || class_name == StringName()) { |
| 291 | // All nodes inherit from Node, so no need to continue checking. |
| 292 | return SNAME("Node"); |
| 293 | } |
| 294 | |
| 295 | // Check that all nodes inherit from class_name. |
| 296 | for (const NodePath &E : nodes) { |
| 297 | Node *node = es->get_node_or_null(E); |
| 298 | if (!node) { |
| 299 | continue; |
| 300 | } |
| 301 | |
| 302 | const StringName node_class_name = node->get_class_name(); |
| 303 | if (class_name == node_class_name || ClassDB::is_parent_class(node_class_name, class_name)) { |
| 304 | // class_name is the same or a parent of the node's class. |
| 305 | continue; |
| 306 | } |
| 307 | |
| 308 | // class_name is not a parent of the node's class, so check again with the parent class. |
| 309 | class_name = ClassDB::get_parent_class(class_name); |
| 310 | check_again = true; |
| 311 | break; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | return class_name; |
| 316 | } |
| 317 | |
| 318 | void MultiNodeEdit::set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field) { |
| 319 | // Ignore the field with arrays and dictionaries, as they are passed whole when edited. |