Blender  V3.3
Classes | Typedefs | Variables
object_edit.c File Reference
#include <ctype.h>
#include <float.h>
#include <math.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math_rotation.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_vfont_types.h"
#include "DNA_workspace_types.h"
#include "IMB_imbuf_types.h"
#include "BKE_anim_visualization.h"
#include "BKE_armature.h"
#include "BKE_collection.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_editlattice.h"
#include "BKE_editmesh.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_softbody.h"
#include "BKE_workspace.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_curve.h"
#include "ED_gpencil.h"
#include "ED_image.h"
#include "ED_keyframes_keylist.h"
#include "ED_lattice.h"
#include "ED_mball.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_undo.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "RNA_types.h"
#include "UI_interface_icons.h"
#include "CLG_log.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "object_intern.h"

Go to the source code of this file.

Classes

struct  MoveToCollectionData
 

Typedefs

typedef struct MoveToCollectionData MoveToCollectionData
 

Functions

Internal Utilities
ObjectED_object_context (const bContext *C)
 
ObjectED_object_active_context (const bContext *C)
 
Object ** ED_object_array_in_mode_or_selected (bContext *C, bool(*filter_fn)(const Object *ob, void *user_data), void *filter_user_data, uint *r_objects_len)
 
Toggle Edit-Mode Operator
static bool mesh_needs_keyindex (Main *bmain, const Mesh *me)
 
static bool ED_object_editmode_load_free_ex (Main *bmain, Object *obedit, const bool load_data, const bool free_data)
 
bool ED_object_editmode_load (Main *bmain, Object *obedit)
 
bool ED_object_editmode_exit_ex (Main *bmain, Scene *scene, Object *obedit, int flag)
 
bool ED_object_editmode_exit (bContext *C, int flag)
 
bool ED_object_editmode_free_ex (Main *bmain, Object *obedit)
 
bool ED_object_editmode_exit_multi_ex (Main *bmain, Scene *scene, ViewLayer *view_layer, int flag)
 
bool ED_object_editmode_exit_multi (bContext *C, int flag)
 
bool ED_object_editmode_enter_ex (Main *bmain, Scene *scene, Object *ob, int flag)
 
bool ED_object_editmode_enter (bContext *C, int flag)
 
static int editmode_toggle_exec (bContext *C, wmOperator *op)
 
static bool editmode_toggle_poll (bContext *C)
 
void OBJECT_OT_editmode_toggle (wmOperatorType *ot)
 
Toggle Pose-Mode Operator
static int posemode_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_posemode_toggle (wmOperatorType *ot)
 
Force Field Toggle Operator
void ED_object_check_force_modifiers (Main *bmain, Scene *scene, Object *object)
 
static int forcefield_toggle_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_forcefield_toggle (wmOperatorType *ot)
 
Calculate Motion Paths Operator
static eAnimvizCalcRange object_path_convert_range (eObjectPathCalcRange range)
 
void ED_objects_recalculate_paths_selected (bContext *C, Scene *scene, eObjectPathCalcRange range)
 
void ED_objects_recalculate_paths_visible (bContext *C, Scene *scene, eObjectPathCalcRange range)
 
static bool has_object_motion_paths (Object *ob)
 
static bool has_pose_motion_paths (Object *ob)
 
void ED_objects_recalculate_paths (bContext *C, Scene *scene, eObjectPathCalcRange range, ListBase *ld_objects)
 
static int object_calculate_paths_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
static int object_calculate_paths_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_paths_calculate (wmOperatorType *ot)
 
Update Motion Paths Operator
static bool object_update_paths_poll (bContext *C)
 
static int object_update_paths_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_paths_update (wmOperatorType *ot)
 
Update All Motion Paths Operator
static bool object_update_all_paths_poll (bContext *UNUSED(C))
 
static int object_update_all_paths_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_paths_update_visible (wmOperatorType *ot)
 
Clear Motion Paths Operator
static void object_clear_mpath (Object *ob)
 
void ED_objects_clear_paths (bContext *C, bool only_selected)
 
static int object_clear_paths_exec (bContext *C, wmOperator *op)
 
static int object_clear_paths_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void OBJECT_OT_paths_clear (wmOperatorType *ot)
 
Object Shade Smooth/Flat Operator
static int shade_smooth_exec (bContext *C, wmOperator *op)
 
static bool shade_poll (bContext *C)
 
void OBJECT_OT_shade_flat (wmOperatorType *ot)
 
