| 288 | } |
| 289 | |
| 290 | bool ActionMapEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { |
| 291 | Dictionary d = p_data; |
| 292 | if (!d.has("input_type")) { |
| 293 | return false; |
| 294 | } |
| 295 | |
| 296 | TreeItem *source = Object::cast_to<TreeItem>(ObjectDB::get_instance(d["source"].operator ObjectID())); |
| 297 | TreeItem *selected = action_tree->get_selected(); |
| 298 | |
| 299 | TreeItem *item = (p_point == Vector2(Math::INF, Math::INF)) ? selected : action_tree->get_item_at_position(p_point); |
| 300 | if (!selected || !item || item == source) { |
| 301 | return false; |
| 302 | } |
| 303 | |
| 304 | // Don't allow moving an action in-between events. |
| 305 | if (d["input_type"] == "action" && item->has_meta("__event")) { |
| 306 | return false; |
| 307 | } |
| 308 | |
| 309 | // Don't allow moving an event to a different action. |
| 310 | if (d["input_type"] == "event" && item->get_parent() != selected->get_parent()) { |
| 311 | return false; |
| 312 | } |
| 313 | |
| 314 | return true; |
| 315 | } |
| 316 | |
| 317 | void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { |
| 318 | if (!can_drop_data_fw(p_point, p_data, p_from)) { |
nothing calls this directly
no test coverage detected