[Bf-blender-cvs] [4a9495ef7d7] sculpt-dev: Sculpt-dev: fix pbvh_bmesh_normals_update
Joseph Eagar
noreply at git.blender.org
Tue Dec 14 19:19:46 CET 2021
Commit: 4a9495ef7d7623eb4ad3cbe42164df747bee0e97
Author: Joseph Eagar
Date: Tue Dec 14 10:19:21 2021 -0800
Branches: sculpt-dev
https://developer.blender.org/rB4a9495ef7d7623eb4ad3cbe42164df747bee0e97
Sculpt-dev: fix pbvh_bmesh_normals_update
===================================================================
M source/blender/blenkernel/BKE_brush_engine.h
M source/blender/blenkernel/intern/brush_engine.c
M source/blender/blenkernel/intern/brush_engine_presets.c
M source/blender/blenkernel/intern/paint.c
M source/blender/blenkernel/intern/pbvh_bmesh.c
M source/blender/editors/sculpt_paint/sculpt_dyntopo.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index 55f7d983666..81ef138300d 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -62,8 +62,7 @@ struct UnifiedPaintSettings;
#define MAKE_BUILTIN_CH_NAME(idname) BRUSH_BUILTIN_##idname
-/* these macros check channel names at compile time */
-
+/* these macros validate channel names at compile time */
#define BRUSHSET_LOOKUP_FINAL(childset, parentset, idname) \
BKE_brush_channelset_lookup_final(childset, parentset, MAKE_BUILTIN_CH_NAME(idname))
#define BRUSHSET_LOOKUP(chset, channel) \
@@ -76,8 +75,7 @@ struct UnifiedPaintSettings;
BKE_brush_channelset_get_final_float(childset, parentset, MAKE_BUILTIN_CH_NAME(channel), mapdata)
#define BRUSHSET_GET_INT(chset, channel, mapdata) \
BKE_brush_channelset_get_int(chset, MAKE_BUILTIN_CH_NAME(channel), mapdata)
-#define BRUSHSET_GET_BOOL(chset, channel, mapdata) \
- (!!BRUSHSET_GET_INT(chset, channel, mapdata))
+#define BRUSHSET_GET_BOOL(chset, channel, mapdata) (!!BRUSHSET_GET_INT(chset, channel, mapdata))
#define BRUSHSET_GET_FINAL_INT(child, parent, channel, mapdata) \
BKE_brush_channelset_get_final_int(child, parent, MAKE_BUILTIN_CH_NAME(channel), mapdata)
#define BRUSHSET_GET_FINAL_BOOL(child, parent, channel, mapdata) \
@@ -107,7 +105,7 @@ typedef void (*BrushChannelIDCallback)(void *userdata,
struct ID *id,
BrushChannelSet *chset,
BrushChannel *ch);
-
+/* TODO: clean up this struct */
typedef struct BrushMappingDef {
int curve;
bool enabled;
@@ -125,12 +123,15 @@ typedef struct BrushMappingPreset {
struct BrushMappingDef pressure, xtilt, ytilt, angle, speed, random, stroke_t;
} BrushMappingPreset;
+/* input mapping data */
typedef struct BrushMappingData {
float pressure, xtilt, ytilt, angle, speed, random, stroke_t;
} BrushMappingData;
#define MAX_BRUSH_ENUM_DEF 32
+/* copy of PropertyEnumItem only with static char arrays instead of pointers
+ for strings */
typedef struct BrushEnumDef {
int value;
const char identifier[64];
@@ -139,6 +140,10 @@ typedef struct BrushEnumDef {
const char description[512];
} BrushEnumDef;
+/*
+ Defines a brush channel. Includes limits, UI data,
+ default values, etc.
+*/
typedef struct BrushChannelType {
char name[128], idname[64], tooltip[512], category[128];
float min, max, soft_min, soft_max;
@@ -146,18 +151,19 @@ typedef struct BrushChannelType {
int type, flag;
int subtype;
- int ivalue;
+ int ivalue; /* for int, bool, enum and bitmask types */
int icon;
float fvalue;
- float vector[4];
+ float vector[4]; /* for vector3 & vector4 types */
+
int curve_preset;
bool curve_preset_slope_neg;
- BrushEnumDef enumdef[MAX_BRUSH_ENUM_DEF]; // for enum/bitmask types
+ BrushEnumDef enumdef[MAX_BRUSH_ENUM_DEF]; /* for enum/bitmask types */
EnumPropertyItem *rna_enumdef;
- bool user_defined;
- struct StructRNA *rna_ext;
+ bool user_defined; /* this is a user-defined channel; currently unused */
+ struct StructRNA *rna_ext; /* private rna pointer */
} BrushChannelType;
/* since MTex is going away lets'
@@ -166,7 +172,10 @@ typedef struct BrushChannelType {
point of view it's just a bunch of
BrushChannels.
- This will eventually end up in DNA.*/
+ This will eventually end up in DNA.
+
+ Note, this hasn't been fully implemented yet.
+ */
typedef struct BrushTex {
struct BrushTex *next, *prev;
@@ -186,14 +195,17 @@ void BKE_brush_tex_start(BrushTex *btex, BrushChannelSet *chset, BrushMappingDat
#define MAKE_BRUSHTEX_SLOTS 5
+/*
+
+*/
typedef struct BrushCommand {
- int tool;
- float last_spacing_t[512]; // this is an array for different symmetry passes
+ int tool; /* SCULPT_TOOL_XXX value */
+ float last_spacing_t[512]; /* has values for all possible symmetry passes */
struct BrushChannelSet *params;
- struct BrushChannelSet *params_final; // with inheritence applied
- struct BrushChannelSet *params_mapped; // with pressure etc applied
+ struct BrushChannelSet *params_final; /* with inheritence applied */
+ struct BrushChannelSet *params_mapped; /* with pressure etc applied */
- BrushTex *texture_slots[MAKE_BRUSHTEX_SLOTS];
+ BrushTex *texture_slots[MAKE_BRUSHTEX_SLOTS]; /* currently unused */
} BrushCommand;
typedef struct BrushCommandList {
@@ -203,14 +215,39 @@ typedef struct BrushCommandList {
void BKE_brush_channel_free_data(BrushChannel *ch);
void BKE_brush_channel_free(BrushChannel *ch);
+
+/* creates all the channels needed for a given sculpt tool */
+void BKE_brush_builtin_create(struct Brush *brush, int tool);
+
+/*
+Copies channel data from src to dst. Dst's data
+will be freed first.
+*/
void BKE_brush_channel_copy_data(BrushChannel *dst,
BrushChannel *src,
bool keep_mappings,
bool keep_idname_and_def);
+
+/* Initialize a channel from a channel definition */
void BKE_brush_channel_init(BrushChannel *ch, BrushChannelType *def);
+
+/* Lookup a built-in channel definition by name */
BrushChannelType *BKE_brush_builtin_channel_def_find(const char *name);
+/* Create new channel set; info is a guardedalloc tag and should point
+ to a static/permanent string */
BrushChannelSet *BKE_brush_channelset_create(const char *info);
+
+/* adds missing channels to exising .channels in brush.
+ * if channels do not exist use BKE_brush_builtin_create.
+ */
+void BKE_brush_builtin_patch(struct Brush *brush, int tool);
+
+/* loads old brush settings to/from channels */
+void BKE_brush_channelset_compat_load(BrushChannelSet *chset,
+ struct Brush *brush,
+ bool to_channels);
+
#ifdef DEBUG_CURVE_MAPPING_ALLOC
BrushChannelSet *_BKE_brush_channelset_copy(BrushChannelSet *src);
# define BKE_brush_channelset_copy(src) \
@@ -231,21 +268,44 @@ void BKE_brush_channel_ensure_unque_name(BrushChannelSet *chset, BrushChannel *c
/* does not free ch or its data */
void BKE_brush_channelset_remove(BrushChannelSet *chset, BrushChannel *ch);
-// does not free ch or its data
+/* does not free ch or its data */
bool BKE_brush_channelset_remove_named(BrushChannelSet *chset, const char *idname);
-// checks is a channel with existing->idname exists; if not a copy of existing is made and inserted
+/* checks if a channel with existing->idname exists; if not a copy of existing
+ is made and inserted
+ */
void BKE_brush_channelset_ensure_existing(BrushChannelSet *chset, BrushChannel *existing);
+/* Lookup a channel in chset; returns NULL if it does not exist */
BrushChannel *BKE_brush_channelset_lookup(BrushChannelSet *chset, const char *idname);
+
+/* Looks up a channel in child; if it is set to inherit or does not exist, then
+ the channel will be looked up in parent; otherwise the one in child is returned.
+
+ Note that this does not apply brush mapping inheritance.
+ */
BrushChannel *BKE_brush_channelset_lookup_final(BrushChannelSet *child,
BrushChannelSet *parent,
const char *idname);
+/*
+takes child and parent channels and builds inherited channel
+in dst, with channel and brush mapping inheritance flags
+properly resolved.
+
+note that child or parent may be NULL, but not both.
+*/
+void BKE_brush_channel_copy_final_data(BrushChannel *dst,
+ BrushChannel *src_child,
+ BrushChannel *src_parent,
+ bool keep_mapping,
+ bool keep_idname_and_def);
+
bool BKE_brush_channelset_has(BrushChannelSet *chset, const char *idname);
BrushChannel *BKE_brush_channelset_add_builtin(BrushChannelSet *chset, const char *idname);
BrushChannel *BKE_brush_channelset_ensure_builtin(BrushChannelSet *chset, const char *idname);
+
void BKE_brush_mapping_reset(BrushChannel *ch, int tool, int mapping);
void BKE_brush_mapping_inherit_all(BrushChannel *ch);
@@ -254,44 +314,40 @@ void BKE_brush_channelset_inherit_mappings(BrushChannelSet *chset);
void BKE_brush_channelset_merge(BrushChannelSet *dst,
BrushChannelSet *child,
BrushChannelSet *parent);
+
void BKE_brush_channel_apply_mapping_flags(BrushChannel *dst,
BrushChannel *child,
BrushChannel *parent);
-bool BKE_brush_mapping_is_enabled(BrushChannel *child, BrushChannel *parent, int mapping);
-/*takes child and parent channels and builds inherited channel
-in dst, with channel and brush mapping inheritance flags
-properly resolved.
-
-note that child or parent may be NULL, but not both.
-*/
-void BKE_brush_channel_copy_final_data(BrushChannel *dst,
- BrushChannel *src_child,
- BrushChannel *src_parent,
- bool keep_mapping,
- bool keep_idname_and_def);
+bool BKE_brush_mapping_is_enabled(BrushChannel *child, BrushChannel *parent, int mapping);
+/* iterators over each channel in brush->channels, and any set to inherit will be
+ overwritten by equivalent channel in sd->channels */
void BKE_brush_resolve_channels(struct Brush *brush, struct Sculpt *sd);
-void BKE_brush_channelset_set_final_int(BrushChannelSet *brushset,
- BrushChannelSet *toolset,
+/* sets channel value in either child or parent depending on inheritance flag */
+void BKE_brush_channelset_set_final_int(BrushChannelSet *child,
+ BrushChannelSet *parent,
const char *idname,
int value);
-int BKE_brush_channelset_get_final_in
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list