Blender  V3.3
ed_util.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include <math.h>
9 #include <stdlib.h>
10 #include <string.h>
11 
12 #include "MEM_guardedalloc.h"
13 
14 #include "BLI_listbase.h"
15 #include "BLI_path_util.h"
16 #include "BLI_string.h"
17 
18 #include "BLT_translation.h"
19 
20 #include "BKE_collection.h"
21 #include "BKE_global.h"
22 #include "BKE_layer.h"
23 #include "BKE_lib_id.h"
24 #include "BKE_lib_remap.h"
25 #include "BKE_main.h"
26 #include "BKE_material.h"
27 #include "BKE_multires.h"
28 #include "BKE_object.h"
29 #include "BKE_packedFile.h"
30 #include "BKE_paint.h"
31 #include "BKE_screen.h"
32 #include "BKE_undo_system.h"
33 
34 #include "DEG_depsgraph.h"
35 
36 #include "DNA_gpencil_types.h"
37 
38 #include "ED_armature.h"
39 #include "ED_asset.h"
40 #include "ED_gpencil.h"
41 #include "ED_image.h"
42 #include "ED_mesh.h"
43 #include "ED_object.h"
44 #include "ED_paint.h"
45 #include "ED_screen.h"
46 #include "ED_space_api.h"
47 #include "ED_util.h"
48 
49 #include "GPU_immediate.h"
50 
51 #include "UI_interface.h"
52 #include "UI_resources.h"
53 
54 #include "RNA_access.h"
55 #include "WM_api.h"
56 #include "WM_types.h"
57 
58 /* ********* general editor util funcs, not BKE stuff please! ********* */
59 
61 {
62  wmWindowManager *wm = bmain->wm.first;
63  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
64  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
65  Base *base = BASACT(view_layer);
66  if (base != NULL) {
67  Object *ob = base->object;
68  if (ob->mode & OB_MODE_TEXTURE_PAINT) {
70 
73  }
74  }
75  }
76 }
77 
79 {
81  Main *bmain = CTX_data_main(C);
84 
85  /* This is called during initialization, so we don't want to store any reports */
86  ReportList *reports = CTX_wm_reports(C);
87  int reports_flag_prev = reports->flag & ~RPT_STORE;
88 
89  SWAP(int, reports->flag, reports_flag_prev);
90 
91  /* Don't do undo pushes when calling an operator. */
92  wm->op_undo_depth++;
93 
94  /* toggle on modes for objects that were saved with these enabled. for
95  * e.g. linked objects we have to ensure that they are actually the
96  * active object in this scene. */
98  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
99  int mode = ob->mode;
100  if (mode == OB_MODE_OBJECT) {
101  continue;
102  }
103  if (BKE_object_has_mode_data(ob, mode)) {
104  continue;
105  }
106  if (ob->type == OB_GPENCIL) {
107  /* For multi-edit mode we may already have mode data (grease pencil does not need it).
108  * However we may have a non-active object stuck in a grease-pencil edit mode. */
109  if (ob != obact) {
110  bGPdata *gpd = (bGPdata *)ob->data;
114  ob->mode = OB_MODE_OBJECT;
116  }
117  else if (mode & OB_MODE_ALL_PAINT_GPENCIL) {
119  }
120  continue;
121  }
122 
123  /* Reset object to Object mode, so that code below can properly re-switch it to its
124  * previous mode if possible, re-creating its mode data, etc. */
125  ID *ob_data = ob->data;
126  ob->mode = OB_MODE_OBJECT;
128 
129  /* Object mode is enforced if there is no active object, or if the active object's type is
130  * different. */
131  if (obact == NULL || ob->type != obact->type) {
132  continue;
133  }
134  /* Object mode is enforced for non-editable data (or their obdata). */
135  if (!BKE_id_is_editable(bmain, &ob->id) ||
136  (ob_data != NULL && !BKE_id_is_editable(bmain, ob_data))) {
137  continue;
138  }
139 
140  /* Pose mode is very similar to Object one, we can apply it even on objects not in current
141  * scene. */
142  if (mode == OB_MODE_POSE) {
143  ED_object_posemode_enter_ex(bmain, ob);
144  }
145 
146  /* Other edit/paint/etc. modes are only settable for objects visible in active scene currently.
147  * Otherwise, they (and their obdata) may not be (fully) evaluated, which is mandatory for some
148  * modes like Sculpt.
149  * Ref. T98225. */
151  !BKE_scene_has_object(scene, ob) || (ob->visibility_flag & OB_HIDE_VIEWPORT) != 0) {
152  continue;
153  }
154 
155  if (mode == OB_MODE_EDIT) {
156  ED_object_editmode_enter_ex(bmain, scene, ob, 0);
157  }
158  else if (mode & OB_MODE_ALL_SCULPT) {
159  if (obact == ob) {
160  if (mode == OB_MODE_SCULPT) {
161  ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, reports);
162  }
163  else if (mode == OB_MODE_VERTEX_PAINT) {
165  }
166  else if (mode == OB_MODE_WEIGHT_PAINT) {
168  }
169  else {
171  }
172  }
173  else {
174  /* Create data for non-active objects which need it for
175  * mode-switching but don't yet support multi-editing. */
176  if (mode & OB_MODE_ALL_SCULPT) {
177  ob->mode = mode;
179  }
180  }
181  }
182  else {
183  /* TODO(campbell): avoid operator calls. */
184  if (obact == ob) {
185  ED_object_mode_set(C, mode);
186  }
187  }
188  }
189 
190  /* image editor paint mode */
191  if (scene) {
193  }
194 
195  /* Enforce a full redraw for the first time areas/regions get drawn. Further region init/refresh
196  * just triggers non-rebuild redraws (#RGN_DRAW_NO_REBUILD). Usually a full redraw would be
197  * triggered by a `NC_WM | ND_FILEREAD` notifier, but if a startup script calls an operator that
198  * redraws the window, notifiers are not handled before the operator runs. See T98461. */
199  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
200  const bScreen *screen = WM_window_get_active_screen(win);
201 
202  ED_screen_areas_iter (win, screen, area) {
204  }
205  }
206 
208 
209  SWAP(int, reports->flag, reports_flag_prev);
210  wm->op_undo_depth--;
211 }
212 
213 void ED_editors_exit(Main *bmain, bool do_undo_system)
214 {
215  if (!bmain) {
216  return;
217  }
218 
219  /* Frees all edit-mode undo-steps. */
220  if (do_undo_system && G_MAIN->wm.first) {
221  wmWindowManager *wm = G_MAIN->wm.first;
222  /* normally we don't check for NULL undo stack,
223  * do here since it may run in different context. */
224  if (wm->undo_stack) {
226  wm->undo_stack = NULL;
227  }
228  }
229 
230  /* On undo, tag for update so the depsgraph doesn't use stale edit-mode data,
231  * this is possible when mixing edit-mode and memory-file undo.
232  *
233  * By convention, objects are not left in edit-mode - so this isn't often problem in practice,
234  * since exiting edit-mode will tag the objects too.
235  *
236  * However there is no guarantee the active object _never_ changes while in edit-mode.
237  * Python for example can do this, some callers to #ED_object_base_activate
238  * don't handle modes either (doing so isn't always practical).
239  *
240  * To reproduce the problem where stale data is used, see: T84920. */
241  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
242  if (ED_object_editmode_free_ex(bmain, ob)) {
243  if (do_undo_system == false) {
245  }
246  }
247  }
248 
249  /* global in meshtools... */
252 }
253 
255  Object *ob,
256  bool for_render,
257  bool check_needs_flush)
258 {
259  bool has_edited = false;
260  if (ob->mode & OB_MODE_SCULPT) {
261  /* Don't allow flushing while in the middle of a stroke (frees data in use).
262  * Auto-save prevents this from happening but scripts
263  * may cause a flush on saving: T53986. */
264  if (ob->sculpt != NULL && ob->sculpt->cache == NULL) {
265  char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
266  if (check_needs_flush && (*needs_flush_ptr == 0)) {
267  return false;
268  }
269  *needs_flush_ptr = 0;
270 
271  /* flush multires changes (for sculpt) */
273  has_edited = true;
274 
275  if (for_render) {
276  /* flush changes from dynamic topology sculpt */
278  }
279  else {
280  /* Set reorder=false so that saving the file doesn't reorder
281  * the BMesh's elements */
282  BKE_sculptsession_bm_to_me(ob, false);
283  }
284  }
285  }
286  else if (ob->mode & OB_MODE_EDIT) {
287 
288  char *needs_flush_ptr = BKE_object_data_editmode_flush_ptr_get(ob->data);
289  if (needs_flush_ptr != NULL) {
290  if (check_needs_flush && (*needs_flush_ptr == 0)) {
291  return false;
292  }
293  *needs_flush_ptr = 0;
294  }
295 
296  /* get editmode results */
297  has_edited = true;
298  ED_object_editmode_load(bmain, ob);
299  }
300  return has_edited;
301 }
302 
304 {
305  return ED_editors_flush_edits_for_object_ex(bmain, ob, false, false);
306 }
307 
308 bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush)
309 {
310  bool has_edited = false;
311  Object *ob;
312 
313  /* loop through all data to find edit mode or object mode, because during
314  * exiting we might not have a context for edit object and multiple sculpt
315  * objects can exist at the same time */
316  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
317  has_edited |= ED_editors_flush_edits_for_object_ex(bmain, ob, for_render, check_needs_flush);
318  }
319 
320  bmain->is_memfile_undo_flush_needed = false;
321 
322  return has_edited;
323 }
324 
326 {
327  return ED_editors_flush_edits_ex(bmain, false, false);
328 }
329 
330 /* ***** XXX: functions are using old blender names, cleanup later ***** */
331 
333  bool shift, bool ctrl, float *val, float fac1, float fac2, float fac3, int invert)
334 {
335  /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
336  if (invert) {
337  ctrl = !ctrl;
338  }
339 
340  if (ctrl && shift) {
341  if (fac3 != 0.0f) {
342  *val = fac3 * floorf(*val / fac3 + 0.5f);
343  }
344  }
345  else if (ctrl) {
346  if (fac2 != 0.0f) {
347  *val = fac2 * floorf(*val / fac2 + 0.5f);
348  }
349  }
350  else {
351  if (fac1 != 0.0f) {
352  *val = fac1 * floorf(*val / fac1 + 0.5f);
353  }
354  }
355 }
356 
358  const char *opname,
359  const char *id_name,
360  const char *abs_name,
361  const char *folder,
362  struct PackedFile *pf)
363 {
364  Main *bmain = CTX_data_main(C);
365  PointerRNA props_ptr;
366  uiPopupMenu *pup;
367  uiLayout *layout;
368  char line[FILE_MAX + 100];
369  wmOperatorType *ot = WM_operatortype_find(opname, 1);
370  const char *blendfile_path = BKE_main_blendfile_path(bmain);
371 
372  pup = UI_popup_menu_begin(C, IFACE_("Unpack File"), ICON_NONE);
373  layout = UI_popup_menu_layout(pup);
374 
376  layout, ot, IFACE_("Remove Pack"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
377  RNA_enum_set(&props_ptr, "method", PF_REMOVE);
378  RNA_string_set(&props_ptr, "id", id_name);
379 
380  if (blendfile_path[0] != '\0') {
381  char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
382 
383  BLI_split_file_part(abs_name, fi, sizeof(fi));
384  BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
385  if (!STREQ(abs_name, local_name)) {
386  switch (BKE_packedfile_compare_to_file(blendfile_path, local_name, pf)) {
387  case PF_CMP_NOFILE:
388  BLI_snprintf(line, sizeof(line), TIP_("Create %s"), local_name);
389  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
390  RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
391  RNA_string_set(&props_ptr, "id", id_name);
392 
393  break;
394  case PF_CMP_EQUAL:
395  BLI_snprintf(line, sizeof(line), TIP_("Use %s (identical)"), local_name);
396  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
397  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
398  RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
399  RNA_string_set(&props_ptr, "id", id_name);
400 
401  break;
402  case PF_CMP_DIFFERS:
403  BLI_snprintf(line, sizeof(line), TIP_("Use %s (differs)"), local_name);
404  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
405  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
406  RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
407  RNA_string_set(&props_ptr, "id", id_name);
408 
409  BLI_snprintf(line, sizeof(line), TIP_("Overwrite %s"), local_name);
410  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
411  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
412  RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
413  RNA_string_set(&props_ptr, "id", id_name);
414  break;
415  }
416  }
417  }
418 
419  switch (BKE_packedfile_compare_to_file(blendfile_path, abs_name, pf)) {
420  case PF_CMP_NOFILE:
421  BLI_snprintf(line, sizeof(line), TIP_("Create %s"), abs_name);
422  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
423  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
424  RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
425  RNA_string_set(&props_ptr, "id", id_name);
426  break;
427  case PF_CMP_EQUAL:
428  BLI_snprintf(line, sizeof(line), TIP_("Use %s (identical)"), abs_name);
429  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
430  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
431  RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
432  RNA_string_set(&props_ptr, "id", id_name);
433  break;
434  case PF_CMP_DIFFERS:
435  BLI_snprintf(line, sizeof(line), TIP_("Use %s (differs)"), abs_name);
436  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
437  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
438  RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
439  RNA_string_set(&props_ptr, "id", id_name);
440 
441  BLI_snprintf(line, sizeof(line), TIP_("Overwrite %s"), abs_name);
442  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
443  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
444  RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
445  RNA_string_set(&props_ptr, "id", id_name);
446  break;
447  }
448 
449  UI_popup_menu_end(C, pup);
450 }
451 
453  struct SpaceLink *sl,
454  const struct IDRemapper *mappings)
455 {
457  if (st && st->id_remap) {
458  st->id_remap(area, sl, mappings);
459  }
460 }
461 
463  struct SpaceLink *sl,
464  ID *old_id,
465  ID *new_id)
466 {
468 
469  if (st && st->id_remap) {
470  struct IDRemapper *mappings = BKE_id_remapper_create();
471  BKE_id_remapper_add(mappings, old_id, new_id);
472  st->id_remap(area, sl, mappings);
473  BKE_id_remapper_free(mappings);
474  }
475 }
bool BKE_collection_has_object_recursive(struct Collection *collection, struct Object *ob)
Definition: collection.c:921
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
Definition: context.c:1519
struct ReportList * CTX_wm_reports(const bContext *C)
Definition: context.c:775
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
#define G_MAIN
Definition: BKE_global.h:267
bool BKE_scene_has_object(struct Scene *scene, struct Object *ob)
Definition: layer.c:1895
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
void BKE_id_remapper_add(struct IDRemapper *id_remapper, struct ID *old_id, struct ID *new_id)
struct IDRemapper * BKE_id_remapper_create(void)
void BKE_id_remapper_free(struct IDRemapper *id_remapper)
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
General operations, lookup, etc. for materials.
void BKE_texpaint_slots_refresh_object(struct Scene *scene, struct Object *ob)
Definition: material.c:1564
void multires_flush_sculpt_updates(struct Object *object)
Definition: multires.c:408
General operations, lookup, etc. for blender objects.
char * BKE_object_data_editmode_flush_ptr_get(struct ID *id)
Definition: object.cc:1941
void BKE_object_sculpt_data_create(struct Object *ob)
Definition: object.cc:4321
bool BKE_object_has_mode_data(const struct Object *ob, eObjectMode object_mode)
Definition: object.cc:2004
@ PF_CMP_EQUAL
@ PF_CMP_NOFILE
@ PF_CMP_DIFFERS
enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name, const char *filepath_rel, struct PackedFile *pf)
Definition: packedFile.c:360
@ PF_USE_ORIGINAL
@ PF_USE_LOCAL
@ PF_REMOVE
@ PF_WRITE_ORIGINAL
@ PF_WRITE_LOCAL
void BKE_sculptsession_bm_to_me_for_render(struct Object *object)
Definition: paint.c:1447
void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder)
Definition: paint.c:1401
struct SpaceType * BKE_spacetype_from_id(int spaceid)
Definition: screen.c:353
void BKE_undosys_stack_destroy(UndoStack *ustack)
Definition: undo_system.c:256
#define BLI_assert_unreachable()
Definition: BLI_assert.h:93
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define FILE_MAX
void BLI_split_file_part(const char *string, char *file, size_t filelen)
Definition: path_util.c:1495
#define FILE_MAXDIR
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define SWAP(type, a, b)
#define STREQ(a, b)
#define TIP_(msgid)
#define IFACE_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:771
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ GP_DATA_STROKE_WEIGHTMODE
@ GP_DATA_STROKE_VERTEXMODE
@ GP_DATA_STROKE_PAINTMODE
@ GP_DATA_STROKE_SCULPTMODE
@ GP_DATA_STROKE_EDITMODE
#define OB_MODE_ALL_PAINT_GPENCIL
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_SCULPT
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_VERTEX_PAINT
#define OB_MODE_ALL_SCULPT
@ OB_HIDE_VIEWPORT
@ OB_GPENCIL
#define BASACT(_view_layer)
void ED_assetlist_storage_tag_main_data_dirty(void)
Definition: asset_list.cc:533
void ED_space_image_paint_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene)
Definition: paint_image.cc:438
void ED_mesh_mirror_topo_table_end(struct Object *ob)
void ED_mesh_mirror_spatial_table_end(struct Object *ob)
bool ED_object_editmode_enter_ex(struct Main *bmain, struct Scene *scene, struct Object *ob, int flag)
Definition: object_edit.c:734
bool ED_object_editmode_free_ex(struct Main *bmain, struct Object *obedit)
Definition: object_edit.c:703
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
Definition: object_modes.c:231
bool ED_object_editmode_load(struct Main *bmain, struct Object *obedit)
Definition: object_edit.c:648
void ED_object_sculptmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, bool force_dyntopo, struct ReportList *reports)
Definition: sculpt_ops.c:326
void ED_object_vpaintmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
void ED_object_wpaintmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
bool ED_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
#define ED_screen_areas_iter(win, screen, area_name)
Definition: ED_screen.h:267
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemFullO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, struct IDProperty *properties, wmOperatorCallContext context, int flag, struct PointerRNA *r_opptr)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
@ WM_OP_EXEC_DEFAULT
Definition: WM_types.h:208
std::string id_name(void *id)
Scene scene
const Depsgraph * depsgraph
void ED_spacedata_id_remap_single(struct ScrArea *area, struct SpaceLink *sl, ID *old_id, ID *new_id)
Definition: ed_util.c:462
void ED_editors_exit(Main *bmain, bool do_undo_system)
Definition: ed_util.c:213
bool ED_editors_flush_edits_for_object(Main *bmain, Object *ob)
Definition: ed_util.c:303
void unpack_menu(bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf)
Definition: ed_util.c:357
bool ED_editors_flush_edits_for_object_ex(Main *bmain, Object *ob, bool for_render, bool check_needs_flush)
Definition: ed_util.c:254
void ED_spacedata_id_remap(struct ScrArea *area, struct SpaceLink *sl, const struct IDRemapper *mappings)
Definition: ed_util.c:452
bool ED_editors_flush_edits(Main *bmain)
Definition: ed_util.c:325
void apply_keyb_grid(bool shift, bool ctrl, float *val, float fac1, float fac2, float fac3, int invert)
Definition: ed_util.c:332
void ED_editors_init_for_undo(Main *bmain)
Definition: ed_util.c:60
bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush)
Definition: ed_util.c:308
void ED_editors_init(bContext *C)
Definition: ed_util.c:78
#define pf(_x, _i)
Prefetch 64.
Definition: gim_memory.h:48
void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: invert.h:8
#define floorf(x)
Definition: metal/compat.h:224
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
Definition: pose_edit.c:80
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
struct Object * object
Definition: DNA_ID.h:368
void * next
Definition: DNA_ID.h:369
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase wm
Definition: BKE_main.h:197
char is_memfile_undo_flush_needed
Definition: BKE_main.h:145
ListBase objects
Definition: BKE_main.h:170
struct SculptSession * sculpt
void * data
struct Collection * master_collection
char needs_flush_to_id
Definition: BKE_paint.h:651
struct StrokeCache * cache
Definition: BKE_paint.h:563
struct UndoStack * undo_stack
wmOperatorType * ot
Definition: wm_files.c:3479
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
bScreen * WM_window_get_active_screen(const wmWindow *win)
Definition: wm_window.c:2300
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2217
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2183