void OBJECT_OT_shade_smooth (wmOperatorType *ot)
 
Object Mode Set Operator
static const EnumPropertyItemobject_mode_set_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
static bool object_mode_set_poll (bContext *C)
 
static int object_mode_set_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_mode_set (wmOperatorType *ot)
 
void OBJECT_OT_mode_set_with_submode (wmOperatorType *ot)
 

Variables

static CLG_LogRef LOG = {"ed.object.edit"}
 

Hide Operator

#define COLLECTION_INVALID_INDEX   -1
 
static bool object_hide_poll (bContext *C)
 
static int object_hide_view_clear_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_hide_view_clear (wmOperatorType *ot)
 
static int object_hide_view_set_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_hide_view_set (wmOperatorType *ot)
 
static int object_hide_collection_exec (bContext *C, wmOperator *op)
 
void ED_collection_hide_menu_draw (const bContext *C, uiLayout *layout)
 
static int object_hide_collection_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void OBJECT_OT_hide_collection (wmOperatorType *ot)
 

Object Link/Move to Collection Operator

static MoveToCollectionDatamaster_collection_menu = NULL
 
static void move_to_collection_menus_items (struct uiLayout *layout, struct MoveToCollectionData *menu)
 
static ListBase selected_objects_get (bContext *C)
 
static bool move_to_collection_poll (bContext *C)
 
static int move_to_collection_exec (bContext *C, wmOperator *op)
 
static int move_to_collection_menus_create (wmOperator *op, MoveToCollectionData *menu)
 
static void move_to_collection_menus_free_recursive (MoveToCollectionData *menu)
 
static void move_to_collection_menus_free (MoveToCollectionData **menu)
 
static void move_to_collection_menu_create (bContext *C, uiLayout *layout, void *menu_v)
 
static int move_to_collection_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
void OBJECT_OT_move_to_collection (wmOperatorType *ot)
 
void OBJECT_OT_link_to_collection (wmOperatorType *ot)
 

Macro Definition Documentation

◆ COLLECTION_INVALID_INDEX

#define COLLECTION_INVALID_INDEX   -1

Definition at line 380 of file object_edit.c.

Typedef Documentation

◆ MoveToCollectionData

Definition at line 108 of file object_edit.c.

Function Documentation

◆ ED_collection_hide_menu_draw()

void ED_collection_hide_menu_draw ( const bContext C,
uiLayout layout 
)

◆ ED_object_active_context()

Object* ED_object_active_context ( const bContext C)

Definition at line 125 of file object_edit.c.

References C, CTX_data_active_object(), ED_object_context(), and NULL.

Referenced by object_update_paths_poll().

◆ ED_object_array_in_mode_or_selected()

