Blender V5.0
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.h"
17#include "BLI_utildefines.h"
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.h"
31#include "BLI_string.h"
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 }
150
151 return false;
152}
153
155{
156 bool ok;
157 if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) {
158 const char *opstring = object_mode_op_string(eObjectMode(ob->mode));
159
160 WM_operator_name_call(C, opstring, wm::OpCallContext::ExecRegionWin, nullptr, nullptr);
161 ok = ELEM(ob->mode, mode, OB_MODE_OBJECT);
162 if (!ok) {
163 wmOperatorType *ot = WM_operatortype_find(opstring, false);
164 BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
165 }
166 }
167 else {
168 ok = true;
169 }
170
171 return ok;
172}
173
175
176/* -------------------------------------------------------------------- */
183
184bool mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportList *reports)
185{
187 const Scene *scene = CTX_data_scene(C);
188 ViewLayer *view_layer = CTX_data_view_layer(C);
189
190 BKE_view_layer_synced_ensure(scene, view_layer);
192 if (ob == nullptr) {
193 return (mode == OB_MODE_OBJECT);
194 }
195
196 if (ob->mode == mode) {
197 return true;
198 }
199
200 if (!mode_compat_test(ob, mode)) {
201 return false;
202 }
203
204 const char *opstring = object_mode_op_string((mode == OB_MODE_OBJECT) ? eObjectMode(ob->mode) :
205 mode);
206 wmOperatorType *ot = WM_operatortype_find(opstring, false);
207
208 if (!use_undo) {
209 wm->op_undo_depth++;
210 }
212 if (!use_undo) {
213 wm->op_undo_depth--;
214 }
215
216 if (ob->mode != mode) {
217 /* Give more specific error messages for cases that are known to fail (like linked and packed
218 * object-data). */
219 if (ob->data && !ID_IS_EDITABLE(ob->data)) {
220 const ID &obdata_id = *static_cast<ID *>(ob->data);
221 char obdata_idtype_name_lower[MAX_ID_NAME];
222 STRNCPY(obdata_idtype_name_lower, BKE_idtype_idcode_to_name(GS(obdata_id.name)));
223 BLI_str_tolower_ascii(obdata_idtype_name_lower, strlen(obdata_idtype_name_lower));
224
225 if (ID_IS_PACKED(static_cast<ID *>(ob->data))) {
226 BKE_reportf(reports,
227 RPT_ERROR,
228 "The '%s' %s data-block is packed and not editable. Use \"Make Local\" to "
229 "make it editable.",
230 BKE_id_name(obdata_id),
231 obdata_idtype_name_lower);
232 return false;
233 }
234 if (ID_IS_LINKED(ob->data)) {
235 BKE_reportf(reports,
236 RPT_ERROR,
237 "The '%s' %s data-block is linked and not editable. Use \"Make Local\" to "
238 "make it editable.",
239 BKE_id_name(obdata_id),
240 obdata_idtype_name_lower);
241 return false;
242 }
243 }
244
245 BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
246 return false;
247 }
248
249 return true;
250}
251
253{
254 /* Don't do undo push by default, since this may be called by lower level code. */
255 return mode_set_ex(C, mode, true, nullptr);
256}
257
263 Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, bool only_test)
264{
265 BLI_assert((bmain == nullptr) == only_test);
266 if (ob->mode & OB_MODE_EDIT) {
268 if (only_test) {
269 return true;
270 }
271 editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
272 }
273 }
274 else if (ob->mode & OB_MODE_VERTEX_PAINT) {
275 if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
276 if (only_test) {
277 return true;
278 }
280 }
281 }
282 else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
283 if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
284 if (only_test) {
285 return true;
286 }
288 }
289 }
290 else if (ob->mode & OB_MODE_SCULPT) {
291 if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) {
292 if (only_test) {
293 return true;
294 }
296 }
297 }
298 else if (ob->mode & OB_MODE_POSE) {
299 if (ob->pose != nullptr) {
300 if (only_test) {
301 return true;
302 }
304 }
305 }
306 else if (ob->mode & OB_MODE_TEXTURE_PAINT) {
307 if (only_test) {
308 return true;
309 }
310 ED_object_texture_paint_mode_exit_ex(*bmain, *scene, *ob);
311 }
312 else if (ob->mode & OB_MODE_PARTICLE_EDIT) {
313 if (only_test) {
314 return true;
315 }
317 }
318 else if (ob->type == OB_GREASE_PENCIL) {
319 BLI_assert((ob->mode & OB_MODE_OBJECT) == 0);
320 if (only_test) {
321 return true;
322 }
323 ob->restore_mode = ob->mode;
326
327 /* Inform all evaluated versions that we changed the mode. */
329 }
330 else {
331 if (only_test) {
332 return false;
333 }
335 }
336
337 return false;
338}
339
340/* When locked, it's almost impossible to select the pose-object
341 * then the mesh-object to enter weight paint mode.
342 * Even when the object mode is not locked this is inconvenient - so allow in either case.
343 *
344 * In this case move our pose object in/out of pose mode.
345 * This is in fits with the convention of selecting multiple objects and entering a mode.
346 */
348 Main *bmain,
349 Object *ob_arm,
350 const bool is_mode_set)
351{
352 View3D *v3d = CTX_wm_view3d(C);
353 const Scene *scene = CTX_data_scene(C);
354 ViewLayer *view_layer = CTX_data_view_layer(C);
355
356 if (ob_arm != nullptr) {
357 BKE_view_layer_synced_ensure(scene, view_layer);
358 const Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm);
359 if (base_arm && BASE_VISIBLE(v3d, base_arm)) {
360 if (is_mode_set) {
361 if ((ob_arm->mode & OB_MODE_POSE) != 0) {
362 ED_object_posemode_exit_ex(bmain, ob_arm);
363 }
364 }
365 else {
366 /* Only check selected status when entering weight-paint mode
367 * because we may have multiple armature objects.
368 * Selecting one will de-select the other, which would leave it in pose-mode
369 * when exiting weight paint mode. While usable, this looks like inconsistent
370 * behavior from a user perspective. */
371 if (base_arm->flag & BASE_SELECTED) {
372 if ((ob_arm->mode & OB_MODE_POSE) == 0) {
373 ED_object_posemode_enter_ex(bmain, ob_arm);
374 }
375 }
376 }
377 }
378 }
379}
380
381void posemode_set_for_weight_paint(bContext *C, Main *bmain, Object *ob, const bool is_mode_set)
382{
383 VirtualModifierData virtual_modifier_data;
384 ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob, &virtual_modifier_data);
385 for (; md; md = md->next) {
386 if (md->type == eModifierType_Armature) {
387 ArmatureModifierData *amd = reinterpret_cast<ArmatureModifierData *>(md);
388 Object *ob_arm = amd->object;
389 ed_object_posemode_set_for_weight_paint_ex(C, bmain, ob_arm, is_mode_set);
390 }
393 md);
394 Object *ob_arm = amd->object;
395 ed_object_posemode_set_for_weight_paint_ex(C, bmain, ob_arm, is_mode_set);
396 }
397 }
398}
399
400void mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
401{
402 ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false);
403}
404
405bool mode_generic_has_data(Depsgraph *depsgraph, const Object *ob)
406{
407 return ed_object_mode_generic_exit_ex(nullptr, depsgraph, nullptr, (Object *)ob, true);
408}
409
411
412/* -------------------------------------------------------------------- */
418
420{
421 if (!CTX_wm_region_view3d(C)) {
422 return false;
423 }
424 const Object *ob = CTX_data_active_object(C);
425 return ob && (ob->mode != OB_MODE_OBJECT);
426}
427
428/* Update the viewport rotation origin to the mouse cursor. */
430 Paint *paint,
431 const int mval[2])
432{
433 float global_loc[3];
434 if (!ED_view3d_autodist_simple(region, mval, global_loc, 0, nullptr)) {
435 return;
436 }
437 bke::PaintRuntime *paint_runtime = paint->runtime;
438 copy_v3_v3(paint_runtime->average_stroke_accum, global_loc);
439 paint_runtime->average_stroke_counter = 1;
440 paint_runtime->last_stroke_valid = true;
441}
442
443constexpr float mode_transfer_flash_length = 0.55f;
444
446{
447 static Map<std::string, double> map;
448 return map;
449}
450
451static float alpha_from_time_get(const float anim_time)
452{
453 if (anim_time < 0.0f) {
454 return 0.0f;
455 }
456 return (1.0f - (anim_time / mode_transfer_flash_length));
457}
458
460{
461 const double now = BLI_time_now_seconds();
462
463 /* Protect against possible concurrent access from multiple renderers or viewports. */
464 static Mutex mutex;
465 std::scoped_lock lock(mutex);
466
467 /* Remove finished animations form the global map. */
469 start_times.remove_if(
470 [&](const auto &item) { return (now - item.value) > mode_transfer_flash_length; });
471
473 for (const auto &item : start_times.items()) {
474 const float alpha = alpha_from_time_get(now - item.value);
475 if (alpha > 0.0f) {
476 factors.add_new(item.key, alpha);
477 }
478 }
479 return factors;
480}
481
488
490 wmOperator *op,
491 Scene *scene,
492 Object * /*ob_src*/,
493 Object *ob_dst,
494 const eObjectMode mode_dst)
495{
496 ViewLayer *view_layer = CTX_data_view_layer(C);
497
498 /* Undo is handled manually here, such that the entry in the user-visible undo history is named
499 * from the expected mode toggle operator name, and not the 'Transfer Mode' operator itself.
500 *
501 * The undo grouping is needed to ensure that only one step is visible, even though there may be
502 * two undo steps stored when executed successfully (moving source object to Object mode, and
503 * then target object to the previous mode of source object). */
505
506 const bool mode_transferred = mode_set_ex(C, OB_MODE_OBJECT, true, op->reports);
507 if (mode_transferred) {
508 BKE_view_layer_synced_ensure(scene, view_layer);
509 Base *base_dst = BKE_view_layer_base_find(view_layer, ob_dst);
510 BKE_view_layer_base_deselect_all(scene, view_layer);
511 BKE_view_layer_base_select_and_set_active(view_layer, base_dst);
512
513 /* Not entirely clear why, but this extra undo step (the two calls to #mode_set_ex should
514 * already create their own) is required. Otherwise some mode switching does not work as
515 * expected on undo/redo (see #130420 with Sculpt mode). */
516 ED_undo_push(C, "Change Active");
517
518 mode_set_ex(C, mode_dst, true, op->reports);
519
520 if (RNA_boolean_get(op->ptr, "use_flash_on_transfer")) {
522 }
523 }
524
526
527 return mode_transferred;
528}
529
531 wmOperator *op,
532 const wmEvent *event)
533{
534 Scene *scene = CTX_data_scene(C);
535 ARegion *region = CTX_wm_region(C);
537 const eObjectMode mode_src = eObjectMode(ob_src->mode);
538
539 Base *base_dst = ED_view3d_give_base_under_cursor(C, event->mval);
540 if (!base_dst) {
541 BKE_reportf(op->reports, RPT_ERROR, "No target object to transfer the mode to");
542 return OPERATOR_CANCELLED;
543 }
544
545 Object *ob_dst = base_dst->object;
546
547 if (ob_src == ob_dst) {
548 return OPERATOR_CANCELLED;
549 }
550
551 BLI_assert(ob_dst->id.orig_id == nullptr);
552 if (!ID_IS_EDITABLE(ob_dst) || !ID_IS_EDITABLE(ob_src)) {
554 RPT_ERROR,
555 "Unable to transfer mode, the source and/or target objects are not editable");
556 return OPERATOR_CANCELLED;
557 }
558 if (ID_IS_OVERRIDE_LIBRARY(ob_dst) && !ELEM(mode_src, OB_MODE_OBJECT, OB_MODE_POSE)) {
560 op->reports,
561 RPT_ERROR,
562 "Current mode of source object '%s' is not compatible with target liboverride object '%s'",
563 ob_src->id.name + 2,
564 ob_dst->id.name + 2);
565 return OPERATOR_CANCELLED;
566 }
567 if (!mode_compat_test(ob_dst, mode_src)) {
569 RPT_ERROR,
570 "Current mode of source object '%s' is not compatible with target object '%s'",
571 ob_src->id.name + 2,
572 ob_dst->id.name + 2);
573 return OPERATOR_CANCELLED;
574 }
575
576 const bool mode_transferred = object_transfer_mode_to_base(
577 C, op, scene, ob_src, ob_dst, mode_src);
578 if (!mode_transferred) {
579 /* Error report should have been set by #object_transfer_mode_to_base call here. */
580 return OPERATOR_CANCELLED;
581 }
582
586
588 if (mode_src & OB_MODE_ALL_PAINT) {
591 }
592
593 return OPERATOR_FINISHED;
594}
595
597{
598 /* identifiers */
599 ot->name = "Transfer Mode";
600 ot->idname = "OBJECT_OT_transfer_mode";
601 ot->description =
602 "Switches the active object and assigns the same mode to a new one under the mouse cursor, "
603 "leaving the active mode in the current one";
604
605 /* API callbacks. */
608
609 /* Undo push is handled by the operator, see #object_transfer_mode_to_base for details. */
611
612 ot->cursor_pending = WM_CURSOR_EYEDROPPER;
613
614 RNA_def_boolean(ot->srna,
615 "use_flash_on_transfer",
616 true,
617 "Flash On Transfer",
618 "Flash the target object when transferring the mode");
619}
620
622
623} // namespace blender::ed::object
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
const char * BKE_idtype_idcode_to_name(short idcode)
Definition idtype.cc:164
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
void BKE_view_layer_base_deselect_all(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void BKE_view_layer_base_select_and_set_active(ViewLayer *view_layer, Base *selbase)
const char * BKE_id_name(const ID &id)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
General operations, lookup, etc. for blender objects.
bool BKE_object_is_in_editmode(const Object *ob)
Paint * BKE_paint_get_active_from_context(const bContext *C)
Definition paint.cc:476
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE void copy_v3_v3(float r[3], const float a[3])
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
void BLI_str_tolower_ascii(char *str, size_t len) ATTR_NONNULL(1)
Definition string.cc:956
Platform independent time functions.
double BLI_time_now_seconds(void)
Definition time.cc:113
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
#define ID_IS_PACKED(_id)
Definition DNA_ID.h:700
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:694
#define MAX_ID_NAME
Definition DNA_ID.h:373
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:705
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:730
@ eModifierType_GreasePencilArmature
@ eModifierType_Armature
#define OB_MODE_ALL_PAINT
#define OB_MODE_ALL_MODE_DATA
eObjectMode
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_SCULPT
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_PAINT_GREASE_PENCIL
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_WEIGHT_GREASE_PENCIL
@ OB_MODE_VERTEX_PAINT
Object is a sort of wrapper for general info.
@ OB_LATTICE
@ OB_MBALL
@ OB_SURF
@ OB_FONT
@ OB_GREASE_PENCIL
@ OB_ARMATURE
@ OB_MESH
@ OB_POINTCLOUD
@ OB_CURVES_LEGACY
@ OB_CURVES
#define BASE_SELECTED(v3d, base)
#define BASE_VISIBLE(v3d, base)
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
void ED_outliner_select_sync_from_object_tag(bContext *C)
void ED_object_wpaintmode_exit_ex(Object &ob)
void ED_object_vpaintmode_exit_ex(Object &ob)
void ED_object_texture_paint_mode_exit_ex(Main &bmain, Scene &scene, Object &ob)
bool ED_object_particle_edit_mode_supported(const Object *ob)
void ED_object_particle_edit_mode_exit_ex(Scene *scene, Object *ob)
void ED_undo_push(bContext *C, const char *str)
Definition ed_undo.cc:98
void ED_undo_group_begin(bContext *C)
Definition ed_undo.cc:86
void ED_undo_group_end(bContext *C)
Definition ed_undo.cc:92
bool ED_view3d_autodist_simple(ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, const float *force_depth)
Base * ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
#define C
Definition RandGen.cpp:29
#define ND_OB_SELECT
Definition WM_types.hh:442
#define NC_SCENE
Definition WM_types.hh:378
@ OPTYPE_DEPENDS_ON_CURSOR
Definition WM_types.hh:218
@ OPTYPE_REGISTER
Definition WM_types.hh:180
volatile int lock
BPy_StructRNA * depsgraph
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
#define GS(x)
ThreadMutex mutex
DEG_id_tag_update_ex(cb_data->bmain, cb_data->owner_id, ID_RECALC_TAG_FOR_UNDO|ID_RECALC_SYNC_TO_EVAL)
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)
std::mutex Mutex
Definition BLI_mutex.hh:47
bool ED_object_posemode_enter_ex(Main *bmain, Object *ob)
Definition pose_edit.cc:77
bool ED_object_posemode_exit_ex(Main *bmain, Object *ob)
Definition pose_edit.cc:113
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
short flag
struct Object * object
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
struct ID * orig_id
Definition DNA_ID.h:501
struct ModifierData * next
struct bPose * pose
struct SculptSession * sculpt
PaintRuntimeHandle * runtime
eObjectMode mode_type
Definition BKE_paint.hh:491
blender::float3 average_stroke_accum
int mval[2]
Definition WM_types.hh:763
struct ReportList * reports
struct PointerRNA * ptr
@ WM_CURSOR_EYEDROPPER
Definition wm_cursors.hh:36
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
wmOperatorType * ot
Definition wm_files.cc:4237
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_toolsystem_update_from_context_view3d(bContext *C)