Blender  V3.3
object_select.c File Reference
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "DNA_workspace_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_bits.h"
#include "BLI_rand.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_workspace.h"
#include "DEG_depsgraph.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "object_intern.h"

Go to the source code of this file.

Functions

Public Object Selection API
void ED_object_base_select (Base *base, eObjectSelect_Mode mode)
 
void ED_object_base_active_refresh (Main *bmain, Scene *scene, ViewLayer *view_layer)
 
void ED_object_base_activate (bContext *C, Base *base)
 
void ED_object_base_activate_with_mode_exit_if_needed (bContext *C, Base *base)
 
bool ED_object_base_deselect_all_ex (ViewLayer *view_layer, View3D *v3d, int action, bool *r_any_visible)
 
bool ED_object_base_deselect_all (ViewLayer *view_layer, View3D *v3d, int action)
 
Jump To Object Utilities
static int get_base_select_priority (Base *base)
 
BaseED_object_find_first_by_data_id (ViewLayer *view_layer, ID *id)
 
bool ED_object_jump_to_object (bContext *C, Object *ob, const bool UNUSED(reveal_hidden))
 
bool ED_object_jump_to_bone (bContext *C, Object *ob, const char *bone_name, const bool reveal_hidden)
 
Select Operator Utils
static bool objects_selectable_poll (bContext *C)
 
Select by Type
static int object_select_by_type_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_by_type (wmOperatorType *ot)
 
(De)select All
static int object_select_all_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_all (wmOperatorType *ot)
 
Select In The Same Collection
static int object_select_same_collection_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_same_collection (wmOperatorType *ot)
 
Select Mirror
static int object_select_mirror_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_mirror (wmOperatorType *ot)
 
Select More/Less
static bool object_select_more_less (bContext *C, const bool select)
 
static int object_select_more_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_select_more (wmOperatorType *ot)
 
static int object_select_less_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_select_less (wmOperatorType *ot)
 
Select Random
static int object_select_random_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_random (wmOperatorType *ot)
 

Selected Grouped

#define COLLECTION_MENU_MAX   24
 
enum  {
  OBJECT_GRPSEL_CHILDREN_RECURSIVE = 0 , OBJECT_GRPSEL_CHILDREN = 1 , OBJECT_GRPSEL_PARENT = 2 , OBJECT_GRPSEL_SIBLINGS = 3 ,
  OBJECT_GRPSEL_TYPE = 4 , OBJECT_GRPSEL_COLLECTION = 5 , OBJECT_GRPSEL_HOOK = 7 , OBJECT_GRPSEL_PASS = 8 ,
  OBJECT_GRPSEL_COLOR = 9 , OBJECT_GRPSEL_KEYINGSET = 10 , OBJECT_GRPSEL_LIGHT_TYPE = 11
}
 
static const EnumPropertyItem prop_select_grouped_types []
 
static bool select_grouped_children (bContext *C, Object *ob, const bool recursive)
 
static bool select_grouped_parent (bContext *C)
 
static bool select_grouped_collection (bContext *C, Object *ob)
 
static bool select_grouped_object_hooks (bContext *C, Object *ob)
 
static bool select_grouped_siblings (bContext *C, Object *ob)
 
static bool select_grouped_lighttype (bContext *C, Object *ob)
 
static bool select_grouped_type (bContext *C, Object *ob)
 
static bool select_grouped_index_object (bContext *C, Object *ob)
 
static bool select_grouped_color (bContext *C, Object *ob)
 
static bool select_grouped_keyingset (bContext *C, Object *UNUSED(ob), ReportList *reports)
 
static int object_select_grouped_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_grouped (wmOperatorType *ot)
 

Selection by Links

enum  {
  OBJECT_SELECT_LINKED_IPO = 1 , OBJECT_SELECT_LINKED_OBDATA , OBJECT_SELECT_LINKED_MATERIAL , OBJECT_SELECT_LINKED_DUPGROUP ,
  OBJECT_SELECT_LINKED_PARTICLE , OBJECT_SELECT_LINKED_LIBRARY , OBJECT_SELECT_LINKED_LIBRARY_OBDATA
}
 
static const EnumPropertyItem prop_select_linked_types []
 
static bool object_select_all_by_obdata (bContext *C, void *obdata)
 
static bool object_select_all_by_material (bContext *C, Material *mat)
 
static bool object_select_all_by_instance_collection (bContext *C, Object *ob)
 
static bool object_select_all_by_particle (bContext *C, Object *ob)
 
static bool object_select_all_by_library (bContext *C, Library *lib)
 
