Blender V4.5
view3d_dropboxes.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
11#include "BKE_asset.hh"
12#include "BKE_context.hh"
13#include "BKE_idprop.hh"
14#include "BKE_layer.hh"
15#include "BKE_lib_id.hh"
16#include "BKE_library.hh"
17#include "BKE_object.hh"
18
19#include "BLI_math_matrix.h"
20#include "BLI_math_rotation.h"
21#include "BLI_math_vector.h"
22
23#include "BLT_translation.hh"
24
25#include "DEG_depsgraph.hh"
27
28#include "DNA_ID.h"
30#include "DNA_screen_types.h"
31
32#include "ED_object.hh"
33#include "ED_outliner.hh"
34#include "ED_screen.hh"
35#include "ED_undo.hh"
36#include "ED_view3d.hh"
37
38#include "UI_resources.hh"
39
40#include "RNA_access.hh"
41
42#include "WM_api.hh"
43#include "WM_types.hh"
44
45#include "view3d_intern.hh" /* own include */
46
48{
49 ScrArea *area = CTX_wm_area(C);
50 return ED_region_overlap_isect_any_xy(area, event->xy) == false;
51}
52
54 wmDrag *drag,
55 const wmEvent *event)
56{
57 const ScrArea *area = CTX_wm_area(C);
58
59 if (ED_region_overlap_isect_any_xy(area, event->xy)) {
60 return ID_Type(0);
61 }
63 return ID_Type(0);
64 }
65
66 ID *local_id = WM_drag_get_local_ID(drag, 0);
67 if (local_id) {
68 return GS(local_id->name);
69 }
70
71 wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
72 if (asset_drag) {
73 return asset_drag->asset->get_id_type();
74 }
75
76 return ID_Type(0);
77}
78
80 wmDrag *drag,
81 const wmEvent *event,
82 ID_Type id_type)
83{
85 return false;
86 }
87
88 return WM_drag_is_ID_type(drag, id_type);
89}
90
92{
94 if (state) {
95 return state;
96 }
97
99 drop->draw_data = state;
100 state->draw_plane = true;
101 return state;
102}
103
104static void view3d_drop_snap_exit(wmDropBox *drop, wmDrag * /*drag*/)
105{
106 V3DSnapCursorState *state = static_cast<V3DSnapCursorState *>(drop->draw_data);
107 if (state) {
109 drop->draw_data = nullptr;
110 }
111}
112
113static void view3d_ob_drop_on_enter(wmDropBox *drop, wmDrag *drag)
114{
115 /* Don't use the snap cursor when linking the object. Object transform isn't editable then and
116 * would be reset on reload. */
118 return;
119 }
120
122
123 float dimensions[3] = {0.0f};
124 if (drag->type == WM_DRAG_ID) {
125 Object *ob = (Object *)WM_drag_get_local_ID(drag, ID_OB);
127 }
128 else {
130 IDProperty *dimensions_prop = BKE_asset_metadata_idprop_find(meta_data, "dimensions");
131 if (dimensions_prop) {
132 copy_v3_v3(dimensions, static_cast<float *>(IDP_Array(dimensions_prop)));
133 }
134 }
135
136 if (!is_zero_v3(dimensions)) {
137 mul_v3_v3fl(state->box_dimensions, dimensions, 0.5f);
139 state->draw_box = true;
140 }
141}
142
143static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
144{
145 return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB);
146}
148{
149 if (!view3d_ob_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ASSET)) {
150 return false;
151 }
152 return true;
153}
154
159static bool view3d_ob_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
160{
161 if (!view3d_ob_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ID)) {
162 return false;
163 }
164 return true;
165}
166
167static bool view3d_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
168{
169 return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GR);
170}
171
173{
174 if (!view3d_collection_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ID)) {
175 return false;
176 }
177 return true;
178}
179
181 wmDrag *drag,
182 const wmEvent *event)
183{
184 if (!view3d_collection_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ASSET)) {
185 return false;
186 }
187 return true;
188}
189
190static bool view3d_mat_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
191{
192 if (!view3d_drop_id_in_main_region_poll(C, drag, event, ID_MA)) {
193 return false;
194 }
195
197
198 return (ob && ID_IS_EDITABLE(&ob->id) && !ID_IS_OVERRIDE_LIBRARY(&ob->id));
199}
200
202 wmDrag *drag,
203 const int xy[2],
204 wmDropBox * /*drop*/)
205{
206 const char *name = WM_drag_get_item_name(drag);
207 ARegion *region = CTX_wm_region(C);
208 const int mval[2] = {
209 xy[0] - region->winrct.xmin,
210 xy[1] - region->winrct.ymin,
211 };
213}
214
215static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
216{
217 return view3d_drop_id_in_main_region_poll(C, drag, event, ID_WO);
218}
219
220static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
221{
223 if (id_type && OB_DATA_SUPPORT_ID(id_type)) {
224 return true;
225 }
226 return false;
227}
228
229static std::string view3d_object_data_drop_tooltip(bContext * /*C*/,
230 wmDrag * /*drag*/,
231 const int /*xy*/[2],
232 wmDropBox * /*drop*/)
233{
234 return TIP_("Create object instance from object-data");
235}
236
237static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
238{
240 return false;
241 }
242 return WM_drag_is_ID_type(drag, ID_IM);
243}
244
246{
248 if (rv3d && (rv3d->persp == RV3D_CAMOB)) {
249 View3D *v3d = CTX_wm_view3d(C);
250 if (v3d && v3d->camera && v3d->camera->type == OB_CAMERA) {
251 return true;
252 }
253 }
254 return false;
255}
256
257static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
258{
259 if (!view3d_ima_drop_poll(C, drag, event)) {
260 return false;
261 }
262
264 return false;
265 }
266
268}
269
270static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
271{
272 if (!view3d_ima_drop_poll(C, drag, event)) {
273 return false;
274 }
275
277
278 if (ob == nullptr) {
279 return true;
280 }
281
282 if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) {
283 return true;
284 }
285
286 return false;
287}
288
289static bool view3d_geometry_nodes_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
290{
291 if (!view3d_drop_id_in_main_region_poll(C, drag, event, ID_NT)) {
292 return false;
293 }
294
295 if (drag->type == WM_DRAG_ID) {
296 const bNodeTree *node_tree = reinterpret_cast<const bNodeTree *>(
298 if (!node_tree) {
299 return false;
300 }
301 return node_tree->type == NTREE_GEOMETRY;
302 }
303
304 if (drag->type == WM_DRAG_ASSET) {
305 const wmDragAsset *asset_data = WM_drag_get_asset_data(drag, ID_NT);
306 if (!asset_data) {
307 return false;
308 }
309 const AssetMetaData *metadata = &asset_data->asset->get_metadata();
310 const IDProperty *tree_type = BKE_asset_metadata_idprop_find(metadata, "type");
311 if (!tree_type || IDP_Int(tree_type) != NTREE_GEOMETRY) {
312 return false;
313 }
314 if (wmDropBox *drop_box = drag->drop_state.active_dropbox) {
315 const uint32_t uid = RNA_int_get(drop_box->ptr, "session_uid");
316 const bNodeTree *node_tree = reinterpret_cast<const bNodeTree *>(
318 if (node_tree) {
319 return node_tree->type == NTREE_GEOMETRY;
320 }
321 }
322 }
323 return true;
324}
325
327 wmDrag * /*drag*/,
328 const int xy[2],
329 wmDropBox *drop)
330{
331 ARegion *region = CTX_wm_region(C);
332 int mval[2] = {xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin};
334}
335
337 Object *ob,
338 float obmat_final[4][4])
339{
340 using namespace blender;
342 BLI_assert(snap_state->draw_box || snap_state->draw_plane);
343 UNUSED_VARS_NDEBUG(snap_state);
344 copy_m4_m3(obmat_final, snap_data->plane_omat);
345 copy_v3_v3(obmat_final[3], snap_data->loc);
346
347 float scale[3];
348 mat4_to_size(scale, ob->object_to_world().ptr());
349 rescale_m4(obmat_final, scale);
350
351 if (const std::optional<Bounds<float3>> bb = BKE_object_boundbox_get(ob)) {
352 float3 offset = math::midpoint(bb->min, bb->max);
353 offset[2] = bb->min[2];
354 mul_mat3_m4_v3(obmat_final, offset);
355 sub_v3_v3(obmat_final[3], offset);
356 }
357}
358
359static void view3d_ob_drop_copy_local_id(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
360{
361 ID *id = WM_drag_get_local_ID(drag, ID_OB);
362
363 RNA_int_set(drop->ptr, "session_uid", id->session_uid);
364 /* Don't duplicate ID's which were just imported. Only do that for existing, local IDs. */
365 BLI_assert(drag->type != WM_DRAG_ASSET);
366
368 float obmat_final[4][4];
369
370 view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final);
371
372 RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]);
373}
374
375/* Mostly the same logic as #view3d_collection_drop_copy_external_asset(), just different enough to
376 * make sharing code a bit difficult. */
378{
379 /* NOTE(@ideasman42): Selection is handled here, de-selecting objects before append,
380 * using auto-select to ensure the new objects are selected.
381 * This is done so #OBJECT_OT_transform_to_mouse (which runs after this drop handler)
382 * can use the context setup here to place the objects. */
383 BLI_assert(drag->type == WM_DRAG_ASSET);
384
385 wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
386 Scene *scene = CTX_data_scene(C);
387 ViewLayer *view_layer = CTX_data_view_layer(C);
388
389 BKE_view_layer_base_deselect_all(scene, view_layer);
390
391 ID *id = WM_drag_asset_id_import(C, asset_drag, FILE_AUTOSELECT);
392
393 /* TODO(sergey): Only update relations for the current scene. */
396
397 RNA_int_set(drop->ptr, "session_uid", id->session_uid);
398
399 BKE_view_layer_synced_ensure(scene, view_layer);
400 Base *base = BKE_view_layer_base_find(view_layer, (Object *)id);
401 if (base != nullptr) {
404 }
407
408 /* Make sure the depsgraph is evaluated so the new object's transforms are up-to-date.
409 * The evaluated #Object::object_to_world() will be copied back to the original object
410 * and used below. */
412
413 V3DSnapCursorState *snap_state = static_cast<V3DSnapCursorState *>(drop->draw_data);
414 if (snap_state) {
415 float obmat_final[4][4];
416
417 view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final);
418
419 RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]);
420 }
421}
422
424{
426 const wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
427 /* Linked collections cannot be transformed except when using instancing. Don't enable
428 * snapping. */
429 if (!asset_drag->import_settings.use_instance_collections) {
430 return;
431 }
432 }
433
435}
436
438 float r_loc[3],
439 float r_rot[3])
440{
441 using namespace blender;
443 BLI_assert(snap_state->draw_box || snap_state->draw_plane);
444 UNUSED_VARS_NDEBUG(snap_state);
445
446 mat3_normalized_to_eul(r_rot, snap_data->plane_omat);
447 copy_v3_v3(r_loc, snap_data->loc);
448}
449
451{
452 ID *id = WM_drag_get_local_ID(drag, ID_GR);
453 RNA_int_set(drop->ptr, "session_uid", int(id->session_uid));
454
456
457 float loc[3], rot[3];
459 RNA_float_set_array(drop->ptr, "location", loc);
460 RNA_float_set_array(drop->ptr, "rotation", rot);
461}
462
463/* Mostly the same logic as #view3d_ob_drop_copy_external_asset(), just different enough to make
464 * sharing code a bit difficult. */
466{
467 BLI_assert(drag->type == WM_DRAG_ASSET);
468
469 wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
470 Scene *scene = CTX_data_scene(C);
471 ViewLayer *view_layer = CTX_data_view_layer(C);
472
473 BKE_view_layer_base_deselect_all(scene, view_layer);
474
475 const bool use_instance_collections = asset_drag->import_settings.use_instance_collections;
476 /* Temporarily disable instancing for the import, the drop operator handles that. */
477 asset_drag->import_settings.use_instance_collections = false;
478
479 ID *id = WM_drag_asset_id_import(C, asset_drag, FILE_AUTOSELECT);
480 Collection *collection = (Collection *)id;
481
482 /* Reset temporary override. */
483 asset_drag->import_settings.use_instance_collections = use_instance_collections;
484
485 /* TODO(sergey): Only update relations for the current scene. */
488
489 RNA_int_set(drop->ptr, "session_uid", int(id->session_uid));
490 RNA_boolean_set(drop->ptr, "use_instance", asset_drag->import_settings.use_instance_collections);
491
492 /* Make an object active, just use the first one in the collection. */
493 CollectionObject *cobject = static_cast<CollectionObject *>(collection->gobject.first);
494 BKE_view_layer_synced_ensure(scene, view_layer);
495 Base *base = cobject ? BKE_view_layer_base_find(view_layer, cobject->ob) : nullptr;
496 if (base) {
500 }
503
504 V3DSnapCursorState *snap_state = static_cast<V3DSnapCursorState *>(drop->draw_data);
505 if (snap_state) {
506 float loc[3], rot[3];
508 RNA_float_set_array(drop->ptr, "location", loc);
509 RNA_float_set_array(drop->ptr, "rotation", rot);
510 }
511
512 /* XXX Without an undo push here, there will be a crash when the user modifies operator
513 * properties. The stuff we do in these drop callbacks just isn't safe over undo/redo. */
514 ED_undo_push(C, "Collection_Drop");
515}
516
517static void view3d_id_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
518{
520
522 RNA_boolean_set(drop->ptr, "show_datablock_in_modifier", (drag->type != WM_DRAG_ASSET));
523}
524
526{
527 view3d_id_drop_copy(C, drag, drop);
528 RNA_boolean_set(drop->ptr, "show_datablock_in_modifier", (drag->type != WM_DRAG_ASSET));
529}
530
532{
534
535 RNA_enum_set(drop->ptr, "type", GS(id->name));
537}
538
540{
542
543 if (id) {
545 RNA_struct_property_unset(drop->ptr, "filepath");
546 return;
547 }
548}
549
551{
553
554 wmDropBox *drop;
555 drop = WM_dropbox_add(lb,
556 "OBJECT_OT_add_named",
560 nullptr);
561
565
566 drop = WM_dropbox_add(lb,
567 "OBJECT_OT_transform_to_mouse",
571 nullptr);
572
576
577 drop = WM_dropbox_add(lb,
578 "OBJECT_OT_collection_external_asset_drop",
582 nullptr);
586 drop = WM_dropbox_add(lb,
587 "OBJECT_OT_collection_instance_add",
591 nullptr);
595
597 "OBJECT_OT_drop_named_material",
603 "OBJECT_OT_drop_geometry_nodes",
609 "VIEW3D_OT_camera_background_image_add",
613 nullptr);
615 "OBJECT_OT_empty_image_add",
619 nullptr);
621 "OBJECT_OT_data_instance_add",
627 "VIEW3D_OT_drop_world",
631 nullptr);
632}
Main runtime representation of an asset.
IDProperty * BKE_asset_metadata_idprop_find(const AssetMetaData *asset_data, const char *name) ATTR_WARN_UNUSED_RESULT
Definition asset.cc:179
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
#define IDP_Int(prop)
#define IDP_Array(prop)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
void BKE_view_layer_base_deselect_all(const Scene *scene, ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void BKE_view_layer_base_select_and_set_active(ViewLayer *view_layer, Base *selbase)
ID * BKE_libblock_find_session_uid(Main *bmain, short type, uint32_t session_uid)
Definition lib_id.cc:1697
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_eval_cached_get(const Object *ob, float r_vec[3])
std::optional< blender::Bounds< blender::float3 > > BKE_object_boundbox_get(const Object *ob)
#define BLI_assert(a)
Definition BLI_assert.h:46
void copy_m4_m3(float m1[4][4], const float m2[3][3])
void rescale_m4(float mat[4][4], const float scale[3])
void mat4_to_size(float size[3], const float M[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void mat3_normalized_to_eul(float eul[3], const float mat[3][3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
#define UNUSED_VARS_NDEBUG(...)
#define TIP_(msgid)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
ID and Library types, which are fundamental for SDNA.
@ ID_RECALC_SELECT
Definition DNA_ID.h:1009
ID_Type
@ ID_IM
@ ID_NT
@ ID_WO
@ ID_MA
@ ID_GR
@ ID_OB
Object groups, one object can be in many groups at once.
@ BASE_ENABLED_VIEWPORT
@ NTREE_GEOMETRY
#define OB_DATA_SUPPORT_ID(_id_type)
@ OB_EMPTY
@ OB_CAMERA
@ OB_EMPTY_IMAGE
#define BASE_SELECTABLE(v3d, base)
@ RGN_TYPE_WINDOW
@ SPACE_VIEW3D
@ FILE_AUTOSELECT
@ RV3D_CAMOB
void ED_outliner_select_sync_from_object_tag(bContext *C)
bool ED_region_overlap_isect_any_xy(const ScrArea *area, const int event_xy[2])
Definition area_query.cc:54
void ED_undo_push(bContext *C, const char *str)
Definition ed_undo.cc:99
V3DSnapCursorState * ED_view3d_cursor_snap_state_create()
V3DSnapCursorState * ED_view3d_cursor_snap_state_active_get()
Object * ED_view3d_give_object_under_cursor(bContext *C, const int mval[2])
bool ED_view3d_is_object_under_cursor(bContext *C, const int mval[2])
void ED_view3d_cursor_snap_state_free(V3DSnapCursorState *state)
V3DSnapCursorData * ED_view3d_cursor_snap_data_get()
#define C
Definition RandGen.cpp:29
@ TH_GIZMO_PRIMARY
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
#define ND_OB_ACTIVE
Definition WM_types.hh:437
#define NC_SCENE
Definition WM_types.hh:375
#define ND_LAYER_CONTENT
Definition WM_types.hh:450
@ WM_DRAG_ASSET
Definition WM_types.hh:1199
@ WM_DRAG_ID
Definition WM_types.hh:1198
#define rot(x, k)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define GS(a)
static ulong state[N]
std::string drop_named_material_tooltip(bContext *C, const char *name, const int mval[2])
std::string drop_geometry_nodes_tooltip(bContext *C, PointerRNA *properties, const int mval[2])
T midpoint(const T &a, const T &b)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
short flag
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
unsigned int session_uid
Definition DNA_ID.h:444
void * first
char empty_drawtype
float plane_omat[3][3]
Definition ED_view3d.hh:345
struct Object * camera
int ymin
int xmin
wmDropBox * active_dropbox
Definition WM_types.hh:1293
const AssetRepresentationHandle * asset
Definition WM_types.hh:1239
AssetImportSettings import_settings
Definition WM_types.hh:1240
eWM_DragDataType type
Definition WM_types.hh:1327
wmDragActiveDropState drop_state
Definition WM_types.hh:1336
void * draw_data
Definition WM_types.hh:1397
PointerRNA * ptr
Definition WM_types.hh:1415
void(* on_exit)(wmDropBox *drop, wmDrag *drag)
Definition WM_types.hh:1370
void(* on_enter)(wmDropBox *drop, wmDrag *drag)
Definition WM_types.hh:1366
void(* draw_droptip)(bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])
Definition WM_types.hh:1386
int xy[2]
Definition WM_types.hh:758
int mval[2]
Definition WM_types.hh:760
static void view3d_ob_drop_copy_external_asset(bContext *C, wmDrag *drag, wmDropBox *drop)
static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_collection_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static void view3d_id_path_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
static void view3d_collection_drop_copy_local_id(bContext *, wmDrag *drag, wmDropBox *drop)
static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_ima_bg_is_camera_view(bContext *C)
static bool view3d_collection_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event)
static void view3d_drop_snap_exit(wmDropBox *drop, wmDrag *)
static void view3d_ob_drop_matrix_from_snap(V3DSnapCursorState *snap_state, Object *ob, float obmat_final[4][4])
static std::string view3d_object_data_drop_tooltip(bContext *, wmDrag *, const int[2], wmDropBox *)
static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_ob_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
void view3d_dropboxes()
static void view3d_geometry_nodes_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
static bool view3d_ob_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event)
static std::string view3d_geometry_nodes_drop_tooltip(bContext *C, wmDrag *, const int xy[2], wmDropBox *drop)
static bool view3d_drop_in_main_region_poll(bContext *C, const wmEvent *event)
static void view3d_id_drop_copy_with_type(bContext *C, wmDrag *drag, wmDropBox *drop)
static void view3d_collection_drop_copy_external_asset(bContext *C, wmDrag *drag, wmDropBox *drop)
static bool view3d_drop_id_in_main_region_poll(bContext *C, wmDrag *drag, const wmEvent *event, ID_Type id_type)
static V3DSnapCursorState * view3d_drop_snap_init(wmDropBox *drop)
static std::string view3d_mat_drop_tooltip(bContext *C, wmDrag *drag, const int xy[2], wmDropBox *)
static void view3d_ob_drop_copy_local_id(bContext *, wmDrag *drag, wmDropBox *drop)
static bool view3d_geometry_nodes_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static bool view3d_mat_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static void view3d_collection_drop_on_enter(wmDropBox *drop, wmDrag *drag)
static void view3d_collection_drop_matrix_from_snap(V3DSnapCursorState *snap_state, float r_loc[3], float r_rot[3])
static bool view3d_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
static void view3d_ob_drop_on_enter(wmDropBox *drop, wmDrag *drag)
static void view3d_id_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
static ID_Type view3d_drop_id_in_main_region_poll_get_id_type(bContext *C, wmDrag *drag, const wmEvent *event)
AssetMetaData * WM_drag_get_asset_meta_data(const wmDrag *drag, int idcode)
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *C, wmDrag *drag, const wmEvent *event), void(*copy)(bContext *C, wmDrag *drag, wmDropBox *drop), void(*cancel)(Main *bmain, wmDrag *drag, wmDropBox *drop), WMDropboxTooltipFunc tooltip)
void WM_drag_draw_item_name_fn(bContext *, wmWindow *win, wmDrag *drag, const int xy[2])
void WM_drag_free_imported_drag_ID(Main *bmain, wmDrag *drag, wmDropBox *drop)
bool WM_drag_asset_will_import_linked(const wmDrag *drag)
ID * WM_drag_asset_id_import(const bContext *C, wmDragAsset *asset_drag, const int flag_extra)
const char * WM_drag_get_item_name(wmDrag *drag)
bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
ID * WM_drag_get_local_ID_or_import_from_asset(const bContext *C, const wmDrag *drag, int idcode)
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
wmDragAsset * WM_drag_get_asset_data(const wmDrag *drag, int idcode)
ID * WM_drag_get_local_ID(const wmDrag *drag, short idcode)
int xy[2]
Definition wm_draw.cc:174
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_operator_properties_id_lookup_set_from_id(PointerRNA *ptr, const ID *id)