Blender V5.3
object_modes.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11
12#include "DNA_object_enums.h"
13#include "DNA_object_types.h"
14#include "DNA_scene_types.h"
15
16#include "BLI_time.hh"
17#include "BLI_utildefines.hh"
18
19#include "BKE_context.hh"
20#include "BKE_idtype.hh"
21#include "BKE_layer.hh"
22#include "BKE_lib_id.hh"
23#include "BKE_library.hh"
24#include "BKE_modifier.hh"
25#include "BKE_object.hh"
26#include "BKE_paint.hh"
27#include "BKE_paint_types.hh"
28#include "BKE_report.hh"
29
30#include "BLI_math_vector_c.hh"
31#include "BLI_string.hh"
32
33#include "WM_api.hh"
34#include "WM_types.hh"
35
36#include "RNA_access.hh"
37#include "RNA_define.hh"
38
39#include "DEG_depsgraph.hh"
41
42#include "ED_armature.hh"
43#include "ED_gpencil_legacy.hh"
44#include "ED_outliner.hh"
45#include "ED_paint.hh"
46#include "ED_physics.hh"
47#include "ED_sculpt.hh"
48#include "ED_undo.hh"
49#include "ED_view3d.hh"
50
51#include "WM_toolsystem.hh"
52
53#include "ED_object.hh" /* own include */
54#include "object_intern.hh"
55
56namespace blender::ed::object {
57
58/* -------------------------------------------------------------------- */
61
62static const char *object_mode_op_string(eObjectMode mode)
63{
64 if (mode & OB_MODE_EDIT) {
65 return "OBJECT_OT_editmode_toggle";
66 }
67 if (mode == OB_MODE_SCULPT) {
68 return "SCULPT_OT_sculptmode_toggle";
69 }
70 if (mode == OB_MODE_VERTEX_PAINT) {
71 return "PAINT_OT_vertex_paint_toggle";
72 }
73 if (mode == OB_MODE_WEIGHT_PAINT) {
74 return "PAINT_OT_weight_paint_toggle";
75 }
76 if (mode == OB_MODE_TEXTURE_PAINT) {
77 return "PAINT_OT_texture_paint_toggle";
78 }
79 if (mode == OB_MODE_PARTICLE_EDIT) {
80 return "PARTICLE_OT_particle_edit_toggle";
81 }
82 if (mode == OB_MODE_POSE) {
83 return "OBJECT_OT_posemode_toggle";
84 }
85 if (mode == OB_MODE_PAINT_GREASE_PENCIL) {
86 return "GREASE_PENCIL_OT_paintmode_toggle";
87 }
88 if (mode == OB_MODE_SCULPT_GREASE_PENCIL) {
89 return "GREASE_PENCIL_OT_sculptmode_toggle";
90 }
91 if (mode == OB_MODE_WEIGHT_GREASE_PENCIL) {
92 return "GREASE_PENCIL_OT_weightmode_toggle";
93 }
94 if (mode == OB_MODE_VERTEX_GREASE_PENCIL) {
95 return "GREASE_PENCIL_OT_vertexmode_toggle";
96 }
97 if (mode == OB_MODE_SCULPT_CURVES) {
98 return "CURVES_OT_sculptmode_toggle";
99 }
100 return nullptr;
101}
102
104{
105 if (mode == OB_MODE_OBJECT) {
106 return true;
107 }
108
109 switch (ob->type) {
110 case OB_MESH:
113 {
114 return true;
115 }
116 if (mode & OB_MODE_PARTICLE_EDIT) {
118 return true;
119 }
120 }
121 break;
122 case OB_CURVES_LEGACY:
123 case OB_SURF:
124 case OB_FONT:
125 case OB_MBALL:
126 case OB_POINTCLOUD:
127 case OB_LATTICE:
128 if (mode & OB_MODE_EDIT) {
129 return true;
130 }
131 break;
132 case OB_ARMATURE:
133 if (mode & (OB_MODE_EDIT | OB_MODE_POSE)) {
134 return true;
135 }
136 break;
137 case OB_CURVES:
138 if (mode & (OB_MODE_EDIT | OB_MODE_SCULPT_CURVES)) {
139 return true;
140 }
141 break;
142 case OB_GREASE_PENCIL:
145 {
146 return true;
147 }
148 break;
149 default:
150 break;
151 }
152
153 return false;
154}
155
157{
158 bool ok;
159 if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) {
160 const char *opstring = object_mode_op_string(ob->mode);
161
162 WM_operator_name_call(C, opstring, wm::OpCallContext::ExecRegionWin, nullptr, nullptr);
163 ok = ELEM(ob->mode, mode, OB_MODE_OBJECT);
164 if (!ok) {
165 wmOperatorType *ot = WM_operatortype_find(opstring, false);
166 BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
167 }
168 }
169 else {
170 ok = true;
171 }
172
173 return ok;
174}
175
177
178/* -------------------------------------------------------------------- */
185
186bool mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportList *reports)
187{
189 const Main *bmain = CTX_data_main(C);
190 const Scene *scene = CTX_data_scene(C);
191 ViewLayer *view_layer = CTX_data_view_layer(C);
192
193 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
195 if (ob == nullptr) {
196 return (mode == OB_MODE_OBJECT);
197 }
198
199 if (ob->mode == mode) {
200 return true;
201 }
202
203 if (!mode_compat_test(ob, mode)) {
204 return false;
205 }
206
207 const char *opstring = object_mode_op_string((mode == OB_MODE_OBJECT) ? ob->mode : mode);
208 if (opstring == nullptr) {
209 BKE_reportf(reports,
210 RPT_ERROR,
211 "Unable to set invalid object mode %d",
212 int((mode == OB_MODE_OBJECT) ? ob->mode : mode));
213 return false;
214 }
215 wmOperatorType *ot = WM_operatortype_find(opstring, false);
216
217 if (!use_undo) {
218 wm->op_undo_depth++;
219 }
221 if (!use_undo) {
222 wm->op_undo_depth--;
223 }
224
225 if (ob->mode != mode) {
226 /* Give more specific error messages for cases that are known to fail (like linked and packed
227 * object-data). */
228 if (ob->data && !ID_IS_EDITABLE(ob->data)) {
229 const ID &obdata_id = *ob->data;
230 char obdata_idtype_name_lower[MAX_ID_NAME];
231 const size_t obdata_idtype_name_lower_len = STRNCPY_RLEN(
232 obdata_idtype_name_lower, BKE_idtype_idcode_to_name(GS(obdata_id.name)));
233 BLI_str_tolower_ascii(obdata_idtype_name_lower, obdata_idtype_name_lower_len);
234
235 if (ID_IS_PACKED(ob->data)) {
236 BKE_reportf(reports,
237 RPT_ERROR,
238 "The '%s' %s data-block is packed and not editable. Use \"Make Local\" to "
239 "make it editable.",
240 BKE_id_name(obdata_id),
241 obdata_idtype_name_lower);
242 return false;
243 }
244 if (ID_IS_LINKED(ob->data)) {
245 BKE_reportf(reports,
246 RPT_ERROR,
247 "The '%s' %s data-block is linked and not editable. Use \"Make Local\" to "
248 "make it editable.",
249 BKE_id_name(obdata_id),
250 obdata_idtype_name_lower);
251 return false;
252 }
253 }
254
255 BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
256 return false;
257 }
258
259 return true;
260}
261
263{
264 /* Don't do undo push by default, since this may be called by lower level code. */
265 return mode_set_ex(C, mode, true, nullptr);
266}
267
273 Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, bool only_test)
274{
275 BLI_assert((bmain == nullptr) == only_test);
276 if (ob->mode & OB_MODE_EDIT) {
278 if (only_test) {
279 return true;
280 }
281 editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
282 }
283 }
284 else if (ob->mode & OB_MODE_VERTEX_PAINT) {
285 if (ob->runtime->sculpt_session &&
287 {
288 if (only_test) {
289 return true;
290 }
291 ED_object_vpaintmode_exit_ex(*scene, *ob);
292 }
293 }
294 else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
295 if (ob->runtime->sculpt_session &&
297 {
298 if (only_test) {
299 return true;
300 }
301 ED_object_wpaintmode_exit_ex(*scene, *ob);
302 }
303 }
304 else if (ob->mode & OB_MODE_SCULPT) {
306 {
307 if (only_test) {
308 return true;
309 }
310 sculpt_paint::object_sculpt_mode_exit(*bmain, *depsgraph, *scene, *ob);
311 }
312 }
313 else if (ob->mode & OB_MODE_POSE) {
314 if (ob->pose != nullptr) {
315 if (only_test) {
316 return true;
317 }
319 }
320 }
321 else if (ob->mode & OB_MODE_TEXTURE_PAINT) {
322 if (only_test) {
323 return true;
324 }
325 ED_object_texture_paint_mode_exit_ex(*bmain, *scene, *ob);
326 }
327 else if (ob->mode & OB_MODE_PARTICLE_EDIT) {
328 if (only_test) {
329 return true;
330 }
332 }
333 else if (ob->type == OB_GREASE_PENCIL) {
334 BLI_assert((ob->mode & OB_MODE_OBJECT) == 0);
335 if (only_test) {
336 return true;
337 }
338 ob->restore_mode = ob->mode;
341
342 /* Inform all evaluated versions that we changed the mode. */
344 }
345 else {
346 if (only_test) {
347 return false;
348 }
350 }
351
352 return false;
353}
354
355/* When locked, it's almost impossible to select the pose-object
356 * then the mesh-object to enter weight paint mode.
357 * Even when the object mode is not locked this is inconvenient - so allow in either case.
358 *
359 * In this case move our pose object in/out of pose mode.
360 * This is in fits with the convention of selecting multiple objects and entering a mode.
361 */
363 Main *bmain,
364 Object *ob_arm,
365 const bool is_mode_set)
366{
367 View3D *v3d = CTX_wm_view3d(C);
368 const Scene *scene = CTX_data_scene(C);
369 ViewLayer *view_layer = CTX_data_view_layer(C);
370
371 if (ob_arm != nullptr) {
372 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
373 const Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm);
374 if (base_arm && BASE_VISIBLE(v3d, base_arm)) {
375 if (is_mode_set) {
376 if ((ob_arm->mode & OB_MODE_POSE) != 0) {
377 ED_object_posemode_exit_ex(bmain, ob_arm);
378 }
379 }
380 else {
381 /* Only check selected status when entering weight-paint mode
382 * because we may have multiple armature objects.
383 * Selecting one will de-select the other, which would leave it in pose-mode
384 * when exiting weight paint mode. While usable, this looks like inconsistent
385 * behavior from a user perspective. */
386 if (base_arm->flag & BASE_SELECTED) {
387 if ((ob_arm->mode & OB_MODE_POSE) == 0) {
388 ED_object_posemode_enter_ex(bmain, ob_arm);
389 }
390 }
391 }
392 }
393 }
394}
395
396void posemode_set_for_weight_paint(bContext *C, Main *bmain, Object *ob, const bool is_mode_set)
397{
398 VirtualModifierData virtual_modifier_data;
399 ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob, &virtual_modifier_data);
400 for (; md; md = md->next) {
401 if (md->type == eModifierType_Armature) {
402 ArmatureModifierData *amd = reinterpret_cast<ArmatureModifierData *>(md);
403 Object *ob_arm = amd->object;
404 ed_object_posemode_set_for_weight_paint_ex(C, bmain, ob_arm, is_mode_set);
405 }
408 md);
409 Object *ob_arm = amd->object;
410 ed_object_posemode_set_for_weight_paint_ex(C, bmain, ob_arm, is_mode_set);
411 }
412 }
413}
414
415void mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
416{
417 ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false);
418}
419
420bool mode_generic_has_data(Depsgraph *depsgraph, const Object *ob)
421{
423 nullptr, depsgraph, nullptr, const_cast<Object *>(ob), true);
424}
425
427
428/* -------------------------------------------------------------------- */
434
436{
437 if (!CTX_wm_region_view3d(C)) {
438 return false;
439 }
440 const Object *ob = CTX_data_active_object(C);
441 return ob && (ob->mode != OB_MODE_OBJECT);
442}
443
444/* Update the viewport rotation origin to the mouse cursor. */
446 Paint *paint,
447 const int mval[2])
448{
449 float global_loc[3];
450 if (!ED_view3d_autodist_simple(region, mval, global_loc, 0, nullptr)) {
451 return;
452 }
454}
455
456constexpr float mode_transfer_flash_length = 0.55f;
457
459{
460 static Map<std::string, double> map;
461 return map;
462}
463
464static float alpha_from_time_get(const float anim_time)
465{
466 if (anim_time < 0.0f) {
467 return 0.0f;
468 }
469 return (1.0f - (anim_time / mode_transfer_flash_length));
470}
471
473{
474 const double now = BLI_time_now_seconds();
475
476 /* Protect against possible concurrent access from multiple renderers or viewports. */
477 static Mutex mutex;
478 std::scoped_lock lock(mutex);
479
480 /* Remove finished animations form the global map. */
482 start_times.remove_if(
483 [&](const auto &item) { return (now - item.value) > mode_transfer_flash_length; });
484
486 for (const auto &item : start_times.items()) {
487 const float alpha = alpha_from_time_get(now - item.value);
488 if (alpha > 0.0f) {
489 factors.add_new(item.key, alpha);
490 }
491 }
492 return factors;
493}
494
496{
497 Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
498 Object *ob_dst_eval = DEG_get_evaluated(depsgraph, ob_dst);
500}
501
503 wmOperator *op,
504 Scene *scene,
505 Object * /*ob_src*/,
506 Object *ob_dst,
507 const eObjectMode mode_dst)
508{
509 const Main *bmain = CTX_data_main(C);
510 ViewLayer *view_layer = CTX_data_view_layer(C);
511
512 /* Undo is handled manually here, such that the entry in the user-visible undo history is named
513 * from the expected mode toggle operator name, and not the 'Transfer Mode' operator itself.
514 *
515 * The undo grouping is needed to ensure that only one step is visible, even though there may be
516 * two undo steps stored when executed successfully (moving source object to Object mode, and
517 * then target object to the previous mode of source object). */
519
520 const bool mode_transferred = mode_set_ex(C, OB_MODE_OBJECT, true, op->reports);
521 if (mode_transferred) {
522 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
523 Base *base_dst = BKE_view_layer_base_find(view_layer, ob_dst);
524 BKE_view_layer_base_deselect_all(*bmain, scene, view_layer);
525 BKE_view_layer_base_select_and_set_active(view_layer, base_dst);
526
527 /* Not entirely clear why, but this extra undo step (the two calls to #mode_set_ex should
528 * already create their own) is required. Otherwise some mode switching does not work as
529 * expected on undo/redo (see #130420 with Sculpt mode). */
530 ED_undo_push(C, "Change Active");
531
532 mode_set_ex(C, mode_dst, true, op->reports);
533
534 if (RNA_boolean_get(op->ptr, "use_flash_on_transfer")) {
536 }
537 }
538
540
541 return mode_transferred;
542}
543
545 wmOperator *op,
546 const wmEvent *event)
547{
548 Scene *scene = CTX_data_scene(C);
549 ARegion *region = CTX_wm_region(C);
551 const eObjectMode mode_src = ob_src->mode;
552
553 Base *base_dst = ED_view3d_give_base_under_cursor(C, event->mval);
554 if (!base_dst) {
555 BKE_reportf(op->reports, RPT_ERROR, "No target object to transfer the mode to");
556 return OPERATOR_CANCELLED;
557 }
558
559 Object *ob_dst = base_dst->object;
560
561 if (ob_src == ob_dst) {
562 return OPERATOR_CANCELLED;
563 }
564
565 BLI_assert(ob_dst->id.orig_id == nullptr);
566 if (!ID_IS_EDITABLE(ob_dst) || !ID_IS_EDITABLE(ob_src)) {
568 RPT_ERROR,
569 "Unable to transfer mode, the source and/or target objects are not editable");
570 return OPERATOR_CANCELLED;
571 }
572 if (ID_IS_OVERRIDE_LIBRARY(ob_dst) && !ELEM(mode_src, OB_MODE_OBJECT, OB_MODE_POSE)) {
574 op->reports,
575 RPT_ERROR,
576 "Current mode of source object '%s' is not compatible with target liboverride object '%s'",
577 ob_src->id.name + 2,
578 ob_dst->id.name + 2);
579 return OPERATOR_CANCELLED;
580 }
581 if (!mode_compat_test(ob_dst, mode_src)) {
583 RPT_ERROR,
584 "Current mode of source object '%s' is not compatible with target object '%s'",
585 ob_src->id.name + 2,
586 ob_dst->id.name + 2);
587 return OPERATOR_CANCELLED;
588 }
589
590 const bool mode_transferred = object_transfer_mode_to_base(
591 C, op, scene, ob_src, ob_dst, mode_src);
592 if (!mode_transferred) {
593 /* Error report should have been set by #object_transfer_mode_to_base call here. */
594 return OPERATOR_CANCELLED;
595 }
596
600
602 if (mode_src & OB_MODE_ALL_PAINT_MESH) {
605 }
606
607 return OPERATOR_FINISHED;
608}
609
611{
612 /* identifiers */
613 ot->name = "Transfer Mode";
614 ot->idname = "OBJECT_OT_transfer_mode";
615 ot->description =
616 "Switches the active object and assigns the same mode to a new one under the mouse cursor, "
617 "leaving the active mode in the current one";
618
619 /* API callbacks. */
622
623 /* Undo push is handled by the operator, see #object_transfer_mode_to_base for details. */
625
627
629 "use_flash_on_transfer",
630 true,
631 "Flash On Transfer",
632 "Flash the target object when transferring the mode");
633}
634
636
637} // namespace blender::ed::object
General operations, lookup, etc. for blender objects.
#define STRNCPY_RLEN(dst, src)
Platform independent time functions.
#define ID_IS_PACKED(_id)
Definition DNA_ID.h:703
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:697
#define MAX_ID_NAME
Definition DNA_ID.h:367
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:708
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:736
#define OB_MODE_ALL_PAINT_MESH
#define OB_MODE_ALL_MODE_DATA
Object is a sort of wrapper for general info.
#define BASE_VISIBLE(v3d, base)
#define C
Definition RandGen.cpp:29
#define ND_OB_SELECT
Definition WM_types.hh:461
#define NC_SCENE
Definition WM_types.hh:391
volatile int lock
#define ELEM(...)
void add_new(const Key &key, const Value &value)
Definition BLI_map.hh:265
int64_t remove_if(Predicate &&predicate)
Definition BLI_map.hh:948
ItemIterator items() const &
Definition BLI_map.hh:902
void stroke_set_location(Paint &paint, float3 location)
bool mode_generic_has_data(Depsgraph *depsgraph, const Object *ob)
constexpr float mode_transfer_flash_length
static void object_overlay_mode_transfer_animation_start(bContext *C, Object *ob_dst)
static wmOperatorStatus object_transfer_mode_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool ed_object_mode_generic_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, bool only_test)
static float alpha_from_time_get(const float anim_time)
Map< std::string, float, 1 > mode_transfer_overlay_current_state()
bool mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportList *reports)
void mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Scene *scene, Object *, Object *ob_dst, const eObjectMode mode_dst)
bool mode_compat_test(const Object *ob, eObjectMode mode)
static void ed_object_posemode_set_for_weight_paint_ex(bContext *C, Main *bmain, Object *ob_arm, const bool is_mode_set)
void posemode_set_for_weight_paint(bContext *C, Main *bmain, Object *ob, bool is_mode_set)
bool mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
static const char * object_mode_op_string(eObjectMode mode)
static auto & mode_transfer_overlay_start_times()
static bool object_transfer_mode_poll(bContext *C)
static void object_transfer_mode_reposition_view_pivot(ARegion *region, Paint *paint, const int mval[2])
bool mode_set(bContext *C, eObjectMode mode)
bool editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag)
void OBJECT_OT_transfer_mode(wmOperatorType *ot)
void object_sculpt_mode_exit(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob)
const char * BKE_idtype_idcode_to_name(short idcode)
Definition idtype.cc:261
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BKE_view_layer_base_select_and_set_active(ViewLayer *view_layer, Base *selbase)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
@ eModifierType_GreasePencilArmature
const char * BKE_id_name(const ID &id)
ViewLayer * CTX_data_view_layer(const bContext *C)
void ED_outliner_select_sync_from_object_tag(bContext *C)
Base * ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
void ED_object_particle_edit_mode_exit_ex(Scene *scene, Object *ob)
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
bool ED_object_posemode_exit_ex(Main *bmain, Object *ob)
Definition pose_edit.cc:117
void DEG_id_tag_update(ID *id, unsigned int flags)
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_WEIGHT_GREASE_PENCIL
@ OB_MODE_PAINT_GREASE_PENCIL
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void ED_object_texture_paint_mode_exit_ex(Main &bmain, Scene &scene, Object &ob)
wmWindowManager * CTX_wm_manager(const bContext *C)
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
Definition ed_undo.cc:103
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
void WM_toolsystem_update_from_context_view3d(bContext *C)
void ED_object_vpaintmode_exit_ex(Scene &scene, Object &ob)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
bool ED_object_particle_edit_mode_supported(const Object *ob)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
bool ED_view3d_autodist_simple(ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, const float *force_depth)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void ED_undo_group_begin(bContext *C)
Definition ed_undo.cc:91
void BLI_str_tolower_ascii(char *str, size_t len) ATTR_NONNULL(1)
void BKE_view_layer_base_deselect_all(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
bool BKE_object_is_in_editmode(const Object *ob)
Definition object.cc:1898
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
@ WM_CURSOR_EYEDROPPER
Definition wm_cursors.hh:38
Main * CTX_data_main(const bContext *C)
Paint * BKE_paint_get_active_from_context(const bContext *C)
std::mutex Mutex
Definition BLI_mutex.hh:51
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
ID_Type GS(const char *name)
Definition DNA_ID.h:410
bool ED_object_posemode_enter_ex(Main *bmain, Object *ob)
Definition pose_edit.cc:81
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
double BLI_time_now_seconds()
Definition time.cc:30
Scene * CTX_data_scene(const bContext *C)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_DEPENDS_ON_CURSOR
Definition WM_types.hh:228
VecBase< float, 3 > float3
void ED_undo_group_end(bContext *C)
Definition ed_undo.cc:97
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
Object * CTX_data_active_object(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
void ED_object_wpaintmode_exit_ex(Scene &scene, Object &ob)
struct Object * object
char name[258]
Definition DNA_ID.h:433
struct ID * orig_id
Definition DNA_ID.h:502
struct ModifierData * next
eObjectMode restore_mode
bke::ObjectRuntime * runtime
struct bPose * pose
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
struct ReportList * reports