Object** ED_object_array_in_mode_or_selected ( bContext C,
bool(*)(const Object *ob, void *user_data filter_fn,
void filter_user_data,
uint r_objects_len 
)

◆ ED_object_check_force_modifiers()

void ED_object_check_force_modifiers ( Main bmain,
Scene scene,
Object object 
)

◆ ED_object_context()

Object* ED_object_context ( const bContext C)

Definition at line 120 of file object_edit.c.

References C, CTX_data_pointer_get_type(), and PointerRNA::data.

Referenced by ED_object_active_context().

◆ ED_object_editmode_enter()

bool ED_object_editmode_enter ( bContext C,
int  flag 
)

◆ ED_object_editmode_enter_ex()

bool ED_object_editmode_enter_ex ( Main bmain,
Scene scene,
Object ob,
int  flag 
)

◆ ED_object_editmode_exit()

bool ED_object_editmode_exit ( bContext C,
int  flag 
)

◆ ED_object_editmode_exit_ex()

bool ED_object_editmode_exit_ex ( struct Main bmain,
struct Scene scene,
struct Object obedit,
int  flag 
)

◆ ED_object_editmode_exit_multi()

bool ED_object_editmode_exit_multi ( bContext C,
int  flag 
)

◆ ED_object_editmode_exit_multi_ex()

bool ED_object_editmode_exit_multi_ex ( Main bmain,
Scene scene,
ViewLayer view_layer,
int  flag 
)

◆ ED_object_editmode_free_ex()

bool ED_object_editmode_free_ex ( struct Main bmain,
struct Object obedit 
)

Support freeing edit-mode data without flushing it back to the object.

Returns
true if data was freed.

Definition at line 703 of file object_edit.c.

References ED_object_editmode_load_free_ex().

Referenced by ED_editors_exit().

◆ ED_object_editmode_load()

bool ED_object_editmode_load ( Main bmain,
Object obedit 
)

◆ ED_object_editmode_load_free_ex()

static bool ED_object_editmode_load_free_ex ( Main bmain,
Object obedit,
const bool  load_data,
const bool  free_data 
)
static

◆ ED_objects_clear_paths()

void ED_objects_clear_paths ( struct bContext C,
bool  only_selected 
)

Clear motion paths for all objects.

Definition at line 1407 of file object_edit.c.

References C, CTX_DATA_BEGIN, CTX_DATA_END, and object_clear_mpath().

Referenced by object_clear_paths_exec().

◆ ED_objects_recalculate_paths()

void ED_objects_recalculate_paths ( struct bContext C,
struct Scene scene,
eObjectPathCalcRange  range,
struct ListBase ld_objects 
)

◆ ED_objects_recalculate_paths_selected()

void ED_objects_recalculate_paths_selected ( bContext C,
Scene scene,
eObjectPathCalcRange  range 
)

◆ ED_objects_recalculate_paths_visible()

void ED_objects_recalculate_paths_visible ( bContext C,
Scene scene,
eObjectPathCalcRange  range 
)

◆ editmode_toggle_exec()

static int editmode_toggle_exec ( bContext C,
wmOperator op 
)
static

◆ editmode_toggle_poll()

static bool editmode_toggle_poll ( bContext C)
static

◆ forcefield_toggle_exec()

static int forcefield_toggle_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ has_object_motion_paths()

static bool has_object_motion_paths ( Object ob)
static

◆ has_pose_motion_paths()

static bool has_pose_motion_paths ( Object ob)
static

◆ mesh_needs_keyindex()

static bool mesh_needs_keyindex ( Main bmain,
const Mesh me 
)
static

◆ move_to_collection_exec()

static int move_to_collection_exec ( bContext C,
wmOperator op 
)
static

◆ move_to_collection_invoke()

static int move_to_collection_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

◆ move_to_collection_menu_create()

static void move_to_collection_menu_create ( bContext C,
uiLayout layout,
void menu_v 
)
static

◆ move_to_collection_menus_create()

static int move_to_collection_menus_create ( wmOperator op,
MoveToCollectionData menu 
)
static

◆ move_to_collection_menus_free()

static void move_to_collection_menus_free ( MoveToCollectionData **  menu)
static

Definition at line 1941 of file object_edit.c.

References MEM_freeN, move_to_collection_menus_free_recursive(), and NULL.

Referenced by move_to_collection_invoke().

◆ move_to_collection_menus_free_recursive()

static void move_to_collection_menus_free_recursive ( MoveToCollectionData menu)
static

◆ move_to_collection_menus_items()

static void move_to_collection_menus_items ( struct uiLayout layout,
struct MoveToCollectionData menu 
)
static

◆ move_to_collection_poll()

static bool move_to_collection_poll ( bContext C)
static

◆ object_calculate_paths_exec()

static int object_calculate_paths_exec ( bContext C,
wmOperator op 
)
static

◆ object_calculate_paths_invoke()

static int object_calculate_paths_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

◆ object_clear_mpath()

static void object_clear_mpath ( Object ob)
static

◆ object_clear_paths_exec()

static int object_clear_paths_exec ( bContext C,
wmOperator op 
)
static

◆ object_clear_paths_invoke()

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

◆ object_hide_collection_exec()

static int object_hide_collection_exec ( bContext C,
wmOperator op 
)
static

◆ object_hide_collection_invoke()

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

◆ object_hide_poll()

static bool object_hide_poll ( bContext C)
static

◆ object_hide_view_clear_exec()

static int object_hide_view_clear_exec ( bContext C,
wmOperator op 
)
static

◆ object_hide_view_set_exec()

static int object_hide_view_set_exec ( bContext C,
wmOperator op 
)
static

◆ object_mode_set_exec()

static int object_mode_set_exec ( bContext C,
wmOperator op 
)
static

Mode Switching Logic (internal details).

Notes:

  • Code below avoids calling mode switching functions more than once, as this causes unnecessary calculations and undo steps to be added.
  • The previous mode (Object.restore_mode) is object mode by default.

Supported Cases:

  • Setting the mode (when the 'toggle' setting is off).
  • Toggle the mode:
    • Toggle between object mode and non-object mode property.
    • Toggle between the previous mode (Object.restore_mode) and the mode property.
    • Toggle object mode. While this is similar to regular toggle, this operator depends on there being a previous mode set (this isn't bound to a key with the default key-map).

Definition at line 1667 of file object_edit.c.

References C, CTX_data_active_object(), ED_object_mode_compat_test(), ED_object_mode_set_ex(), EDBM_selectmode_set_multi(), wmOperator::idname, Object::mode, OB_GPENCIL, OB_MESH, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL, OB_MODE_OBJECT, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, wmOperator::ptr, wmOperator::reports, Object::restore_mode, RNA_boolean_get(), RNA_enum_get(), RNA_property_enum_get(), RNA_property_is_set(), RNA_struct_find_property(), STREQ, and Object::type.

Referenced by OBJECT_OT_mode_set().

◆ object_mode_set_itemf()

static const EnumPropertyItem* object_mode_set_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)
static

◆ object_mode_set_poll()

static bool object_mode_set_poll ( bContext C)
static

Definition at line 1660 of file object_edit.c.

References C, CTX_data_active_object(), and ED_operator_object_active_editable_ex().

Referenced by OBJECT_OT_mode_set().

◆ OBJECT_OT_editmode_toggle()

void OBJECT_OT_editmode_toggle ( wmOperatorType ot)

◆ OBJECT_OT_forcefield_toggle()

void OBJECT_OT_forcefield_toggle ( wmOperatorType ot)

◆ OBJECT_OT_hide_collection()

void OBJECT_OT_hide_collection ( wmOperatorType ot)

◆ OBJECT_OT_hide_view_clear()

void OBJECT_OT_hide_view_clear ( wmOperatorType ot)

◆ OBJECT_OT_hide_view_set()

void OBJECT_OT_hide_view_set ( wmOperatorType ot)

◆ OBJECT_OT_link_to_collection()

void OBJECT_OT_link_to_collection ( wmOperatorType ot)

◆ OBJECT_OT_mode_set()

void OBJECT_OT_mode_set ( wmOperatorType ot)

◆ OBJECT_OT_mode_set_with_submode()

void OBJECT_OT_mode_set_with_submode ( wmOperatorType ot)

◆ OBJECT_OT_move_to_collection()

void OBJECT_OT_move_to_collection ( wmOperatorType ot)

◆ OBJECT_OT_paths_calculate()

void OBJECT_OT_paths_calculate ( wmOperatorType ot)

◆ OBJECT_OT_paths_clear()

void OBJECT_OT_paths_clear ( wmOperatorType ot)

◆ OBJECT_OT_paths_update()

void OBJECT_OT_paths_update ( wmOperatorType ot)

◆ OBJECT_OT_paths_update_visible()

void OBJECT_OT_paths_update_visible ( wmOperatorType ot)

◆ OBJECT_OT_posemode_toggle()

void OBJECT_OT_posemode_toggle ( wmOperatorType ot)

◆ OBJECT_OT_shade_flat()

void OBJECT_OT_shade_flat ( wmOperatorType ot)

◆ OBJECT_OT_shade_smooth()

void OBJECT_OT_shade_smooth ( wmOperatorType ot)

◆ object_path_convert_range()

static eAnimvizCalcRange object_path_convert_range ( eObjectPathCalcRange  range)
static

◆ object_update_all_paths_exec()

static int object_update_all_paths_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ object_update_all_paths_poll()

static bool object_update_all_paths_poll ( bContext UNUSEDC)
static

Definition at line 1353 of file object_edit.c.

Referenced by OBJECT_OT_paths_update_visible().

◆ object_update_paths_exec()

static int object_update_paths_exec ( bContext C,
wmOperator op 
)
static

◆ object_update_paths_poll()

static bool object_update_paths_poll ( bContext C)
static

◆ posemode_exec()

static int posemode_exec ( bContext C,
wmOperator op 
)
static

◆ selected_objects_get()

static ListBase selected_objects_get ( bContext C)
static

◆ shade_poll()

static bool shade_poll ( bContext C)
static

◆ shade_smooth_exec()

static int shade_smooth_exec ( bContext C,
wmOperator op 
)
static

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"ed.object.edit"}
static

Definition at line 108 of file object_edit.c.

Referenced by ED_object_editmode_enter_ex(), and ED_object_editmode_load_free_ex().

◆ master_collection_menu

MoveToCollectionData* master_collection_menu = NULL
static

Definition at line 2003 of file object_edit.c.

Referenced by move_to_collection_invoke().