70 if ((fmval[1] > te->
ys) && (fmval[1] < (te->
ys +
UI_UNIT_Y))) {
139 ®ion->
v2d, event->
mval[0], event->
mval[1], &view_mval[0], &view_mval[1]);
145 const float margin =
UI_UNIT_Y * (1.0f / 4);
147 if (view_mval[1] < (te_hovered->
ys + margin)) {
161 if (view_mval[1] > (te_hovered->
ys + (3 * margin))) {
174 if (view_mval[1] < last->
ys) {
192 if (check_type(te)) {
228 if (!collection_te) {
233 if (collection_te != te) {
242 return collection_te;
253 drop_te = drop_te->
prev;
258 drop_te = drop_te->
next;
262 if (drop_te ==
NULL) {
280 if (potential_parent == potential_child) {
286 if (potential_parent == potential_child->
parent) {
322 const char **
UNUSED(r_tooltip))
332 if (!potential_child) {
361 const bool keep_transform)
378 bool parent_set =
false;
379 bool linked_objects =
false;
381 for (
wmDragID *drag_id = drag; drag_id; drag_id = drag_id->
next) {
382 if (
GS(drag_id->id->name) ==
ID_OB) {
387 linked_objects =
true;
392 reports,
C,
scene,
object, parent, parent_type,
false, keep_transform,
NULL)) {
398 if (linked_objects) {
443 ot->
name =
"Drop to Set Parent (hold Alt to keep transforms)";
445 ot->
idname =
"OUTLINER_OT_parent_drop";
461 const char **
UNUSED(r_tooltip))
513 if (
GS(drag_id->id->name) ==
ID_OB) {
529 ot->
name =
"Drop to Clear Parent (hold Alt to keep transforms)";
531 ot->
idname =
"OUTLINER_OT_parent_clear";
547 const char **
UNUSED(r_tooltip))
597 ot->
name =
"Drop Object to Scene";
599 ot->
idname =
"OUTLINER_OT_scene_drop";
615 const char **
UNUSED(r_tooltip))
649 ot->
name =
"Drop Material on Object";
651 ot->
idname =
"OUTLINER_OT_material_drop";
705 drag->
poin = drop_data;
763 else if (ob && ob != drop_data->
ob_parent) {
764 drop_data->
drop_te = object_te;
771 else if (ob || pchan) {
779 else if (ob && ob != drop_data->
ob_parent) {
782 drop_data->
drop_te = object_te;
790 drop_data->
drop_te = te_target;
844 const char **r_tooltip)
883 *r_tooltip =
TIP_(
"Reorder");
887 *r_tooltip =
TIP_(
"Copy to bone");
890 *r_tooltip =
TIP_(
"Copy to object");
895 *r_tooltip =
TIP_(
"Link all to bone");
898 *r_tooltip =
TIP_(
"Link all to object");
1061 ot->
name =
"Data Stack Drop";
1062 ot->
description =
"Copy or reorder modifiers, constraints, and effects";
1063 ot->
idname =
"OUTLINER_OT_datastack_drop";
1093 return ((
Scene *)
id)->master_collection;
1129 if (drag_id ==
NULL) {
1133 ID *
id = drag_id->
id;
1142 from_collection =
NULL;
1147 if (
id == &to_collection->
id) {
1155 data->from = from_collection;
1156 data->to = to_collection;
1158 data->insert_type = insert_type;
1166 const char **r_tooltip)
1180 *r_tooltip =
TIP_(
"Link inside Collection");
1183 switch (
data.insert_type) {
1188 *r_tooltip =
TIP_(
"Move between collections");
1191 *r_tooltip =
TIP_(
"Move before collection");
1198 *r_tooltip =
TIP_(
"Move between collections");
1201 *r_tooltip =
TIP_(
"Move after collection");
1214 *r_tooltip =
TIP_(
"Move inside collection (Ctrl to link, Shift to parent)");
1217 *r_tooltip =
TIP_(
"Move inside collection (Ctrl to link)");
1253 bool relative_after =
false;
1277 if (
GS(drag_id->id->name) ==
ID_OB) {
1288 else if (
GS(drag_id->id->name) ==
ID_GR) {
1292 if (collection !=
from) {
1313 ot->
name =
"Move to Collection";
1315 ot->
idname =
"OUTLINER_OT_collection_drop";
1327 #define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD 7
1353 if (!
data.drag_id) {
1359 ®ion->
v2d, event->
mval[0], event->
mval[1], &view_mval[0], &view_mval[1]);
1378 const bool use_datastack_drag =
ELEM(tselem->
type,
1389 if (use_datastack_drag) {
1410 &space_outliner->
tree,
1418 &space_outliner->
tree,
1434 bool parent_selected =
false;
1436 te_parent = te_parent->
parent) {
1439 parent_selected =
true;
1445 if (parent_selected) {
1455 if (te_selected->
parent) {
1457 te_parent = te_parent->
parent) {
1490 ot->
name =
"Drag and Drop";
1491 ot->
idname =
"OUTLINER_OT_item_drag_drop";
1498 #undef OUTLINER_DRAG_SCOLL_OUTSIDE_PAD
bool BKE_collection_object_add(struct Main *bmain, struct Collection *collection, struct Object *ob)
bool BKE_collection_is_empty(const struct Collection *collection)
bool BKE_collection_move(struct Main *bmain, struct Collection *to_parent, struct Collection *from_parent, struct Collection *relative, bool relative_after, struct Collection *collection)
void BKE_collection_object_move(struct Main *bmain, struct Scene *scene, struct Collection *collection_dst, struct Collection *collection_src, struct Object *ob)
struct Scene * CTX_data_scene(const bContext *C)
struct SpaceOutliner * CTX_wm_space_outliner(const bContext *C)
struct Collection * CTX_data_collection(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
bool BKE_scene_has_object(struct Scene *scene, struct Object *ob)
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
General operations, lookup, etc. for materials.
@ BKE_MAT_ASSIGN_USERPREF
void BKE_object_material_assign(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type)
General operations, lookup, etc. for blender objects.
bool BKE_object_is_child_recursive(const struct Object *ob_parent, const struct Object *ob_child)
void BKE_report(ReportList *reports, ReportType type, const char *message)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
@ TSE_LIBRARY_OVERRIDE_BASE
@ TSE_GPENCIL_EFFECT_BASE
@ SO_FILTER_NO_COLLECTION
bool ED_object_parent_set(struct ReportList *reports, const struct bContext *C, struct Scene *scene, struct Object *const ob, struct Object *const par, int partype, const bool xmirror, const bool keep_transform, const int vert_par[3])
void ED_object_modifier_link(struct bContext *C, struct Object *ob_dst, struct Object *ob_src)
@ CLEAR_PARENT_KEEP_TRANSFORM
void ED_object_shaderfx_link(struct Object *dst, struct Object *src)
bool ED_object_gpencil_modifier_move_to_index(struct ReportList *reports, struct Object *ob, struct GpencilModifierData *md, const int index)
void ED_object_parent_clear(struct Object *ob, const int type)
void ED_object_modifier_copy_to_object(struct bContext *C, struct Object *ob_dst, struct Object *ob_src, struct ModifierData *md)
void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode)
void ED_object_constraint_copy_for_pose(struct Main *bmain, struct Object *ob_dst, struct bPoseChannel *pchan, struct bConstraint *con)
void ED_object_shaderfx_copy(struct Object *dst, struct ShaderFxData *fx)
bool ED_object_shaderfx_move_to_index(struct ReportList *reports, struct Object *ob, struct ShaderFxData *fx, const int index)
void ED_object_constraint_link(struct Main *bmain, struct Object *ob_dst, struct ListBase *dst, struct ListBase *src)
bool ED_object_modifier_move_to_index(struct ReportList *reports, struct Object *ob, struct ModifierData *md, const int index)
bool ED_object_constraint_move_to_index(struct Object *ob, struct bConstraint *con, const int index)
void ED_object_gpencil_modifier_copy_to_object(struct Object *ob_dst, struct GpencilModifierData *md)
void ED_object_constraint_copy_for_object(struct Main *bmain, struct Object *ob_dst, struct bConstraint *con)
void ED_outliner_select_sync_from_outliner(struct bContext *C, struct SpaceOutliner *space_outliner)
void ED_region_tag_redraw_no_rebuild(struct ARegion *region)
bool ED_operator_outliner_active(struct bContext *C)
Read Guarded memory(de)allocation.
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
float UI_view2d_region_to_view_y(const struct View2D *v2d, float y)
#define WM_DRAG_DATASTACK
void *(* MEM_callocN)(size_t len, const char *str)
Collection * outliner_collection_from_tree_element(const TreeElement *te)
TreeTraversalAction outliner_find_selected_collections(TreeElement *te, void *customdata)
TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *customdata)
bool outliner_is_collection_tree_element(const TreeElement *te)
static bool scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(r_tooltip))
static bool collection_drop_init(bContext *C, wmDrag *drag, const wmEvent *event, CollectionDrop *data)
static bool allow_parenting_without_modifier_key(SpaceOutliner *space_outliner)
static int outliner_item_drag_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static TreeElement * outliner_data_from_tree_element_and_parents(CheckTypeFn check_type, TreeElement *te)
static void datastack_drop_copy(bContext *C, StackDropData *drop_data)
static bool material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(r_tooltip))
void OUTLINER_OT_material_drop(wmOperatorType *ot)
void OUTLINER_OT_item_drag_drop(wmOperatorType *ot)
static bool is_pchan_element(TreeElement *te)
bool(* CheckTypeFn)(TreeElement *te)
static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int scene_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static bool is_collection_element(TreeElement *te)
static ID * outliner_ID_drop_find(bContext *C, const wmEvent *event, short idcode)
static int outliner_get_insert_index(TreeElement *drag_te, TreeElement *drop_te, TreeElementInsertType insert_type, ListBase *listbase)
static bool parent_drop_allowed(TreeElement *te, Object *potential_child)
static bool collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **r_tooltip)
static TreeElement * outliner_dropzone_find(const SpaceOutliner *space_outliner, const float fmval[2], const bool children)
static int datastack_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static TreeElement * outliner_item_drag_element_find(SpaceOutliner *space_outliner, ARegion *region, const wmEvent *event)
static int parent_clear_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static TreeElement * outliner_drop_find(bContext *C, const wmEvent *event)
static bool is_object_element(TreeElement *te)
static void datastack_drop_link(bContext *C, StackDropData *drop_data)
static TreeElement * outliner_dropzone_element(TreeElement *te, const float fmval[2], const bool children)
void OUTLINER_OT_parent_drop(wmOperatorType *ot)
void outliner_dropboxes(void)
static TreeElement * outliner_drop_insert_collection_find(bContext *C, const wmEvent *event, TreeElementInsertType *r_insert_type)
static Collection * collection_parent_from_ID(ID *id)
void OUTLINER_OT_collection_drop(wmOperatorType *ot)
static bool datastack_drop_are_types_valid(StackDropData *drop_data)
static int material_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static void datastack_drop_reorder(bContext *C, ReportList *reports, StackDropData *drop_data)
static bool datastack_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **r_tooltip)
static void datastack_drop_data_init(wmDrag *drag, Object *ob, bPoseChannel *pchan, TreeElement *te, TreeStoreElem *tselem, void *directdata)
static TreeElement * outliner_drop_insert_find(bContext *C, const wmEvent *event, TreeElementInsertType *r_insert_type)
@ DATA_STACK_DROP_REORDER
void OUTLINER_OT_scene_drop(wmOperatorType *ot)
struct StackDropData StackDropData
struct CollectionDrop CollectionDrop
static void parent_drop_set_parents(bContext *C, ReportList *reports, wmDragID *drag, Object *parent, short parent_type, const bool keep_transform)
void OUTLINER_OT_datastack_drop(wmOperatorType *ot)
void OUTLINER_OT_parent_clear(wmOperatorType *ot)
#define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD
static bool parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(r_tooltip))
static bool parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(r_tooltip))
static bool datastack_drop_init(bContext *C, const wmEvent *event, StackDropData *drop_data)
TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
bool outliner_flag_set(ListBase *lb, short flag, short set)
bool outliner_tree_traverse(const SpaceOutliner *space_outliner, ListBase *tree, int filter_te_flag, int filter_tselem_flag, TreeTraversalFunc func, void *customdata)
bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x)
TreeElement * outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem)
TreeElement * outliner_find_item_at_y(const SpaceOutliner *space_outliner, const ListBase *tree, float view_co_y)
struct bPoseChannel * outliner_find_parent_bone(TreeElement *te, TreeElement **r_bone_te)
TreeElement * outliner_find_id(struct SpaceOutliner *space_outliner, ListBase *lb, const struct ID *id)
TreeElement * outliner_find_parent_element(ListBase *lb, TreeElement *parent_te, const TreeElement *child_te)
struct ID * outliner_search_back(TreeElement *te, short idcode)
#define TSELEM_OPEN(telm, sv)
bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2])
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
TreeElementInsertType insert_type
struct ListBase selected_array
struct MaterialGPencilStyle * gp_style
ListBase greasepencil_modifiers
struct Collection * master_collection
eDataStackDropAction drop_action
TreeStoreElem * drag_tselem
TreeElementInsertType insert_type
bPoseChannel * pchan_parent
struct TreeElement * parent
struct TreeElement * prev
struct TreeElement * next
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *, wmDrag *, const wmEvent *, const char **), void(*copy)(wmDrag *, wmDropBox *), void(*cancel)(struct Main *, wmDrag *, wmDropBox *))
ID * WM_drag_get_local_ID(const wmDrag *drag, short idcode)
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
ID * WM_drag_get_local_ID_from_event(const wmEvent *event, short idcode)
wmDrag * WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags)
void WM_drag_add_local_ID(wmDrag *drag, ID *id, ID *from_parent)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, short context, PointerRNA *properties)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)