Blender V4.3
geometry_randomization.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
5#include "WM_api.hh"
6
7#include "BKE_context.hh"
8#include "BKE_global.hh"
9#include "BKE_main.hh"
10
11#include "DEG_depsgraph.hh"
12
13#include "RNA_access.hh"
14#include "RNA_define.hh"
15
16#include "geometry_intern.hh"
17
18namespace blender::ed::geometry {
19
21{
22 RNA_boolean_set(op->ptr, "value", G.randomize_geometry_element_order);
23 return WM_operator_props_popup(C, op, event);
24}
25
27{
28 Main *bmain = CTX_data_main(C);
29
30 G.randomize_geometry_element_order = RNA_boolean_get(op->ptr, "value");
31
32 LISTBASE_FOREACH (Object *, object, &bmain->objects) {
34 }
36 return OPERATOR_FINISHED;
37}
38
40{
41 ot->name = "Set Geometry Randomization";
42 ot->idname = "GEOMETRY_OT_geometry_randomization";
43 ot->description = "Toggle geometry randomization for debugging purposes";
44
48
50 "value",
51 false,
52 "Value",
53 "Randomize the order of geometry elements (e.g. vertices or edges) after some "
54 "operations where there are no guarantees about the order. This avoids "
55 "accidentally depending on something that may change in the future");
56}
57
58} // namespace blender::ed::geometry
Main * CTX_data_main(const bContext *C)
#define LISTBASE_FOREACH(type, var, list)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1041
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
#define NC_WINDOW
Definition WM_types.hh:342
#define G(x, y, z)
static int geometry_randomization_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int geometry_randomization_exec(bContext *C, wmOperator *op)
void GEOMETRY_OT_geometry_randomization(wmOperatorType *ot)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
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)
ListBase objects
Definition BKE_main.hh:212
const char * name
Definition WM_types.hh:990
const char * idname
Definition WM_types.hh:992
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1022
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
StructRNA * srna
Definition WM_types.hh:1080
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4125
int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)