Blender  V2.93
ed_util.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 #include <stdlib.h>
26 #include <string.h>
27 
28 #include "MEM_guardedalloc.h"
29 
30 #include "BLI_listbase.h"
31 #include "BLI_path_util.h"
32 #include "BLI_string.h"
33 
34 #include "BLT_translation.h"
35 
36 #include "BKE_global.h"
37 #include "BKE_main.h"
38 #include "BKE_material.h"
39 #include "BKE_multires.h"
40 #include "BKE_object.h"
41 #include "BKE_packedFile.h"
42 #include "BKE_paint.h"
43 #include "BKE_screen.h"
44 #include "BKE_undo_system.h"
45 
46 #include "DEG_depsgraph.h"
47 
48 #include "ED_armature.h"
49 #include "ED_gpencil.h"
50 #include "ED_image.h"
51 #include "ED_mesh.h"
52 #include "ED_object.h"
53 #include "ED_paint.h"
54 #include "ED_space_api.h"
55 #include "ED_util.h"
56 
57 #include "GPU_immediate.h"
58 
59 #include "UI_interface.h"
60 #include "UI_resources.h"
61 
62 #include "RNA_access.h"
63 #include "WM_api.h"
64 #include "WM_types.h"
65 
66 /* ********* general editor util funcs, not BKE stuff please! ********* */
67 
69 {
70  wmWindowManager *wm = bmain->wm.first;
71  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
72  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
73  Base *base = BASACT(view_layer);
74  if (base != NULL) {
75  Object *ob = base->object;
76  if (ob->mode & OB_MODE_TEXTURE_PAINT) {
78 
81  }
82  }
83  }
84 }
85 
87 {
89  Main *bmain = CTX_data_main(C);
92 
93  /* This is called during initialization, so we don't want to store any reports */
94  ReportList *reports = CTX_wm_reports(C);
95  int reports_flag_prev = reports->flag & ~RPT_STORE;
96 
97  SWAP(int, reports->flag, reports_flag_prev);
98 
99  /* Don't do undo pushes when calling an operator. */
100  wm->op_undo_depth++;
101 
102  /* toggle on modes for objects that were saved with these enabled. for
103  * e.g. linked objects we have to ensure that they are actually the
104  * active object in this scene. */
105  Object *obact = CTX_data_active_object(C);
106  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
107  int mode = ob->mode;
108  if (mode == OB_MODE_OBJECT) {
109  continue;
110  }
111  if (BKE_object_has_mode_data(ob, mode)) {
112  continue;
113  }
114  if (ob->type == OB_GPENCIL) {
115  /* For multi-edit mode we may already have mode data (grease pencil does not need it).
116  * However we may have a non-active object stuck in a grease-pencil edit mode. */
117  if (ob != obact) {
118  ob->mode = OB_MODE_OBJECT;
120  }
121  else if (mode & OB_MODE_ALL_PAINT_GPENCIL) {
123  }
124  continue;
125  }
126 
127  ID *ob_data = ob->data;
128  ob->mode = OB_MODE_OBJECT;
130  if (obact && (ob->type == obact->type) && !ID_IS_LINKED(ob) &&
131  !(ob_data && ID_IS_LINKED(ob_data))) {
132  if (mode == OB_MODE_EDIT) {
133  ED_object_editmode_enter_ex(bmain, scene, ob, 0);
134  }
135  else if (mode == OB_MODE_POSE) {
136  ED_object_posemode_enter_ex(bmain, ob);
137  }
138  else if (mode & OB_MODE_ALL_SCULPT) {
139  if (obact == ob) {
140  if (mode == OB_MODE_SCULPT) {
141  ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, reports);
142  }
143  else if (mode == OB_MODE_VERTEX_PAINT) {
145  }
146  else if (mode == OB_MODE_WEIGHT_PAINT) {
148  }
149  else {
151  }
152  }
153  else {
154  /* Create data for non-active objects which need it for
155  * mode-switching but don't yet support multi-editing. */
156  if (mode & OB_MODE_ALL_SCULPT) {
157  ob->mode = mode;
159  }
160  }
161  }
162  else {
163  /* TODO(campbell): avoid operator calls. */
164  if (obact == ob) {
165  ED_object_mode_set(C, mode);
166  }
167  }
168  }
169  }
170 
171  /* image editor paint mode */
172  if (scene) {
174  }
175 
176  SWAP(int, reports->flag, reports_flag_prev);
177  wm->op_undo_depth--;
178 }
179 
180 /* frees all editmode stuff */
181 void ED_editors_exit(Main *bmain, bool do_undo_system)
182 {
183  if (!bmain) {
184  return;
185  }
186 
187  /* Frees all edit-mode undo-steps. */
188  if (do_undo_system && G_MAIN->wm.first) {
189  wmWindowManager *wm = G_MAIN->wm.first;
190  /* normally we don't check for NULL undo stack,
191  * do here since it may run in different context. */
192  if (wm->undo_stack) {
194  wm->undo_stack = NULL;
195  }
196  }
197 
198  /* On undo, tag for update so the depsgraph doesn't use stale edit-mode data,
199  * this is possible when mixing edit-mode and memory-file undo.
200  *
201  * By convention, objects are not left in edit-mode - so this isn't often problem in practice,
202  * since exiting edit-mode will tag the objects too.
203  *
204  * However there is no guarantee the active object _never_ changes while in edit-mode.
205  * Python for example can do this, some callers to #ED_object_base_activate
206  * don't handle modes either (doing so isn't always practical).
207  *
208  * To reproduce the problem where stale data is used, see: T84920. */
209  for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
210  if (ED_object_editmode_free_ex(bmain, ob)) {
211  if (do_undo_system == false) {
213  }
214  }
215  }
216 
217  /* global in meshtools... */
220 }
221 
223  Object *ob,
224  bool for_render,
225  bool check_needs_flush)
226 {
227  bool has_edited = false;
228  if (ob->mode & OB_MODE_SCULPT) {
229  /* Don't allow flushing while in the middle of a stroke (frees data in use).
230  * Auto-save prevents this from happening but scripts
231  * may cause a flush on saving: T53986. */
232  if (ob->sculpt != NULL && ob->sculpt->cache == NULL) {
233  char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
234  if (check_needs_flush && (*needs_flush_ptr == 0)) {
235  return false;
236  }
237  *needs_flush_ptr = 0;
238 
239  /* flush multires changes (for sculpt) */
241  has_edited = true;
242 
243  if (for_render) {
244  /* flush changes from dynamic topology sculpt */
246  }
247  else {
248  /* Set reorder=false so that saving the file doesn't reorder
249  * the BMesh's elements */
250  BKE_sculptsession_bm_to_me(ob, false);
251  }
252  }
253  }
254  else if (ob->mode & OB_MODE_EDIT) {
255 
256  char *needs_flush_ptr = BKE_object_data_editmode_flush_ptr_get(ob->data);
257  if (needs_flush_ptr != NULL) {
258  if (check_needs_flush && (*needs_flush_ptr == 0)) {
259  return false;
260  }
261  *needs_flush_ptr = 0;
262  }
263 
264  /* get editmode results */
265  has_edited = true;
266  ED_object_editmode_load(bmain, ob);
267  }
268  return has_edited;
269 }
270 
272 {
273  return ED_editors_flush_edits_for_object_ex(bmain, ob, false, false);
274 }
275 
276 /* flush any temp data from object editing to DNA before writing files,
277  * rendering, copying, etc. */
278 bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush)
279 {
280  bool has_edited = false;
281  Object *ob;
282 
283  /* loop through all data to find edit mode or object mode, because during
284  * exiting we might not have a context for edit object and multiple sculpt
285  * objects can exist at the same time */
286  for (ob = bmain->objects.first; ob; ob = ob->id.next) {
287  has_edited |= ED_editors_flush_edits_for_object_ex(bmain, ob, for_render, check_needs_flush);
288  }
289 
290  bmain->is_memfile_undo_flush_needed = false;
291 
292  return has_edited;
293 }
294 
296 {
297  return ED_editors_flush_edits_ex(bmain, false, false);
298 }
299 
300 /* ***** XXX: functions are using old blender names, cleanup later ***** */
301 
302 /* now only used in 2d spaces, like time, ipo, nla, sima... */
303 /* XXX shift/ctrl not configurable */
305  int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert)
306 {
307  /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
308  if (invert) {
309  ctrl = !ctrl;
310  }
311 
312  if (ctrl && shift) {
313  if (fac3 != 0.0f) {
314  *val = fac3 * floorf(*val / fac3 + 0.5f);
315  }
316  }
317  else if (ctrl) {
318  if (fac2 != 0.0f) {
319  *val = fac2 * floorf(*val / fac2 + 0.5f);
320  }
321  }
322  else {
323  if (fac1 != 0.0f) {
324  *val = fac1 * floorf(*val / fac1 + 0.5f);
325  }
326  }
327 }
328 
330  const char *opname,
331  const char *id_name,
332  const char *abs_name,
333  const char *folder,
334  struct PackedFile *pf)
335 {
336  Main *bmain = CTX_data_main(C);
337  PointerRNA props_ptr;
338  uiPopupMenu *pup;
339  uiLayout *layout;
340  char line[FILE_MAX + 100];
341  wmOperatorType *ot = WM_operatortype_find(opname, 1);
342 
343  pup = UI_popup_menu_begin(C, IFACE_("Unpack File"), ICON_NONE);
344  layout = UI_popup_menu_layout(pup);
345 
347  layout, ot, IFACE_("Remove Pack"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
348  RNA_enum_set(&props_ptr, "method", PF_REMOVE);
349  RNA_string_set(&props_ptr, "id", id_name);
350 
351  if (G.relbase_valid) {
352  char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
353 
354  BLI_split_file_part(abs_name, fi, sizeof(fi));
355  BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
356  if (!STREQ(abs_name, local_name)) {
357  switch (BKE_packedfile_compare_to_file(BKE_main_blendfile_path(bmain), local_name, pf)) {
358  case PF_CMP_NOFILE:
359  BLI_snprintf(line, sizeof(line), TIP_("Create %s"), local_name);
360  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
361  RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
362  RNA_string_set(&props_ptr, "id", id_name);
363 
364  break;
365  case PF_CMP_EQUAL:
366  BLI_snprintf(line, sizeof(line), TIP_("Use %s (identical)"), local_name);
367  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
368  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
369  RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
370  RNA_string_set(&props_ptr, "id", id_name);
371 
372  break;
373  case PF_CMP_DIFFERS:
374  BLI_snprintf(line, sizeof(line), TIP_("Use %s (differs)"), local_name);
375  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
376  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
377  RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
378  RNA_string_set(&props_ptr, "id", id_name);
379 
380  BLI_snprintf(line, sizeof(line), TIP_("Overwrite %s"), local_name);
381  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
382  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
383  RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
384  RNA_string_set(&props_ptr, "id", id_name);
385  break;
386  }
387  }
388  }
389 
390  switch (BKE_packedfile_compare_to_file(BKE_main_blendfile_path(bmain), abs_name, pf)) {
391  case PF_CMP_NOFILE:
392  BLI_snprintf(line, sizeof(line), TIP_("Create %s"), abs_name);
393  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
394  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
395  RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
396  RNA_string_set(&props_ptr, "id", id_name);
397  break;
398  case PF_CMP_EQUAL:
399  BLI_snprintf(line, sizeof(line), TIP_("Use %s (identical)"), abs_name);
400  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
401  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
402  RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
403  RNA_string_set(&props_ptr, "id", id_name);
404  break;
405  case PF_CMP_DIFFERS:
406  BLI_snprintf(line, sizeof(line), TIP_("Use %s (differs)"), abs_name);
407  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
408  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
409  RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
410  RNA_string_set(&props_ptr, "id", id_name);
411 
412  BLI_snprintf(line, sizeof(line), TIP_("Overwrite %s"), abs_name);
413  // uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
414  uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
415  RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
416  RNA_string_set(&props_ptr, "id", id_name);
417  break;
418  }
419 
420  UI_popup_menu_end(C, pup);
421 }
422 
428 void ED_spacedata_id_remap(struct ScrArea *area, struct SpaceLink *sl, ID *old_id, ID *new_id)
429 {
431 
432  if (st && st->id_remap) {
433  st->id_remap(area, sl, old_id, new_id);
434  }
435 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1279
struct Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
Definition: context.c:1415
struct ReportList * CTX_wm_reports(const bContext *C)
Definition: context.c:751
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
#define G_MAIN
Definition: BKE_global.h:232
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:1361
void multires_flush_sculpt_updates(struct Object *object)
Definition: multires.c:427
General operations, lookup, etc. for blender objects.
char * BKE_object_data_editmode_flush_ptr_get(struct ID *id)
Definition: object.c:1893
void BKE_object_sculpt_data_create(struct Object *ob)
Definition: object.c:4406
bool BKE_object_has_mode_data(const struct Object *ob, eObjectMode object_mode)
Definition: object.c:1952
@ PF_CMP_EQUAL
@ PF_CMP_NOFILE
@ PF_CMP_DIFFERS
enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name, const char *filename, struct PackedFile *pf)
Definition: packedFile.c:384
@ 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:1444
void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder)
Definition: paint.c:1398
struct SpaceType * BKE_spacetype_from_id(int spaceid)
Definition: screen.c:382
void BKE_undosys_stack_destroy(UndoStack *ustack)
Definition: undo_system.c:271
#define BLI_assert_unreachable()
Definition: BLI_assert.h:96
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
#define FILE_MAX
void BLI_split_file_part(const char *string, char *file, const size_t filelen)
Definition: path_util.c:1690
#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:51
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:599
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:654
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
#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_GPENCIL
#define BASACT(_view_layer)
void ED_space_image_paint_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene)
Definition: paint_image.c:807
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:762
bool ED_object_editmode_free_ex(struct Main *bmain, struct Object *obedit)
Definition: object_edit.c:731
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
Definition: object_modes.c:235
bool ED_object_editmode_load(struct Main *bmain, struct Object *obedit)
Definition: object_edit.c:667
void ED_object_vpaintmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
void ED_object_sculptmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const bool force_dyntopo, struct ReportList *reports)
Definition: sculpt.c:8391
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)
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:39
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemFullO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, struct IDProperty *properties, int 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:204
std::string id_name(void *id)
Scene scene
const Depsgraph * depsgraph
void ED_editors_exit(Main *bmain, bool do_undo_system)
Definition: ed_util.c:181
bool ED_editors_flush_edits_for_object(Main *bmain, Object *ob)
Definition: ed_util.c:271
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:329
bool ED_editors_flush_edits_for_object_ex(Main *bmain, Object *ob, bool for_render, bool check_needs_flush)
Definition: ed_util.c:222
void ED_spacedata_id_remap(struct ScrArea *area, struct SpaceLink *sl, ID *old_id, ID *new_id)
Definition: ed_util.c:428
bool ED_editors_flush_edits(Main *bmain)
Definition: ed_util.c:295
void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert)
Definition: ed_util.c:304
void ED_editors_init_for_undo(Main *bmain)
Definition: ed_util.c:68
bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush)
Definition: ed_util.c:278
void ED_editors_init(bContext *C)
Definition: ed_util.c:86
#define pf(_x, _i)
Prefetch 64.
Definition: gim_memory.h:48
void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata)
#define floorf(x)
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
Definition: pose_edit.c:94
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:6550
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:6413
struct Object * object
Definition: DNA_ID.h:273
void * next
Definition: DNA_ID.h:274
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase wm
Definition: BKE_main.h:175
char is_memfile_undo_flush_needed
Definition: BKE_main.h:130
ListBase objects
Definition: BKE_main.h:148
struct SculptSession * sculpt
void * data
char needs_flush_to_id
Definition: BKE_paint.h:609
struct StrokeCache * cache
Definition: BKE_paint.h:518
void(* id_remap)(struct ScrArea *area, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id)
Definition: BKE_screen.h:120
struct UndoStack * undo_stack
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: svm_invert.h:19
#define G(x, y, z)
wmOperatorType * ot
Definition: wm_files.c:3156
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2286
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2249