static bool object_select_all_by_library_obdata (bContext *C, Library *lib)
 
void ED_object_select_linked_by_id (bContext *C, ID *id)
 
static int object_select_linked_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_select_linked (wmOperatorType *ot)
 

Macro Definition Documentation

◆ COLLECTION_MENU_MAX

#define COLLECTION_MENU_MAX   24

Definition at line 802 of file object_select.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OBJECT_SELECT_LINKED_IPO 
OBJECT_SELECT_LINKED_OBDATA 
OBJECT_SELECT_LINKED_MATERIAL 
OBJECT_SELECT_LINKED_DUPGROUP 
OBJECT_SELECT_LINKED_PARTICLE 
OBJECT_SELECT_LINKED_LIBRARY 
OBJECT_SELECT_LINKED_LIBRARY_OBDATA 

Definition at line 443 of file object_select.c.

◆ anonymous enum

anonymous enum
Enumerator
OBJECT_GRPSEL_CHILDREN_RECURSIVE 
OBJECT_GRPSEL_CHILDREN 
OBJECT_GRPSEL_PARENT 
OBJECT_GRPSEL_SIBLINGS 
OBJECT_GRPSEL_TYPE 
OBJECT_GRPSEL_COLLECTION 
OBJECT_GRPSEL_HOOK 
OBJECT_GRPSEL_PASS 
OBJECT_GRPSEL_COLOR 
OBJECT_GRPSEL_KEYINGSET 
OBJECT_GRPSEL_LIGHT_TYPE 

Definition at line 727 of file object_select.c.

Function Documentation

◆ ED_object_base_activate()

void ED_object_base_activate ( struct bContext C,
struct Base base 
)

◆ ED_object_base_activate_with_mode_exit_if_needed()

void ED_object_base_activate_with_mode_exit_if_needed ( bContext C,
Base base 
)

◆ ED_object_base_active_refresh()

void ED_object_base_active_refresh ( struct Main bmain,
struct Scene scene,
struct ViewLayer view_layer 
)

◆ ED_object_base_deselect_all()

bool ED_object_base_deselect_all ( ViewLayer view_layer,
View3D v3d,
int  action 
)

◆ ED_object_base_deselect_all_ex()

bool ED_object_base_deselect_all_ex ( ViewLayer view_layer,
View3D v3d,
int  action,
bool r_any_visible 
)

◆ ED_object_base_select()

void ED_object_base_select ( struct Base base,
eObjectSelect_Mode  mode 
)

Simple API for object selection, rather than just using the flag this takes into account the 'restrict selection in 3d view' flag. deselect works always, the restriction just prevents selection

Note
Caller must send a NC_SCENE | ND_OB_SELECT notifier (or a NC_SCENE | ND_OB_VISIBLE in case of visibility toggling).

Definition at line 76 of file object_select.c.

References BA_DESELECT, BA_INVERT, BA_SELECT, BASE_SELECTABLE, BASE_SELECTED, BKE_scene_object_base_flag_sync_from_base(), and Base::flag.

Referenced by bone_select_menu_exec(), clear_trans_object_base_flags(), click_select_channel_object(), do_lasso_select_objects(), do_object_box_select(), do_outliner_item_activate_tree_element(), do_outliner_item_editmode_toggle(), do_outliner_item_posemode_toggle(), do_outliner_object_select_recursive(), duplibase_for_convert(), duplicate_exec(), ED_armature_pose_select_in_wpaint_mode(), ED_object_base_deselect_all_ex(), ED_object_jump_to_object(), ed_object_select_pick(), ED_undo_object_editmode_restore_helper(), get_new_constraint_target(), gpencil_layer_to_curve(), localview_remove_from_exec(), make_local_all__instance_indirect_unused(), make_object_duplilist_real(), mesh_separate_arrays(), mesh_separate_tagged(), mouse_nla_channels(), object_add_named_exec(), object_circle_select(), object_deselect_all_except(), object_deselect_all_visible(), object_hide_view_set_exec(), object_select_all_by_instance_collection(), object_select_all_by_library(), object_select_all_by_library_obdata(), object_select_all_by_material(), object_select_all_by_obdata(), object_select_all_by_particle(), object_select_by_type_exec(), object_select_fn(), object_select_menu_exec(), object_select_mirror_exec(), object_select_more_less(), object_select_random_exec(), object_select_same_collection_exec(), outliner_select_sync_to_object(), scene_drop_invoke(), select_grouped_children(), select_grouped_collection(), select_grouped_color(), select_grouped_exec(), select_grouped_index_object(), select_grouped_keyingset(), select_grouped_lighttype(), select_grouped_object_hooks(), select_grouped_parent(), select_grouped_siblings(), select_grouped_type(), select_marker_camera_switch(), and tree_element_object_activate().

