diff options
author | Julian Eisel <julian@blender.org> | 2022-05-24 17:47:48 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-05-24 18:08:02 +0300 |
commit | 7b778166db4048b5109146bc073ab85fa49261f4 (patch) | |
tree | 8d95e63e4c3fd655ccc322c1fd8cda49b79465ce /source/blender/editors/object | |
parent | 25d216724bc195d25aaaf336ab1cd3e7c55d78bf (diff) |
Cleanup: Use new helpers for passing IDs from drag & drop to operators
There are now some generalized helpers for passing IDs from drag & drop
to operators via operator properties, mostly introduced in 917c096be6b9
and 8f79fa9c6780. These can be used in a bunch of places to reduce
duplicated code and explicitly share a common solution.
Side-effect: The "Name" property won't show up in the Adjust Last
Operation anymore, and its value won't be remembered over multiple
executions of the operator. Both were not at all useful from what I can
tell, and I doubt this was done intentionally.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.cc | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 1fb7d50856b..35745bc7208 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -1729,8 +1729,7 @@ static int object_instance_add_invoke(bContext *C, wmOperator *op, const wmEvent RNA_int_set(op->ptr, "drop_y", event->xy[1]); } - if (!RNA_struct_property_is_set(op->ptr, "name") && - !RNA_struct_property_is_set(op->ptr, "session_uuid")) { + if (!WM_operator_properties_id_lookup_is_set(op->ptr)) { return WM_enum_search_invoke(C, op, event); } return op->type->exec(C, op); @@ -1762,16 +1761,7 @@ void OBJECT_OT_collection_instance_add(wmOperatorType *ot) ot->prop = prop; ED_object_add_generic_props(ot, false); - prop = RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the collection to add", - INT32_MIN, - INT32_MAX); - RNA_def_property_flag(prop, (PropertyFlag)(PROP_SKIP_SAVE | PROP_HIDDEN)); + WM_operator_properties_id_lookup(ot, false); object_add_drop_xy_props(ot); } @@ -1868,16 +1858,7 @@ void OBJECT_OT_collection_external_asset_drop(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* properties */ - prop = RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the collection to add", - INT32_MIN, - INT32_MAX); - RNA_def_property_flag(prop, (PropertyFlag)(PROP_SKIP_SAVE | PROP_HIDDEN)); + WM_operator_properties_id_lookup(ot, false); ED_object_add_generic_props(ot, false); |