Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_dragdrop.cc')
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.cc73
1 files changed, 57 insertions, 16 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.cc b/source/blender/editors/space_outliner/outliner_dragdrop.cc
index edd2e5f304f..30b81b2ecb2 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.cc
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.cc
@@ -46,7 +46,9 @@
static Collection *collection_parent_from_ID(ID *id);
-/* ******************** Drop Target Find *********************** */
+/* -------------------------------------------------------------------- */
+/** \name Drop Target Find
+ * \{ */
static TreeElement *outliner_dropzone_element(TreeElement *te,
const float fmval[2],
@@ -254,7 +256,11 @@ static int outliner_get_insert_index(TreeElement *drag_te,
return BLI_findindex(listbase, drop_te->directdata);
}
-/* ******************** Parent Drop Operator *********************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Parent Drop Operator
+ * \{ */
static bool parent_drop_allowed(TreeElement *te, Object *potential_child)
{
@@ -443,7 +449,11 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-/* ******************** Parent Clear Operator *********************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Parent Clear Operator
+ * \{ */
static bool parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
@@ -527,7 +537,11 @@ void OUTLINER_OT_parent_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-/* ******************** Scene Drop Operator *********************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Scene Drop Operator
+ * \{ */
static bool scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
@@ -592,7 +606,11 @@ void OUTLINER_OT_scene_drop(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-/* ******************** Material Drop Operator *********************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Material Drop Operator
+ * \{ */
static bool material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
@@ -641,15 +659,19 @@ void OUTLINER_OT_material_drop(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-/* ******************** Data Stack Drop Operator *********************** */
+/** \} */
-/* A generic operator to allow drag and drop for modifiers, constraints,
+/* -------------------------------------------------------------------- */
+/** \name Data Stack Drop Operator
+ *
+ * A generic operator to allow drag and drop for modifiers, constraints,
* and shader effects which all share the same UI stack layout.
*
* The following operations are allowed:
* - Reordering within an object.
* - Copying a single modifier/constraint/effect to another object.
- * - Copying (linking) an object's modifiers/constraints/effects to another. */
+ * - Copying (linking) an object's modifiers/constraints/effects to another.
+ * \{ */
enum eDataStackDropAction {
DATA_STACK_DROP_REORDER,
@@ -1069,7 +1091,11 @@ void OUTLINER_OT_datastack_drop(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-/* ******************** Collection Drop Operator *********************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Collection Drop Operator
+ * \{ */
struct CollectionDrop {
Collection *from;
@@ -1350,7 +1376,11 @@ void OUTLINER_OT_collection_drop(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-/* ********************* Outliner Drag Operator ******************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Outliner Drag Operator
+ * \{ */
#define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD 7 /* In UI units */
@@ -1358,9 +1388,12 @@ static TreeElement *outliner_item_drag_element_find(SpaceOutliner *space_outline
ARegion *region,
const wmEvent *event)
{
- /* NOTE: using EVT_TWEAK_ events to trigger dragging is fine,
+ /* NOTE: using click-drag events to trigger dragging is fine,
* it sends coordinates from where dragging was started */
- const float my = UI_view2d_region_to_view_y(&region->v2d, event->mval[1]);
+ int mval[2];
+ WM_event_drag_start_mval(event, region, mval);
+
+ const float my = UI_view2d_region_to_view_y(&region->v2d, mval[1]);
return outliner_find_item_at_y(space_outliner, &space_outliner->tree, my);
}
@@ -1372,6 +1405,9 @@ static int outliner_item_drag_drop_invoke(bContext *C,
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te = outliner_item_drag_element_find(space_outliner, region, event);
+ int mval[2];
+ WM_event_drag_start_mval(event, region, mval);
+
if (!te) {
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
@@ -1383,8 +1419,7 @@ static int outliner_item_drag_drop_invoke(bContext *C,
}
float view_mval[2];
- UI_view2d_region_to_view(
- &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
if (outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
@@ -1399,7 +1434,7 @@ static int outliner_item_drag_drop_invoke(bContext *C,
PointerRNA op_ptr;
WM_operator_properties_create_ptr(&op_ptr, ot);
RNA_float_set(&op_ptr, "outside_padding", OUTLINER_DRAG_SCOLL_OUTSIDE_PAD);
- WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr);
+ WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr, event);
WM_operator_properties_free(&op_ptr);
}
@@ -1523,7 +1558,11 @@ void OUTLINER_OT_item_drag_drop(wmOperatorType *ot)
#undef OUTLINER_DRAG_SCOLL_OUTSIDE_PAD
-/* *************************** Drop Boxes ************************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Drop Boxes
+ * \{ */
void outliner_dropboxes(void)
{
@@ -1546,3 +1585,5 @@ void outliner_dropboxes(void)
nullptr,
collection_drop_tooltip);
}
+
+/** \} */