◆ ED_object_find_first_by_data_id()

Base* ED_object_find_first_by_data_id ( struct ViewLayer view_layer,
struct ID id 
)

If id is not already an Object, try to find an object that uses it as data. Prefers active, then selected, then visible/selectable.

Definition at line 215 of file object_select.c.

References ViewLayer::basact, BASE_SELECTED, BLI_assert, Object::data, get_base_select_priority(), GS, id, LISTBASE_FOREACH, ID::name, NULL, OB_DATA_SUPPORT_ID, Base::object, and ViewLayer::object_bases.

Referenced by jump_to_target_ptr().

◆ ED_object_jump_to_bone()

bool ED_object_jump_to_bone ( struct bContext C,
struct Object ob,
const char *  bone_name,
bool  reveal_hidden 
)

◆ ED_object_jump_to_object()

bool ED_object_jump_to_object ( bContext C,
Object ob,
const bool   UNUSEDreveal_hidden 
)

◆ ED_object_select_linked_by_id()

void ED_object_select_linked_by_id ( bContext C,
ID id 
)

◆ get_base_select_priority()

static int get_base_select_priority ( Base base)
static

Definition at line 204 of file object_select.c.

References BASE_SELECTABLE, BASE_VISIBLE_DEPSGRAPH, and Base::flag.

Referenced by ED_object_find_first_by_data_id().

◆ OBJECT_OT_select_all()

void OBJECT_OT_select_all ( wmOperatorType ot)

◆ OBJECT_OT_select_by_type()

void OBJECT_OT_select_by_type ( wmOperatorType ot)

◆ OBJECT_OT_select_grouped()

void OBJECT_OT_select_grouped ( wmOperatorType ot)

◆ OBJECT_OT_select_less()

void OBJECT_OT_select_less ( wmOperatorType ot)

◆ OBJECT_OT_select_linked()

void OBJECT_OT_select_linked ( wmOperatorType ot)

◆ OBJECT_OT_select_mirror()

void OBJECT_OT_select_mirror ( wmOperatorType ot)

◆ OBJECT_OT_select_more()

void OBJECT_OT_select_more ( wmOperatorType ot)

◆ OBJECT_OT_select_random()

void OBJECT_OT_select_random ( wmOperatorType ot)

◆ OBJECT_OT_select_same_collection()

void OBJECT_OT_select_same_collection ( wmOperatorType ot)

◆ object_select_all_by_instance_collection()

static bool object_select_all_by_instance_collection ( bContext C,
Object ob 
)
static

◆ object_select_all_by_library()

static bool object_select_all_by_library ( bContext C,
Library lib 
)
static

◆ object_select_all_by_library_obdata()

static bool object_select_all_by_library_obdata ( bContext C,
Library lib 
)
static

◆ object_select_all_by_material()

static bool object_select_all_by_material ( bContext C,
Material mat 
)
static

◆ object_select_all_by_obdata()

static bool object_select_all_by_obdata ( bContext C,
void obdata 
)
static

◆ object_select_all_by_particle()

static bool object_select_all_by_particle ( bContext C,
Object ob 
)
static

◆ object_select_all_exec()

static int object_select_all_exec ( bContext C,
wmOperator op 
)
static

◆ object_select_by_type_exec()

static int object_select_by_type_exec ( bContext C,
wmOperator op 
)
static

◆ object_select_grouped_exec()

static int object_select_grouped_exec ( bContext C,
wmOperator op 
)
static

◆ object_select_less_exec()

static int object_select_less_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ object_select_linked_exec()

static int object_select_linked_exec ( bContext C,
wmOperator op 
)
static

◆ object_select_mirror_exec()

static int object_select_mirror_exec ( bContext C,
wmOperator op 
)
static

◆ object_select_more_exec()

static int object_select_more_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ object_select_more_less()

static bool object_select_more_less ( bContext C,
const bool  select 
)
static

◆ object_select_random_exec()

static int object_select_random_exec ( bContext C,
wmOperator op 
)
static

◆ object_select_same_collection_exec()

static int object_select_same_collection_exec ( bContext C,
wmOperator op 
)
static

◆ objects_selectable_poll()

static bool objects_selectable_poll ( bContext C)
static

◆ select_grouped_children()

static bool select_grouped_children ( bContext C,
Object ob,
const bool  recursive 
)
static

◆ select_grouped_collection()

