Cleanup: Move 6 sculpt-session-related files and header to C++
To allow further mesh data structure refactoring. See #103343 Pull Request #104540
This commit is contained in:
@@ -478,7 +478,7 @@ void ED_object_constraint_copy_for_pose(struct Main *bmain,
|
||||
struct bPoseChannel *pchan,
|
||||
struct bConstraint *con);
|
||||
|
||||
/* object_modes.c */
|
||||
/* object_modes.cc */
|
||||
|
||||
/**
|
||||
* Checks the mode to be set is compatible with the object
|
||||
|
||||
@@ -24,7 +24,7 @@ struct wmKeyConfig;
|
||||
struct wmOperator;
|
||||
typedef struct PaintTileMap PaintTileMap;
|
||||
|
||||
/* paint_ops.c */
|
||||
/* paint_ops.cc */
|
||||
|
||||
void ED_operatortypes_paint(void);
|
||||
void ED_operatormacros_paint(void);
|
||||
|
||||
@@ -18,7 +18,7 @@ struct IDRemapper;
|
||||
struct Main;
|
||||
struct bContext;
|
||||
|
||||
/* ed_util.c */
|
||||
/* ed_util.cc */
|
||||
|
||||
void ED_editors_init_for_undo(struct Main *bmain);
|
||||
void ED_editors_init(struct bContext *C);
|
||||
|
||||
@@ -44,7 +44,7 @@ set(SRC
|
||||
object_facemap_ops.c
|
||||
object_gpencil_modifier.c
|
||||
object_hook.c
|
||||
object_modes.c
|
||||
object_modes.cc
|
||||
object_modifier.cc
|
||||
object_ops.c
|
||||
object_random.c
|
||||
|
||||
@@ -97,7 +97,7 @@ static const char *object_mode_op_string(eObjectMode mode)
|
||||
if (mode == OB_MODE_SCULPT_CURVES) {
|
||||
return "CURVES_OT_sculptmode_toggle";
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode)
|
||||
@@ -160,9 +160,9 @@ bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, Report
|
||||
{
|
||||
bool ok;
|
||||
if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) {
|
||||
const char *opstring = object_mode_op_string(ob->mode);
|
||||
const char *opstring = object_mode_op_string(eObjectMode(ob->mode));
|
||||
|
||||
WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL, NULL);
|
||||
WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, nullptr, nullptr);
|
||||
ok = ELEM(ob->mode, mode, OB_MODE_OBJECT);
|
||||
if (!ok) {
|
||||
wmOperatorType *ot = WM_operatortype_find(opstring, false);
|
||||
@@ -194,7 +194,7 @@ bool ED_object_mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportL
|
||||
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
if (ob == NULL) {
|
||||
if (ob == nullptr) {
|
||||
return (mode == OB_MODE_OBJECT);
|
||||
}
|
||||
|
||||
@@ -210,13 +210,14 @@ bool ED_object_mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportL
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *opstring = object_mode_op_string((mode == OB_MODE_OBJECT) ? ob->mode : mode);
|
||||
const char *opstring = object_mode_op_string((mode == OB_MODE_OBJECT) ? eObjectMode(ob->mode) :
|
||||
mode);
|
||||
wmOperatorType *ot = WM_operatortype_find(opstring, false);
|
||||
|
||||
if (!use_undo) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_REGION_WIN, NULL, NULL);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_REGION_WIN, nullptr, nullptr);
|
||||
if (!use_undo) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
@@ -232,20 +233,17 @@ bool ED_object_mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportL
|
||||
bool ED_object_mode_set(bContext *C, eObjectMode mode)
|
||||
{
|
||||
/* Don't do undo push by default, since this may be called by lower level code. */
|
||||
return ED_object_mode_set_ex(C, mode, true, NULL);
|
||||
return ED_object_mode_set_ex(C, mode, true, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use for changing works-paces or changing active object.
|
||||
* Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run.
|
||||
*/
|
||||
static bool ed_object_mode_generic_exit_ex(struct Main *bmain,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
struct Object *ob,
|
||||
bool only_test)
|
||||
static bool ed_object_mode_generic_exit_ex(
|
||||
Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, bool only_test)
|
||||
{
|
||||
BLI_assert((bmain == NULL) == only_test);
|
||||
BLI_assert((bmain == nullptr) == only_test);
|
||||
if (ob->mode & OB_MODE_EDIT) {
|
||||
if (BKE_object_is_in_editmode(ob)) {
|
||||
if (only_test) {
|
||||
@@ -279,7 +277,7 @@ static bool ed_object_mode_generic_exit_ex(struct Main *bmain,
|
||||
}
|
||||
}
|
||||
else if (ob->mode & OB_MODE_POSE) {
|
||||
if (ob->pose != NULL) {
|
||||
if (ob->pose != nullptr) {
|
||||
if (only_test) {
|
||||
return true;
|
||||
}
|
||||
@@ -332,7 +330,7 @@ static void ed_object_posemode_set_for_weight_paint_ex(bContext *C,
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
||||
if (ob_arm != NULL) {
|
||||
if (ob_arm != nullptr) {
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
const Base *base_arm = BKE_view_layer_base_find(view_layer, ob_arm);
|
||||
if (base_arm && BASE_VISIBLE(v3d, base_arm)) {
|
||||
@@ -387,17 +385,14 @@ void ED_object_posemode_set_for_weight_paint(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
void ED_object_mode_generic_exit(struct Main *bmain,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
struct Object *ob)
|
||||
void ED_object_mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
|
||||
{
|
||||
ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false);
|
||||
}
|
||||
|
||||
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob)
|
||||
bool ED_object_mode_generic_has_data(Depsgraph *depsgraph, const Object *ob)
|
||||
{
|
||||
return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, (Object *)ob, true);
|
||||
return ed_object_mode_generic_exit_ex(nullptr, depsgraph, nullptr, (Object *)ob, true);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -425,7 +420,7 @@ static void object_transfer_mode_reposition_view_pivot(bContext *C, const int mv
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
float global_loc[3];
|
||||
if (!ED_view3d_autodist_simple(region, mval, global_loc, 0, NULL)) {
|
||||
if (!ED_view3d_autodist_simple(region, mval, global_loc, 0, nullptr)) {
|
||||
return;
|
||||
}
|
||||
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
|
||||
@@ -446,7 +441,7 @@ static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Base *base
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
||||
if (base_dst == NULL) {
|
||||
if (base_dst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,15 +45,15 @@ set(SRC
|
||||
paint_cursor.cc
|
||||
paint_curve.c
|
||||
paint_curve_undo.c
|
||||
paint_hide.c
|
||||
paint_hide.cc
|
||||
paint_image.cc
|
||||
paint_image_2d.c
|
||||
paint_image_2d_curve_mask.cc
|
||||
paint_image_ops_paint.cc
|
||||
paint_image_proj.cc
|
||||
paint_mask.cc
|
||||
paint_ops.c
|
||||
paint_stroke.c
|
||||
paint_ops.cc
|
||||
paint_stroke.cc
|
||||
paint_utils.c
|
||||
paint_vertex.cc
|
||||
paint_vertex_color_ops.cc
|
||||
@@ -88,7 +88,7 @@ set(SRC
|
||||
curves_sculpt_intern.h
|
||||
curves_sculpt_intern.hh
|
||||
paint_intern.h
|
||||
sculpt_intern.h
|
||||
sculpt_intern.hh
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#include "paint_intern.h"
|
||||
/* still needed for sculpt_stroke_get_location, should be
|
||||
* removed eventually (TODO) */
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
/* TODOs:
|
||||
*
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "paint_intern.h"
|
||||
|
||||
/* For undo push. */
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
/* Return true if the element should be hidden/shown. */
|
||||
static bool is_effected(PartialVisArea area,
|
||||
@@ -67,21 +67,21 @@ static void partialvis_update_mesh(Object *ob,
|
||||
PartialVisArea area,
|
||||
float planes[4][4])
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
const float(*positions)[3] = BKE_pbvh_get_vert_positions(pbvh);
|
||||
const float *paint_mask;
|
||||
int totvert, i;
|
||||
bool any_changed = false, any_visible = false;
|
||||
|
||||
BKE_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
|
||||
BKE_pbvh_node_num_verts(pbvh, node, nullptr, &totvert);
|
||||
const int *vert_indices = BKE_pbvh_node_get_vert_indices(node);
|
||||
paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
|
||||
paint_mask = static_cast<const float *>(CustomData_get_layer(&me->vdata, CD_PAINT_MASK));
|
||||
|
||||
bool *hide_vert = CustomData_get_layer_named_for_write(
|
||||
&me->vdata, CD_PROP_BOOL, ".hide_vert", me->totvert);
|
||||
if (hide_vert == NULL) {
|
||||
hide_vert = CustomData_add_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, me->totvert, ".hide_vert");
|
||||
bool *hide_vert = static_cast<bool *>(
|
||||
CustomData_get_layer_named_for_write(&me->vdata, CD_PROP_BOOL, ".hide_vert", me->totvert));
|
||||
if (hide_vert == nullptr) {
|
||||
hide_vert = static_cast<bool *>(CustomData_add_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, CD_SET_DEFAULT, nullptr, me->totvert, ".hide_vert"));
|
||||
}
|
||||
|
||||
SCULPT_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
||||
@@ -122,7 +122,7 @@ static void partialvis_update_grids(Depsgraph *depsgraph,
|
||||
bool any_changed = false, any_visible = false;
|
||||
|
||||
/* Get PBVH data. */
|
||||
BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, NULL, NULL, &grids);
|
||||
BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, nullptr, nullptr, &grids);
|
||||
grid_hidden = BKE_pbvh_grid_hidden(pbvh);
|
||||
CCGKey key = *BKE_pbvh_get_grid_key(pbvh);
|
||||
|
||||
@@ -147,7 +147,7 @@ static void partialvis_update_grids(Depsgraph *depsgraph,
|
||||
else if (action == PARTIALVIS_SHOW && area == PARTIALVIS_ALL) {
|
||||
/* Special case if we're showing all, just free the grid. */
|
||||
MEM_freeN(gh);
|
||||
grid_hidden[g] = NULL;
|
||||
grid_hidden[g] = nullptr;
|
||||
any_changed = true;
|
||||
any_visible = true;
|
||||
continue;
|
||||
@@ -180,7 +180,7 @@ static void partialvis_update_grids(Depsgraph *depsgraph,
|
||||
/* If everything in the grid is now visible, free the grid flags. */
|
||||
if (!any_hidden) {
|
||||
MEM_freeN(gh);
|
||||
grid_hidden[g] = NULL;
|
||||
grid_hidden[g] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +203,9 @@ static void partialvis_update_bmesh_verts(BMesh *bm,
|
||||
GSetIterator gs_iter;
|
||||
|
||||
GSET_ITER (gs_iter, verts) {
|
||||
BMVert *v = BLI_gsetIterator_getKey(&gs_iter);
|
||||
float *vmask = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_PAINT_MASK);
|
||||
BMVert *v = static_cast<BMVert *>(BLI_gsetIterator_getKey(&gs_iter));
|
||||
float *vmask = static_cast<float *>(
|
||||
CustomData_bmesh_get(&bm->vdata, v->head.data, CD_PAINT_MASK));
|
||||
|
||||
/* Hide vertex if in the hide volume. */
|
||||
if (is_effected(area, planes, v->co, *vmask)) {
|
||||
@@ -228,7 +229,7 @@ static void partialvis_update_bmesh_faces(GSet *faces)
|
||||
GSetIterator gs_iter;
|
||||
|
||||
GSET_ITER (gs_iter, faces) {
|
||||
BMFace *f = BLI_gsetIterator_getKey(&gs_iter);
|
||||
BMFace *f = static_cast<BMFace *>(BLI_gsetIterator_getKey(&gs_iter));
|
||||
|
||||
if (paint_is_bmesh_face_hidden(f)) {
|
||||
BM_elem_flag_enable(f, BM_ELEM_HIDDEN);
|
||||
@@ -298,7 +299,7 @@ static void clip_planes_from_rect(bContext *C,
|
||||
static void get_pbvh_nodes(
|
||||
PBVH *pbvh, PBVHNode ***nodes, int *totnode, float clip_planes[4][4], PartialVisArea mode)
|
||||
{
|
||||
BKE_pbvh_SearchCallback cb = NULL;
|
||||
BKE_pbvh_SearchCallback cb = nullptr;
|
||||
|
||||
/* Select search callback. */
|
||||
switch (mode) {
|
||||
@@ -313,7 +314,9 @@ static void get_pbvh_nodes(
|
||||
break;
|
||||
}
|
||||
|
||||
PBVHFrustumPlanes frustum = {.planes = clip_planes, .num_planes = 4};
|
||||
PBVHFrustumPlanes frustum{};
|
||||
frustum.planes = clip_planes;
|
||||
frustum.num_planes = 4;
|
||||
BKE_pbvh_search_gather(pbvh, cb, &frustum, nodes, totnode);
|
||||
}
|
||||
|
||||
@@ -322,7 +325,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Mesh *me = ob->data;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
PartialVisAction action;
|
||||
PartialVisArea area;
|
||||
PBVH *pbvh;
|
||||
@@ -333,8 +336,8 @@ static int hide_show_exec(bContext *C, wmOperator *op)
|
||||
int totnode;
|
||||
|
||||
/* Read operator properties. */
|
||||
action = RNA_enum_get(op->ptr, "action");
|
||||
area = RNA_enum_get(op->ptr, "area");
|
||||
action = PartialVisAction(RNA_enum_get(op->ptr, "action"));
|
||||
area = PartialVisArea(RNA_enum_get(op->ptr, "area"));
|
||||
rect_from_props(&rect, op->ptr);
|
||||
|
||||
clip_planes_from_rect(C, depsgraph, clip_planes, &rect);
|
||||
@@ -395,7 +398,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
|
||||
|
||||
static int hide_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
PartialVisArea area = RNA_enum_get(op->ptr, "area");
|
||||
PartialVisArea area = PartialVisArea(RNA_enum_get(op->ptr, "area"));
|
||||
|
||||
if (!ELEM(area, PARTIALVIS_ALL, PARTIALVIS_MASKED)) {
|
||||
return WM_gesture_box_invoke(C, op, event);
|
||||
@@ -403,12 +406,12 @@ static int hide_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
return op->type->exec(C, op);
|
||||
}
|
||||
|
||||
void PAINT_OT_hide_show(struct wmOperatorType *ot)
|
||||
void PAINT_OT_hide_show(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem action_items[] = {
|
||||
{PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
|
||||
{PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem area_items[] = {
|
||||
@@ -420,7 +423,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
|
||||
0,
|
||||
"Masked",
|
||||
"Hide or show vertices that are masked (minimum mask value of 0.5)"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* Identifiers. */
|
||||
@@ -46,7 +46,7 @@ typedef struct CoNo {
|
||||
float no[3];
|
||||
} CoNo;
|
||||
|
||||
/* paint_stroke.c */
|
||||
/* paint_stroke.cc */
|
||||
|
||||
typedef bool (*StrokeGetLocation)(struct bContext *C,
|
||||
float location[3],
|
||||
@@ -87,7 +87,7 @@ bool paint_supports_texture(enum ePaintMode mode);
|
||||
bool paint_supports_jitter(enum ePaintMode mode);
|
||||
|
||||
/**
|
||||
* Called in paint_ops.c, on each regeneration of key-maps.
|
||||
* Called in paint_ops.cc, on each regeneration of key-maps.
|
||||
*/
|
||||
struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
int paint_stroke_modal(struct bContext *C,
|
||||
@@ -457,7 +457,7 @@ typedef enum BrushStrokeMode {
|
||||
BRUSH_STROKE_SMOOTH,
|
||||
} BrushStrokeMode;
|
||||
|
||||
/* paint_hide.c */
|
||||
/* paint_hide.cc */
|
||||
|
||||
typedef enum {
|
||||
PARTIALVIS_HIDE,
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "paint_intern.h"
|
||||
|
||||
/* For undo push. */
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
static const EnumPropertyItem mode_items[] = {
|
||||
{PAINT_MASK_FLOOD_VALUE,
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
* \ingroup edsculpt
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
@@ -41,13 +44,10 @@
|
||||
|
||||
#include "curves_sculpt_intern.h"
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
/* Brush operators */
|
||||
static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int brush_add_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
// int type = RNA_enum_get(op->ptr, "type");
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
@@ -158,7 +158,7 @@ static eGPBrush_Presets gpencil_get_brush_preset_from_tool(bToolRef *tool,
|
||||
return GP_BRUSH_PRESET_UNKNOWN;
|
||||
}
|
||||
|
||||
static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int brush_add_gpencil_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Brush *br = BKE_paint_brush(paint);
|
||||
@@ -170,11 +170,11 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
else {
|
||||
/* Get the active tool to determine what type of brush is active. */
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
if (screen == NULL) {
|
||||
if (screen == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
bToolRef *tool = NULL;
|
||||
bToolRef *tool = nullptr;
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
if (area->spacetype == SPACE_VIEW3D) {
|
||||
/* Check the current tool is a brush. */
|
||||
@@ -186,7 +186,7 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
}
|
||||
|
||||
if (tool == NULL) {
|
||||
if (tool == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Brush *brush = BKE_paint_brush(paint);
|
||||
const bool is_gpencil = (brush && brush->gpencil_settings != NULL);
|
||||
const bool is_gpencil = (brush && brush->gpencil_settings != nullptr);
|
||||
// Object *ob = CTX_data_active_object(C);
|
||||
float scalar = RNA_float_get(op->ptr, "scalar");
|
||||
|
||||
@@ -318,7 +318,7 @@ static void BRUSH_OT_scale_size(wmOperatorType *ot)
|
||||
|
||||
/* Palette operators */
|
||||
|
||||
static int palette_new_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int palette_new_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
@@ -349,7 +349,7 @@ static bool palette_poll(bContext *C)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
|
||||
if (paint && paint->palette != NULL && !ID_IS_LINKED(paint->palette) &&
|
||||
if (paint && paint->palette != nullptr && !ID_IS_LINKED(paint->palette) &&
|
||||
!ID_IS_OVERRIDE_LIBRARY(paint->palette)) {
|
||||
return true;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ static bool palette_poll(bContext *C)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int palette_color_add_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
@@ -401,11 +401,12 @@ static void PALETTE_OT_color_add(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int palette_color_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int palette_color_delete_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Palette *palette = paint->palette;
|
||||
PaletteColor *color = BLI_findlink(&palette->colors, palette->active_color);
|
||||
PaletteColor *color = static_cast<PaletteColor *>(
|
||||
BLI_findlink(&palette->colors, palette->active_color));
|
||||
|
||||
if (color) {
|
||||
BKE_palette_color_remove(palette, color);
|
||||
@@ -432,7 +433,7 @@ static void PALETTE_OT_color_delete(wmOperatorType *ot)
|
||||
static bool palette_extract_img_poll(bContext *C)
|
||||
{
|
||||
SpaceLink *sl = CTX_wm_space_data(C);
|
||||
if ((sl != NULL) && (sl->spacetype == SPACE_IMAGE)) {
|
||||
if ((sl != nullptr) && (sl->spacetype == SPACE_IMAGE)) {
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
Image *image = sima->image;
|
||||
ImageUser iuser = sima->iuser;
|
||||
@@ -480,7 +481,7 @@ static int palette_extract_img_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* Free memory. */
|
||||
BLI_ghash_free(color_table, NULL, NULL);
|
||||
BLI_ghash_free(color_table, nullptr, nullptr);
|
||||
BKE_image_release_ibuf(image, ibuf, lock);
|
||||
|
||||
if (done) {
|
||||
@@ -508,7 +509,7 @@ static void PALETTE_OT_extract_from_image(wmOperatorType *ot)
|
||||
|
||||
/* properties */
|
||||
prop = RNA_def_int(ot->srna, "threshold", 1, 1, 1, "Threshold", "", 1, 1);
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
RNA_def_property_flag(prop, PropertyFlag(PROP_HIDDEN | PROP_SKIP_SAVE));
|
||||
}
|
||||
|
||||
/* Sort Palette color by Hue and Saturation. */
|
||||
@@ -519,17 +520,17 @@ static int palette_sort_exec(bContext *C, wmOperator *op)
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Palette *palette = paint->palette;
|
||||
|
||||
if (palette == NULL) {
|
||||
if (palette == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
tPaletteColorHSV *color_array = NULL;
|
||||
tPaletteColorHSV *col_elm = NULL;
|
||||
tPaletteColorHSV *color_array = nullptr;
|
||||
tPaletteColorHSV *col_elm = nullptr;
|
||||
|
||||
const int totcol = BLI_listbase_count(&palette->colors);
|
||||
|
||||
if (totcol > 0) {
|
||||
color_array = MEM_calloc_arrayN(totcol, sizeof(tPaletteColorHSV), __func__);
|
||||
color_array = MEM_cnew_array<tPaletteColorHSV>(totcol, __func__);
|
||||
/* Put all colors in an array. */
|
||||
int t = 0;
|
||||
LISTBASE_FOREACH (PaletteColor *, color, &palette->colors) {
|
||||
@@ -558,9 +559,7 @@ static int palette_sort_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* Clear old color swatches. */
|
||||
PaletteColor *color_next = NULL;
|
||||
for (PaletteColor *color = palette->colors.first; color; color = color_next) {
|
||||
color_next = color->next;
|
||||
LISTBASE_FOREACH_MUTABLE (PaletteColor *, color, &palette->colors) {
|
||||
BKE_palette_color_remove(palette, color);
|
||||
}
|
||||
|
||||
@@ -579,7 +578,7 @@ static int palette_sort_exec(bContext *C, wmOperator *op)
|
||||
MEM_SAFE_FREE(color_array);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -591,7 +590,7 @@ static void PALETTE_OT_sort(wmOperatorType *ot)
|
||||
{2, "SVH", 0, "Saturation, Value, Hue", ""},
|
||||
{3, "VHS", 0, "Value, Hue, Saturation", ""},
|
||||
{4, "LUMINANCE", 0, "Luminance", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
@@ -614,9 +613,10 @@ static int palette_color_move_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Palette *palette = paint->palette;
|
||||
PaletteColor *palcolor = BLI_findlink(&palette->colors, palette->active_color);
|
||||
PaletteColor *palcolor = static_cast<PaletteColor *>(
|
||||
BLI_findlink(&palette->colors, palette->active_color));
|
||||
|
||||
if (palcolor == NULL) {
|
||||
if (palcolor == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ static int palette_color_move_exec(bContext *C, wmOperator *op)
|
||||
BLI_assert(ELEM(direction, -1, 0, 1)); /* we use value below */
|
||||
if (BLI_listbase_link_move(&palette->colors, palcolor, direction)) {
|
||||
palette->active_color += direction;
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, nullptr);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -636,7 +636,7 @@ static void PALETTE_OT_color_move(wmOperatorType *ot)
|
||||
static const EnumPropertyItem slot_move[] = {
|
||||
{-1, "UP", 0, "Up", ""},
|
||||
{1, "DOWN", 0, "Down", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
@@ -660,18 +660,18 @@ static int palette_join_exec(bContext *C, wmOperator *op)
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Palette *palette = paint->palette;
|
||||
Palette *palette_join = NULL;
|
||||
Palette *palette_join = nullptr;
|
||||
bool done = false;
|
||||
|
||||
char name[MAX_ID_NAME - 2];
|
||||
RNA_string_get(op->ptr, "palette", name);
|
||||
|
||||
if ((palette == NULL) || (name[0] == '\0')) {
|
||||
if ((palette == nullptr) || (name[0] == '\0')) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
palette_join = (Palette *)BKE_libblock_find_name(bmain, ID_PAL, name);
|
||||
if (palette_join == NULL) {
|
||||
if (palette_join == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -690,14 +690,12 @@ static int palette_join_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (done) {
|
||||
/* Clear old color swatches. */
|
||||
PaletteColor *color_next = NULL;
|
||||
for (PaletteColor *color = palette_join->colors.first; color; color = color_next) {
|
||||
color_next = color->next;
|
||||
LISTBASE_FOREACH_MUTABLE (PaletteColor *, color, &palette_join->colors) {
|
||||
BKE_palette_color_remove(palette_join, color);
|
||||
}
|
||||
|
||||
/* Notifier. */
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, nullptr);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -718,10 +716,10 @@ static void PALETTE_OT_join(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "palette", NULL, MAX_ID_NAME - 2, "Palette", "Name of the Palette");
|
||||
RNA_def_string(ot->srna, "palette", nullptr, MAX_ID_NAME - 2, "Palette", "Name of the Palette");
|
||||
}
|
||||
|
||||
static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int brush_reset_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Brush *brush = BKE_paint_brush(paint);
|
||||
@@ -771,8 +769,8 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
|
||||
{
|
||||
Brush *brush, *first_brush;
|
||||
|
||||
if (!brush_orig && !(brush_orig = bmain->brushes.first)) {
|
||||
return NULL;
|
||||
if (!brush_orig && !(brush_orig = static_cast<Brush *>(bmain->brushes.first))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (brush_tool(brush_orig, paint->runtime.tool_offset) != tool) {
|
||||
@@ -784,8 +782,8 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
|
||||
|
||||
/* Try to tool-slot first. */
|
||||
first_brush = BKE_paint_toolslots_brush_get(paint, tool);
|
||||
if (first_brush == NULL) {
|
||||
first_brush = bmain->brushes.first;
|
||||
if (first_brush == nullptr) {
|
||||
first_brush = static_cast<Brush *>(bmain->brushes.first);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -793,7 +791,8 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
|
||||
* currently active brush do a cycling via all possible
|
||||
* brushes with requested tool.
|
||||
*/
|
||||
first_brush = brush_orig->id.next ? brush_orig->id.next : bmain->brushes.first;
|
||||
first_brush = brush_orig->id.next ? static_cast<Brush *>(brush_orig->id.next) :
|
||||
static_cast<Brush *>(bmain->brushes.first);
|
||||
}
|
||||
|
||||
/* get the next brush with the active tool */
|
||||
@@ -804,10 +803,11 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
|
||||
return brush;
|
||||
}
|
||||
|
||||
brush = brush->id.next ? brush->id.next : bmain->brushes.first;
|
||||
brush = brush->id.next ? static_cast<Brush *>(brush->id.next) :
|
||||
static_cast<Brush *>(bmain->brushes.first);
|
||||
} while (brush != first_brush);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static Brush *brush_tool_toggle(Main *bmain, Paint *paint, Brush *brush_orig, const int tool)
|
||||
@@ -829,7 +829,7 @@ static Brush *brush_tool_toggle(Main *bmain, Paint *paint, Brush *brush_orig, co
|
||||
* back to the previously selected brush. */
|
||||
return brush_orig->toggle_brush;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool brush_generic_tool_set(bContext *C,
|
||||
@@ -849,9 +849,9 @@ static bool brush_generic_tool_set(bContext *C,
|
||||
brush = brush_tool_cycle(bmain, paint, brush_orig, tool);
|
||||
}
|
||||
|
||||
if (((brush == NULL) && create_missing) &&
|
||||
((brush_orig == NULL) || brush_tool(brush_orig, paint->runtime.tool_offset) != tool)) {
|
||||
brush = BKE_brush_add(bmain, tool_name, paint->runtime.ob_mode);
|
||||
if (((brush == nullptr) && create_missing) &&
|
||||
((brush_orig == nullptr) || brush_tool(brush_orig, paint->runtime.tool_offset) != tool)) {
|
||||
brush = BKE_brush_add(bmain, tool_name, eObjectMode(paint->runtime.ob_mode));
|
||||
id_us_min(&brush->id); /* fake user only */
|
||||
brush_tool_set(brush, paint->runtime.tool_offset, tool);
|
||||
brush->toggle_brush = brush_orig;
|
||||
@@ -918,7 +918,7 @@ static int brush_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode);
|
||||
if (paint == NULL) {
|
||||
if (paint == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
const EnumPropertyItem *items = BKE_paint_get_tool_enum_from_paintmode(paint_mode);
|
||||
@@ -957,34 +957,34 @@ static void PAINT_OT_brush_select(wmOperatorType *ot)
|
||||
|
||||
prop = RNA_def_boolean(
|
||||
ot->srna, "toggle", 0, "Toggle", "Toggle between two brushes rather than cycling");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
RNA_def_property_flag(prop, PropertyFlag(PROP_HIDDEN | PROP_SKIP_SAVE));
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"create_missing",
|
||||
0,
|
||||
"Create Missing",
|
||||
"If the requested brush type does not exist, create a new brush");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
RNA_def_property_flag(prop, PropertyFlag(PROP_HIDDEN | PROP_SKIP_SAVE));
|
||||
}
|
||||
|
||||
/***** Stencil Control *****/
|
||||
|
||||
typedef enum {
|
||||
enum StencilControlMode {
|
||||
STENCIL_TRANSLATE,
|
||||
STENCIL_SCALE,
|
||||
STENCIL_ROTATE,
|
||||
} StencilControlMode;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
enum StencilTextureMode {
|
||||
STENCIL_PRIMARY = 0,
|
||||
STENCIL_SECONDARY = 1,
|
||||
} StencilTextureMode;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
enum StencilConstraint {
|
||||
STENCIL_CONSTRAINT_X = 1,
|
||||
STENCIL_CONSTRAINT_Y = 2,
|
||||
} StencilConstraint;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct StencilControlData {
|
||||
float init_mouse[2];
|
||||
float init_spos[2];
|
||||
float init_sdim[2];
|
||||
@@ -1001,7 +1001,7 @@ typedef struct {
|
||||
float *rot_target;
|
||||
float *pos_target;
|
||||
short launch_event;
|
||||
} StencilControlData;
|
||||
};
|
||||
|
||||
static void stencil_set_target(StencilControlData *scd)
|
||||
{
|
||||
@@ -1039,7 +1039,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Brush *br = BKE_paint_brush(paint);
|
||||
const float mvalf[2] = {event->mval[0], event->mval[1]};
|
||||
const float mvalf[2] = {float(event->mval[0]), float(event->mval[1])};
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
StencilControlData *scd;
|
||||
int mask = RNA_enum_get(op->ptr, "texmode");
|
||||
@@ -1055,7 +1055,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
}
|
||||
}
|
||||
|
||||
scd = MEM_mallocN(sizeof(StencilControlData), "stencil_control");
|
||||
scd = static_cast<StencilControlData *>(MEM_mallocN(sizeof(StencilControlData), __func__));
|
||||
scd->mask = mask;
|
||||
scd->br = br;
|
||||
|
||||
@@ -1063,7 +1063,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
|
||||
stencil_set_target(scd);
|
||||
|
||||
scd->mode = RNA_enum_get(op->ptr, "mode");
|
||||
scd->mode = StencilControlMode(RNA_enum_get(op->ptr, "mode"));
|
||||
scd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
|
||||
scd->area_size[0] = region->winx;
|
||||
scd->area_size[1] = region->winy;
|
||||
@@ -1081,12 +1081,11 @@ static void stencil_restore(StencilControlData *scd)
|
||||
*scd->rot_target = scd->init_rot;
|
||||
}
|
||||
|
||||
static void stencil_control_cancel(bContext *UNUSED(C), wmOperator *op)
|
||||
static void stencil_control_cancel(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
StencilControlData *scd = op->customdata;
|
||||
|
||||
StencilControlData *scd = static_cast<StencilControlData *>(op->customdata);
|
||||
stencil_restore(scd);
|
||||
MEM_freeN(op->customdata);
|
||||
MEM_freeN(scd);
|
||||
}
|
||||
|
||||
static void stencil_control_calculate(StencilControlData *scd, const int mval[2])
|
||||
@@ -1094,7 +1093,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
|
||||
#define PIXEL_MARGIN 5
|
||||
|
||||
float mdiff[2];
|
||||
const float mvalf[2] = {mval[0], mval[1]};
|
||||
const float mvalf[2] = {float(mval[0]), float(mval[1])};
|
||||
switch (scd->mode) {
|
||||
case STENCIL_TRANSLATE:
|
||||
sub_v2_v2v2(mdiff, mvalf, scd->init_mouse);
|
||||
@@ -1144,11 +1143,11 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
|
||||
|
||||
static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
StencilControlData *scd = op->customdata;
|
||||
StencilControlData *scd = static_cast<StencilControlData *>(op->customdata);
|
||||
|
||||
if (event->type == scd->launch_event && event->val == KM_RELEASE) {
|
||||
MEM_freeN(op->customdata);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1158,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
case EVT_ESCKEY:
|
||||
if (event->val == KM_PRESS) {
|
||||
stencil_control_cancel(C, op);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
break;
|
||||
@@ -1167,7 +1166,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
if (event->val == KM_PRESS) {
|
||||
|
||||
if (scd->constrain_mode == STENCIL_CONSTRAINT_X) {
|
||||
scd->constrain_mode = 0;
|
||||
scd->constrain_mode = StencilConstraint(0);
|
||||
}
|
||||
else {
|
||||
scd->constrain_mode = STENCIL_CONSTRAINT_X;
|
||||
@@ -1179,7 +1178,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
case EVT_YKEY:
|
||||
if (event->val == KM_PRESS) {
|
||||
if (scd->constrain_mode == STENCIL_CONSTRAINT_Y) {
|
||||
scd->constrain_mode = 0;
|
||||
scd->constrain_mode = StencilConstraint(0);
|
||||
}
|
||||
else {
|
||||
scd->constrain_mode = STENCIL_CONSTRAINT_Y;
|
||||
@@ -1220,13 +1219,13 @@ static void BRUSH_OT_stencil_control(wmOperatorType *ot)
|
||||
{STENCIL_TRANSLATE, "TRANSLATION", 0, "Translation", ""},
|
||||
{STENCIL_SCALE, "SCALE", 0, "Scale", ""},
|
||||
{STENCIL_ROTATE, "ROTATION", 0, "Rotation", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem stencil_texture_items[] = {
|
||||
{STENCIL_PRIMARY, "PRIMARY", 0, "Primary", ""},
|
||||
{STENCIL_SECONDARY, "SECONDARY", 0, "Secondary", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
/* identifiers */
|
||||
ot->name = "Stencil Brush Control";
|
||||
@@ -1244,9 +1243,9 @@ static void BRUSH_OT_stencil_control(wmOperatorType *ot)
|
||||
|
||||
PropertyRNA *prop;
|
||||
prop = RNA_def_enum(ot->srna, "mode", stencil_control_items, STENCIL_TRANSLATE, "Tool", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
RNA_def_property_flag(prop, PropertyFlag(PROP_HIDDEN | PROP_SKIP_SAVE));
|
||||
prop = RNA_def_enum(ot->srna, "texmode", stencil_texture_items, STENCIL_PRIMARY, "Tool", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
RNA_def_property_flag(prop, PropertyFlag(PROP_HIDDEN | PROP_SKIP_SAVE));
|
||||
}
|
||||
|
||||
static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
|
||||
@@ -1256,8 +1255,8 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
|
||||
bool use_scale = RNA_boolean_get(op->ptr, "use_scale");
|
||||
bool use_repeat = RNA_boolean_get(op->ptr, "use_repeat");
|
||||
bool do_mask = RNA_boolean_get(op->ptr, "mask");
|
||||
Tex *tex = NULL;
|
||||
MTex *mtex = NULL;
|
||||
Tex *tex = nullptr;
|
||||
MTex *mtex = nullptr;
|
||||
if (br) {
|
||||
mtex = do_mask ? &br->mask_mtex : &br->mtex;
|
||||
tex = mtex->tex;
|
||||
@@ -1267,7 +1266,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
|
||||
float aspx, aspy;
|
||||
Image *ima = tex->ima;
|
||||
float orig_area, stencil_area, factor;
|
||||
ED_image_get_uv_aspect(ima, NULL, &aspx, &aspy);
|
||||
ED_image_get_uv_aspect(ima, nullptr, &aspx, &aspy);
|
||||
|
||||
if (use_scale) {
|
||||
aspx *= mtex->size[0];
|
||||
@@ -1300,7 +1299,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1355,7 +1354,7 @@ static int stencil_reset_transform_exec(bContext *C, wmOperator *op)
|
||||
br->mtex.rot = 0;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
* \ingroup edsculpt
|
||||
*/
|
||||
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
@@ -40,10 +43,7 @@
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
//#define DEBUG_TIME
|
||||
|
||||
@@ -51,16 +51,16 @@
|
||||
# include "PIL_time_utildefines.h"
|
||||
#endif
|
||||
|
||||
typedef struct PaintSample {
|
||||
struct PaintSample {
|
||||
float mouse[2];
|
||||
float pressure;
|
||||
} PaintSample;
|
||||
};
|
||||
|
||||
typedef struct PaintStroke {
|
||||
struct PaintStroke {
|
||||
void *mode_data;
|
||||
void *stroke_cursor;
|
||||
wmTimer *timer;
|
||||
struct RNG *rng;
|
||||
RNG *rng;
|
||||
|
||||
/* Cached values */
|
||||
ViewContext vc;
|
||||
@@ -124,14 +124,14 @@ typedef struct PaintStroke {
|
||||
StrokeDone done;
|
||||
|
||||
bool original; /* Ray-cast original mesh at start of stroke. */
|
||||
} PaintStroke;
|
||||
};
|
||||
|
||||
/*** Cursors ***/
|
||||
static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Brush *brush = BKE_paint_brush(paint);
|
||||
PaintStroke *stroke = customdata;
|
||||
PaintStroke *stroke = static_cast<PaintStroke *>(customdata);
|
||||
|
||||
if (stroke && brush) {
|
||||
GPU_line_smooth(true);
|
||||
@@ -161,7 +161,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
|
||||
static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
PaintStroke *stroke = customdata;
|
||||
PaintStroke *stroke = static_cast<PaintStroke *>(customdata);
|
||||
|
||||
GPU_line_smooth(true);
|
||||
|
||||
@@ -247,7 +247,7 @@ static bool paint_stroke_use_scene_spacing(Brush *brush, ePaintMode mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool paint_tool_raycast_original(Brush *brush, ePaintMode UNUSED(mode))
|
||||
static bool paint_tool_raycast_original(Brush *brush, ePaintMode /*mode*/)
|
||||
{
|
||||
return brush->flag & (BRUSH_ANCHORED | BRUSH_DRAG_DOT);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ static bool paint_tool_require_inbetween_mouse_events(Brush *brush, ePaintMode m
|
||||
static bool paint_brush_update(bContext *C,
|
||||
Brush *brush,
|
||||
ePaintMode mode,
|
||||
struct PaintStroke *stroke,
|
||||
PaintStroke *stroke,
|
||||
const float mouse_init[2],
|
||||
float mouse[2],
|
||||
float pressure,
|
||||
@@ -315,18 +315,18 @@ static bool paint_brush_update(bContext *C,
|
||||
stroke->cached_size_pressure = pressure;
|
||||
|
||||
ups->do_linear_conversion = false;
|
||||
ups->colorspace = NULL;
|
||||
ups->colorspace = nullptr;
|
||||
|
||||
/* check here if color sampling the main brush should do color conversion. This is done here
|
||||
* to avoid locking up to get the image buffer during sampling */
|
||||
if (brush->mtex.tex && brush->mtex.tex->type == TEX_IMAGE && brush->mtex.tex->ima) {
|
||||
ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(
|
||||
brush->mtex.tex->ima, &brush->mtex.tex->iuser, NULL);
|
||||
if (tex_ibuf && tex_ibuf->rect_float == NULL) {
|
||||
brush->mtex.tex->ima, &brush->mtex.tex->iuser, nullptr);
|
||||
if (tex_ibuf && tex_ibuf->rect_float == nullptr) {
|
||||
ups->do_linear_conversion = true;
|
||||
ups->colorspace = tex_ibuf->rect_colorspace;
|
||||
}
|
||||
BKE_image_pool_release_ibuf(brush->mtex.tex->ima, tex_ibuf, NULL);
|
||||
BKE_image_pool_release_ibuf(brush->mtex.tex->ima, tex_ibuf, nullptr);
|
||||
}
|
||||
|
||||
stroke->brush_init = true;
|
||||
@@ -452,7 +452,7 @@ static bool paint_brush_update(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
if ((do_random || do_random_mask) && stroke->rng == NULL) {
|
||||
if ((do_random || do_random_mask) && stroke->rng == nullptr) {
|
||||
/* Lazy initialization. */
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= (uint)POINTER_AS_INT(brush);
|
||||
@@ -896,8 +896,8 @@ PaintStroke *paint_stroke_new(bContext *C,
|
||||
StrokeDone done,
|
||||
int event_type)
|
||||
{
|
||||
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke");
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
PaintStroke *stroke = MEM_cnew<PaintStroke>(__func__);
|
||||
ToolSettings *toolsettings = CTX_data_tool_settings(C);
|
||||
UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings;
|
||||
Paint *p = BKE_paint_get_active_from_context(C);
|
||||
@@ -948,23 +948,23 @@ PaintStroke *paint_stroke_new(bContext *C,
|
||||
BKE_curvemapping_init(p->cavity_curve);
|
||||
}
|
||||
|
||||
BKE_paint_set_overlay_override(br->overlay_flags);
|
||||
BKE_paint_set_overlay_override(eOverlayFlags(br->overlay_flags));
|
||||
|
||||
ups->start_pixel_radius = BKE_brush_size_get(CTX_data_scene(C), br);
|
||||
|
||||
return stroke;
|
||||
}
|
||||
|
||||
void paint_stroke_free(bContext *C, wmOperator *UNUSED(op), PaintStroke *stroke)
|
||||
void paint_stroke_free(bContext *C, wmOperator * /*op*/, PaintStroke *stroke)
|
||||
{
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
if (rv3d) {
|
||||
rv3d->rflag &= ~RV3D_PAINTING;
|
||||
}
|
||||
|
||||
BKE_paint_set_overlay_override(0);
|
||||
BKE_paint_set_overlay_override(eOverlayFlags(0));
|
||||
|
||||
if (stroke == NULL) {
|
||||
if (stroke == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -981,7 +981,7 @@ void paint_stroke_free(bContext *C, wmOperator *UNUSED(op), PaintStroke *stroke)
|
||||
}
|
||||
|
||||
if (stroke->stroke_cursor) {
|
||||
WM_paint_cursor_end(stroke->stroke_cursor);
|
||||
WM_paint_cursor_end(static_cast<wmPaintCursor *>(stroke->stroke_cursor));
|
||||
}
|
||||
|
||||
BLI_freelistN(&stroke->line);
|
||||
@@ -1035,7 +1035,7 @@ bool paint_space_stroke_enabled(Brush *br, ePaintMode mode)
|
||||
}
|
||||
|
||||
if (mode == PAINT_MODE_SCULPT_CURVES &&
|
||||
!curves_sculpt_brush_uses_spacing(br->curves_sculpt_tool)) {
|
||||
!curves_sculpt_brush_uses_spacing(eBrushCurvesSculptTool(br->curves_sculpt_tool))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1130,16 +1130,16 @@ bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode)
|
||||
|
||||
#define PAINT_STROKE_MODAL_CANCEL 1
|
||||
|
||||
struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf)
|
||||
wmKeyMap *paint_stroke_modal_keymap(wmKeyConfig *keyconf)
|
||||
{
|
||||
static struct EnumPropertyItem modal_items[] = {
|
||||
static EnumPropertyItem modal_items[] = {
|
||||
{PAINT_STROKE_MODAL_CANCEL, "CANCEL", 0, "Cancel", "Cancel and undo a stroke in progress"},
|
||||
|
||||
{0}};
|
||||
|
||||
static const char *name = "Paint Stroke Modal";
|
||||
|
||||
struct wmKeyMap *keymap = WM_modalkeymap_find(keyconf, name);
|
||||
wmKeyMap *keymap = WM_modalkeymap_find(keyconf, name);
|
||||
|
||||
/* This function is called for each space-type, only needs to add map once. */
|
||||
if (!keymap) {
|
||||
@@ -1440,7 +1440,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS
|
||||
/* see if tablet affects event. Line, anchored and drag dot strokes do not support pressure */
|
||||
pressure = ((br->flag & (BRUSH_LINE | BRUSH_ANCHORED | BRUSH_DRAG_DOT)) ?
|
||||
1.0f :
|
||||
WM_event_tablet_data(event, &stroke->pen_flip, NULL));
|
||||
WM_event_tablet_data(event, &stroke->pen_flip, nullptr));
|
||||
|
||||
/* When processing a timer event the pressure from the event is 0, so use the last valid
|
||||
* pressure. */
|
||||
@@ -1473,7 +1473,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS
|
||||
/* one time initialization */
|
||||
if (!stroke->stroke_init) {
|
||||
if (paint_stroke_curve_end(C, op, stroke)) {
|
||||
*stroke_p = NULL;
|
||||
*stroke_p = nullptr;
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -1530,14 +1530,14 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS
|
||||
paint_stroke_line_constrain(stroke, mouse);
|
||||
paint_stroke_line_end(C, op, stroke, mouse);
|
||||
stroke_done(C, op, stroke);
|
||||
*stroke_p = NULL;
|
||||
*stroke_p = nullptr;
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
else if (ELEM(event->type, EVT_RETKEY, EVT_SPACEKEY)) {
|
||||
paint_stroke_line_end(C, op, stroke, sample_average.mouse);
|
||||
stroke_done(C, op, stroke);
|
||||
*stroke_p = NULL;
|
||||
*stroke_p = nullptr;
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else if (br->flag & BRUSH_LINE) {
|
||||
@@ -1650,22 +1650,22 @@ ViewContext *paint_stroke_view_context(PaintStroke *stroke)
|
||||
return &stroke->vc;
|
||||
}
|
||||
|
||||
void *paint_stroke_mode_data(struct PaintStroke *stroke)
|
||||
void *paint_stroke_mode_data(PaintStroke *stroke)
|
||||
{
|
||||
return stroke->mode_data;
|
||||
}
|
||||
|
||||
bool paint_stroke_flipped(struct PaintStroke *stroke)
|
||||
bool paint_stroke_flipped(PaintStroke *stroke)
|
||||
{
|
||||
return stroke->pen_flip;
|
||||
}
|
||||
|
||||
bool paint_stroke_inverted(struct PaintStroke *stroke)
|
||||
bool paint_stroke_inverted(PaintStroke *stroke)
|
||||
{
|
||||
return stroke->stroke_mode == BRUSH_STROKE_INVERT;
|
||||
}
|
||||
|
||||
float paint_stroke_distance_get(struct PaintStroke *stroke)
|
||||
float paint_stroke_distance_get(PaintStroke *stroke)
|
||||
{
|
||||
return stroke->stroke_distance;
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
#include "bmesh.h"
|
||||
|
||||
#include "paint_intern.h" /* own include */
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
using blender::IndexRange;
|
||||
using namespace blender;
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include "ED_screen.h"
|
||||
#include "ED_sculpt.h"
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "BKE_pbvh.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "GPU_immediate.h"
|
||||
#include "GPU_state.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "ED_screen.h"
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_view3d.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_undo.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "ED_screen.h"
|
||||
#include "ED_sculpt.h"
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
#include "ED_sculpt.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_paint.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "BKE_pbvh.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
|
||||
@@ -24,19 +24,20 @@
|
||||
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct AutomaskingCache;
|
||||
struct AutomaskingNodeData;
|
||||
struct Dial;
|
||||
struct DistRayAABB_Precalc;
|
||||
struct Image;
|
||||
struct ImageUser;
|
||||
struct KeyBlock;
|
||||
struct Object;
|
||||
struct SculptProjectVector;
|
||||
struct SculptUndoNode;
|
||||
struct bContext;
|
||||
struct PaintModeSettings;
|
||||
struct WeightPaintInfo;
|
||||
struct WPaintData;
|
||||
struct wmKeyConfig;
|
||||
struct wmOperator;
|
||||
struct wmOperatorType;
|
||||
@@ -47,23 +48,23 @@ struct wmOperatorType;
|
||||
/** \name Sculpt Types
|
||||
* \{ */
|
||||
|
||||
typedef enum SculptUpdateType {
|
||||
enum SculptUpdateType {
|
||||
SCULPT_UPDATE_COORDS = 1 << 0,
|
||||
SCULPT_UPDATE_MASK = 1 << 1,
|
||||
SCULPT_UPDATE_VISIBILITY = 1 << 2,
|
||||
SCULPT_UPDATE_COLOR = 1 << 3,
|
||||
SCULPT_UPDATE_IMAGE = 1 << 4,
|
||||
} SculptUpdateType;
|
||||
};
|
||||
|
||||
typedef struct SculptCursorGeometryInfo {
|
||||
struct SculptCursorGeometryInfo {
|
||||
float location[3];
|
||||
float normal[3];
|
||||
float active_vertex_co[3];
|
||||
} SculptCursorGeometryInfo;
|
||||
};
|
||||
|
||||
#define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY 256
|
||||
|
||||
typedef struct SculptVertexNeighborIter {
|
||||
struct SculptVertexNeighborIter {
|
||||
/* Storage */
|
||||
PBVHVertRef *neighbors;
|
||||
int *neighbor_indices;
|
||||
@@ -81,13 +82,13 @@ typedef struct SculptVertexNeighborIter {
|
||||
int index;
|
||||
PBVHVertRef vertex;
|
||||
bool is_duplicate;
|
||||
} SculptVertexNeighborIter;
|
||||
};
|
||||
|
||||
/* Sculpt Original Data */
|
||||
typedef struct {
|
||||
struct SculptOrigVertData {
|
||||
struct BMLog *bm_log;
|
||||
|
||||
struct SculptUndoNode *unode;
|
||||
SculptUndoNode *unode;
|
||||
float (*coords)[3];
|
||||
float (*normals)[3];
|
||||
const float *vmasks;
|
||||
@@ -98,29 +99,29 @@ typedef struct {
|
||||
const float *no;
|
||||
float mask;
|
||||
const float *col;
|
||||
} SculptOrigVertData;
|
||||
};
|
||||
|
||||
typedef struct SculptOrigFaceData {
|
||||
struct SculptUndoNode *unode;
|
||||
struct SculptOrigFaceData {
|
||||
SculptUndoNode *unode;
|
||||
struct BMLog *bm_log;
|
||||
const int *face_sets;
|
||||
int face_set;
|
||||
} SculptOrigFaceData;
|
||||
};
|
||||
|
||||
/* Flood Fill. */
|
||||
typedef struct {
|
||||
struct SculptFloodFill {
|
||||
GSQueue *queue;
|
||||
BLI_bitmap *visited_verts;
|
||||
} SculptFloodFill;
|
||||
};
|
||||
|
||||
typedef enum eBoundaryAutomaskMode {
|
||||
enum eBoundaryAutomaskMode {
|
||||
AUTOMASK_INIT_BOUNDARY_EDGES = 1,
|
||||
AUTOMASK_INIT_BOUNDARY_FACE_SETS = 2,
|
||||
} eBoundaryAutomaskMode;
|
||||
};
|
||||
|
||||
/* Undo */
|
||||
|
||||
typedef enum {
|
||||
enum SculptUndoType {
|
||||
SCULPT_UNDO_COORDS,
|
||||
SCULPT_UNDO_HIDDEN,
|
||||
SCULPT_UNDO_MASK,
|
||||
@@ -130,11 +131,11 @@ typedef enum {
|
||||
SCULPT_UNDO_GEOMETRY,
|
||||
SCULPT_UNDO_FACE_SETS,
|
||||
SCULPT_UNDO_COLOR,
|
||||
} SculptUndoType;
|
||||
};
|
||||
|
||||
/* Storage of geometry for the undo node.
|
||||
* Is used as a storage for either original or modified geometry. */
|
||||
typedef struct SculptUndoNodeGeometry {
|
||||
struct SculptUndoNodeGeometry {
|
||||
/* Is used for sanity check, helping with ensuring that two and only two
|
||||
* geometry pushes happened in the undo stack. */
|
||||
bool is_initialized;
|
||||
@@ -147,10 +148,10 @@ typedef struct SculptUndoNodeGeometry {
|
||||
int totedge;
|
||||
int totloop;
|
||||
int totpoly;
|
||||
} SculptUndoNodeGeometry;
|
||||
};
|
||||
|
||||
typedef struct SculptUndoNode {
|
||||
struct SculptUndoNode *next, *prev;
|
||||
struct SculptUndoNode {
|
||||
SculptUndoNode *next, *prev;
|
||||
|
||||
SculptUndoType type;
|
||||
|
||||
@@ -184,7 +185,7 @@ typedef struct SculptUndoNode {
|
||||
BLI_bitmap **grid_hidden;
|
||||
|
||||
/* bmesh */
|
||||
struct BMLogEntry *bm_entry;
|
||||
BMLogEntry *bm_entry;
|
||||
bool applied;
|
||||
|
||||
/* shape keys */
|
||||
@@ -214,7 +215,7 @@ typedef struct SculptUndoNode {
|
||||
int faces_num;
|
||||
|
||||
size_t undo_size;
|
||||
} SculptUndoNode;
|
||||
};
|
||||
|
||||
/* Factor of brush to have rake point following behind
|
||||
* (could be configurable but this is reasonable default). */
|
||||
@@ -230,19 +231,19 @@ struct SculptRakeData {
|
||||
* normally we would split it up, but it might be better to see if we can't eliminate it
|
||||
* altogether after moving to C++ (where we'll be able to use lambdas).
|
||||
*/
|
||||
typedef struct SculptThreadedTaskData {
|
||||
struct bContext *C;
|
||||
struct Sculpt *sd;
|
||||
struct Object *ob;
|
||||
const struct Brush *brush;
|
||||
struct PBVHNode **nodes;
|
||||
struct SculptThreadedTaskData {
|
||||
bContext *C;
|
||||
Sculpt *sd;
|
||||
Object *ob;
|
||||
const Brush *brush;
|
||||
PBVHNode **nodes;
|
||||
int totnode;
|
||||
|
||||
struct VPaint *vp;
|
||||
struct WPaintData *wpd;
|
||||
struct WeightPaintInfo *wpi;
|
||||
VPaint *vp;
|
||||
WPaintData *wpd;
|
||||
WeightPaintInfo *wpi;
|
||||
unsigned int *lcol;
|
||||
struct Mesh *me;
|
||||
Mesh *me;
|
||||
/* For passing generic params. */
|
||||
void *custom_data;
|
||||
|
||||
@@ -257,7 +258,7 @@ typedef struct SculptThreadedTaskData {
|
||||
bool smooth_mask;
|
||||
bool has_bm_orco;
|
||||
|
||||
struct SculptProjectVector *spvc;
|
||||
SculptProjectVector *spvc;
|
||||
float *offset;
|
||||
float *grab_delta;
|
||||
float *cono;
|
||||
@@ -345,10 +346,10 @@ typedef struct SculptThreadedTaskData {
|
||||
|
||||
ThreadMutex mutex;
|
||||
int iteration;
|
||||
} SculptThreadedTaskData;
|
||||
};
|
||||
|
||||
/*************** Brush testing declarations ****************/
|
||||
typedef struct SculptBrushTest {
|
||||
struct SculptBrushTest {
|
||||
float radius_squared;
|
||||
float radius;
|
||||
float location[3];
|
||||
@@ -365,48 +366,48 @@ typedef struct SculptBrushTest {
|
||||
float plane_tool[4];
|
||||
|
||||
/* View3d clipping - only set rv3d for clipping */
|
||||
struct RegionView3D *clip_rv3d;
|
||||
} SculptBrushTest;
|
||||
RegionView3D *clip_rv3d;
|
||||
};
|
||||
|
||||
typedef bool (*SculptBrushTestFn)(SculptBrushTest *test, const float co[3]);
|
||||
using SculptBrushTestFn = bool (*)(SculptBrushTest *test, const float co[3]);
|
||||
|
||||
typedef struct {
|
||||
struct Sculpt *sd;
|
||||
struct SculptSession *ss;
|
||||
struct SculptSearchSphereData {
|
||||
Sculpt *sd;
|
||||
SculptSession *ss;
|
||||
float radius_squared;
|
||||
const float *center;
|
||||
bool original;
|
||||
/* This ignores fully masked and fully hidden nodes. */
|
||||
bool ignore_fully_ineffective;
|
||||
} SculptSearchSphereData;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct Sculpt *sd;
|
||||
struct SculptSession *ss;
|
||||
struct SculptSearchCircleData {
|
||||
Sculpt *sd;
|
||||
SculptSession *ss;
|
||||
float radius_squared;
|
||||
bool original;
|
||||
bool ignore_fully_ineffective;
|
||||
struct DistRayAABB_Precalc *dist_ray_to_aabb_precalc;
|
||||
} SculptSearchCircleData;
|
||||
DistRayAABB_Precalc *dist_ray_to_aabb_precalc;
|
||||
};
|
||||
|
||||
/* Sculpt Filters */
|
||||
typedef enum SculptFilterOrientation {
|
||||
enum SculptFilterOrientation {
|
||||
SCULPT_FILTER_ORIENTATION_LOCAL = 0,
|
||||
SCULPT_FILTER_ORIENTATION_WORLD = 1,
|
||||
SCULPT_FILTER_ORIENTATION_VIEW = 2,
|
||||
} SculptFilterOrientation;
|
||||
};
|
||||
|
||||
/* Defines how transform tools are going to apply its displacement. */
|
||||
typedef enum SculptTransformDisplacementMode {
|
||||
enum SculptTransformDisplacementMode {
|
||||
/* Displaces the elements from their original coordinates. */
|
||||
SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL = 0,
|
||||
/* Displaces the elements incrementally from their previous position. */
|
||||
SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL = 1,
|
||||
} SculptTransformDisplacementMode;
|
||||
};
|
||||
|
||||
#define SCULPT_CLAY_STABILIZER_LEN 10
|
||||
|
||||
typedef struct AutomaskingSettings {
|
||||
struct AutomaskingSettings {
|
||||
/* Flags from eAutomasking_flag. */
|
||||
int flags;
|
||||
int initial_face_set;
|
||||
@@ -414,22 +415,22 @@ typedef struct AutomaskingSettings {
|
||||
|
||||
float cavity_factor;
|
||||
int cavity_blur_steps;
|
||||
struct CurveMapping *cavity_curve;
|
||||
CurveMapping *cavity_curve;
|
||||
|
||||
float start_normal_limit, start_normal_falloff;
|
||||
float view_normal_limit, view_normal_falloff;
|
||||
|
||||
bool topology_use_brush_limit;
|
||||
} AutomaskingSettings;
|
||||
};
|
||||
|
||||
typedef struct AutomaskingCache {
|
||||
struct AutomaskingCache {
|
||||
AutomaskingSettings settings;
|
||||
|
||||
bool can_reuse_mask;
|
||||
uchar current_stroke_id;
|
||||
} AutomaskingCache;
|
||||
};
|
||||
|
||||
typedef struct FilterCache {
|
||||
struct FilterCache {
|
||||
bool enabled_axis[3];
|
||||
bool enabled_force_axis[3];
|
||||
int random_seed;
|
||||
@@ -493,13 +494,13 @@ typedef struct FilterCache {
|
||||
float (*pre_smoothed_color)[4];
|
||||
|
||||
ViewContext vc;
|
||||
} FilterCache;
|
||||
};
|
||||
|
||||
/**
|
||||
* This structure contains all the temporary data
|
||||
* needed for individual brush strokes.
|
||||
*/
|
||||
typedef struct StrokeCache {
|
||||
struct StrokeCache {
|
||||
/* Invariants */
|
||||
float initial_radius;
|
||||
float scale[3];
|
||||
@@ -555,8 +556,8 @@ typedef struct StrokeCache {
|
||||
float projection_mat[4][4];
|
||||
|
||||
/* Clean this up! */
|
||||
struct ViewContext *vc;
|
||||
const struct Brush *brush;
|
||||
ViewContext *vc;
|
||||
const Brush *brush;
|
||||
|
||||
float special_rotation;
|
||||
float grab_delta[3], grab_delta_symmetry[3];
|
||||
@@ -565,7 +566,7 @@ typedef struct StrokeCache {
|
||||
/* screen-space rotation defined by mouse motion */
|
||||
float rake_rotation[4], rake_rotation_symmetry[4];
|
||||
bool is_rake_rotation_valid;
|
||||
struct SculptRakeData rake_data;
|
||||
SculptRakeData rake_data;
|
||||
|
||||
/* Face Sets */
|
||||
int paint_face_set;
|
||||
@@ -608,7 +609,7 @@ typedef struct StrokeCache {
|
||||
} paint_brush;
|
||||
|
||||
/* Pose brush */
|
||||
struct SculptPoseIKChain *pose_ik_chain;
|
||||
SculptPoseIKChain *pose_ik_chain;
|
||||
|
||||
/* Enhance Details. */
|
||||
float (*detail_directions)[3];
|
||||
@@ -621,14 +622,14 @@ typedef struct StrokeCache {
|
||||
int clay_pressure_stabilizer_index;
|
||||
|
||||
/* Cloth brush */
|
||||
struct SculptClothSimulation *cloth_sim;
|
||||
SculptClothSimulation *cloth_sim;
|
||||
float initial_location[3];
|
||||
float true_initial_location[3];
|
||||
float initial_normal[3];
|
||||
float true_initial_normal[3];
|
||||
|
||||
/* Boundary brush */
|
||||
struct SculptBoundary *boundaries[PAINT_SYMM_AREAS];
|
||||
SculptBoundary *boundaries[PAINT_SYMM_AREAS];
|
||||
|
||||
/* Surface Smooth Brush */
|
||||
/* Stores the displacement produced by the laplacian step of HC smooth. */
|
||||
@@ -638,7 +639,7 @@ typedef struct StrokeCache {
|
||||
float *layer_displacement_factor;
|
||||
|
||||
float vertex_rotation; /* amount to rotate the vertices when using rotate brush */
|
||||
struct Dial *dial;
|
||||
Dial *dial;
|
||||
|
||||
char saved_active_brush_name[MAX_ID_NAME];
|
||||
char saved_mask_brush_tool;
|
||||
@@ -664,13 +665,13 @@ typedef struct StrokeCache {
|
||||
rcti current_r; /* current redraw rectangle */
|
||||
|
||||
int stroke_id;
|
||||
} StrokeCache;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Sculpt Expand
|
||||
* \{ */
|
||||
|
||||
typedef enum eSculptExpandFalloffType {
|
||||
enum eSculptExpandFalloffType {
|
||||
SCULPT_EXPAND_FALLOFF_GEODESIC,
|
||||
SCULPT_EXPAND_FALLOFF_TOPOLOGY,
|
||||
SCULPT_EXPAND_FALLOFF_TOPOLOGY_DIAGONALS,
|
||||
@@ -679,22 +680,22 @@ typedef enum eSculptExpandFalloffType {
|
||||
SCULPT_EXPAND_FALLOFF_BOUNDARY_TOPOLOGY,
|
||||
SCULPT_EXPAND_FALLOFF_BOUNDARY_FACE_SET,
|
||||
SCULPT_EXPAND_FALLOFF_ACTIVE_FACE_SET,
|
||||
} eSculptExpandFalloffType;
|
||||
};
|
||||
|
||||
typedef enum eSculptExpandTargetType {
|
||||
enum eSculptExpandTargetType {
|
||||
SCULPT_EXPAND_TARGET_MASK,
|
||||
SCULPT_EXPAND_TARGET_FACE_SETS,
|
||||
SCULPT_EXPAND_TARGET_COLORS,
|
||||
} eSculptExpandTargetType;
|
||||
};
|
||||
|
||||
typedef enum eSculptExpandRecursionType {
|
||||
enum eSculptExpandRecursionType {
|
||||
SCULPT_EXPAND_RECURSION_TOPOLOGY,
|
||||
SCULPT_EXPAND_RECURSION_GEODESICS,
|
||||
} eSculptExpandRecursionType;
|
||||
};
|
||||
|
||||
#define EXPAND_SYMM_AREAS 8
|
||||
|
||||
typedef struct ExpandCache {
|
||||
struct ExpandCache {
|
||||
/* Target data elements that the expand operation will affect. */
|
||||
eSculptExpandTargetType target;
|
||||
|
||||
@@ -758,7 +759,7 @@ typedef struct ExpandCache {
|
||||
|
||||
/* Texture distortion data. */
|
||||
Brush *brush;
|
||||
struct Scene *scene;
|
||||
Scene *scene;
|
||||
// struct MTex *mtex;
|
||||
|
||||
/* Controls how much texture distortion will be applied to the current falloff */
|
||||
@@ -823,7 +824,7 @@ typedef struct ExpandCache {
|
||||
|
||||
bool check_islands;
|
||||
int normal_falloff_blur_steps;
|
||||
} ExpandCache;
|
||||
};
|
||||
/** \} */
|
||||
|
||||
/** \} */
|
||||
@@ -832,13 +833,13 @@ typedef struct ExpandCache {
|
||||
/** \name Sculpt Poll Functions
|
||||
* \{ */
|
||||
|
||||
bool SCULPT_mode_poll(struct bContext *C);
|
||||
bool SCULPT_mode_poll_view3d(struct bContext *C);
|
||||
bool SCULPT_mode_poll(bContext *C);
|
||||
bool SCULPT_mode_poll_view3d(bContext *C);
|
||||
/**
|
||||
* Checks for a brush, not just sculpt mode.
|
||||
*/
|
||||
bool SCULPT_poll(struct bContext *C);
|
||||
bool SCULPT_poll_view3d(struct bContext *C);
|
||||
bool SCULPT_poll(bContext *C);
|
||||
bool SCULPT_poll_view3d(bContext *C);
|
||||
|
||||
/**
|
||||
* Returns true if sculpt session can handle color attributes
|
||||
@@ -850,7 +851,7 @@ bool SCULPT_poll_view3d(struct bContext *C);
|
||||
* Calling code must handle this itself; in most cases a call to
|
||||
* BKE_sculpt_color_layer_create_if_needed() is sufficient.
|
||||
*/
|
||||
bool SCULPT_handles_colors_report(struct SculptSession *ss, struct ReportList *reports);
|
||||
bool SCULPT_handles_colors_report(SculptSession *ss, ReportList *reports);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -866,7 +867,7 @@ void SCULPT_pbvh_clear(Object *ob);
|
||||
/**
|
||||
* Flush displacement from deformed PBVH to original layer.
|
||||
*/
|
||||
void SCULPT_flush_stroke_deform(struct Sculpt *sd, Object *ob, bool is_proxy_used);
|
||||
void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used);
|
||||
|
||||
/**
|
||||
* Should be used after modifying the mask or Face Sets IDs.
|
||||
@@ -885,7 +886,7 @@ void SCULPT_tag_update_overlays(bContext *C);
|
||||
* (This allows us to ignore the GL depth buffer)
|
||||
* Returns 0 if the ray doesn't hit the mesh, non-zero otherwise.
|
||||
*/
|
||||
bool SCULPT_stroke_get_location(struct bContext *C,
|
||||
bool SCULPT_stroke_get_location(bContext *C,
|
||||
float out[3],
|
||||
const float mouse[2],
|
||||
bool force_original);
|
||||
@@ -897,10 +898,10 @@ bool SCULPT_cursor_geometry_info_update(bContext *C,
|
||||
SculptCursorGeometryInfo *out,
|
||||
const float mouse[2],
|
||||
bool use_sampled_normal);
|
||||
void SCULPT_geometry_preview_lines_update(bContext *C, struct SculptSession *ss, float radius);
|
||||
void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float radius);
|
||||
|
||||
void SCULPT_stroke_modifiers_check(const bContext *C, Object *ob, const Brush *brush);
|
||||
float SCULPT_raycast_init(struct ViewContext *vc,
|
||||
float SCULPT_raycast_init(ViewContext *vc,
|
||||
const float mval[2],
|
||||
float ray_start[3],
|
||||
float ray_end[3],
|
||||
@@ -914,7 +915,7 @@ ePaintSymmetryFlags SCULPT_mesh_symmetry_xyz_get(Object *object);
|
||||
* Returns true when the step belongs to the stroke that is directly performed by the brush and
|
||||
* not by one of the symmetry passes.
|
||||
*/
|
||||
bool SCULPT_stroke_is_main_symmetry_pass(struct StrokeCache *cache);
|
||||
bool SCULPT_stroke_is_main_symmetry_pass(StrokeCache *cache);
|
||||
/**
|
||||
* Return true only once per stroke on the first symmetry pass, regardless of the symmetry passes
|
||||
* enabled.
|
||||
@@ -922,11 +923,11 @@ bool SCULPT_stroke_is_main_symmetry_pass(struct StrokeCache *cache);
|
||||
* This should be used for functionality that needs to be computed once per stroke of a particular
|
||||
* tool (allocating memory, updating random seeds...).
|
||||
*/
|
||||
bool SCULPT_stroke_is_first_brush_step(struct StrokeCache *cache);
|
||||
bool SCULPT_stroke_is_first_brush_step(StrokeCache *cache);
|
||||
/**
|
||||
* Returns true on the first brush step of each symmetry pass.
|
||||
*/
|
||||
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(struct StrokeCache *cache);
|
||||
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(StrokeCache *cache);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -935,15 +936,15 @@ bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(struct StrokeCache *cach
|
||||
* \{ */
|
||||
|
||||
/** Ensure random access; required for PBVH_BMESH */
|
||||
void SCULPT_vertex_random_access_ensure(struct SculptSession *ss);
|
||||
void SCULPT_vertex_random_access_ensure(SculptSession *ss);
|
||||
|
||||
int SCULPT_vertex_count_get(struct SculptSession *ss);
|
||||
const float *SCULPT_vertex_co_get(struct SculptSession *ss, PBVHVertRef vertex);
|
||||
int SCULPT_vertex_count_get(SculptSession *ss);
|
||||
const float *SCULPT_vertex_co_get(SculptSession *ss, PBVHVertRef vertex);
|
||||
|
||||
/** Get the normal for a given sculpt vertex; do not modify the result */
|
||||
void SCULPT_vertex_normal_get(SculptSession *ss, PBVHVertRef vertex, float no[3]);
|
||||
|
||||
float SCULPT_vertex_mask_get(struct SculptSession *ss, PBVHVertRef vertex);
|
||||
float SCULPT_vertex_mask_get(SculptSession *ss, PBVHVertRef vertex);
|
||||
void SCULPT_vertex_color_get(const SculptSession *ss, PBVHVertRef vertex, float r_color[4]);
|
||||
void SCULPT_vertex_color_set(SculptSession *ss, PBVHVertRef vertex, const float color[4]);
|
||||
|
||||
@@ -953,7 +954,7 @@ bool SCULPT_vertex_is_occluded(SculptSession *ss, PBVHVertRef vertex, bool origi
|
||||
bool SCULPT_has_colors(const SculptSession *ss);
|
||||
|
||||
/** Returns true if the active color attribute is on loop (ATTR_DOMAIN_CORNER) domain. */
|
||||
bool SCULPT_has_loop_colors(const struct Object *ob);
|
||||
bool SCULPT_has_loop_colors(const Object *ob);
|
||||
|
||||
const float *SCULPT_vertex_persistent_co_get(SculptSession *ss, PBVHVertRef vertex);
|
||||
void SCULPT_vertex_persistent_normal_get(SculptSession *ss, PBVHVertRef vertex, float no[3]);
|
||||
@@ -977,7 +978,7 @@ float *SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss,
|
||||
int deform_target,
|
||||
PBVHVertexIter *iter);
|
||||
|
||||
void SCULPT_vertex_neighbors_get(struct SculptSession *ss,
|
||||
void SCULPT_vertex_neighbors_get(SculptSession *ss,
|
||||
PBVHVertRef vertex,
|
||||
bool include_duplicates,
|
||||
SculptVertexNeighborIter *iter);
|
||||
@@ -1020,10 +1021,10 @@ float (*SCULPT_mesh_deformed_positions_get(SculptSession *ss))[3];
|
||||
|
||||
#define FAKE_NEIGHBOR_NONE -1
|
||||
|
||||
void SCULPT_fake_neighbors_ensure(struct Sculpt *sd, Object *ob, float max_dist);
|
||||
void SCULPT_fake_neighbors_ensure(Sculpt *sd, Object *ob, float max_dist);
|
||||
void SCULPT_fake_neighbors_enable(Object *ob);
|
||||
void SCULPT_fake_neighbors_disable(Object *ob);
|
||||
void SCULPT_fake_neighbors_free(struct Object *ob);
|
||||
void SCULPT_fake_neighbors_free(Object *ob);
|
||||
|
||||
/* Vertex Info. */
|
||||
void SCULPT_boundary_info_ensure(Object *object);
|
||||
@@ -1044,7 +1045,7 @@ bool SCULPT_vertex_any_face_visible_get(SculptSession *ss, PBVHVertRef vertex);
|
||||
void SCULPT_face_visibility_all_invert(SculptSession *ss);
|
||||
void SCULPT_face_visibility_all_set(SculptSession *ss, bool visible);
|
||||
|
||||
void SCULPT_visibility_sync_all_from_faces(struct Object *ob);
|
||||
void SCULPT_visibility_sync_all_from_faces(Object *ob);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1088,9 +1089,7 @@ void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter
|
||||
* Initialize a #SculptOrigVertData for accessing original vertex data;
|
||||
* handles #BMesh, #Mesh, and multi-resolution.
|
||||
*/
|
||||
void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data,
|
||||
Object *ob,
|
||||
struct SculptUndoNode *unode);
|
||||
void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, SculptUndoNode *unode);
|
||||
/**
|
||||
* Initialize a #SculptOrigFaceData for accessing original face data;
|
||||
* handles #BMesh, #Mesh, and multi-resolution.
|
||||
@@ -1107,9 +1106,7 @@ void SCULPT_orig_face_data_update(SculptOrigFaceData *orig_data, PBVHFaceIter *i
|
||||
* Initialize a #SculptOrigVertData for accessing original vertex data;
|
||||
* handles #BMesh, #Mesh, and multi-resolution.
|
||||
*/
|
||||
void SCULPT_orig_face_data_unode_init(SculptOrigFaceData *data,
|
||||
Object *ob,
|
||||
struct SculptUndoNode *unode);
|
||||
void SCULPT_orig_face_data_unode_init(SculptOrigFaceData *data, Object *ob, SculptUndoNode *unode);
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -1148,12 +1145,8 @@ BLI_INLINE bool SCULPT_tool_needs_all_pbvh_nodes(const Brush *brush)
|
||||
return false;
|
||||
}
|
||||
|
||||
void SCULPT_calc_brush_plane(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode,
|
||||
float r_area_no[3],
|
||||
float r_area_co[3]);
|
||||
void SCULPT_calc_brush_plane(
|
||||
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3], float r_area_co[3]);
|
||||
|
||||
void SCULPT_calc_area_normal(
|
||||
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3]);
|
||||
@@ -1166,16 +1159,11 @@ void SCULPT_calc_area_normal_and_center(
|
||||
void SCULPT_calc_area_center(
|
||||
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_co[3]);
|
||||
|
||||
PBVHVertRef SCULPT_nearest_vertex_get(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
const float co[3],
|
||||
float max_distance,
|
||||
bool use_original);
|
||||
PBVHVertRef SCULPT_nearest_vertex_get(
|
||||
Sculpt *sd, Object *ob, const float co[3], float max_distance, bool use_original);
|
||||
|
||||
int SCULPT_plane_point_side(const float co[3], const float plane[4]);
|
||||
int SCULPT_plane_trim(const struct StrokeCache *cache,
|
||||
const struct Brush *brush,
|
||||
const float val[3]);
|
||||
int SCULPT_plane_trim(const StrokeCache *cache, const Brush *brush, const float val[3]);
|
||||
/**
|
||||
* Handles clipping against a mirror modifier and #SCULPT_LOCK_X/Y/Z axis flags.
|
||||
*/
|
||||
@@ -1205,7 +1193,7 @@ void SCULPT_flip_quat_by_symm_area(float quat[4],
|
||||
/**
|
||||
* Initialize a point-in-brush test
|
||||
*/
|
||||
void SCULPT_brush_test_init(struct SculptSession *ss, SculptBrushTest *test);
|
||||
void SCULPT_brush_test_init(SculptSession *ss, SculptBrushTest *test);
|
||||
|
||||
bool SCULPT_brush_test_sphere(SculptBrushTest *test, const float co[3]);
|
||||
bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3]);
|
||||
@@ -1242,8 +1230,8 @@ const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss,
|
||||
/**
|
||||
* Return a multiplier for brush strength on a particular vertex.
|
||||
*/
|
||||
float SCULPT_brush_strength_factor(struct SculptSession *ss,
|
||||
const struct Brush *br,
|
||||
float SCULPT_brush_strength_factor(SculptSession *ss,
|
||||
const Brush *br,
|
||||
const float point[3],
|
||||
float len,
|
||||
const float vno[3],
|
||||
@@ -1251,14 +1239,12 @@ float SCULPT_brush_strength_factor(struct SculptSession *ss,
|
||||
float mask,
|
||||
const PBVHVertRef vertex,
|
||||
int thread_id,
|
||||
struct AutomaskingNodeData *automask_data);
|
||||
AutomaskingNodeData *automask_data);
|
||||
|
||||
/**
|
||||
* Tilts a normal by the x and y tilt values using the view axis.
|
||||
*/
|
||||
void SCULPT_tilt_apply_to_normal(float r_normal[3],
|
||||
struct StrokeCache *cache,
|
||||
float tilt_strength);
|
||||
void SCULPT_tilt_apply_to_normal(float r_normal[3], StrokeCache *cache, float tilt_strength);
|
||||
|
||||
/**
|
||||
* Get effective surface normal with pen tilt and tilt strength applied to it.
|
||||
@@ -1271,21 +1257,18 @@ void SCULPT_tilt_effective_normal_get(const SculptSession *ss, const Brush *brus
|
||||
/** \name Flood Fill
|
||||
* \{ */
|
||||
|
||||
void SCULPT_floodfill_init(struct SculptSession *ss, SculptFloodFill *flood);
|
||||
void SCULPT_floodfill_add_active(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct SculptSession *ss,
|
||||
SculptFloodFill *flood,
|
||||
float radius);
|
||||
void SCULPT_floodfill_add_initial_with_symmetry(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct SculptSession *ss,
|
||||
void SCULPT_floodfill_init(SculptSession *ss, SculptFloodFill *flood);
|
||||
void SCULPT_floodfill_add_active(
|
||||
Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, float radius);
|
||||
void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd,
|
||||
Object *ob,
|
||||
SculptSession *ss,
|
||||
SculptFloodFill *flood,
|
||||
PBVHVertRef vertex,
|
||||
float radius);
|
||||
void SCULPT_floodfill_add_initial(SculptFloodFill *flood, PBVHVertRef vertex);
|
||||
void SCULPT_floodfill_add_and_skip_initial(SculptFloodFill *flood, PBVHVertRef vertex);
|
||||
void SCULPT_floodfill_execute(struct SculptSession *ss,
|
||||
void SCULPT_floodfill_execute(SculptSession *ss,
|
||||
SculptFloodFill *flood,
|
||||
bool (*func)(SculptSession *ss,
|
||||
PBVHVertRef from_v,
|
||||
@@ -1310,13 +1293,13 @@ enum eDynTopoWarnFlag {
|
||||
ENUM_OPERATORS(eDynTopoWarnFlag, DYNTOPO_WARN_MODIFIER);
|
||||
|
||||
/** Enable dynamic topology; mesh will be triangulated */
|
||||
void SCULPT_dynamic_topology_enable_ex(struct Main *bmain,
|
||||
struct Depsgraph *depsgraph,
|
||||
void SCULPT_dynamic_topology_enable_ex(Main *bmain,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob);
|
||||
void SCULPT_dynamic_topology_disable(bContext *C, struct SculptUndoNode *unode);
|
||||
void sculpt_dynamic_topology_disable_with_undo(struct Main *bmain,
|
||||
struct Depsgraph *depsgraph,
|
||||
void SCULPT_dynamic_topology_disable(bContext *C, SculptUndoNode *unode);
|
||||
void sculpt_dynamic_topology_disable_with_undo(Main *bmain,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob);
|
||||
|
||||
@@ -1330,7 +1313,7 @@ void sculpt_dynamic_topology_disable_with_undo(struct Main *bmain,
|
||||
*/
|
||||
bool SCULPT_stroke_is_dynamic_topology(const SculptSession *ss, const Brush *brush);
|
||||
|
||||
void SCULPT_dynamic_topology_triangulate(struct BMesh *bm);
|
||||
void SCULPT_dynamic_topology_triangulate(BMesh *bm);
|
||||
|
||||
enum eDynTopoWarnFlag SCULPT_dynamic_topology_check(Scene *scene, Object *ob);
|
||||
|
||||
@@ -1340,18 +1323,18 @@ enum eDynTopoWarnFlag SCULPT_dynamic_topology_check(Scene *scene, Object *ob);
|
||||
/** \name Auto-masking.
|
||||
* \{ */
|
||||
|
||||
typedef struct AutomaskingNodeData {
|
||||
struct AutomaskingNodeData {
|
||||
PBVHNode *node;
|
||||
SculptOrigVertData orig_data;
|
||||
bool have_orig_data;
|
||||
} AutomaskingNodeData;
|
||||
};
|
||||
|
||||
/** Call before PBVH vertex iteration.
|
||||
* \param automask_data: pointer to an uninitialized AutomaskingNodeData struct.
|
||||
*/
|
||||
void SCULPT_automasking_node_begin(struct Object *ob,
|
||||
void SCULPT_automasking_node_begin(Object *ob,
|
||||
const SculptSession *ss,
|
||||
struct AutomaskingCache *automasking,
|
||||
AutomaskingCache *automasking,
|
||||
AutomaskingNodeData *automask_data,
|
||||
PBVHNode *node);
|
||||
|
||||
@@ -1360,18 +1343,18 @@ void SCULPT_automasking_node_update(SculptSession *ss,
|
||||
AutomaskingNodeData *automask_data,
|
||||
PBVHVertexIter *vd);
|
||||
|
||||
float SCULPT_automasking_factor_get(struct AutomaskingCache *automasking,
|
||||
float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
|
||||
SculptSession *ss,
|
||||
PBVHVertRef vertex,
|
||||
AutomaskingNodeData *automask_data);
|
||||
|
||||
/* Returns the automasking cache depending on the active tool. Used for code that can run both for
|
||||
* brushes and filter. */
|
||||
struct AutomaskingCache *SCULPT_automasking_active_cache_get(SculptSession *ss);
|
||||
AutomaskingCache *SCULPT_automasking_active_cache_get(SculptSession *ss);
|
||||
|
||||
/* Brush can be null. */
|
||||
struct AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object *ob);
|
||||
void SCULPT_automasking_cache_free(struct AutomaskingCache *automasking);
|
||||
AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object *ob);
|
||||
void SCULPT_automasking_cache_free(AutomaskingCache *automasking);
|
||||
|
||||
bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd, const Brush *br, eAutomasking_flag mode);
|
||||
bool SCULPT_is_automasking_enabled(const Sculpt *sd, const SculptSession *ss, const Brush *br);
|
||||
@@ -1383,7 +1366,7 @@ float *SCULPT_boundary_automasking_init(Object *ob,
|
||||
bool SCULPT_automasking_needs_normal(const SculptSession *ss,
|
||||
const Sculpt *sculpt,
|
||||
const Brush *brush);
|
||||
bool SCULPT_automasking_needs_original(const struct Sculpt *sd, const struct Brush *brush);
|
||||
bool SCULPT_automasking_needs_original(const Sculpt *sd, const Brush *brush);
|
||||
int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking);
|
||||
|
||||
/** \} */
|
||||
@@ -1398,11 +1381,9 @@ int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking);
|
||||
* Geodesic distances will only work when used with PBVH_FACES, for other types of PBVH it will
|
||||
* fallback to euclidean distances to one of the initial vertices in the set.
|
||||
*/
|
||||
float *SCULPT_geodesic_distances_create(struct Object *ob,
|
||||
struct GSet *initial_verts,
|
||||
float limit_radius);
|
||||
float *SCULPT_geodesic_from_vertex_and_symm(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
float *SCULPT_geodesic_distances_create(Object *ob, GSet *initial_verts, float limit_radius);
|
||||
float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd,
|
||||
Object *ob,
|
||||
PBVHVertRef vertex,
|
||||
float limit_radius);
|
||||
float *SCULPT_geodesic_from_vertex(Object *ob, PBVHVertRef vertex, float limit_radius);
|
||||
@@ -1412,22 +1393,22 @@ float *SCULPT_geodesic_from_vertex(Object *ob, PBVHVertRef vertex, float limit_r
|
||||
/** \name Filter API
|
||||
* \{ */
|
||||
|
||||
void SCULPT_filter_cache_init(struct bContext *C,
|
||||
void SCULPT_filter_cache_init(bContext *C,
|
||||
Object *ob,
|
||||
Sculpt *sd,
|
||||
int undo_type,
|
||||
const int mval[2],
|
||||
float area_normal_radius);
|
||||
void SCULPT_filter_cache_free(SculptSession *ss);
|
||||
void SCULPT_mesh_filter_properties(struct wmOperatorType *ot);
|
||||
void SCULPT_mesh_filter_properties(wmOperatorType *ot);
|
||||
|
||||
void SCULPT_mask_filter_smooth_apply(
|
||||
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, int smooth_iterations);
|
||||
|
||||
/* Filter orientation utils. */
|
||||
void SCULPT_filter_to_orientation_space(float r_v[3], struct FilterCache *filter_cache);
|
||||
void SCULPT_filter_to_object_space(float r_v[3], struct FilterCache *filter_cache);
|
||||
void SCULPT_filter_zero_disabled_axis_components(float r_v[3], struct FilterCache *filter_cache);
|
||||
void SCULPT_filter_to_orientation_space(float r_v[3], FilterCache *filter_cache);
|
||||
void SCULPT_filter_to_object_space(float r_v[3], FilterCache *filter_cache);
|
||||
void SCULPT_filter_zero_disabled_axis_components(float r_v[3], FilterCache *filter_cache);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1436,42 +1417,35 @@ void SCULPT_filter_zero_disabled_axis_components(float r_v[3], struct FilterCach
|
||||
* \{ */
|
||||
|
||||
/* Main cloth brush function */
|
||||
void SCULPT_do_cloth_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_cloth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim);
|
||||
void SCULPT_cloth_simulation_free(SculptClothSimulation *cloth_sim);
|
||||
|
||||
/* Public functions. */
|
||||
|
||||
struct SculptClothSimulation *SCULPT_cloth_brush_simulation_create(struct Object *ob,
|
||||
float cloth_mass,
|
||||
float cloth_damping,
|
||||
float cloth_softbody_strength,
|
||||
bool use_collisions,
|
||||
bool needs_deform_coords);
|
||||
void SCULPT_cloth_brush_simulation_init(struct SculptSession *ss,
|
||||
struct SculptClothSimulation *cloth_sim);
|
||||
SculptClothSimulation *SCULPT_cloth_brush_simulation_create(Object *ob,
|
||||
float cloth_mass,
|
||||
float cloth_damping,
|
||||
float cloth_softbody_strength,
|
||||
bool use_collisions,
|
||||
bool needs_deform_coords);
|
||||
void SCULPT_cloth_brush_simulation_init(SculptSession *ss, SculptClothSimulation *cloth_sim);
|
||||
|
||||
void SCULPT_cloth_sim_activate_nodes(struct SculptClothSimulation *cloth_sim,
|
||||
void SCULPT_cloth_sim_activate_nodes(SculptClothSimulation *cloth_sim,
|
||||
PBVHNode **nodes,
|
||||
int totnode);
|
||||
|
||||
void SCULPT_cloth_brush_store_simulation_state(struct SculptSession *ss,
|
||||
struct SculptClothSimulation *cloth_sim);
|
||||
void SCULPT_cloth_brush_store_simulation_state(SculptSession *ss,
|
||||
SculptClothSimulation *cloth_sim);
|
||||
|
||||
void SCULPT_cloth_brush_do_simulation_step(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct SculptClothSimulation *cloth_sim,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_cloth_brush_do_simulation_step(
|
||||
Sculpt *sd, Object *ob, SculptClothSimulation *cloth_sim, PBVHNode **nodes, int totnode);
|
||||
|
||||
void SCULPT_cloth_brush_ensure_nodes_constraints(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
void SCULPT_cloth_brush_ensure_nodes_constraints(Sculpt *sd,
|
||||
Object *ob,
|
||||
PBVHNode **nodes,
|
||||
int totnode,
|
||||
struct SculptClothSimulation *cloth_sim,
|
||||
SculptClothSimulation *cloth_sim,
|
||||
float initial_location[3],
|
||||
float radius);
|
||||
|
||||
@@ -1479,7 +1453,7 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(struct Sculpt *sd,
|
||||
* Cursor drawing function.
|
||||
*/
|
||||
void SCULPT_cloth_simulation_limits_draw(uint gpuattr,
|
||||
const struct Brush *brush,
|
||||
const Brush *brush,
|
||||
const float location[3],
|
||||
const float normal[3],
|
||||
float rds,
|
||||
@@ -1487,7 +1461,7 @@ void SCULPT_cloth_simulation_limits_draw(uint gpuattr,
|
||||
const float outline_col[3],
|
||||
float alpha);
|
||||
void SCULPT_cloth_plane_falloff_preview_draw(uint gpuattr,
|
||||
struct SculptSession *ss,
|
||||
SculptSession *ss,
|
||||
const float outline_col[3],
|
||||
float outline_alpha);
|
||||
|
||||
@@ -1515,7 +1489,7 @@ BLI_INLINE bool SCULPT_is_cloth_deform_brush(const Brush *brush)
|
||||
* For bmesh: Average surrounding verts based on an orthogonality measure.
|
||||
* Naturally converges to a quad-like structure.
|
||||
*/
|
||||
void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], struct BMVert *v);
|
||||
void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v);
|
||||
|
||||
void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], PBVHVertRef vertex);
|
||||
float SCULPT_neighbor_mask_average(SculptSession *ss, PBVHVertRef vertex);
|
||||
@@ -1550,8 +1524,8 @@ void SCULPT_surface_smooth_displace_step(SculptSession *ss,
|
||||
void SCULPT_do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
/* Slide/Relax */
|
||||
void SCULPT_relax_vertex(struct SculptSession *ss,
|
||||
struct PBVHVertexIter *vd,
|
||||
void SCULPT_relax_vertex(SculptSession *ss,
|
||||
PBVHVertexIter *vd,
|
||||
float factor,
|
||||
bool filter_boundary_face_sets,
|
||||
float *r_final_pos);
|
||||
@@ -1561,7 +1535,7 @@ void SCULPT_relax_vertex(struct SculptSession *ss,
|
||||
/**
|
||||
* Expose 'calc_area_normal' externally (just for vertex paint).
|
||||
*/
|
||||
bool SCULPT_pbvh_calc_area_normal(const struct Brush *brush,
|
||||
bool SCULPT_pbvh_calc_area_normal(const Brush *brush,
|
||||
Object *ob,
|
||||
PBVHNode **nodes,
|
||||
int totnode,
|
||||
@@ -1591,15 +1565,15 @@ SculptUndoNode *SCULPT_undo_get_first_node(void);
|
||||
* redo panels to work; operators that do not support that may use
|
||||
* #SCULPT_undo_push_begin_ex instead if so desired.
|
||||
*/
|
||||
void SCULPT_undo_push_begin(struct Object *ob, const struct wmOperator *op);
|
||||
void SCULPT_undo_push_begin(Object *ob, const wmOperator *op);
|
||||
|
||||
/**
|
||||
* NOTE: #SCULPT_undo_push_begin is preferred since `name`
|
||||
* must match operator name for redo panels to work.
|
||||
*/
|
||||
void SCULPT_undo_push_begin_ex(struct Object *ob, const char *name);
|
||||
void SCULPT_undo_push_end(struct Object *ob);
|
||||
void SCULPT_undo_push_end_ex(struct Object *ob, const bool use_nested_undo);
|
||||
void SCULPT_undo_push_begin_ex(Object *ob, const char *name);
|
||||
void SCULPT_undo_push_end(Object *ob);
|
||||
void SCULPT_undo_push_end_ex(Object *ob, const bool use_nested_undo);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1608,15 +1582,12 @@ void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
|
||||
/**
|
||||
* Copy the PBVH bounding box into the object's bounding box.
|
||||
*/
|
||||
void SCULPT_update_object_bounding_box(struct Object *ob);
|
||||
void SCULPT_update_object_bounding_box(Object *ob);
|
||||
|
||||
/**
|
||||
* Get a screen-space rectangle of the modified area.
|
||||
*/
|
||||
bool SCULPT_get_redraw_rect(struct ARegion *region,
|
||||
struct RegionView3D *rv3d,
|
||||
Object *ob,
|
||||
rcti *rect);
|
||||
bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect);
|
||||
|
||||
/* Operators. */
|
||||
|
||||
@@ -1624,32 +1595,32 @@ bool SCULPT_get_redraw_rect(struct ARegion *region,
|
||||
/** \name Expand Operator
|
||||
* \{ */
|
||||
|
||||
void SCULPT_OT_expand(struct wmOperatorType *ot);
|
||||
void sculpt_expand_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
void SCULPT_OT_expand(wmOperatorType *ot);
|
||||
void sculpt_expand_modal_keymap(wmKeyConfig *keyconf);
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Gesture Operators
|
||||
* \{ */
|
||||
|
||||
void SCULPT_OT_face_set_lasso_gesture(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_set_box_gesture(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_set_lasso_gesture(wmOperatorType *ot);
|
||||
void SCULPT_OT_face_set_box_gesture(wmOperatorType *ot);
|
||||
|
||||
void SCULPT_OT_trim_lasso_gesture(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_trim_box_gesture(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_trim_lasso_gesture(wmOperatorType *ot);
|
||||
void SCULPT_OT_trim_box_gesture(wmOperatorType *ot);
|
||||
|
||||
void SCULPT_OT_project_line_gesture(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_project_line_gesture(wmOperatorType *ot);
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Face Set Operators
|
||||
* \{ */
|
||||
|
||||
void SCULPT_OT_face_sets_randomize_colors(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_change_visibility(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_init(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_create(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_edit(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_randomize_colors(wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_change_visibility(wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_init(wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_create(wmOperatorType *ot);
|
||||
void SCULPT_OT_face_sets_edit(wmOperatorType *ot);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1657,7 +1628,7 @@ void SCULPT_OT_face_sets_edit(struct wmOperatorType *ot);
|
||||
/** \name Transform Operators
|
||||
* \{ */
|
||||
|
||||
void SCULPT_OT_set_pivot_position(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_set_pivot_position(wmOperatorType *ot);
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -1666,15 +1637,15 @@ void SCULPT_OT_set_pivot_position(struct wmOperatorType *ot);
|
||||
|
||||
/* Mesh Filter. */
|
||||
|
||||
void SCULPT_OT_mesh_filter(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_mesh_filter(wmOperatorType *ot);
|
||||
|
||||
/* Cloth Filter. */
|
||||
|
||||
void SCULPT_OT_cloth_filter(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_cloth_filter(wmOperatorType *ot);
|
||||
|
||||
/* Color Filter. */
|
||||
|
||||
void SCULPT_OT_color_filter(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_color_filter(wmOperatorType *ot);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1684,15 +1655,15 @@ void SCULPT_OT_color_filter(struct wmOperatorType *ot);
|
||||
|
||||
/* Mask filter and Dirty Mask. */
|
||||
|
||||
void SCULPT_OT_mask_filter(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_mask_filter(wmOperatorType *ot);
|
||||
|
||||
/* Mask and Face Sets Expand. */
|
||||
|
||||
void SCULPT_OT_mask_expand(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_mask_expand(wmOperatorType *ot);
|
||||
|
||||
/* Mask Init. */
|
||||
|
||||
void SCULPT_OT_mask_init(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_mask_init(wmOperatorType *ot);
|
||||
/** \} */
|
||||
|
||||
/* Detail size. */
|
||||
@@ -1701,15 +1672,15 @@ void SCULPT_OT_mask_init(struct wmOperatorType *ot);
|
||||
/** \name Dyntopo/Retopology Operators
|
||||
* \{ */
|
||||
|
||||
void SCULPT_OT_detail_flood_fill(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_sample_detail_size(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_set_detail_size(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_dyntopo_detail_size_edit(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_detail_flood_fill(wmOperatorType *ot);
|
||||
void SCULPT_OT_sample_detail_size(wmOperatorType *ot);
|
||||
void SCULPT_OT_set_detail_size(wmOperatorType *ot);
|
||||
void SCULPT_OT_dyntopo_detail_size_edit(wmOperatorType *ot);
|
||||
/** \} */
|
||||
|
||||
/* Dyntopo. */
|
||||
|
||||
void SCULPT_OT_dynamic_topology_toggle(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_dynamic_topology_toggle(wmOperatorType *ot);
|
||||
|
||||
/* sculpt_brush_types.cc */
|
||||
|
||||
@@ -1722,10 +1693,7 @@ void SCULPT_OT_dynamic_topology_toggle(struct wmOperatorType *ot);
|
||||
/**
|
||||
* Main Brush Function.
|
||||
*/
|
||||
void SCULPT_do_pose_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_pose_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
/**
|
||||
* Calculate the pose origin and (Optionally the pose factor)
|
||||
* that is used when using the pose brush.
|
||||
@@ -1733,25 +1701,22 @@ void SCULPT_do_pose_brush(struct Sculpt *sd,
|
||||
* \param r_pose_origin: Must be a valid pointer.
|
||||
* \param r_pose_factor: Optional, when set to NULL it won't be calculated.
|
||||
*/
|
||||
void SCULPT_pose_calc_pose_data(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct SculptSession *ss,
|
||||
void SCULPT_pose_calc_pose_data(Sculpt *sd,
|
||||
Object *ob,
|
||||
SculptSession *ss,
|
||||
float initial_location[3],
|
||||
float radius,
|
||||
float pose_offset,
|
||||
float *r_pose_origin,
|
||||
float *r_pose_factor);
|
||||
void SCULPT_pose_brush_init(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct SculptSession *ss,
|
||||
struct Brush *br);
|
||||
struct SculptPoseIKChain *SCULPT_pose_ik_chain_init(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct SculptSession *ss,
|
||||
struct Brush *br,
|
||||
const float initial_location[3],
|
||||
float radius);
|
||||
void SCULPT_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain);
|
||||
void SCULPT_pose_brush_init(Sculpt *sd, Object *ob, SculptSession *ss, Brush *br);
|
||||
SculptPoseIKChain *SCULPT_pose_ik_chain_init(Sculpt *sd,
|
||||
Object *ob,
|
||||
SculptSession *ss,
|
||||
Brush *br,
|
||||
const float initial_location[3],
|
||||
float radius);
|
||||
void SCULPT_pose_ik_chain_free(SculptPoseIKChain *ik_chain);
|
||||
|
||||
/* Boundary Brush. */
|
||||
|
||||
@@ -1759,22 +1724,19 @@ void SCULPT_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain);
|
||||
* Main function to get #SculptBoundary data both for brush deformation and viewport preview.
|
||||
* Can return NULL if there is no boundary from the given vertex using the given radius.
|
||||
*/
|
||||
struct SculptBoundary *SCULPT_boundary_data_init(Object *object,
|
||||
Brush *brush,
|
||||
PBVHVertRef initial_vertex,
|
||||
float radius);
|
||||
void SCULPT_boundary_data_free(struct SculptBoundary *boundary);
|
||||
SculptBoundary *SCULPT_boundary_data_init(Object *object,
|
||||
Brush *brush,
|
||||
PBVHVertRef initial_vertex,
|
||||
float radius);
|
||||
void SCULPT_boundary_data_free(SculptBoundary *boundary);
|
||||
/* Main Brush Function. */
|
||||
void SCULPT_do_boundary_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_boundary_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
void SCULPT_boundary_edges_preview_draw(uint gpuattr,
|
||||
struct SculptSession *ss,
|
||||
SculptSession *ss,
|
||||
const float outline_col[3],
|
||||
float outline_alpha);
|
||||
void SCULPT_boundary_pivot_line_preview_draw(uint gpuattr, struct SculptSession *ss);
|
||||
void SCULPT_boundary_pivot_line_preview_draw(uint gpuattr, SculptSession *ss);
|
||||
|
||||
/* Multi-plane Scrape Brush. */
|
||||
/* Main Brush Function. */
|
||||
@@ -1788,7 +1750,7 @@ void SCULPT_multiplane_scrape_preview_draw(uint gpuattr,
|
||||
void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
/* Paint Brush. */
|
||||
void SCULPT_do_paint_brush(struct PaintModeSettings *paint_mode_settings,
|
||||
void SCULPT_do_paint_brush(PaintModeSettings *paint_mode_settings,
|
||||
Sculpt *sd,
|
||||
Object *ob,
|
||||
PBVHNode **nodes,
|
||||
@@ -1803,126 +1765,57 @@ void SCULPT_do_paint_brush(struct PaintModeSettings *paint_mode_settings,
|
||||
* image and image user. Returns false when the image isn't found. In the later case the r_image
|
||||
* and r_image_user are set to NULL.
|
||||
*/
|
||||
bool SCULPT_paint_image_canvas_get(struct PaintModeSettings *paint_mode_settings,
|
||||
struct Object *ob,
|
||||
struct Image **r_image,
|
||||
struct ImageUser **r_image_user) ATTR_NONNULL();
|
||||
void SCULPT_do_paint_brush_image(struct PaintModeSettings *paint_mode_settings,
|
||||
bool SCULPT_paint_image_canvas_get(PaintModeSettings *paint_mode_settings,
|
||||
Object *ob,
|
||||
Image **r_image,
|
||||
ImageUser **r_image_user) ATTR_NONNULL();
|
||||
void SCULPT_do_paint_brush_image(PaintModeSettings *paint_mode_settings,
|
||||
Sculpt *sd,
|
||||
Object *ob,
|
||||
PBVHNode **texnodes,
|
||||
int texnode_num) ATTR_NONNULL();
|
||||
bool SCULPT_use_image_paint_brush(struct PaintModeSettings *settings, Object *ob) ATTR_NONNULL();
|
||||
bool SCULPT_use_image_paint_brush(PaintModeSettings *settings, Object *ob) ATTR_NONNULL();
|
||||
|
||||
/* Smear Brush. */
|
||||
void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
float SCULPT_clay_thumb_get_stabilized_pressure(struct StrokeCache *cache);
|
||||
float SCULPT_clay_thumb_get_stabilized_pressure(StrokeCache *cache);
|
||||
|
||||
void SCULPT_do_draw_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
void SCULPT_do_fill_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_scrape_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_clay_thumb_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_flatten_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_clay_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_clay_strips_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_snake_hook_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_thumb_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_rotate_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_layer_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_inflate_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_nudge_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_crease_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_pinch_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_grab_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_elastic_deform_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_draw_sharp_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_slide_relax_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_clay_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_elastic_deform_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_draw_sharp_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_slide_relax_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
|
||||
void SCULPT_do_displacement_smear_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_displacement_eraser_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_mask_brush_draw(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_mask_brush(struct Sculpt *sd,
|
||||
struct Object *ob,
|
||||
struct PBVHNode **nodes,
|
||||
int totnode);
|
||||
void SCULPT_do_displacement_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_displacement_eraser_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_mask_brush_draw(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
void SCULPT_do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
||||
/** \} */
|
||||
|
||||
void SCULPT_bmesh_topology_rake(
|
||||
struct Sculpt *sd, struct Object *ob, struct PBVHNode **nodes, int totnode, float bstrength);
|
||||
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength);
|
||||
|
||||
/* end sculpt_brush_types.cc */
|
||||
|
||||
/* sculpt_ops.cc */
|
||||
|
||||
void SCULPT_OT_brush_stroke(struct wmOperatorType *ot);
|
||||
void SCULPT_OT_brush_stroke(wmOperatorType *ot);
|
||||
|
||||
/* end sculpt_ops.cc */
|
||||
|
||||
@@ -1941,11 +1834,11 @@ BLI_INLINE bool SCULPT_tool_is_face_sets(int tool)
|
||||
return ELEM(tool, SCULPT_TOOL_DRAW_FACE_SETS);
|
||||
}
|
||||
|
||||
void SCULPT_stroke_id_ensure(struct Object *ob);
|
||||
void SCULPT_stroke_id_next(struct Object *ob);
|
||||
void SCULPT_stroke_id_ensure(Object *ob);
|
||||
void SCULPT_stroke_id_next(Object *ob);
|
||||
bool SCULPT_tool_can_reuse_automask(int sculpt_tool);
|
||||
|
||||
void SCULPT_ensure_valid_pivot(const struct Object *ob, struct Scene *scene);
|
||||
void SCULPT_ensure_valid_pivot(const Object *ob, Scene *scene);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Topology island API
|
||||
@@ -1956,7 +1849,7 @@ void SCULPT_ensure_valid_pivot(const struct Object *ob, struct Scene *scene);
|
||||
*/
|
||||
|
||||
/* Ensures vertex island keys exist and are valid. */
|
||||
void SCULPT_topology_islands_ensure(struct Object *ob);
|
||||
void SCULPT_topology_islands_ensure(Object *ob);
|
||||
|
||||
/* Mark vertex island keys as invalid. Call when adding or hiding
|
||||
* geometry.
|
||||
@@ -1968,10 +1861,6 @@ int SCULPT_vertex_island_get(SculptSession *ss, PBVHVertRef vertex);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make SCULPT_ alias to a few blenkernel sculpt methods. */
|
||||
|
||||
#define SCULPT_vertex_attr_get BKE_sculpt_vertex_attr_get
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pbvh.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "GPU_immediate.h"
|
||||
#include "GPU_matrix.h"
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#include "ED_sculpt.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
namespace blender::ed::sculpt_paint::paint::image {
|
||||
|
||||
@@ -514,8 +514,6 @@ static void do_mark_dirty_regions(void *__restrict userdata,
|
||||
|
||||
} // namespace blender::ed::sculpt_paint::paint::image
|
||||
|
||||
extern "C" {
|
||||
|
||||
using namespace blender::ed::sculpt_paint::paint::image;
|
||||
|
||||
bool SCULPT_paint_image_canvas_get(PaintModeSettings *paint_mode_settings,
|
||||
@@ -576,4 +574,3 @@ void SCULPT_do_paint_brush_image(PaintModeSettings *paint_mode_settings,
|
||||
BKE_pbvh_parallel_range_settings(&settings_flush, false, texnodes_num);
|
||||
BLI_task_parallel_range(0, texnodes_num, &data, do_mark_dirty_regions, &settings_flush);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "BKE_pbvh.h"
|
||||
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pbvh.h"
|
||||
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "ED_sculpt.h"
|
||||
#include "ED_view3d.h"
|
||||
#include "paint_intern.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
#include "ED_undo.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
#include "sculpt_intern.h"
|
||||
#include "sculpt_intern.hh"
|
||||
|
||||
/* Uncomment to print the undo stack in the console on push/undo/redo. */
|
||||
//#define SCULPT_UNDO_DEBUG
|
||||
|
||||
@@ -28,7 +28,7 @@ set(INC_SYS
|
||||
set(SRC
|
||||
ed_draw.c
|
||||
ed_transverts.c
|
||||
ed_util.c
|
||||
ed_util.cc
|
||||
ed_util_imbuf.c
|
||||
ed_util_ops.cc
|
||||
ed_viewer_path.cc
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* \ingroup edutil
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
void ED_editors_init_for_undo(Main *bmain)
|
||||
{
|
||||
wmWindowManager *wm = bmain->wm.first;
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first);
|
||||
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
|
||||
@@ -67,14 +67,14 @@ void ED_editors_init_for_undo(Main *bmain)
|
||||
Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
if (ob && (ob->mode & OB_MODE_TEXTURE_PAINT)) {
|
||||
BKE_texpaint_slots_refresh_object(scene, ob);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, nullptr, nullptr, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ED_editors_init(bContext *C)
|
||||
{
|
||||
struct Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
|
||||
Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
@@ -92,12 +92,12 @@ void ED_editors_init(bContext *C)
|
||||
* e.g. linked objects we have to ensure that they are actually the
|
||||
* active object in this scene. */
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
int mode = ob->mode;
|
||||
if (mode == OB_MODE_OBJECT) {
|
||||
continue;
|
||||
}
|
||||
if (BKE_object_has_mode_data(ob, mode)) {
|
||||
if (BKE_object_has_mode_data(ob, eObjectMode(mode))) {
|
||||
/* For multi-edit mode we may already have mode data. */
|
||||
continue;
|
||||
}
|
||||
@@ -113,25 +113,25 @@ void ED_editors_init(bContext *C)
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
|
||||
}
|
||||
else if (mode & OB_MODE_ALL_PAINT_GPENCIL) {
|
||||
ED_gpencil_toggle_brush_cursor(C, true, NULL);
|
||||
ED_gpencil_toggle_brush_cursor(C, true, nullptr);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Reset object to Object mode, so that code below can properly re-switch it to its
|
||||
* previous mode if possible, re-creating its mode data, etc. */
|
||||
ID *ob_data = ob->data;
|
||||
ID *ob_data = static_cast<ID *>(ob->data);
|
||||
ob->mode = OB_MODE_OBJECT;
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
|
||||
|
||||
/* Object mode is enforced if there is no active object, or if the active object's type is
|
||||
* different. */
|
||||
if (obact == NULL || ob->type != obact->type) {
|
||||
if (obact == nullptr || ob->type != obact->type) {
|
||||
continue;
|
||||
}
|
||||
/* Object mode is enforced for non-editable data (or their obdata). */
|
||||
if (!BKE_id_is_editable(bmain, &ob->id) ||
|
||||
(ob_data != NULL && !BKE_id_is_editable(bmain, ob_data))) {
|
||||
(ob_data != nullptr && !BKE_id_is_editable(bmain, ob_data))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void ED_editors_init(bContext *C)
|
||||
else {
|
||||
/* TODO(@ideasman42): avoid operator calls. */
|
||||
if (obact == ob) {
|
||||
ED_object_mode_set(C, mode);
|
||||
ED_object_mode_set(C, eObjectMode(mode));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,12 +216,12 @@ void ED_editors_exit(Main *bmain, bool do_undo_system)
|
||||
|
||||
/* Frees all edit-mode undo-steps. */
|
||||
if (do_undo_system && G_MAIN->wm.first) {
|
||||
wmWindowManager *wm = G_MAIN->wm.first;
|
||||
/* normally we don't check for NULL undo stack,
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(G_MAIN->wm.first);
|
||||
/* normally we don't check for null undo stack,
|
||||
* do here since it may run in different context. */
|
||||
if (wm->undo_stack) {
|
||||
BKE_undosys_stack_destroy(wm->undo_stack);
|
||||
wm->undo_stack = NULL;
|
||||
wm->undo_stack = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ void ED_editors_exit(Main *bmain, bool do_undo_system)
|
||||
* don't handle modes either (doing so isn't always practical).
|
||||
*
|
||||
* To reproduce the problem where stale data is used, see: T84920. */
|
||||
for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ED_object_editmode_free_ex(bmain, ob)) {
|
||||
if (do_undo_system == false) {
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
|
||||
@@ -245,8 +245,8 @@ void ED_editors_exit(Main *bmain, bool do_undo_system)
|
||||
}
|
||||
|
||||
/* global in meshtools... */
|
||||
ED_mesh_mirror_spatial_table_end(NULL);
|
||||
ED_mesh_mirror_topo_table_end(NULL);
|
||||
ED_mesh_mirror_spatial_table_end(nullptr);
|
||||
ED_mesh_mirror_topo_table_end(nullptr);
|
||||
}
|
||||
|
||||
bool ED_editors_flush_edits_for_object_ex(Main *bmain,
|
||||
@@ -259,7 +259,7 @@ bool ED_editors_flush_edits_for_object_ex(Main *bmain,
|
||||
/* Don't allow flushing while in the middle of a stroke (frees data in use).
|
||||
* Auto-save prevents this from happening but scripts
|
||||
* may cause a flush on saving: T53986. */
|
||||
if (ob->sculpt != NULL && ob->sculpt->cache == NULL) {
|
||||
if (ob->sculpt != nullptr && ob->sculpt->cache == nullptr) {
|
||||
char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
|
||||
if (check_needs_flush && (*needs_flush_ptr == 0)) {
|
||||
return false;
|
||||
@@ -283,8 +283,8 @@ bool ED_editors_flush_edits_for_object_ex(Main *bmain,
|
||||
}
|
||||
else if (ob->mode & OB_MODE_EDIT) {
|
||||
|
||||
char *needs_flush_ptr = BKE_object_data_editmode_flush_ptr_get(ob->data);
|
||||
if (needs_flush_ptr != NULL) {
|
||||
char *needs_flush_ptr = BKE_object_data_editmode_flush_ptr_get(static_cast<ID *>(ob->data));
|
||||
if (needs_flush_ptr != nullptr) {
|
||||
if (check_needs_flush && (*needs_flush_ptr == 0)) {
|
||||
return false;
|
||||
}
|
||||
@@ -306,12 +306,11 @@ bool ED_editors_flush_edits_for_object(Main *bmain, Object *ob)
|
||||
bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush)
|
||||
{
|
||||
bool has_edited = false;
|
||||
Object *ob;
|
||||
|
||||
/* loop through all data to find edit mode or object mode, because during
|
||||
* exiting we might not have a context for edit object and multiple sculpt
|
||||
* objects can exist at the same time */
|
||||
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
has_edited |= ED_editors_flush_edits_for_object_ex(bmain, ob, for_render, check_needs_flush);
|
||||
}
|
||||
|
||||
@@ -357,7 +356,7 @@ void unpack_menu(bContext *C,
|
||||
const char *id_name,
|
||||
const char *abs_name,
|
||||
const char *folder,
|
||||
struct PackedFile *pf)
|
||||
PackedFile *pf)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PointerRNA props_ptr;
|
||||
@@ -371,7 +370,7 @@ void unpack_menu(bContext *C,
|
||||
layout = UI_popup_menu_layout(pup);
|
||||
|
||||
uiItemFullO_ptr(
|
||||
layout, ot, IFACE_("Remove Pack"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
layout, ot, IFACE_("Remove Pack"), ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
@@ -384,7 +383,7 @@ void unpack_menu(bContext *C,
|
||||
switch (BKE_packedfile_compare_to_file(blendfile_path, local_name, pf)) {
|
||||
case PF_CMP_NOFILE:
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Create %s"), local_name);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
@@ -392,7 +391,7 @@ void unpack_menu(bContext *C,
|
||||
case PF_CMP_EQUAL:
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Use %s (identical)"), local_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
@@ -400,13 +399,13 @@ void unpack_menu(bContext *C,
|
||||
case PF_CMP_DIFFERS:
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Use %s (differs)"), local_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Overwrite %s"), local_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
break;
|
||||
@@ -418,27 +417,27 @@ void unpack_menu(bContext *C,
|
||||
case PF_CMP_NOFILE:
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Create %s"), abs_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
break;
|
||||
case PF_CMP_EQUAL:
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Use %s (identical)"), abs_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
break;
|
||||
case PF_CMP_DIFFERS:
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Use %s (differs)"), abs_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
|
||||
BLI_snprintf(line, sizeof(line), TIP_("Overwrite %s"), abs_name);
|
||||
// uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, nullptr, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
|
||||
RNA_string_set(&props_ptr, "id", id_name);
|
||||
break;
|
||||
@@ -447,9 +446,7 @@ void unpack_menu(bContext *C,
|
||||
UI_popup_menu_end(C, pup);
|
||||
}
|
||||
|
||||
void ED_spacedata_id_remap(struct ScrArea *area,
|
||||
struct SpaceLink *sl,
|
||||
const struct IDRemapper *mappings)
|
||||
void ED_spacedata_id_remap(ScrArea *area, SpaceLink *sl, const IDRemapper *mappings)
|
||||
{
|
||||
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
|
||||
if (st && st->id_remap) {
|
||||
@@ -457,15 +454,12 @@ void ED_spacedata_id_remap(struct ScrArea *area,
|
||||
}
|
||||
}
|
||||
|
||||
void ED_spacedata_id_remap_single(struct ScrArea *area,
|
||||
struct SpaceLink *sl,
|
||||
ID *old_id,
|
||||
ID *new_id)
|
||||
void ED_spacedata_id_remap_single(ScrArea *area, SpaceLink *sl, ID *old_id, ID *new_id)
|
||||
{
|
||||
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
|
||||
|
||||
if (st && st->id_remap) {
|
||||
struct IDRemapper *mappings = BKE_id_remapper_create();
|
||||
IDRemapper *mappings = BKE_id_remapper_create();
|
||||
BKE_id_remapper_add(mappings, old_id, new_id);
|
||||
st->id_remap(area, sl, mappings);
|
||||
BKE_id_remapper_free(mappings);
|
||||
Reference in New Issue
Block a user