Blender  V3.3
Classes
outliner_dragdrop.cc File Reference
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_collection_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLT_translation.h"
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_view2d.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "outliner_intern.hh"

Go to the source code of this file.

Classes

struct  StackDropData
 
struct  CollectionDrop
 

Functions

Collection Drop Operator
static Collectioncollection_parent_from_ID (ID *id)
 
static bool collection_drop_init (bContext *C, wmDrag *drag, const int xy[2], CollectionDrop *data)
 
static bool collection_drop_poll (bContext *C, wmDrag *drag, const wmEvent *event)
 
static char * collection_drop_tooltip (bContext *C, wmDrag *drag, const int xy[2], wmDropBox *UNUSED(drop))
 
static int collection_drop_invoke (bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 
void OUTLINER_OT_collection_drop (wmOperatorType *ot)
 
Parent Drop Operator
static bool parent_drop_allowed (TreeElement *te, Object *potential_child)
 
static bool allow_parenting_without_modifier_key (SpaceOutliner *space_outliner)
 
static bool parent_drop_poll (bContext *C, wmDrag *drag, const wmEvent *event)
 
static void parent_drop_set_parents (bContext *C, ReportList *reports, wmDragID *drag, Object *parent, short parent_type, const bool keep_transform)
 
static int parent_drop_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void OUTLINER_OT_parent_drop (wmOperatorType *ot)
 
Parent Clear Operator
static bool parent_clear_poll (bContext *C, wmDrag *drag, const wmEvent *event)
 
static int parent_clear_invoke (bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 
void OUTLINER_OT_parent_clear (wmOperatorType *ot)
 
Scene Drop Operator
static bool scene_drop_poll (bContext *C, wmDrag *drag, const wmEvent *event)
 
static int scene_drop_invoke (bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 
void OUTLINER_OT_scene_drop (wmOperatorType *ot)
 
Material Drop Operator
static bool material_drop_poll (bContext *C, wmDrag *drag, const wmEvent *event)
 
static int material_drop_invoke (bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 
void OUTLINER_OT_material_drop (wmOperatorType *ot)
 
Drop Boxes
void outliner_dropboxes (void)
 

Outliner Drag Operator

#define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD   7 /* In UI units */
 
static TreeElementoutliner_item_drag_element_find (SpaceOutliner *space_outliner, ARegion *region, const wmEvent *event)
 
static int outliner_item_drag_drop_invoke (bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 
void OUTLINER_OT_item_drag_drop (wmOperatorType *ot)
 

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.
enum  eDataStackDropAction { DATA_STACK_DROP_REORDER , DATA_STACK_DROP_COPY , DATA_STACK_DROP_LINK }
 
static void datastack_drop_data_init (wmDrag *drag, Object *ob, bPoseChannel *pchan, TreeElement *te, TreeStoreElem *tselem, void *directdata)
 
static bool datastack_drop_init (bContext *C, const wmEvent *event, StackDropData *drop_data)
 
static bool datastack_drop_are_types_valid (StackDropData *drop_data)
 
static bool datastack_drop_poll (bContext *C, wmDrag *drag, const wmEvent *event)
 
static char * datastack_drop_tooltip (bContext *UNUSED(C), wmDrag *drag, const int UNUSED(xy[2]), struct wmDropBox *UNUSED(drop))
 
static void datastack_drop_link (bContext *C, StackDropData *drop_data)
 
static void datastack_drop_copy (bContext *C, StackDropData *drop_data)
 
static void datastack_drop_reorder (bContext *C, ReportList *reports, StackDropData *drop_data)
 
static int datastack_drop_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void OUTLINER_OT_datastack_drop (wmOperatorType *ot)
 

Drop Target Find

using CheckTypeFn = bool(*)(TreeElement *te)
 
static TreeElementoutliner_dropzone_element (TreeElement *te, const float fmval[2], const bool children)
 
static TreeElementoutliner_dropzone_find (const SpaceOutliner *space_outliner, const float fmval[2], const bool children)
 
static TreeElementoutliner_drop_find (bContext *C, const wmEvent *event)
 
static IDoutliner_ID_drop_find (bContext *C, const wmEvent *event, short idcode)
 
static TreeElementoutliner_drop_insert_find (bContext *C, const int xy[2], TreeElementInsertType *r_insert_type)
 
static TreeElementoutliner_data_from_tree_element_and_parents (CheckTypeFn check_type, TreeElement *te)
 
static bool is_collection_element (TreeElement *te)
 
static bool is_object_element (TreeElement *te)
 
static bool is_pchan_element (TreeElement *te)
 
static TreeElementoutliner_drop_insert_collection_find (bContext *C, const int xy[2], TreeElementInsertType *r_insert_type)
 
static int outliner_get_insert_index (TreeElement *drag_te, TreeElement *drop_te, TreeElementInsertType insert_type, ListBase *listbase)
 

Macro Definition Documentation

◆ OUTLINER_DRAG_SCOLL_OUTSIDE_PAD

#define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD   7 /* In UI units */

Definition at line 1393 of file outliner_dragdrop.cc.

Typedef Documentation

◆ CheckTypeFn

using CheckTypeFn = bool (*)(TreeElement *te)

Definition at line 178 of file outliner_dragdrop.cc.

Enumeration Type Documentation

◆ eDataStackDropAction

Enumerator
DATA_STACK_DROP_REORDER 
DATA_STACK_DROP_COPY 
DATA_STACK_DROP_LINK 

Definition at line 678 of file outliner_dragdrop.cc.

Function Documentation

◆ allow_parenting_without_modifier_key()

static bool allow_parenting_without_modifier_key ( SpaceOutliner space_outliner)
static

◆ collection_drop_init()

static bool collection_drop_init ( bContext C,
wmDrag drag,
const int  xy[2],
CollectionDrop data 
)
static

◆ collection_drop_invoke()

static int collection_drop_invoke ( bContext C,
wmOperator UNUSEDop,
const wmEvent event 
)
static

◆ collection_drop_poll()

static bool collection_drop_poll ( bContext C,
wmDrag drag,
const wmEvent event 
)
static

◆ collection_drop_tooltip()

static char* collection_drop_tooltip ( bContext C,
wmDrag drag,
const int  xy[2],
wmDropBox UNUSEDdrop 
)
static

◆ collection_parent_from_ID()

static Collection * collection_parent_from_ID ( ID id)
static

◆ datastack_drop_are_types_valid()

static bool datastack_drop_are_types_valid ( StackDropData drop_data)
static

◆ datastack_drop_copy()

static void datastack_drop_copy ( bContext C,
StackDropData drop_data 
)
static

◆ datastack_drop_data_init()

static void datastack_drop_data_init ( wmDrag drag,
Object ob,
bPoseChannel pchan,
TreeElement te,
TreeStoreElem tselem,
void directdata 
)
static

◆ datastack_drop_init()

static bool datastack_drop_init ( bContext C,
const wmEvent event,
StackDropData drop_data 
)
static

◆ datastack_drop_invoke()

static int datastack_drop_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ datastack_drop_link()

static void datastack_drop_link ( bContext C,
StackDropData drop_data 
)
static

◆ datastack_drop_poll()

static bool datastack_drop_poll ( bContext C,
wmDrag drag,
const wmEvent event 
)
static

◆ datastack_drop_reorder()

static void datastack_drop_reorder ( bContext C,
ReportList reports,
StackDropData drop_data 
)
static

◆ datastack_drop_tooltip()

static char* datastack_drop_tooltip ( bContext UNUSEDC,
wmDrag drag,
const int   UNUSEDxy[2],
struct wmDropBox UNUSEDdrop 
)
static

◆ is_collection_element()

static bool is_collection_element ( TreeElement te)
static

◆ is_object_element()

static bool is_object_element ( TreeElement te)
static

Definition at line 197 of file outliner_dragdrop.cc.

References ID_OB, TreeElement::idcode, TREESTORE, TSE_SOME_ID, and TreeStoreElem::type.

Referenced by datastack_drop_init().

◆ is_pchan_element()

static bool is_pchan_element ( TreeElement te)
static

Definition at line 203 of file outliner_dragdrop.cc.

References TREESTORE, TSE_POSE_CHANNEL, and TreeStoreElem::type.

Referenced by datastack_drop_init().

◆ material_drop_invoke()

static int material_drop_invoke ( bContext C,
wmOperator UNUSEDop,
const wmEvent event 
)
static

◆ material_drop_poll()

static bool material_drop_poll ( bContext C,
wmDrag drag,
const wmEvent event 
)
static

Definition at line 617 of file outliner_dragdrop.cc.

References C, ID_MA, ID_OB, outliner_ID_drop_find(), and WM_drag_get_local_ID().

Referenced by outliner_dropboxes().

◆ outliner_data_from_tree_element_and_parents()

static TreeElement* outliner_data_from_tree_element_and_parents ( CheckTypeFn  check_type,
TreeElement te 
)
static

◆ outliner_drop_find()

static TreeElement* outliner_drop_find ( bContext C,
const wmEvent event 
)
static

◆ outliner_drop_insert_collection_find()

static TreeElement* outliner_drop_insert_collection_find ( bContext C,
const int  xy[2],
TreeElementInsertType r_insert_type 
)
static

◆ outliner_drop_insert_find()

static TreeElement* outliner_drop_insert_find ( bContext C,
const int  xy[2],
TreeElementInsertType r_insert_type 
)
static

◆ outliner_dropboxes()

void outliner_dropboxes ( void  )

◆ outliner_dropzone_element()

static TreeElement* outliner_dropzone_element ( TreeElement te,
const float  fmval[2],
const bool  children 
)
static

◆ outliner_dropzone_find()

static TreeElement* outliner_dropzone_find ( const SpaceOutliner space_outliner,
const float  fmval[2],
const bool  children 
)
static

◆ outliner_get_insert_index()

static int outliner_get_insert_index ( TreeElement drag_te,
TreeElement drop_te,
TreeElementInsertType  insert_type,
ListBase listbase 
)
static

◆ outliner_ID_drop_find()

static ID* outliner_ID_drop_find ( bContext C,
const wmEvent event,
short  idcode 
)
static

◆ outliner_item_drag_drop_invoke()

static int outliner_item_drag_drop_invoke ( bContext C,
wmOperator UNUSEDop,
const wmEvent event 
)
static

◆ outliner_item_drag_element_find()

static TreeElement* outliner_item_drag_element_find ( SpaceOutliner space_outliner,
ARegion region,
const wmEvent event 
)
static

◆ OUTLINER_OT_collection_drop()

void OUTLINER_OT_collection_drop ( wmOperatorType ot)

◆ OUTLINER_OT_datastack_drop()

void OUTLINER_OT_datastack_drop ( wmOperatorType ot)

◆ OUTLINER_OT_item_drag_drop()

void OUTLINER_OT_item_drag_drop ( wmOperatorType ot)

◆ OUTLINER_OT_material_drop()

void OUTLINER_OT_material_drop ( wmOperatorType ot)

◆ OUTLINER_OT_parent_clear()

void OUTLINER_OT_parent_clear ( wmOperatorType ot)

◆ OUTLINER_OT_parent_drop()

void OUTLINER_OT_parent_drop ( wmOperatorType ot)

◆ OUTLINER_OT_scene_drop()

void OUTLINER_OT_scene_drop ( wmOperatorType ot)

◆ parent_clear_invoke()

static int parent_clear_invoke ( bContext C,
wmOperator UNUSEDop,
const wmEvent event 
)
static

◆ parent_clear_poll()

static bool parent_clear_poll ( bContext C,
wmDrag drag,
const wmEvent event 
)
static

◆ parent_drop_allowed()

static bool parent_drop_allowed ( TreeElement te,
Object potential_child 
)
static

◆ parent_drop_invoke()

static int parent_drop_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ parent_drop_poll()

static bool parent_drop_poll ( bContext C,
wmDrag drag,
const wmEvent event 
)
static

◆ parent_drop_set_parents()

static void parent_drop_set_parents ( bContext C,
ReportList reports,
wmDragID drag,
Object parent,
short  parent_type,
const bool  keep_transform 
)
static

◆ scene_drop_invoke()

static int scene_drop_invoke ( bContext C,
wmOperator UNUSEDop,
const wmEvent event 
)
static

◆ scene_drop_poll()

static bool scene_drop_poll ( bContext C,
wmDrag drag,
const wmEvent event 
)
static

Definition at line 548 of file outliner_dragdrop.cc.

References C, ID_OB, ID_SCE, outliner_ID_drop_find(), and WM_drag_get_local_ID().

Referenced by outliner_dropboxes().