static bool select_grouped_collection ( bContext C,
Object ob 
)
static

◆ select_grouped_color()

static bool select_grouped_color ( bContext C,
Object ob 
)
static

◆ select_grouped_index_object()

static bool select_grouped_index_object ( bContext C,
Object ob 
)
static

◆ select_grouped_keyingset()

static bool select_grouped_keyingset ( bContext C,
Object UNUSEDob,
ReportList reports 
)
static

◆ select_grouped_lighttype()

static bool select_grouped_lighttype ( bContext C,
Object ob 
)
static

◆ select_grouped_object_hooks()

static bool select_grouped_object_hooks ( bContext C,
Object ob 
)
static

◆ select_grouped_parent()

static bool select_grouped_parent ( bContext C)
static

◆ select_grouped_siblings()

static bool select_grouped_siblings ( bContext C,
Object ob 
)
static

◆ select_grouped_type()

static bool select_grouped_type ( bContext C,
Object ob 
)
static

Variable Documentation

◆ prop_select_grouped_types

const EnumPropertyItem prop_select_grouped_types[]
static
Initial value:
= {
{OBJECT_GRPSEL_CHILDREN_RECURSIVE, "CHILDREN_RECURSIVE", 0, "Children", ""},
{OBJECT_GRPSEL_CHILDREN, "CHILDREN", 0, "Immediate Children", ""},
{OBJECT_GRPSEL_PARENT, "PARENT", 0, "Parent", ""},
{OBJECT_GRPSEL_SIBLINGS, "SIBLINGS", 0, "Siblings", "Shared parent"},
{OBJECT_GRPSEL_TYPE, "TYPE", 0, "Type", "Shared object type"},
{OBJECT_GRPSEL_COLLECTION, "COLLECTION", 0, "Collection", "Shared collection"},
{OBJECT_GRPSEL_HOOK, "HOOK", 0, "Hook", ""},
{OBJECT_GRPSEL_PASS, "PASS", 0, "Pass", "Render pass index"},
{OBJECT_GRPSEL_COLOR, "COLOR", 0, "Color", "Object color"},
"KEYINGSET",
0,
"Keying Set",
"Objects included in active Keying Set"},
{OBJECT_GRPSEL_LIGHT_TYPE, "LIGHT_TYPE", 0, "Light Type", "Matching light types"},
{0, NULL, 0, NULL, NULL},
}
@ OBJECT_GRPSEL_LIGHT_TYPE
@ OBJECT_GRPSEL_TYPE
@ OBJECT_GRPSEL_KEYINGSET
@ OBJECT_GRPSEL_CHILDREN_RECURSIVE
@ OBJECT_GRPSEL_COLOR
@ OBJECT_GRPSEL_SIBLINGS
@ OBJECT_GRPSEL_PARENT
@ OBJECT_GRPSEL_COLLECTION
@ OBJECT_GRPSEL_PASS
@ OBJECT_GRPSEL_CHILDREN
@ OBJECT_GRPSEL_HOOK

Definition at line 741 of file object_select.c.

Referenced by GPENCIL_OT_select_grouped(), blender::ed::space_node::NODE_OT_select_grouped(), OBJECT_OT_select_grouped(), and POSE_OT_select_grouped().

◆ prop_select_linked_types

const EnumPropertyItem prop_select_linked_types[]
static
Initial value:
= {
{OBJECT_SELECT_LINKED_OBDATA, "OBDATA", 0, "Object Data", ""},
{OBJECT_SELECT_LINKED_MATERIAL, "MATERIAL", 0, "Material", ""},
{OBJECT_SELECT_LINKED_DUPGROUP, "DUPGROUP", 0, "Instanced Collection", ""},
{OBJECT_SELECT_LINKED_PARTICLE, "PARTICLE", 0, "Particle System", ""},
{OBJECT_SELECT_LINKED_LIBRARY, "LIBRARY", 0, "Library", ""},
{OBJECT_SELECT_LINKED_LIBRARY_OBDATA, "LIBRARY_OBDATA", 0, "Library (Object Data)", ""},
{0, NULL, 0, NULL, NULL},
}
@ OBJECT_SELECT_LINKED_LIBRARY
@ OBJECT_SELECT_LINKED_LIBRARY_OBDATA
@ OBJECT_SELECT_LINKED_DUPGROUP
@ OBJECT_SELECT_LINKED_PARTICLE
@ OBJECT_SELECT_LINKED_OBDATA
@ OBJECT_SELECT_LINKED_MATERIAL

Definition at line 453 of file object_select.c.

Referenced by OBJECT_OT_select_linked().