Grease Pencil: move legacy grease pencil modifiers to C++

Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110493
This commit is contained in:
Jacques Lucke 2023-07-26 13:45:04 +02:00
parent 38542ceeda
commit 00e6adb49c
35 changed files with 1069 additions and 991 deletions

View File

@ -25,35 +25,35 @@ set(INC_SYS
)
set(SRC
intern/MOD_gpencil_legacy_ui_common.c
intern/MOD_gpencil_legacy_ui_common.cc
intern/MOD_gpencil_legacy_armature.c
intern/MOD_gpencil_legacy_array.c
intern/MOD_gpencil_legacy_build.c
intern/MOD_gpencil_legacy_color.c
intern/MOD_gpencil_legacy_dash.c
intern/MOD_gpencil_legacy_envelope.c
intern/MOD_gpencil_legacy_hook.c
intern/MOD_gpencil_legacy_lattice.c
intern/MOD_gpencil_legacy_length.c
intern/MOD_gpencil_legacy_lineart.c
intern/MOD_gpencil_legacy_mirror.c
intern/MOD_gpencil_legacy_multiply.c
intern/MOD_gpencil_legacy_noise.c
intern/MOD_gpencil_legacy_offset.c
intern/MOD_gpencil_legacy_opacity.c
intern/MOD_gpencil_legacy_outline.c
intern/MOD_gpencil_legacy_shrinkwrap.c
intern/MOD_gpencil_legacy_simplify.c
intern/MOD_gpencil_legacy_smooth.c
intern/MOD_gpencil_legacy_subdiv.c
intern/MOD_gpencil_legacy_texture.c
intern/MOD_gpencil_legacy_thick.c
intern/MOD_gpencil_legacy_time.c
intern/MOD_gpencil_legacy_tint.c
intern/MOD_gpencil_legacy_util.c
intern/MOD_gpencil_legacy_weight_angle.c
intern/MOD_gpencil_legacy_weight_proximity.c
intern/MOD_gpencil_legacy_armature.cc
intern/MOD_gpencil_legacy_array.cc
intern/MOD_gpencil_legacy_build.cc
intern/MOD_gpencil_legacy_color.cc
intern/MOD_gpencil_legacy_dash.cc
intern/MOD_gpencil_legacy_envelope.cc
intern/MOD_gpencil_legacy_hook.cc
intern/MOD_gpencil_legacy_lattice.cc
intern/MOD_gpencil_legacy_length.cc
intern/MOD_gpencil_legacy_lineart.cc
intern/MOD_gpencil_legacy_mirror.cc
intern/MOD_gpencil_legacy_multiply.cc
intern/MOD_gpencil_legacy_noise.cc
intern/MOD_gpencil_legacy_offset.cc
intern/MOD_gpencil_legacy_opacity.cc
intern/MOD_gpencil_legacy_outline.cc
intern/MOD_gpencil_legacy_shrinkwrap.cc
intern/MOD_gpencil_legacy_simplify.cc
intern/MOD_gpencil_legacy_smooth.cc
intern/MOD_gpencil_legacy_subdiv.cc
intern/MOD_gpencil_legacy_texture.cc
intern/MOD_gpencil_legacy_thick.cc
intern/MOD_gpencil_legacy_time.cc
intern/MOD_gpencil_legacy_tint.cc
intern/MOD_gpencil_legacy_util.cc
intern/MOD_gpencil_legacy_weight_angle.cc
intern/MOD_gpencil_legacy_weight_proximity.cc
MOD_gpencil_legacy_lineart.h
MOD_gpencil_legacy_modifiertypes.h
@ -61,11 +61,11 @@ set(SRC
intern/MOD_gpencil_legacy_util.h
# Lineart code
intern/lineart/lineart_chain.c
intern/lineart/lineart_chain.cc
intern/lineart/lineart_cpu.cc
intern/lineart/lineart_ops.c
intern/lineart/lineart_shadow.c
intern/lineart/lineart_util.c
intern/lineart/lineart_ops.cc
intern/lineart/lineart_shadow.cc
intern/lineart/lineart_util.cc
intern/lineart/MOD_lineart.h
intern/lineart/lineart_intern.h

View File

@ -65,7 +65,8 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
static void gpencil_deform_verts(ArmatureGpencilModifierData *mmd, Object *target, bGPDstroke *gps)
{
bGPDspoint *pt = gps->points;
float(*vert_coords)[3] = MEM_mallocN(sizeof(float[3]) * gps->totpoints, __func__);
float(*vert_coords)[3] = static_cast<float(*)[3]>(
MEM_mallocN(sizeof(float[3]) * gps->totpoints, __func__));
int i;
BKE_gpencil_dvert_ensure(gps);
@ -79,7 +80,7 @@ static void gpencil_deform_verts(ArmatureGpencilModifierData *mmd, Object *targe
BKE_armature_deform_coords_with_gpencil_stroke(mmd->object,
target,
vert_coords,
NULL,
nullptr,
gps->totpoints,
mmd->deformflag,
mmd->vert_coords_prev,
@ -97,37 +98,37 @@ static void gpencil_deform_verts(ArmatureGpencilModifierData *mmd, Object *targe
/* deform stroke */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *UNUSED(gpl),
bGPDframe *UNUSED(gpf),
bGPDlayer * /*gpl*/,
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
if (!mmd->object) {
return;
}
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
gpencil_deform_verts(mmd, ob, gps);
/* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gpd, gps);
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
if (mmd->object == NULL) {
if (mmd->object == nullptr) {
return;
}
generic_bake_deform_stroke(depsgraph, md, ob, true, deformStroke);
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
@ -140,10 +141,10 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
ArmatureGpencilModifierData *lmd = (ArmatureGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
}
@ -157,7 +158,7 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *sub, *row, *col;
uiLayout *layout = panel->layout;
@ -169,9 +170,9 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE);
row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
uiLayoutSetPropDecorate(sub, false);
@ -199,15 +200,15 @@ GpencilModifierTypeInfo modifierType_Gpencil_Armature = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -49,11 +49,11 @@
#include "MOD_gpencil_legacy_ui_common.h"
#include "MOD_gpencil_legacy_util.h"
typedef struct tmpStrokes {
struct tmpStrokes {
struct tmpStrokes *next, *prev;
bGPDframe *gpf;
bGPDstroke *gps;
} tmpStrokes;
};
static void initData(GpencilModifierData *md)
{
@ -123,14 +123,14 @@ static bool gpencil_data_selected_minmax(
INIT_MINMAX(r_min, r_max);
if (gpd == NULL) {
if (gpd == nullptr) {
return changed;
}
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, cfra, GP_GETFRAME_USE_PREV);
if (gpf != NULL) {
if (gpf != nullptr) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
if (is_stroke_affected_by_modifier(ob,
mmd->layername,
@ -162,7 +162,7 @@ static void generate_geometry(GpencilModifierData *md,
int cfra)
{
ArrayGpencilModifierData *mmd = (ArrayGpencilModifierData *)md;
ListBase stroke_cache = {NULL, NULL};
ListBase stroke_cache = {nullptr, nullptr};
/* Load the strokes to be duplicated. */
bGPdata *gpd = (bGPdata *)ob->data;
bool found = false;
@ -189,7 +189,7 @@ static void generate_geometry(GpencilModifierData *md,
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = (apply) ? BKE_gpencil_layer_frame_get(gpl, cfra, GP_GETFRAME_USE_PREV) :
BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
@ -206,7 +206,7 @@ static void generate_geometry(GpencilModifierData *md,
mmd->flag & GP_ARRAY_INVERT_LAYERPASS,
mmd->flag & GP_ARRAY_INVERT_MATERIAL))
{
tmpStrokes *tmp = MEM_callocN(sizeof(tmpStrokes), __func__);
tmpStrokes *tmp = static_cast<tmpStrokes *>(MEM_callocN(sizeof(tmpStrokes), __func__));
tmp->gpf = gpf;
tmp->gps = gps;
BLI_addtail(&stroke_cache, tmp);
@ -323,13 +323,13 @@ static void generate_geometry(GpencilModifierData *md,
}
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
/* Get list of frames. */
GHash *keyframe_list = BLI_ghash_int_new(__func__);
@ -350,8 +350,8 @@ static void bakeModifier(Main *UNUSED(bmain),
}
/* Free temp hash table. */
if (keyframe_list != NULL) {
BLI_ghash_free(keyframe_list, NULL, NULL);
if (keyframe_list != nullptr) {
BLI_ghash_free(keyframe_list, nullptr, nullptr);
}
}
@ -366,10 +366,10 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
ArrayGpencilModifierData *lmd = (ArrayGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Array Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Array Modifier");
}
@ -384,34 +384,34 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "count", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "count", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "replace_material", 0, IFACE_("Material Override"), ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void relative_offset_header_draw(const bContext *UNUSED(C), Panel *panel)
static void relative_offset_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_relative_offset", 0, IFACE_("Relative Offset"), ICON_NONE);
}
static void relative_offset_draw(const bContext *UNUSED(C), Panel *panel)
static void relative_offset_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
@ -421,20 +421,20 @@ static void relative_offset_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(col, ptr, "relative_offset", 0, IFACE_("Factor"), ICON_NONE);
}
static void constant_offset_header_draw(const bContext *UNUSED(C), Panel *panel)
static void constant_offset_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_constant_offset", 0, IFACE_("Constant Offset"), ICON_NONE);
}
static void constant_offset_draw(const bContext *UNUSED(C), Panel *panel)
static void constant_offset_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
@ -447,20 +447,20 @@ static void constant_offset_draw(const bContext *UNUSED(C), Panel *panel)
/**
* Object offset in a subpanel for consistency with the other offset types.
*/
static void object_offset_header_draw(const bContext *UNUSED(C), Panel *panel)
static void object_offset_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_object_offset", 0, IFACE_("Object Offset"), ICON_NONE);
}
static void object_offset_draw(const bContext *UNUSED(C), Panel *panel)
static void object_offset_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
@ -470,22 +470,22 @@ static void object_offset_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(col, ptr, "offset_object", 0, IFACE_("Object"), ICON_NONE);
}
static void random_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void random_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "random_offset", 0, IFACE_("Offset"), ICON_NONE);
uiItemR(layout, ptr, "random_rotation", 0, IFACE_("Rotation"), ICON_NONE);
uiItemR(layout, ptr, "random_scale", 0, IFACE_("Scale"), ICON_NONE);
uiItemR(layout, ptr, "use_uniform_random_scale", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "seed", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_uniform_random_scale", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "seed", 0, nullptr, ICON_NONE);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -509,9 +509,9 @@ static void panelRegister(ARegionType *region_type)
gpencil_modifier_subpanel_register(
region_type, "object_offset", "", object_offset_header_draw, object_offset_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "randomize", "Randomize", NULL, random_panel_draw, panel_type);
region_type, "randomize", "Randomize", nullptr, random_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Array = {
@ -523,17 +523,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Array = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -69,7 +69,7 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
BKE_gpencil_modifier_copydata_generic(md, target);
}
static bool dependsOnTime(GpencilModifierData *UNUSED(md))
static bool dependsOnTime(GpencilModifierData * /*md*/)
{
return true;
}
@ -101,7 +101,7 @@ static void clear_stroke(bGPDframe *gpf, bGPDstroke *gps)
static void gpf_clear_all_strokes(bGPDframe *gpf)
{
bGPDstroke *gps, *gps_next;
for (gps = gpf->strokes.first; gps; gps = gps_next) {
for (gps = static_cast<bGPDstroke *>(gpf->strokes.first); gps; gps = gps_next) {
gps_next = gps->next;
clear_stroke(gpf, gps);
}
@ -118,14 +118,16 @@ static void reduce_stroke_points(bGPdata *gpd,
const int points_num,
const eBuildGpencil_Transition transition)
{
if ((points_num == 0) || (gps->points == NULL)) {
if ((points_num == 0) || (gps->points == nullptr)) {
clear_stroke(gpf, gps);
return;
}
bGPDspoint *new_points = MEM_callocN(sizeof(bGPDspoint) * points_num, __func__);
MDeformVert *new_dvert = NULL;
if ((gps->dvert != NULL) && (points_num > 0)) {
new_dvert = MEM_callocN(sizeof(MDeformVert) * points_num, __func__);
bGPDspoint *new_points = static_cast<bGPDspoint *>(
MEM_callocN(sizeof(bGPDspoint) * points_num, __func__));
MDeformVert *new_dvert = nullptr;
if ((gps->dvert != nullptr) && (points_num > 0)) {
new_dvert = static_cast<MDeformVert *>(
MEM_callocN(sizeof(MDeformVert) * points_num, __func__));
}
/* Which end should points be removed from. */
@ -136,8 +138,8 @@ static void reduce_stroke_points(bGPdata *gpd,
* Remove dead-points from end of stroke. */
{
/* copy over point data */
memcpy(new_points, gps->points, sizeof(bGPDspoint) * points_num);
if ((gps->dvert != NULL) && (points_num > 0)) {
blender::dna::shallow_copy_array(new_points, gps->points, points_num);
if ((gps->dvert != nullptr) && (points_num > 0)) {
memcpy(new_dvert, gps->dvert, sizeof(MDeformVert) * points_num);
/* free unused point weights */
@ -157,8 +159,8 @@ static void reduce_stroke_points(bGPdata *gpd,
const int offset = gps->totpoints - points_num;
/* copy over point data */
memcpy(new_points, gps->points + offset, sizeof(bGPDspoint) * points_num);
if ((gps->dvert != NULL) && (points_num > 0)) {
blender::dna::shallow_copy_array(new_points, gps->points + offset, points_num);
if ((gps->dvert != nullptr) && (points_num > 0)) {
memcpy(new_dvert, gps->dvert + offset, sizeof(MDeformVert) * points_num);
/* free unused weights */
@ -240,7 +242,7 @@ static void fade_stroke_points(bGPDstroke *gps,
/* --------------------------------------------- */
/* Stroke Data Table Entry - This represents one stroke being generated */
typedef struct tStrokeBuildDetails {
struct tStrokeBuildDetails {
bGPDstroke *gps;
/* Indices - first/last indices for the stroke's points (overall) */
@ -251,7 +253,7 @@ typedef struct tStrokeBuildDetails {
/* Distance to control object, used to sort the strokes if set. */
float distance;
} tStrokeBuildDetails;
};
static int cmp_stroke_build_details(const void *ps1, const void *ps2)
{
@ -297,7 +299,8 @@ static void build_sequential(Object *ob,
/* 2) Compute proportion of time each stroke should occupy. */
/* NOTE: This assumes that the total number of points won't overflow! */
tStrokeBuildDetails *table = MEM_callocN(sizeof(tStrokeBuildDetails) * tot_strokes, __func__);
tStrokeBuildDetails *table = static_cast<tStrokeBuildDetails *>(
MEM_callocN(sizeof(tStrokeBuildDetails) * tot_strokes, __func__));
/* Pointer to cache table of times for each point. */
float *idx_times;
/* Running overall time sum incrementing per point. */
@ -306,7 +309,9 @@ static void build_sequential(Object *ob,
size_t sumpoints = 0;
/* 2.1) Pass to initially tally up points. */
for (gps = BLI_findlink(&gpf->strokes, start_stroke), i = 0; gps; gps = gps->next, i++) {
for (gps = static_cast<bGPDstroke *>(BLI_findlink(&gpf->strokes, start_stroke)), i = 0; gps;
gps = gps->next, i++)
{
tStrokeBuildDetails *cell = &table[i];
cell->gps = gps;
@ -336,7 +341,7 @@ static void build_sequential(Object *ob,
/* 2.2) If GP_BUILD_TIMEMODE_DRAWSPEED: Tally up point timestamps & delays to idx_times. */
if (mmd->time_mode == GP_BUILD_TIMEMODE_DRAWSPEED) {
idx_times = MEM_callocN(sizeof(float) * sumpoints, __func__);
idx_times = static_cast<float *>(MEM_callocN(sizeof(float) * sumpoints, __func__));
/* Maximum time gap between strokes in seconds. */
const float GP_BUILD_MAXGAP = mmd->speed_maxgap;
/* Running reference to overall current point. */
@ -347,7 +352,7 @@ static void build_sequential(Object *ob,
for (i = 0; i < tot_strokes; i++) {
tStrokeBuildDetails *cell = &table[i];
/* Adding delay between strokes to sumtime. */
if (mmd->object == NULL) {
if (mmd->object == nullptr) {
/* Normal case: Delay to last stroke. */
if (i != 0 && 0 < cell->gps->inittime && 0 < (cell - 1)->gps->inittime) {
float curgps_delay = fabs(cell->gps->inittime - (cell - 1)->gps->inittime) -
@ -510,9 +515,9 @@ static void build_sequential(Object *ob,
fade_end = last_visible;
break;
/* Hide in forward order
* - As fac increases, the early points start getting hidden
*/
/* Hide in forward order
* - As fac increases, the early points start getting hidden
*/
case GP_BUILD_TRANSITION_VANISH:
first_visible = (size_t)(sumpoints * use_fade_fac);
last_visible = sumpoints; /* i.e. visible until the end, unless first overlaps this */
@ -549,7 +554,7 @@ static void build_sequential(Object *ob,
start_weight,
end_weight,
target_def_nr,
mmd->transition,
eBuildGpencil_Transition(mmd->transition),
mmd->fade_thickness_strength,
mmd->fade_opacity_strength);
/* Calc geometry data. */
@ -562,12 +567,14 @@ static void build_sequential(Object *ob,
else if (first_visible > cell->start_idx) {
/* Starts partway through this stroke */
int points_num = cell->end_idx - first_visible;
reduce_stroke_points(gpd, gpf, cell->gps, points_num, mmd->transition);
reduce_stroke_points(
gpd, gpf, cell->gps, points_num, eBuildGpencil_Transition(mmd->transition));
}
else {
/* Ends partway through this stroke */
int points_num = last_visible - cell->start_idx;
reduce_stroke_points(gpd, gpf, cell->gps, points_num, mmd->transition);
reduce_stroke_points(
gpd, gpf, cell->gps, points_num, eBuildGpencil_Transition(mmd->transition));
}
}
}
@ -595,7 +602,7 @@ static void build_concurrent(BuildGpencilModifierData *mmd,
/* 1) Determine the longest stroke, to figure out when short strokes should start */
/* Todo: A *really* long stroke here could dwarf everything else, causing bad timings */
for (gps = gpf->strokes.first; gps; gps = gps->next) {
for (gps = static_cast<bGPDstroke *>(gpf->strokes.first); gps; gps = gps->next) {
if (gps->totpoints > max_points) {
max_points = gps->totpoints;
}
@ -612,7 +619,7 @@ static void build_concurrent(BuildGpencilModifierData *mmd,
int fade_points = set_fade_fac * max_points;
/* 2) For each stroke, determine how it should be handled */
for (gps = gpf->strokes.first; gps; gps = gps_next) {
for (gps = static_cast<bGPDstroke *>(gpf->strokes.first); gps; gps = gps_next) {
gps_next = gps->next;
/* Relative Length of Stroke - Relative to the longest stroke,
@ -687,12 +694,12 @@ static void build_concurrent(BuildGpencilModifierData *mmd,
starting_weight,
ending_weight,
target_def_nr,
mmd->transition,
eBuildGpencil_Transition(mmd->transition),
mmd->fade_thickness_strength,
mmd->fade_opacity_strength);
if (points_num < gps->totpoints) {
/* Remove some points */
reduce_stroke_points(gpd, gpf, gps, points_num, mmd->transition);
reduce_stroke_points(gpd, gpf, gps, points_num, eBuildGpencil_Transition(mmd->transition));
}
}
}
@ -723,7 +730,7 @@ static void generate_geometry(GpencilModifierData *md,
const float ctime = DEG_get_ctime(depsgraph);
/* Early exit if it's an empty frame */
if (gpf->strokes.first == NULL) {
if (gpf->strokes.first == nullptr) {
return;
}
@ -870,14 +877,14 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
generate_geometry(md, depsgraph, ob, gpd, gpl, gpf);
}
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
@ -890,9 +897,9 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
/* First: Build mode and build settings. */
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
if (mode == GP_BUILD_MODE_SEQUENTIAL) {
uiItemR(layout, ptr, "transition", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "transition", 0, nullptr, ICON_NONE);
}
if (mode == GP_BUILD_MODE_CONCURRENT) {
/* Concurrent mode doesn't support GP_BUILD_TIMEMODE_DRAWSPEED, so unset it. */
@ -900,64 +907,64 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
RNA_enum_set(ptr, "time_mode", GP_BUILD_TIMEMODE_FRAMES);
time_mode = GP_BUILD_TIMEMODE_FRAMES;
}
uiItemR(layout, ptr, "transition", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "transition", 0, nullptr, ICON_NONE);
}
uiItemS(layout);
/* Second: Time mode and time settings. */
uiItemR(layout, ptr, "time_mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "time_mode", 0, nullptr, ICON_NONE);
if (mode == GP_BUILD_MODE_CONCURRENT) {
uiItemR(layout, ptr, "concurrent_time_alignment", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "concurrent_time_alignment", 0, nullptr, ICON_NONE);
}
switch (time_mode) {
case GP_BUILD_TIMEMODE_DRAWSPEED:
uiItemR(layout, ptr, "speed_factor", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "speed_maxgap", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "speed_factor", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "speed_maxgap", 0, nullptr, ICON_NONE);
break;
case GP_BUILD_TIMEMODE_FRAMES:
uiItemR(layout, ptr, "length", 0, IFACE_("Frames"), ICON_NONE);
if (mode != GP_BUILD_MODE_ADDITIVE) {
uiItemR(layout, ptr, "start_delay", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "start_delay", 0, nullptr, ICON_NONE);
}
break;
case GP_BUILD_TIMEMODE_PERCENTAGE:
uiItemR(layout, ptr, "percentage_factor", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "percentage_factor", 0, nullptr, ICON_NONE);
break;
default:
break;
}
uiItemS(layout);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE);
/* Some housekeeping to prevent clashes between incompatible
* options */
/* Check for incompatible time modifier. */
Object *ob = ob_ptr.data;
GpencilModifierData *md = ptr->data;
if (BKE_gpencil_modifiers_findby_type(ob, eGpencilModifierType_Time) != NULL) {
Object *ob = static_cast<Object *>(ob_ptr.data);
GpencilModifierData *md = static_cast<GpencilModifierData *>(ptr->data);
if (BKE_gpencil_modifiers_findby_type(ob, eGpencilModifierType_Time) != nullptr) {
BKE_gpencil_modifier_set_error(md, "Build and Time Offset modifiers are incompatible");
}
gpencil_modifier_panel_end(layout, ptr);
}
static void frame_range_header_draw(const bContext *UNUSED(C), Panel *panel)
static void frame_range_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_restrict_frame_range", 0, IFACE_("Custom Range"), ICON_NONE);
}
static void frame_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void frame_range_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
@ -966,16 +973,16 @@ static void frame_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(col, ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
}
static void fading_header_draw(const bContext *UNUSED(C), Panel *panel)
static void fading_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_fading", 0, IFACE_("Fade"), ICON_NONE);
}
static void fading_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void fading_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
@ -1000,7 +1007,7 @@ static void fading_panel_draw(const bContext *UNUSED(C), Panel *panel)
ICON_NONE);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, false, false);
}
@ -1014,7 +1021,7 @@ static void panelRegister(ARegionType *region_type)
gpencil_modifier_subpanel_register(
region_type, "fading", "", fading_header_draw, fading_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "_mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "_mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
@ -1026,10 +1033,10 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
BuildGpencilModifierData *lmd = (BuildGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Build Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Build Modifier");
}
@ -1047,17 +1054,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Build = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ NULL,
/*remapTime*/ NULL,
/*bakeModifier*/ nullptr,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ dependsOnTime,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -58,9 +58,9 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
ColorGpencilModifierData *gmd = (ColorGpencilModifierData *)md;
ColorGpencilModifierData *tgmd = (ColorGpencilModifierData *)target;
if (tgmd->curve_intensity != NULL) {
if (tgmd->curve_intensity != nullptr) {
BKE_curvemapping_free(tgmd->curve_intensity);
tgmd->curve_intensity = NULL;
tgmd->curve_intensity = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
@ -70,10 +70,10 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* color correction strokes */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
@ -104,8 +104,8 @@ static void deformStroke(GpencilModifierData *md,
/* Fill */
if (mmd->modify_color != GP_MODIFY_COLOR_STROKE) {
/* If not using Vertex Color, use the material color. */
if ((gp_style != NULL) && (gps->vert_color_fill[3] == 0.0f) && (gp_style->fill_rgba[3] > 0.0f))
{
if ((gp_style != nullptr) && (gps->vert_color_fill[3] == 0.0f) &&
(gp_style->fill_rgba[3] > 0.0f)) {
copy_v4_v4(gps->vert_color_fill, gp_style->fill_rgba);
gps->vert_color_fill[3] = 1.0f;
}
@ -123,7 +123,8 @@ static void deformStroke(GpencilModifierData *md,
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
/* If not using Vertex Color, use the material color. */
if ((gp_style != NULL) && (pt->vert_color[3] == 0.0f) && (gp_style->stroke_rgba[3] > 0.0f)) {
if ((gp_style != nullptr) && (pt->vert_color[3] == 0.0f) &&
(gp_style->stroke_rgba[3] > 0.0f)) {
copy_v4_v4(pt->vert_color, gp_style->stroke_rgba);
pt->vert_color[3] = 1.0f;
}
@ -146,7 +147,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -170,23 +171,23 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "modify_color", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "value", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "modify_color", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "hue", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
uiItemR(layout, ptr, "saturation", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
uiItemR(layout, ptr, "value", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -196,7 +197,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Color, panel_draw);
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"curve",
"",
@ -215,16 +216,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Color = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -71,7 +71,7 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
BKE_gpencil_modifier_copydata_generic(md, target);
dmd->segments = MEM_dupallocN(dmd_src->segments);
dmd->segments = static_cast<DashGpencilModifierSegment *>(MEM_dupallocN(dmd_src->segments));
}
static void freeData(GpencilModifierData *md)
@ -199,7 +199,7 @@ static void apply_dash_for_frame(
return;
}
ListBase result = {NULL, NULL};
ListBase result = {nullptr, nullptr};
LISTBASE_FOREACH_MUTABLE (bGPDstroke *, gps, &gpf->strokes) {
if (is_stroke_affected_by_modifier(ob,
@ -222,18 +222,18 @@ static void apply_dash_for_frame(
}
}
bGPDstroke *gps_dash;
while ((gps_dash = BLI_pophead(&result))) {
while ((gps_dash = static_cast<bGPDstroke *>(BLI_pophead(&result)))) {
BLI_addtail(&gpf->strokes, gps_dash);
BKE_gpencil_stroke_geometry_update(gpd, gps_dash);
}
}
static void bakeModifier(Main *UNUSED(bmain),
Depsgraph *UNUSED(depsgraph),
static void bakeModifier(Main * /*bmain*/,
Depsgraph * /*depsgraph*/,
GpencilModifierData *md,
Object *ob)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
@ -244,7 +244,7 @@ static void bakeModifier(Main *UNUSED(bmain),
/* -------------------------------- */
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
DashGpencilModifierData *dmd = (DashGpencilModifierData *)md;
@ -260,11 +260,11 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Object *ob)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
apply_dash_for_frame(ob, gpl, gpd, gpf, (DashGpencilModifierData *)md);
@ -278,16 +278,16 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void segment_list_item(uiList *UNUSED(ui_list),
const bContext *UNUSED(C),
static void segment_list_item(uiList * /*ui_list*/,
const bContext * /*C*/,
uiLayout *layout,
PointerRNA *UNUSED(idataptr),
PointerRNA * /*idataptr*/,
PointerRNA *itemptr,
int UNUSED(icon),
PointerRNA *UNUSED(active_dataptr),
const char *UNUSED(active_propname),
int UNUSED(index),
int UNUSED(flt_flag))
int /*icon*/,
PointerRNA * /*active_dataptr*/,
const char * /*active_propname*/,
int /*index*/,
int /*flt_flag*/)
{
uiLayout *row = uiLayoutRow(layout, true);
uiItemR(row, itemptr, "name", UI_ITEM_R_NO_BG, "", ICON_NONE);
@ -297,11 +297,11 @@ static void panel_draw(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "dash_offset", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "dash_offset", 0, nullptr, ICON_NONE);
uiLayout *row = uiLayoutRow(layout, false);
uiLayoutSetPropSep(row, false);
@ -314,7 +314,7 @@ static void panel_draw(const bContext *C, Panel *panel)
"segments",
ptr,
"segment_active_index",
NULL,
nullptr,
3,
10,
0,
@ -330,7 +330,7 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemEnumO_string(sub, "", ICON_TRIA_UP, "GPENCIL_OT_segment_move", "type", "UP");
uiItemEnumO_string(sub, "", ICON_TRIA_DOWN, "GPENCIL_OT_segment_move", "type", "DOWN");
DashGpencilModifierData *dmd = ptr->data;
DashGpencilModifierData *dmd = static_cast<DashGpencilModifierData *>(ptr->data);
if (dmd->segment_active_index >= 0 && dmd->segment_active_index < dmd->segments_len) {
PointerRNA ds_ptr;
@ -340,20 +340,20 @@ static void panel_draw(const bContext *C, Panel *panel)
&ds_ptr);
sub = uiLayoutColumn(layout, true);
uiItemR(sub, &ds_ptr, "dash", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "gap", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "dash", 0, nullptr, ICON_NONE);
uiItemR(sub, &ds_ptr, "gap", 0, nullptr, ICON_NONE);
sub = uiLayoutColumn(layout, false);
uiItemR(sub, &ds_ptr, "radius", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "opacity", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "material_index", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "use_cyclic", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "radius", 0, nullptr, ICON_NONE);
uiItemR(sub, &ds_ptr, "opacity", 0, nullptr, ICON_NONE);
uiItemR(sub, &ds_ptr, "material_index", 0, nullptr, ICON_NONE);
uiItemR(sub, &ds_ptr, "use_cyclic", 0, nullptr, ICON_NONE);
}
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -363,9 +363,10 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Dash, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
uiListType *list_type = MEM_callocN(sizeof(uiListType), "dash modifier segment uilist");
uiListType *list_type = static_cast<uiListType *>(
MEM_callocN(sizeof(uiListType), "dash modifier segment uilist"));
STRNCPY(list_type->idname, "MOD_UL_dash_segment");
list_type->draw_item = segment_list_item;
WM_uilisttype_add(list_type);
@ -380,17 +381,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Dash = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -177,7 +177,7 @@ static void apply_stroke_envelope(bGPDstroke *gps,
/* Deform the stroke to match the envelope shape. */
for (int i = 0; i < gps->totpoints; i++) {
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify in vertex group. */
float weight = get_modifier_point_weight(dvert, invert_vg, def_nr);
@ -297,10 +297,10 @@ static void apply_stroke_envelope(bGPDstroke *gps,
* Apply envelope effect to the stroke.
*/
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
EnvelopeGpencilModifierData *mmd = (EnvelopeGpencilModifierData *)md;
@ -351,20 +351,21 @@ static void add_stroke(Object *ob,
ListBase *results)
{
const int size = size1 + size2;
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDstroke *gps_dst = BKE_gpencil_stroke_new(mat_nr, size, gps->thickness);
gps_dst->runtime.gps_orig = gps->runtime.gps_orig;
memcpy(&gps_dst->points[0], &gps->points[connection_index], size1 * sizeof(bGPDspoint));
memcpy(&gps_dst->points[size1], &gps->points[point_index], size2 * sizeof(bGPDspoint));
blender::dna::shallow_copy_array(&gps_dst->points[0], &gps->points[connection_index], size1);
blender::dna::shallow_copy_array(&gps_dst->points[size1], &gps->points[point_index], size2);
for (int i = 0; i < size; i++) {
gps_dst->points[i].pressure *= thickness;
gps_dst->points[i].strength *= strength;
}
if (gps->dvert != NULL) {
gps_dst->dvert = MEM_malloc_arrayN(size, sizeof(MDeformVert), __func__);
if (gps->dvert != nullptr) {
gps_dst->dvert = static_cast<MDeformVert *>(
MEM_malloc_arrayN(size, sizeof(MDeformVert), __func__));
BKE_defvert_array_copy(&gps_dst->dvert[0], &gps->dvert[connection_index], size1);
BKE_defvert_array_copy(&gps_dst->dvert[size1], &gps->dvert[point_index], size2);
}
@ -385,31 +386,32 @@ static void add_stroke_cyclic(Object *ob,
const float strength,
ListBase *results)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDstroke *gps_dst = BKE_gpencil_stroke_new(mat_nr, size * 2, gps->thickness);
gps_dst->runtime.gps_orig = gps->runtime.gps_orig;
if (gps->dvert != NULL) {
gps_dst->dvert = MEM_malloc_arrayN(size * 2, sizeof(MDeformVert), __func__);
if (gps->dvert != nullptr) {
gps_dst->dvert = static_cast<MDeformVert *>(
MEM_malloc_arrayN(size * 2, sizeof(MDeformVert), __func__));
}
for (int i = 0; i < size; i++) {
int a = (connection_index + i) % gps->totpoints;
int b = (point_index + i) % gps->totpoints;
gps_dst->points[i] = gps->points[a];
gps_dst->points[i] = blender::dna::shallow_copy(gps->points[a]);
bGPDspoint *pt_dst = &gps_dst->points[i];
bGPDspoint *pt_orig = &gps->points[a];
pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
gps_dst->points[size + i] = gps->points[b];
gps_dst->points[size + i] = blender::dna::shallow_copy(gps->points[b]);
pt_dst = &gps_dst->points[size + i];
pt_orig = &gps->points[b];
pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
if (gps->dvert != NULL) {
if (gps->dvert != nullptr) {
BKE_defvert_array_copy(&gps_dst->dvert[i], &gps->dvert[a], 1);
BKE_defvert_array_copy(&gps_dst->dvert[size + i], &gps->dvert[b], 1);
}
@ -417,7 +419,7 @@ static void add_stroke_cyclic(Object *ob,
for (int i = 0; i < size * 2; i++) {
gps_dst->points[i].pressure *= thickness;
gps_dst->points[i].strength *= strength;
memset(&gps_dst->points[i].runtime, 0, sizeof(bGPDspoint_Runtime));
gps_dst->points[i].runtime = blender::dna::shallow_zero_initialize();
}
BLI_addtail(results, gps_dst);
@ -435,11 +437,11 @@ static void add_stroke_simple(Object *ob,
const float strength,
ListBase *results)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDstroke *gps_dst = BKE_gpencil_stroke_new(mat_nr, 2, gps->thickness);
gps_dst->runtime.gps_orig = gps->runtime.gps_orig;
gps_dst->points[0] = gps->points[connection_index];
gps_dst->points[0] = blender::dna::shallow_copy(gps->points[connection_index]);
gps_dst->points[0].pressure *= thickness;
gps_dst->points[0].strength *= strength;
bGPDspoint *pt_dst = &gps_dst->points[0];
@ -447,7 +449,7 @@ static void add_stroke_simple(Object *ob,
pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
gps_dst->points[1] = gps->points[point_index];
gps_dst->points[1] = blender::dna::shallow_copy(gps->points[point_index]);
gps_dst->points[1].pressure *= thickness;
gps_dst->points[1].strength *= strength;
pt_dst = &gps_dst->points[1];
@ -455,8 +457,9 @@ static void add_stroke_simple(Object *ob,
pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
if (gps->dvert != NULL) {
gps_dst->dvert = MEM_malloc_arrayN(2, sizeof(MDeformVert), __func__);
if (gps->dvert != nullptr) {
gps_dst->dvert = static_cast<MDeformVert *>(
MEM_malloc_arrayN(2, sizeof(MDeformVert), __func__));
BKE_defvert_array_copy(&gps_dst->dvert[0], &gps->dvert[connection_index], 1);
BKE_defvert_array_copy(&gps_dst->dvert[1], &gps->dvert[point_index], 1);
}
@ -577,14 +580,14 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
generate_geometry(md, ob, gpl, gpf);
}
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -594,7 +597,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
generic_bake_deform_stroke(depsgraph, md, ob, false, deformStroke);
}
else {
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
@ -611,30 +614,30 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "spread", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "thickness", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "spread", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "thickness", 0, nullptr, ICON_NONE);
const int mode = RNA_enum_get(ptr, "mode");
if (mode != GP_ENVELOPE_DEFORM) {
uiItemR(layout, ptr, "strength", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mat_nr", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "skip", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "strength", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "mat_nr", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "skip", 0, nullptr, ICON_NONE);
}
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -644,7 +647,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Envelope, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Envelope = {
@ -659,14 +662,14 @@ GpencilModifierTypeInfo modifierType_Gpencil_Envelope = {
/*deformStroke*/ deformStroke,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -86,9 +86,9 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
HookGpencilModifierData *gmd = (HookGpencilModifierData *)md;
HookGpencilModifierData *tgmd = (HookGpencilModifierData *)target;
if (tgmd->curfalloff != NULL) {
if (tgmd->curfalloff != nullptr) {
BKE_curvemapping_free(tgmd->curfalloff);
tgmd->curfalloff = NULL;
tgmd->curfalloff = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
@ -181,10 +181,10 @@ static void gpencil_hook_co_apply(struct GPHookData_cb *tData, float weight, bGP
/* deform stroke */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
HookGpencilModifierData *mmd = (HookGpencilModifierData *)md;
@ -213,7 +213,7 @@ static void deformStroke(GpencilModifierData *md,
{
return;
}
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
/* init struct */
tData.curfalloff = mmd->curfalloff;
@ -248,7 +248,7 @@ static void deformStroke(GpencilModifierData *md,
/* loop points and apply deform */
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* verify vertex group */
const float weight = get_modifier_point_weight(
@ -265,14 +265,14 @@ static void deformStroke(GpencilModifierData *md,
/* FIXME: Ideally we be doing this on a copy of the main depsgraph
* (i.e. one where we don't have to worry about restoring state)
*/
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
HookGpencilModifierData *mmd = (HookGpencilModifierData *)md;
if (mmd->object == NULL) {
if (mmd->object == nullptr) {
return;
}
@ -288,7 +288,7 @@ static void freeData(GpencilModifierData *md)
}
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
HookGpencilModifierData *mmd = (HookGpencilModifierData *)md;
@ -297,10 +297,10 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
HookGpencilModifierData *lmd = (HookGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Hook Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
}
@ -315,7 +315,7 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *sub, *row, *col;
uiLayout *layout = panel->layout;
@ -329,7 +329,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "object", 0, nullptr, ICON_NONE);
if (!RNA_pointer_is_null(&hook_object_ptr) &&
RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE)
{
@ -339,23 +339,23 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
}
row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
uiLayoutSetPropSep(sub, false);
uiItemR(sub, ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
uiItemR(layout, ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "strength", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void falloff_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void falloff_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *row;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
bool use_falloff = RNA_enum_get(ptr, "falloff_type") != eWarp_Falloff_None;
@ -365,16 +365,16 @@ static void falloff_panel_draw(const bContext *UNUSED(C), Panel *panel)
row = uiLayoutRow(layout, false);
uiLayoutSetActive(row, use_falloff);
uiItemR(row, ptr, "falloff_radius", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "falloff_radius", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_falloff_uniform", 0, nullptr, ICON_NONE);
if (RNA_enum_get(ptr, "falloff_type") == eWarp_Falloff_Curve) {
uiTemplateCurveMapping(layout, ptr, "falloff_curve", 0, false, false, false, false);
}
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -384,9 +384,9 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Hook, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
region_type, "falloff", "Falloff", nullptr, falloff_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Hook = {
@ -399,16 +399,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Hook = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -61,13 +61,13 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
}
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
@ -87,13 +87,13 @@ static void deformStroke(GpencilModifierData *md,
return;
}
if (mmd->cache_data == NULL) {
if (mmd->cache_data == nullptr) {
return;
}
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* verify vertex group */
const float weight = get_modifier_point_weight(
@ -111,18 +111,18 @@ static void deformStroke(GpencilModifierData *md,
/* FIXME: Ideally we be doing this on a copy of the main depsgraph
* (i.e. one where we don't have to worry about restoring state)
*/
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
struct LatticeDeformData *ldata = NULL;
bGPdata *gpd = ob->data;
struct LatticeDeformData *ldata = nullptr;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
int oldframe = (int)DEG_get_ctime(depsgraph);
if ((mmd->object == NULL) || (mmd->object->type != OB_LATTICE)) {
if ((mmd->object == nullptr) || (mmd->object->type != OB_LATTICE)) {
return;
}
@ -151,7 +151,7 @@ static void bakeModifier(Main *UNUSED(bmain),
ldata = (struct LatticeDeformData *)mmd->cache_data;
if (ldata) {
BKE_lattice_deform_data_destroy(ldata);
mmd->cache_data = NULL;
mmd->cache_data = nullptr;
}
/* Return frame state and DB to original state. */
@ -169,7 +169,7 @@ static void freeData(GpencilModifierData *md)
}
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
@ -183,10 +183,10 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
LatticeGpencilModifierData *lmd = (LatticeGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
}
@ -201,7 +201,7 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *sub, *row, *col;
uiLayout *layout = panel->layout;
@ -215,7 +215,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "object", 0, nullptr, ICON_NONE);
if (!RNA_pointer_is_null(&hook_object_ptr) &&
RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE)
{
@ -225,18 +225,18 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
}
row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
uiLayoutSetPropSep(sub, false);
uiItemR(sub, ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
uiItemR(layout, ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "strength", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -246,7 +246,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Lattice, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
@ -259,16 +259,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -62,7 +62,7 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
static float *noise_table(int len, int offset, int seed)
{
float *table = MEM_callocN(sizeof(float) * len, __func__);
float *table = static_cast<float *>(MEM_callocN(sizeof(float) * len, __func__));
for (int i = 0; i < len; i++) {
table[i] = BLI_hash_int_01(BLI_hash_int_2d(seed, i + offset + 1));
}
@ -213,7 +213,7 @@ static void deformStroke(GpencilModifierData *md,
bGPDframe *gpf,
bGPDstroke *gps)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
if (!is_stroke_affected_by_modifier(ob,
lmd->layername,
@ -237,7 +237,7 @@ static void deformStroke(GpencilModifierData *md,
applyLength(md, depsgraph, gpd, gpf, gps, ob);
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -252,47 +252,47 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void random_header_draw(const bContext *UNUSED(C), Panel *panel)
static void random_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_random", 0, IFACE_("Randomize"), ICON_NONE);
}
static void random_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void random_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_random"));
uiItemR(layout, ptr, "step", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "step", 0, nullptr, ICON_NONE);
}
static void offset_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void offset_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "random_start_factor", 0, IFACE_("Random Offset Start"), ICON_NONE);
uiItemR(layout, ptr, "random_end_factor", 0, IFACE_("Random Offset End"), ICON_NONE);
uiItemR(layout, ptr, "random_offset", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "seed", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "random_offset", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "seed", 0, nullptr, ICON_NONE);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, true);
@ -310,25 +310,25 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
static void curvature_header_draw(const bContext *UNUSED(C), Panel *panel)
static void curvature_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_curvature", 0, IFACE_("Curvature"), ICON_NONE);
}
static void curvature_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void curvature_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
@ -336,9 +336,9 @@ static void curvature_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_curvature"));
uiItemR(col, ptr, "point_density", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "segment_influence", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "max_angle", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "point_density", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "segment_influence", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "max_angle", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "invert_curvature", 0, IFACE_("Invert"), ICON_NONE);
}
@ -349,11 +349,11 @@ static void panelRegister(ARegionType *region_type)
gpencil_modifier_subpanel_register(
region_type, "curvature", "", curvature_header_draw, curvature_panel_draw, panel_type);
PanelType *offset_panel = gpencil_modifier_subpanel_register(
region_type, "offset", "Random Offsets", NULL, offset_panel_draw, panel_type);
region_type, "offset", "Random Offsets", nullptr, offset_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "randomize", "", random_header_draw, random_panel_draw, offset_panel);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Length = {
@ -366,16 +366,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Length = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -98,7 +98,7 @@ static bool isModifierDisabled(GpencilModifierData *md)
{
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
if ((lmd->target_layer[0] == '\0') || (lmd->target_material == NULL)) {
if ((lmd->target_layer[0] == '\0') || (lmd->target_material == nullptr)) {
return true;
}
@ -120,19 +120,19 @@ static bool isModifierDisabled(GpencilModifierData *md)
static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Object *ob)
{
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
/* Guard early, don't trigger calculation when no grease-pencil frame is present.
* Probably should disable in the #isModifierDisabled() function
* but we need additional argument for depsgraph and `gpd`. */
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
if (gpl == NULL) {
if (gpl == nullptr) {
return;
}
/* Need to call this or we don't get active frame (user may haven't selected any one). */
BKE_gpencil_frame_active_set(depsgraph, gpd);
bGPDframe *gpf = gpl->actframe;
if (gpf == NULL) {
if (gpf == nullptr) {
return;
}
@ -169,20 +169,20 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
}
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
if (gpl == NULL) {
if (gpl == nullptr) {
return;
}
bGPDframe *gpf = gpl->actframe;
if (gpf == NULL) {
if (gpf == nullptr) {
return;
}
@ -203,7 +203,7 @@ static void bakeModifier(Main *UNUSED(bmain),
MOD_lineart_clear_cache(&gpd->runtime.lineart_cache);
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
return isModifierDisabled(md);
}
@ -281,7 +281,7 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&lmd->light_contour_object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
@ -296,47 +296,49 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
uiLayoutSetEnabled(layout, !is_baked);
if (!BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data)) {
uiItemR(layout, ptr, "use_cache", 0, NULL, ICON_NONE);
if (!BKE_gpencil_is_first_lineart_in_stack(static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data)))
{
uiItemR(layout, ptr, "use_cache", 0, nullptr, ICON_NONE);
}
uiItemR(layout, ptr, "source_type", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "source_type", 0, nullptr, ICON_NONE);
if (source_type == LRT_SOURCE_OBJECT) {
uiItemR(layout, ptr, "source_object", 0, NULL, ICON_OBJECT_DATA);
uiItemR(layout, ptr, "source_object", 0, nullptr, ICON_OBJECT_DATA);
}
else if (source_type == LRT_SOURCE_COLLECTION) {
uiLayout *sub = uiLayoutRow(layout, true);
uiItemR(sub, ptr, "source_collection", 0, NULL, ICON_OUTLINER_COLLECTION);
uiItemR(sub, ptr, "source_collection", 0, nullptr, ICON_OUTLINER_COLLECTION);
uiItemR(sub, ptr, "use_invert_collection", 0, "", ICON_ARROW_LEFTRIGHT);
}
else {
/* Source is Scene. */
}
uiItemPointerR(layout, ptr, "target_layer", &obj_data_ptr, "layers", NULL, ICON_GREASEPENCIL);
uiItemPointerR(layout, ptr, "target_layer", &obj_data_ptr, "layers", nullptr, ICON_GREASEPENCIL);
/* Material has to be used by grease pencil object already, it was possible to assign materials
* without this requirement in earlier versions of blender. */
bool material_valid = false;
PointerRNA material_ptr = RNA_pointer_get(ptr, "target_material");
if (!RNA_pointer_is_null(&material_ptr)) {
Material *current_material = material_ptr.data;
Object *ob = ob_ptr.data;
Material *current_material = static_cast<Material *>(material_ptr.data);
Object *ob = static_cast<Object *>(ob_ptr.data);
material_valid = BKE_gpencil_object_material_index_get(ob, current_material) != -1;
}
uiLayout *row = uiLayoutRow(layout, true);
uiLayoutSetRedAlert(row, !material_valid);
uiItemPointerR(
row, ptr, "target_material", &obj_data_ptr, "materials", NULL, ICON_SHADING_TEXTURE);
row, ptr, "target_material", &obj_data_ptr, "materials", nullptr, ICON_SHADING_TEXTURE);
uiLayout *col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "thickness", UI_ITEM_R_SLIDER, IFACE_("Line Thickness"), ICON_NONE);
uiItemR(col, ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "opacity", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void edge_types_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -344,8 +346,10 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool has_light = RNA_pointer_get(ptr, "light_contour_object").data != NULL;
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
const bool has_light = RNA_pointer_get(ptr, "light_contour_object").data != nullptr;
uiLayoutSetEnabled(layout, !is_baked);
@ -379,7 +383,7 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
ptr,
"crease_threshold",
UI_ITEM_R_SLIDER | UI_ITEM_R_FORCE_BLANK_DECORATE,
NULL,
nullptr,
ICON_NONE);
}
@ -417,7 +421,7 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
}
}
static void options_light_reference_draw(const bContext *UNUSED(C), Panel *panel)
static void options_light_reference_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -425,8 +429,10 @@ static void options_light_reference_draw(const bContext *UNUSED(C), Panel *panel
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool has_light = RNA_pointer_get(ptr, "light_contour_object").data != NULL;
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool has_light = RNA_pointer_get(ptr, "light_contour_object").data != nullptr;
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
uiLayoutSetPropSep(layout, true);
uiLayoutSetEnabled(layout, !is_baked);
@ -436,19 +442,19 @@ static void options_light_reference_draw(const bContext *UNUSED(C), Panel *panel
return;
}
uiItemR(layout, ptr, "light_contour_object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "light_contour_object", 0, nullptr, ICON_NONE);
uiLayout *remaining = uiLayoutColumn(layout, false);
uiLayoutSetActive(remaining, has_light);
uiItemR(remaining, ptr, "shadow_camera_size", 0, NULL, ICON_NONE);
uiItemR(remaining, ptr, "shadow_camera_size", 0, nullptr, ICON_NONE);
uiLayout *col = uiLayoutColumn(remaining, true);
uiItemR(col, ptr, "shadow_camera_near", 0, IFACE_("Near"), ICON_NONE);
uiItemR(col, ptr, "shadow_camera_far", 0, IFACE_("Far"), ICON_NONE);
}
static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void options_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -456,7 +462,9 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
uiLayoutSetPropSep(layout, true);
uiLayoutSetEnabled(layout, !is_baked);
@ -476,14 +484,14 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE);
uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_object_instances", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_clip_plane_boundaries", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_crease_on_smooth", 0, IFACE_("Crease On Smooth"), ICON_NONE);
uiItemR(col, ptr, "use_crease_on_sharp", 0, IFACE_("Crease On Sharp"), ICON_NONE);
uiItemR(col, ptr, "use_back_face_culling", 0, IFACE_("Force Backface Culling"), ICON_NONE);
}
static void occlusion_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void occlusion_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -508,7 +516,7 @@ static void occlusion_panel_draw(const bContext *UNUSED(C), Panel *panel)
if (use_multiple_levels) {
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "level_start", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "level_start", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "level_end", 0, IFACE_("End"), ICON_NONE);
}
else {
@ -527,7 +535,7 @@ static bool anything_showing_through(PointerRNA *ptr)
return (level_start > 0);
}
static void material_mask_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
static void material_mask_panel_draw_header(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -542,10 +550,10 @@ static void material_mask_panel_draw_header(const bContext *UNUSED(C), Panel *pa
uiItemR(layout, ptr, "use_material_mask", 0, IFACE_("Material Mask"), ICON_NONE);
}
static void material_mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void material_mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
uiLayoutSetEnabled(layout, !is_baked);
@ -569,10 +577,10 @@ static void material_mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_material_mask_match", 0, IFACE_("Exact Match"), ICON_NONE);
}
static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void intersection_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
uiLayoutSetEnabled(layout, !is_baked);
@ -595,7 +603,7 @@ static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_intersection_match", 0, IFACE_("Exact Match"), ICON_NONE);
}
static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
static void face_mark_panel_draw_header(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -603,7 +611,9 @@ static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
if (!use_cache || is_first) {
uiLayoutSetEnabled(layout, !is_baked);
@ -614,7 +624,7 @@ static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
}
}
static void face_mark_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void face_mark_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -623,7 +633,9 @@ static void face_mark_panel_draw(const bContext *UNUSED(C), Panel *panel)
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_mark = RNA_boolean_get(ptr, "use_face_mark");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
uiLayoutSetEnabled(layout, !is_baked);
@ -636,12 +648,12 @@ static void face_mark_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetActive(layout, use_mark);
uiItemR(layout, ptr, "use_face_mark_invert", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_face_mark_boundaries", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_face_mark_keep_contour", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_face_mark_invert", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_face_mark_boundaries", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_face_mark_keep_contour", 0, nullptr, ICON_NONE);
}
static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void chaining_panel_draw(const bContext * /*C*/, Panel *panel)
{
PointerRNA ob_ptr;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
@ -650,7 +662,9 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
const bool is_geom = RNA_boolean_get(ptr, "use_geometry_space_chain");
uiLayoutSetPropSep(layout, true);
@ -662,25 +676,25 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
}
uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Chain"));
uiItemR(col, ptr, "use_fuzzy_intersections", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_fuzzy_all", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_fuzzy_intersections", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_fuzzy_all", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_loose_edge_chain", 0, IFACE_("Loose Edges"), ICON_NONE);
uiItemR(col, ptr, "use_loose_as_contour", 0, IFACE_("Loose Edges As Contour"), ICON_NONE);
uiItemR(col, ptr, "use_detail_preserve", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_detail_preserve", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_geometry_space_chain", 0, IFACE_("Geometry Space"), ICON_NONE);
uiItemR(layout,
ptr,
"chaining_image_threshold",
0,
is_geom ? IFACE_("Geometry Threshold") : NULL,
is_geom ? IFACE_("Geometry Threshold") : nullptr,
ICON_NONE);
uiItemR(layout, ptr, "smooth_tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "split_angle", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "smooth_tolerance", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
uiItemR(layout, ptr, "split_angle", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
}
static void vgroup_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void vgroup_panel_draw(const bContext * /*C*/, Panel *panel)
{
PointerRNA ob_ptr;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
@ -689,7 +703,9 @@ static void vgroup_panel_draw(const bContext *UNUSED(C), Panel *panel)
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(
static_cast<const Object *>(ob_ptr.data),
static_cast<const GpencilModifierData *>(ptr->data));
uiLayoutSetPropSep(layout, true);
uiLayoutSetEnabled(layout, !is_baked);
@ -706,7 +722,7 @@ static void vgroup_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(row, ptr, "source_vertex_group", 0, IFACE_("Filter Source"), ICON_GROUP_VERTEX);
uiItemR(row, ptr, "invert_source_vertex_group", UI_ITEM_R_TOGGLE, "", ICON_ARROW_LEFTRIGHT);
uiItemR(col, ptr, "use_output_vertex_group_match_by_name", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_output_vertex_group_match_by_name", 0, nullptr, ICON_NONE);
const bool match_output = RNA_boolean_get(ptr, "use_output_vertex_group_match_by_name");
if (!match_output) {
@ -715,7 +731,7 @@ static void vgroup_panel_draw(const bContext *UNUSED(C), Panel *panel)
}
}
static void bake_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void bake_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
@ -735,15 +751,15 @@ static void bake_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayout *col = uiLayoutColumn(layout, false);
uiLayoutSetEnabled(col, !is_baked);
uiItemO(col, NULL, ICON_NONE, "OBJECT_OT_lineart_bake_strokes");
uiItemO(col, NULL, ICON_NONE, "OBJECT_OT_lineart_bake_strokes_all");
uiItemO(col, nullptr, ICON_NONE, "OBJECT_OT_lineart_bake_strokes");
uiItemO(col, nullptr, ICON_NONE, "OBJECT_OT_lineart_bake_strokes_all");
col = uiLayoutColumn(layout, false);
uiItemO(col, NULL, ICON_NONE, "OBJECT_OT_lineart_clear");
uiItemO(col, NULL, ICON_NONE, "OBJECT_OT_lineart_clear_all");
uiItemO(col, nullptr, ICON_NONE, "OBJECT_OT_lineart_clear");
uiItemO(col, nullptr, ICON_NONE, "OBJECT_OT_lineart_clear_all");
}
static void composition_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void composition_panel_draw(const bContext * /*C*/, Panel *panel)
{
PointerRNA ob_ptr;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
@ -754,8 +770,8 @@ static void composition_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "overscan", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_image_boundary_trimming", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "overscan", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_image_boundary_trimming", 0, nullptr, ICON_NONE);
if (show_in_front) {
uiItemL(layout, TIP_("Object is shown in front"), ICON_ERROR);
@ -775,17 +791,17 @@ static void panelRegister(ARegionType *region_type)
region_type, eGpencilModifierType_Lineart, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "edge_types", "Edge Types", NULL, edge_types_panel_draw, panel_type);
region_type, "edge_types", "Edge Types", nullptr, edge_types_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"light_reference",
"Light Reference",
NULL,
nullptr,
options_light_reference_draw,
panel_type);
gpencil_modifier_subpanel_register(
region_type, "geometry", "Geometry Processing", NULL, options_panel_draw, panel_type);
region_type, "geometry", "Geometry Processing", nullptr, options_panel_draw, panel_type);
PanelType *occlusion_panel = gpencil_modifier_subpanel_register(
region_type, "occlusion", "Occlusion", NULL, occlusion_panel_draw, panel_type);
region_type, "occlusion", "Occlusion", nullptr, occlusion_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"material_mask",
"",
@ -793,17 +809,17 @@ static void panelRegister(ARegionType *region_type)
material_mask_panel_draw,
occlusion_panel);
gpencil_modifier_subpanel_register(
region_type, "intersection", "Intersection", NULL, intersection_panel_draw, panel_type);
region_type, "intersection", "Intersection", nullptr, intersection_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "face_mark", "", face_mark_panel_draw_header, face_mark_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "chaining", "Chaining", NULL, chaining_panel_draw, panel_type);
region_type, "chaining", "Chaining", nullptr, chaining_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "vgroup", "Vertex Weight Transfer", NULL, vgroup_panel_draw, panel_type);
region_type, "vgroup", "Vertex Weight Transfer", nullptr, vgroup_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "composition", "Composition", NULL, composition_panel_draw, panel_type);
region_type, "composition", "Composition", nullptr, composition_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "bake", "Bake", NULL, bake_panel_draw, panel_type);
region_type, "bake", "Bake", nullptr, bake_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Lineart = {
@ -815,17 +831,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lineart = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -94,7 +94,7 @@ static void update_mirror_object(Object *ob,
static void update_position(Object *ob, MirrorGpencilModifierData *mmd, bGPDstroke *gps, int axis)
{
if (mmd->object == NULL) {
if (mmd->object == nullptr) {
update_mirror_local(gps, axis);
}
else {
@ -106,8 +106,8 @@ static void generate_geometry(
GpencilModifierData *md, Object *ob, bGPDlayer *gpl, bGPDframe *gpf, const bool update)
{
MirrorGpencilModifierData *mmd = (MirrorGpencilModifierData *)md;
bGPdata *gpd = ob->data;
bGPDstroke *gps, *gps_new = NULL;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDstroke *gps, *gps_new = nullptr;
int tot_strokes;
int i;
@ -118,7 +118,9 @@ static void generate_geometry(
/* count strokes to avoid infinite loop after adding new strokes to tail of listbase */
tot_strokes = BLI_listbase_count(&gpf->strokes);
for (i = 0, gps = gpf->strokes.first; i < tot_strokes; i++, gps = gps->next) {
for (i = 0, gps = static_cast<bGPDstroke *>(gpf->strokes.first); i < tot_strokes;
i++, gps = gps->next)
{
if (is_stroke_affected_by_modifier(ob,
mmd->layername,
mmd->material,
@ -152,20 +154,20 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
generate_geometry(md, ob, gpl, gpf, false);
}
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
int oldframe = (int)DEG_get_ctime(depsgraph);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
@ -184,7 +186,7 @@ static void bakeModifier(Main *UNUSED(bmain),
BKE_scene_graph_update_for_newframe(depsgraph);
}
static bool isDisabled(GpencilModifierData *UNUSED(md), int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData * /*md*/, int /*userRenderParams*/)
{
// MirrorGpencilModifierData *mmd = (MirrorGpencilModifierData *)md;
@ -193,10 +195,10 @@ static bool isDisabled(GpencilModifierData *UNUSED(md), int UNUSED(userRenderPar
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
MirrorGpencilModifierData *lmd = (MirrorGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Mirror Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
}
@ -211,27 +213,27 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *row;
uiLayout *layout = panel->layout;
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
uiItemR(row, ptr, "use_axis_x", toggles_flag, NULL, ICON_NONE);
uiItemR(row, ptr, "use_axis_y", toggles_flag, NULL, ICON_NONE);
uiItemR(row, ptr, "use_axis_z", toggles_flag, NULL, ICON_NONE);
uiItemR(row, ptr, "use_axis_x", toggles_flag, nullptr, ICON_NONE);
uiItemR(row, ptr, "use_axis_y", toggles_flag, nullptr, ICON_NONE);
uiItemR(row, ptr, "use_axis_z", toggles_flag, nullptr, ICON_NONE);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -241,7 +243,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Mirror, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Mirror = {
@ -253,17 +255,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Mirror = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -101,9 +101,9 @@ static void duplicateStroke(Object *ob,
float fading_thickness,
float fading_opacity)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
int i;
bGPDstroke *new_gps = NULL;
bGPDstroke *new_gps = nullptr;
float stroke_normal[3];
bGPDspoint *pt;
float thickness_factor;
@ -118,20 +118,20 @@ static void duplicateStroke(Object *ob,
normalize_v3(stroke_normal);
}
float *t1_array = MEM_callocN(sizeof(float[3]) * gps->totpoints,
"duplicate_temp_result_array_1");
float *t2_array = MEM_callocN(sizeof(float[3]) * gps->totpoints,
"duplicate_temp_result_array_2");
float *t1_array = static_cast<float *>(
MEM_callocN(sizeof(float[3]) * gps->totpoints, "duplicate_temp_result_array_1"));
float *t2_array = static_cast<float *>(
MEM_callocN(sizeof(float[3]) * gps->totpoints, "duplicate_temp_result_array_2"));
pt = gps->points;
for (int j = 0; j < gps->totpoints; j++) {
float minter[3];
if (j == 0) {
minter_v3_v3v3v3_ref(minter, NULL, &pt[j].x, &pt[j + 1].x, stroke_normal);
minter_v3_v3v3v3_ref(minter, nullptr, &pt[j].x, &pt[j + 1].x, stroke_normal);
}
else if (j == gps->totpoints - 1) {
minter_v3_v3v3v3_ref(minter, &pt[j - 1].x, &pt[j].x, NULL, stroke_normal);
minter_v3_v3v3v3_ref(minter, &pt[j - 1].x, &pt[j].x, nullptr, stroke_normal);
}
else {
minter_v3_v3v3v3_ref(minter, &pt[j - 1].x, &pt[j].x, &pt[j + 1].x, stroke_normal);
@ -171,7 +171,7 @@ static void duplicateStroke(Object *ob,
}
}
/* Calc geometry data. */
if (new_gps != NULL) {
if (new_gps != nullptr) {
BKE_gpencil_stroke_geometry_update(gpd, new_gps);
}
MEM_freeN(t1_array);
@ -184,7 +184,7 @@ static void generate_geometry(GpencilModifierData *md, Object *ob, bGPDlayer *gp
MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
bGPDstroke *gps;
ListBase duplicates = {0};
for (gps = gpf->strokes.first; gps; gps = gps->next) {
for (gps = static_cast<bGPDstroke *>(gpf->strokes.first); gps; gps = gps->next) {
if (!is_stroke_affected_by_modifier(ob,
mmd->layername,
mmd->material,
@ -218,12 +218,12 @@ static void generate_geometry(GpencilModifierData *md, Object *ob, bGPDlayer *gp
}
}
static void bakeModifier(Main *UNUSED(bmain),
Depsgraph *UNUSED(depsgraph),
static void bakeModifier(Main * /*bmain*/,
Depsgraph * /*depsgraph*/,
GpencilModifierData *md,
Object *ob)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
@ -240,7 +240,7 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
generate_geometry(md, ob, gpl, gpf);
@ -254,52 +254,52 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "duplicates", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "duplicates", 0, nullptr, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(layout, RNA_int_get(ptr, "duplicates") > 0);
uiItemR(col, ptr, "distance", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "offset", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "distance", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "offset", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void fade_header_draw(const bContext *UNUSED(C), Panel *panel)
static void fade_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_fade", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_fade", 0, nullptr, ICON_NONE);
}
static void fade_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void fade_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_fade"));
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "fading_center", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "fading_thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "fading_opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "fading_center", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "fading_thickness", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
uiItemR(col, ptr, "fading_opacity", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -311,7 +311,7 @@ static void panelRegister(ARegionType *region_type)
gpencil_modifier_subpanel_register(
region_type, "fade", "", fade_header_draw, fade_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
@ -319,21 +319,21 @@ GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
/*structName*/ "MultiplyGpencilModifierData",
/*structSize*/ sizeof(MultiplyGpencilModifierData),
/*type*/ eGpencilModifierTypeType_Gpencil,
/*flags*/ 0,
/*flags*/ GpencilModifierTypeFlag(0),
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -74,9 +74,9 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
NoiseGpencilModifierData *gmd = (NoiseGpencilModifierData *)md;
NoiseGpencilModifierData *tgmd = (NoiseGpencilModifierData *)target;
if (tgmd->curve_intensity != NULL) {
if (tgmd->curve_intensity != nullptr) {
BKE_curvemapping_free(tgmd->curve_intensity);
tgmd->curve_intensity = NULL;
tgmd->curve_intensity = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
@ -92,7 +92,7 @@ static bool dependsOnTime(GpencilModifierData *md)
static float *noise_table(int len, int offset, int seed)
{
float *table = MEM_callocN(sizeof(float) * len, __func__);
float *table = static_cast<float *>(MEM_callocN(sizeof(float) * len, __func__));
for (int i = 0; i < len; i++) {
table[i] = BLI_hash_int_01(BLI_hash_int_2d(seed, i + offset + 1));
}
@ -115,7 +115,7 @@ static void deformStroke(GpencilModifierData *md,
bGPDstroke *gps)
{
NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
MDeformVert *dvert = NULL;
MDeformVert *dvert = nullptr;
/* Noise value in range [-1..1] */
float normal[3];
float vec1[3], vec2[3];
@ -166,16 +166,16 @@ static void deformStroke(GpencilModifierData *md,
int len = ceilf(gps->totpoints * noise_scale) + 2;
float *noise_table_position = (mmd->factor > 0.0f) ?
noise_table(len, (int)floor(mmd->noise_offset), seed + 2) :
NULL;
nullptr;
float *noise_table_strength = (mmd->factor_strength > 0.0f) ?
noise_table(len, (int)floor(mmd->noise_offset), seed + 3) :
NULL;
nullptr;
float *noise_table_thickness = (mmd->factor_thickness > 0.0f) ?
noise_table(len, (int)floor(mmd->noise_offset), seed) :
NULL;
nullptr;
float *noise_table_uvs = (mmd->factor_uvs > 0.0f) ?
noise_table(len, (int)floor(mmd->noise_offset), seed + 4) :
NULL;
nullptr;
/* Calculate stroke normal. */
if (gps->totpoints > 2) {
@ -192,7 +192,7 @@ static void deformStroke(GpencilModifierData *md,
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
/* verify vertex group */
dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
float weight = get_modifier_point_weight(dvert, invert_group, def_nr);
if (weight < 0.0f) {
continue;
@ -256,7 +256,7 @@ static void deformStroke(GpencilModifierData *md,
MEM_SAFE_FREE(noise_table_uvs);
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -271,12 +271,12 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
@ -285,41 +285,41 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(col, ptr, "factor_strength", 0, IFACE_("Strength"), ICON_NONE);
uiItemR(col, ptr, "factor_thickness", 0, IFACE_("Thickness"), ICON_NONE);
uiItemR(col, ptr, "factor_uvs", 0, IFACE_("UV"), ICON_NONE);
uiItemR(col, ptr, "noise_scale", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "noise_offset", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "seed", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "noise_scale", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "noise_offset", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "seed", 0, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void random_header_draw(const bContext *UNUSED(C), Panel *panel)
static void random_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_random", 0, IFACE_("Randomize"), ICON_NONE);
}
static void random_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void random_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_random"));
uiItemR(layout, ptr, "random_mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "random_mode", 0, nullptr, ICON_NONE);
const int mode = RNA_enum_get(ptr, "random_mode");
if (mode != GP_NOISE_RANDOM_KEYFRAME) {
uiItemR(layout, ptr, "step", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "step", 0, nullptr, ICON_NONE);
}
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -331,7 +331,7 @@ static void panelRegister(ARegionType *region_type)
gpencil_modifier_subpanel_register(
region_type, "randomize", "", random_header_draw, random_panel_draw, panel_type);
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"curve",
"",
@ -350,16 +350,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Noise = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ dependsOnTime,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -64,7 +64,7 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* Change stroke offset. */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *gpf,
@ -104,7 +104,7 @@ static void deformStroke(GpencilModifierData *md,
float rand[3][3];
float rand_offset = BLI_hash_int_01(seed);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
if (is_randomized && mmd->mode == GP_OFFSET_RANDOM) {
/* Get stroke index for random offset. */
@ -165,7 +165,7 @@ static void deformStroke(GpencilModifierData *md,
}
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify vertex group. */
const float weight = get_modifier_point_weight(
@ -212,7 +212,7 @@ static void deformStroke(GpencilModifierData *md,
BKE_gpencil_stroke_geometry_update(gpd, gps);
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -220,9 +220,9 @@ static void bakeModifier(struct Main *UNUSED(bmain),
generic_bake_deform_stroke(depsgraph, md, ob, false, deformStroke);
}
static void updateDepsgraph(GpencilModifierData *UNUSED(md),
static void updateDepsgraph(GpencilModifierData * /*md*/,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Offset Modifier");
}
@ -234,41 +234,41 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "location", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "rotation", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "scale", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "location", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "rotation", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "scale", 0, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
uiLayoutSetActive(layout, true);
}
static void empty_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void empty_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
gpencil_modifier_panel_end(layout, ptr);
}
static void random_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void random_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
uiLayout *col;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int mode = RNA_enum_get(ptr, "mode");
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "random_offset", 0, IFACE_("Offset"), ICON_NONE);
uiItemR(layout, ptr, "random_rotation", 0, IFACE_("Rotation"), ICON_NONE);
@ -277,8 +277,8 @@ static void random_panel_draw(const bContext *UNUSED(C), Panel *panel)
col = uiLayoutColumn(layout, true);
switch (mode) {
case GP_OFFSET_RANDOM:
uiItemR(layout, ptr, "use_uniform_random_scale", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "seed", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_uniform_random_scale", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "seed", 0, nullptr, ICON_NONE);
break;
case GP_OFFSET_STROKE:
uiItemR(col, ptr, "stroke_step", 0, IFACE_("Stroke Step"), ICON_NONE);
@ -296,7 +296,7 @@ static void random_panel_draw(const bContext *UNUSED(C), Panel *panel)
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -306,11 +306,11 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Offset, empty_panel_draw);
gpencil_modifier_subpanel_register(
region_type, "general", "General", NULL, panel_draw, panel_type);
region_type, "general", "General", nullptr, panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "randomize", "Advanced", NULL, random_panel_draw, panel_type);
region_type, "randomize", "Advanced", nullptr, random_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Offset = {
@ -323,16 +323,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Offset = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -57,9 +57,9 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
OpacityGpencilModifierData *gmd = (OpacityGpencilModifierData *)md;
OpacityGpencilModifierData *tgmd = (OpacityGpencilModifierData *)target;
if (tgmd->curve_intensity != NULL) {
if (tgmd->curve_intensity != nullptr) {
BKE_curvemapping_free(tgmd->curve_intensity);
tgmd->curve_intensity = NULL;
tgmd->curve_intensity = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
@ -69,10 +69,10 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* opacity strokes */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
OpacityGpencilModifierData *mmd = (OpacityGpencilModifierData *)md;
@ -108,7 +108,7 @@ static void deformStroke(GpencilModifierData *md,
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Stroke using strength. */
if (mmd->modify_color != GP_MODIFY_COLOR_FILL) {
@ -163,7 +163,7 @@ static void deformStroke(GpencilModifierData *md,
if ((mmd->flag & GP_OPACITY_WEIGHT_FACTOR) && (!is_normalized)) {
/* Use first point for weight. */
MDeformVert *dvert = (gps->dvert != NULL) ? &gps->dvert[0] : NULL;
MDeformVert *dvert = (gps->dvert != nullptr) ? &gps->dvert[0] : nullptr;
float weight = get_modifier_point_weight(
dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
if (weight >= 0.0f) {
@ -176,7 +176,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -200,26 +200,26 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
int modify_color = RNA_enum_get(ptr, "modify_color");
uiItemR(layout, ptr, "modify_color", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "modify_color", 0, nullptr, ICON_NONE);
if (modify_color == GP_MODIFY_COLOR_HARDNESS) {
uiItemR(layout, ptr, "hardness", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "hardness", 0, nullptr, ICON_NONE);
}
else {
const bool is_normalized = RNA_boolean_get(ptr, "use_normalized_opacity");
const bool is_weighted = RNA_boolean_get(ptr, "use_weight_factor");
uiItemR(layout, ptr, "use_normalized_opacity", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_normalized_opacity", 0, nullptr, ICON_NONE);
const char *text = (is_normalized) ? IFACE_("Strength") : IFACE_("Opacity Factor");
uiLayout *row = uiLayoutRow(layout, true);
@ -235,9 +235,9 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int modify_color = RNA_enum_get(ptr, "modify_color");
bool show_vertex = (modify_color != GP_MODIFY_COLOR_HARDNESS);
@ -249,7 +249,7 @@ static void curve_header_draw(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int modify_color = RNA_enum_get(ptr, "modify_color");
uiLayoutSetActive(layout, modify_color != GP_MODIFY_COLOR_HARDNESS);
@ -261,7 +261,7 @@ static void curve_panel_draw(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int modify_color = RNA_enum_get(ptr, "modify_color");
uiLayoutSetActive(layout, modify_color != GP_MODIFY_COLOR_HARDNESS);
@ -275,7 +275,7 @@ static void panelRegister(ARegionType *region_type)
region_type, eGpencilModifierType_Opacity, panel_draw);
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "curve", "", curve_header_draw, curve_panel_draw, mask_panel_type);
}
@ -290,16 +290,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Opacity = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -65,7 +65,7 @@ static void free_old_strokes(Depsgraph *depsgraph, Object *ob, bGPdata *gpd)
/* Free old strokes. */
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
LISTBASE_FOREACH_MUTABLE (bGPDstroke *, gps, &gpf->strokes) {
@ -157,7 +157,7 @@ static void convert_stroke(GpencilModifierData *md,
for (int i = 0; i < gps_perimeter->totpoints; i++) {
pt = &gps_perimeter->points[i];
pt->pressure = 1.0f;
pt->runtime.pt_orig = NULL;
pt->runtime.pt_orig = nullptr;
/* If any target object is defined, find the nearest point. */
if (mmd->object) {
float wpt[3];
@ -203,7 +203,7 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
if (gpf == nullptr) {
continue;
}
/* Prepare transform matrix. */
@ -220,13 +220,13 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
free_old_strokes(depsgraph, ob, gpd);
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
int oldframe = (int)DEG_get_ctime(depsgraph);
/* Calc camera view matrix. */
@ -274,7 +274,7 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
OutlineGpencilModifierData *lmd = (OutlineGpencilModifierData *)md;
if (ctx->scene->camera) {
@ -283,7 +283,7 @@ static void updateDepsgraph(GpencilModifierData *md,
DEG_add_object_relation(
ctx->node, ctx->scene->camera, DEG_OB_COMP_PARAMETERS, "Outline Modifier");
}
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Outline Modifier");
}
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Outline Modifier");
@ -293,26 +293,26 @@ static void panel_draw(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "thickness", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_keep_shape", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "subdivision", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "sample_length", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "outline_material", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "thickness", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_keep_shape", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "subdivision", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "sample_length", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "outline_material", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE);
Scene *scene = CTX_data_scene(C);
if (scene->camera == NULL) {
if (scene->camera == nullptr) {
uiItemL(layout, IFACE_("Outline requires an active camera"), ICON_ERROR);
}
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -322,7 +322,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Outline, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Outline = {
@ -334,17 +334,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Outline = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ generateStrokes,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -64,13 +64,13 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
}
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
ShrinkwrapGpencilModifierData *mmd = (ShrinkwrapGpencilModifierData *)md;
const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
@ -90,12 +90,13 @@ static void deformStroke(GpencilModifierData *md,
return;
}
if ((mmd->cache_data == NULL) || (mmd->target == ob) || (mmd->aux_target == ob)) {
if ((mmd->cache_data == nullptr) || (mmd->target == ob) || (mmd->aux_target == ob)) {
return;
}
bGPDspoint *pt = gps->points;
float(*vert_coords)[3] = MEM_mallocN(sizeof(float[3]) * gps->totpoints, __func__);
float(*vert_coords)[3] = static_cast<float(*)[3]>(
MEM_mallocN(sizeof(float[3]) * gps->totpoints, __func__));
int i;
/* Prepare array of points. */
for (i = 0; i < gps->totpoints; i++, pt++) {
@ -114,20 +115,20 @@ static void deformStroke(GpencilModifierData *md,
/* Smooth stroke. */
BKE_gpencil_stroke_smooth(
gps, mmd->smooth_factor, mmd->smooth_step, true, false, false, false, true, NULL);
gps, mmd->smooth_factor, mmd->smooth_step, true, false, false, false, true, nullptr);
/* Calc geometry data. */
BKE_gpencil_stroke_geometry_update(gpd, gps);
}
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
ShrinkwrapGpencilModifierData *mmd = (ShrinkwrapGpencilModifierData *)md;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
int oldframe = (int)DEG_get_ctime(depsgraph);
if ((mmd->target == ob) || (mmd->aux_target == ob)) {
@ -147,7 +148,8 @@ static void bakeModifier(Main *UNUSED(bmain),
}
Object *ob_target = DEG_get_evaluated_object(depsgraph, mmd->target);
Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
mmd->cache_data = MEM_callocN(sizeof(ShrinkwrapTreeData), __func__);
mmd->cache_data = static_cast<ShrinkwrapTreeData *>(
MEM_callocN(sizeof(ShrinkwrapTreeData), __func__));
if (BKE_shrinkwrap_init_tree(
mmd->cache_data, target, mmd->shrink_type, mmd->shrink_mode, false)) {
@ -178,7 +180,7 @@ static void freeData(GpencilModifierData *md)
}
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
ShrinkwrapGpencilModifierData *mmd = (ShrinkwrapGpencilModifierData *)md;
@ -198,7 +200,7 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
ShrinkwrapGpencilModifierData *mmd = (ShrinkwrapGpencilModifierData *)md;
CustomData_MeshMasks mask = {0};
@ -207,7 +209,7 @@ static void updateDepsgraph(GpencilModifierData *md,
mask.lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
}
if (mmd->target != NULL) {
if (mmd->target != nullptr) {
DEG_add_object_relation(ctx->node, mmd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
DEG_add_object_relation(ctx->node, mmd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
DEG_add_customdata_mask(ctx->node, mmd->target, &mask);
@ -215,7 +217,7 @@ static void updateDepsgraph(GpencilModifierData *md,
DEG_add_special_eval_flag(ctx->node, &mmd->target->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
}
}
if (mmd->aux_target != NULL) {
if (mmd->aux_target != nullptr) {
DEG_add_object_relation(
ctx->node, mmd->aux_target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
DEG_add_object_relation(
@ -238,64 +240,64 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *row, *col;
uiLayout *layout = panel->layout;
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
int wrap_method = RNA_enum_get(ptr, "wrap_method");
uiItemR(layout, ptr, "wrap_method", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "wrap_method", 0, nullptr, ICON_NONE);
if (ELEM(wrap_method,
MOD_SHRINKWRAP_PROJECT,
MOD_SHRINKWRAP_NEAREST_SURFACE,
MOD_SHRINKWRAP_TARGET_PROJECT))
{
uiItemR(layout, ptr, "wrap_mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "wrap_mode", 0, nullptr, ICON_NONE);
}
if (wrap_method == MOD_SHRINKWRAP_PROJECT) {
uiItemR(layout, ptr, "project_limit", 0, IFACE_("Limit"), ICON_NONE);
uiItemR(layout, ptr, "subsurf_levels", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "subsurf_levels", 0, nullptr, ICON_NONE);
col = uiLayoutColumn(layout, false);
row = uiLayoutRowWithHeading(col, true, IFACE_("Axis"));
uiItemR(row, ptr, "use_project_x", toggles_flag, NULL, ICON_NONE);
uiItemR(row, ptr, "use_project_y", toggles_flag, NULL, ICON_NONE);
uiItemR(row, ptr, "use_project_z", toggles_flag, NULL, ICON_NONE);
uiItemR(row, ptr, "use_project_x", toggles_flag, nullptr, ICON_NONE);
uiItemR(row, ptr, "use_project_y", toggles_flag, nullptr, ICON_NONE);
uiItemR(row, ptr, "use_project_z", toggles_flag, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_negative_direction", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_positive_direction", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_negative_direction", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "use_positive_direction", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "cull_face", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "cull_face", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col,
RNA_boolean_get(ptr, "use_negative_direction") &&
RNA_enum_get(ptr, "cull_face") != 0);
uiItemR(col, ptr, "use_invert_cull", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_invert_cull", 0, nullptr, ICON_NONE);
}
uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "target", 0, nullptr, ICON_NONE);
if (wrap_method == MOD_SHRINKWRAP_PROJECT) {
uiItemR(layout, ptr, "auxiliary_target", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "auxiliary_target", 0, nullptr, ICON_NONE);
}
uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "offset", 0, nullptr, ICON_NONE);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "smooth_factor", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "smooth_factor", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "smooth_step", 0, IFACE_("Repeat"), ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -305,7 +307,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Shrinkwrap, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Shrinkwrap = {
@ -318,16 +320,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Shrinkwrap = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -53,7 +53,7 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
}
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *gpf,
@ -76,7 +76,7 @@ static void deformStroke(GpencilModifierData *md,
{
return;
}
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
/* Select simplification mode. */
switch (mmd->mode) {
case GP_SIMPLIFY_FIXED: {
@ -103,7 +103,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -118,36 +118,36 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int mode = RNA_enum_get(ptr, "mode");
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
if (mode == GP_SIMPLIFY_FIXED) {
uiItemR(layout, ptr, "step", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "step", 0, nullptr, ICON_NONE);
}
else if (mode == GP_SIMPLIFY_ADAPTIVE) {
uiItemR(layout, ptr, "factor", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "factor", 0, nullptr, ICON_NONE);
}
else if (mode == GP_SIMPLIFY_SAMPLE) {
uiItemR(layout, ptr, "length", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "sharp_threshold", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "length", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "sharp_threshold", 0, nullptr, ICON_NONE);
}
else if (mode == GP_SIMPLIFY_MERGE) {
uiItemR(layout, ptr, "distance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "distance", 0, nullptr, ICON_NONE);
}
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -157,7 +157,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Simplify, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Simplify = {
@ -170,16 +170,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Simplify = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -60,9 +60,9 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
SmoothGpencilModifierData *gmd = (SmoothGpencilModifierData *)md;
SmoothGpencilModifierData *tgmd = (SmoothGpencilModifierData *)target;
if (tgmd->curve_intensity != NULL) {
if (tgmd->curve_intensity != nullptr) {
BKE_curvemapping_free(tgmd->curve_intensity);
tgmd->curve_intensity = NULL;
tgmd->curve_intensity = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
@ -74,10 +74,10 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
* Apply smooth effect based on stroke direction.
*/
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
SmoothGpencilModifierData *mmd = (SmoothGpencilModifierData *)md;
@ -104,12 +104,12 @@ static void deformStroke(GpencilModifierData *md,
return;
}
float *weights = NULL;
float *weights = nullptr;
if (def_nr != -1 || use_curve) {
weights = MEM_malloc_arrayN(gps->totpoints, sizeof(*weights), __func__);
weights = static_cast<float *>(MEM_malloc_arrayN(gps->totpoints, sizeof(*weights), __func__));
/* Calculate weights. */
for (int i = 0; i < gps->totpoints; i++) {
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify vertex group. */
float weight = get_modifier_point_weight(
@ -136,7 +136,7 @@ static void deformStroke(GpencilModifierData *md,
MEM_SAFE_FREE(weights);
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -160,12 +160,12 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *row, *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
row = uiLayoutRow(layout, true);
uiItemR(row, ptr, "use_edit_position", UI_ITEM_R_TOGGLE, IFACE_("Position"), ICON_NONE);
@ -175,17 +175,17 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "factor", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "factor", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "step", 0, IFACE_("Repeat"), ICON_NONE);
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_edit_position"));
uiItemR(col, ptr, "use_keep_shape", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_keep_shape", 0, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -195,7 +195,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Smooth, panel_draw);
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"curve",
"",
@ -214,16 +214,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Smooth = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -52,14 +52,14 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* subdivide stroke to get more control points */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md;
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
if (!is_stroke_affected_by_modifier(ob,
mmd->layername,
@ -83,7 +83,7 @@ static void deformStroke(GpencilModifierData *md,
BKE_gpencil_stroke_subdivide(gpd, gps, mmd->level, type);
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -98,21 +98,21 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "subdivision_type", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "subdivision_type", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "level", 0, IFACE_("Subdivisions"), ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
@ -122,7 +122,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Subdiv, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = {
@ -135,16 +135,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -56,15 +56,15 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* change stroke uv texture values */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
TextureGpencilModifierData *mmd = (TextureGpencilModifierData *)md;
const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
if (!is_stroke_affected_by_modifier(ob,
mmd->layername,
@ -100,7 +100,7 @@ static void deformStroke(GpencilModifierData *md,
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify point is part of vertex group. */
float weight = get_modifier_point_weight(
dvert, (mmd->flag & GP_TEX_INVERT_VGROUP) != 0, def_nr);
@ -116,7 +116,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -131,24 +131,24 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int mode = RNA_enum_get(ptr, "mode");
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
if (ELEM(mode, STROKE, STROKE_AND_FILL)) {
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "fit_method", 0, IFACE_("Stroke Fit Method"), ICON_NONE);
uiItemR(col, ptr, "uv_offset", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "alignment_rotation", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "uv_offset", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "alignment_rotation", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "uv_scale", 0, IFACE_("Scale"), ICON_NONE);
}
@ -158,7 +158,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
if (ELEM(mode, FILL, STROKE_AND_FILL)) {
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "fill_rotation", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "fill_rotation", 0, nullptr, ICON_NONE);
uiItemR(col, ptr, "fill_offset", 0, IFACE_("Offset"), ICON_NONE);
uiItemR(col, ptr, "fill_scale", 0, IFACE_("Scale"), ICON_NONE);
}
@ -166,7 +166,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -176,7 +176,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Texture, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Texture = {
@ -189,16 +189,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Texture = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -66,9 +66,9 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
ThickGpencilModifierData *gmd = (ThickGpencilModifierData *)md;
ThickGpencilModifierData *tgmd = (ThickGpencilModifierData *)target;
if (tgmd->curve_thickness != NULL) {
if (tgmd->curve_thickness != nullptr) {
BKE_curvemapping_free(tgmd->curve_thickness);
tgmd->curve_thickness = NULL;
tgmd->curve_thickness = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
@ -78,10 +78,10 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* change stroke thickness */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
@ -110,7 +110,7 @@ static void deformStroke(GpencilModifierData *md,
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify point is part of vertex group. */
float weight = get_modifier_point_weight(dvert, is_inverted, def_nr);
if (weight < 0.0f) {
@ -148,7 +148,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -163,23 +163,23 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "use_normalized_thickness", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_normalized_thickness", 0, nullptr, ICON_NONE);
if (RNA_boolean_get(ptr, "use_normalized_thickness")) {
uiItemR(layout, ptr, "thickness", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "thickness", 0, nullptr, ICON_NONE);
}
else {
const bool is_weighted = !RNA_boolean_get(ptr, "use_weight_factor");
uiLayout *row = uiLayoutRow(layout, true);
uiLayoutSetActive(row, is_weighted);
uiItemR(row, ptr, "thickness_factor", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "thickness_factor", 0, nullptr, ICON_NONE);
uiLayout *sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, true);
uiItemR(row, ptr, "use_weight_factor", 0, "", ICON_MOD_VERTEX_WEIGHT);
@ -188,7 +188,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -198,7 +198,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Thick, panel_draw);
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"curve",
"",
@ -217,16 +217,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Thick = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -70,7 +70,7 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
TimeGpencilModifierData *gpmd = (TimeGpencilModifierData *)target;
const TimeGpencilModifierData *gpmd_src = (const TimeGpencilModifierData *)md;
BKE_gpencil_modifier_copydata_generic(md, target);
gpmd->segments = MEM_dupallocN(gpmd_src->segments);
gpmd->segments = static_cast<TimeGpencilModifierSegment *>(MEM_dupallocN(gpmd_src->segments));
}
static void freeData(GpencilModifierData *md)
@ -81,9 +81,9 @@ static void freeData(GpencilModifierData *md)
}
static int remapTime(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Scene *scene,
Object *UNUSED(ob),
Object * /*ob*/,
bGPDlayer *gpl,
int cfra)
{
@ -204,7 +204,8 @@ static int remapTime(GpencilModifierData *md,
sequence_length += ((end - start + 1) * mmd->segments[i].seg_repeat);
}
}
segment_arr = MEM_malloc_arrayN(sequence_length, sizeof(int *), __func__);
segment_arr = static_cast<int *>(
MEM_malloc_arrayN(sequence_length, sizeof(int *), __func__));
for (int i = 0; i < mmd->segments_len; i++) {
@ -267,16 +268,16 @@ static int remapTime(GpencilModifierData *md,
return nfra;
}
static void segment_list_item(uiList *UNUSED(ui_list),
const bContext *UNUSED(C),
static void segment_list_item(uiList * /*ui_list*/,
const bContext * /*C*/,
uiLayout *layout,
PointerRNA *UNUSED(idataptr),
PointerRNA * /*idataptr*/,
PointerRNA *itemptr,
int UNUSED(icon),
PointerRNA *UNUSED(active_dataptr),
const char *UNUSED(active_propname),
int UNUSED(index),
int UNUSED(flt_flag))
int /*icon*/,
PointerRNA * /*active_dataptr*/,
const char * /*active_propname*/,
int /*index*/,
int /*flt_flag*/)
{
uiLayout *row = uiLayoutRow(layout, true);
uiItemR(row, itemptr, "name", UI_ITEM_R_NO_BG, "", ICON_NONE);
@ -292,13 +293,13 @@ static void panel_draw(const bContext *C, Panel *panel)
uiLayout *row, *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int mode = RNA_enum_get(ptr, "mode");
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "mode", 0, nullptr, ICON_NONE);
col = uiLayoutColumn(layout, false);
@ -311,7 +312,7 @@ static void panel_draw(const bContext *C, Panel *panel)
row = uiLayoutRow(layout, false);
uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX);
uiItemR(row, ptr, "use_keep_loop", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "use_keep_loop", 0, nullptr, ICON_NONE);
if (mode == GP_TIME_MODE_CHAIN) {
@ -326,7 +327,7 @@ static void panel_draw(const bContext *C, Panel *panel)
"segments",
ptr,
"segment_active_index",
NULL,
nullptr,
3,
10,
0,
@ -344,7 +345,7 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemEnumO_string(sub, "", ICON_TRIA_UP, "GPENCIL_OT_time_segment_move", "type", "UP");
uiItemEnumO_string(sub, "", ICON_TRIA_DOWN, "GPENCIL_OT_time_segment_move", "type", "DOWN");
TimeGpencilModifierData *gpmd = ptr->data;
TimeGpencilModifierData *gpmd = static_cast<TimeGpencilModifierData *>(ptr->data);
if (gpmd->segment_active_index >= 0 && gpmd->segment_active_index < gpmd->segments_len) {
PointerRNA ds_ptr;
RNA_pointer_create(ptr->owner_id,
@ -353,11 +354,11 @@ static void panel_draw(const bContext *C, Panel *panel)
&ds_ptr);
sub = uiLayoutColumn(layout, true);
uiItemR(sub, &ds_ptr, "seg_mode", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "seg_mode", 0, nullptr, ICON_NONE);
sub = uiLayoutColumn(layout, true);
uiItemR(sub, &ds_ptr, "seg_start", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "seg_end", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "seg_repeat", 0, NULL, ICON_NONE);
uiItemR(sub, &ds_ptr, "seg_start", 0, nullptr, ICON_NONE);
uiItemR(sub, &ds_ptr, "seg_end", 0, nullptr, ICON_NONE);
uiItemR(sub, &ds_ptr, "seg_repeat", 0, nullptr, ICON_NONE);
}
gpencil_modifier_panel_end(layout, ptr);
@ -366,25 +367,25 @@ static void panel_draw(const bContext *C, Panel *panel)
gpencil_modifier_panel_end(layout, ptr);
}
static void custom_range_header_draw(const bContext *UNUSED(C), Panel *panel)
static void custom_range_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int mode = RNA_enum_get(ptr, "mode");
uiLayoutSetActive(layout, !ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN));
uiItemR(layout, ptr, "use_custom_frame_range", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_custom_frame_range", 0, nullptr, ICON_NONE);
}
static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void custom_range_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int mode = RNA_enum_get(ptr, "mode");
@ -398,7 +399,7 @@ static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(col, ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, false, false);
}
@ -414,9 +415,10 @@ static void panelRegister(ARegionType *region_type)
custom_range_panel_draw,
panel_type);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
uiListType *list_type = MEM_callocN(sizeof(uiListType), "time modifier segment uilist");
uiListType *list_type = static_cast<uiListType *>(
MEM_callocN(sizeof(uiListType), "time modifier segment uilist"));
STRNCPY(list_type->idname, "MOD_UL_time_segment");
list_type->draw_item = segment_list_item;
WM_uilisttype_add(list_type);
@ -431,17 +433,17 @@ GpencilModifierTypeInfo modifierType_Gpencil_Time = {
/*copyData*/ copyData,
/*deformStroke*/ NULL,
/*generateStrokes*/ NULL,
/*bakeModifier*/ NULL,
/*deformStroke*/ nullptr,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ nullptr,
/*remapTime*/ remapTime,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*isDisabled*/ nullptr,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -84,15 +84,15 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
MEM_SAFE_FREE(tgmd->colorband);
if (tgmd->curve_intensity != NULL) {
if (tgmd->curve_intensity != nullptr) {
BKE_curvemapping_free(tgmd->curve_intensity);
tgmd->curve_intensity = NULL;
tgmd->curve_intensity = nullptr;
}
BKE_gpencil_modifier_copydata_generic(md, target);
if (gmd->colorband) {
tgmd->colorband = MEM_dupallocN(gmd->colorband);
tgmd->colorband = static_cast<ColorBand *>(MEM_dupallocN(gmd->colorband));
}
tgmd->curve_intensity = BKE_curvemapping_copy(gmd->curve_intensity);
@ -100,10 +100,10 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* deform stroke */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
TintGpencilModifierData *mmd = (TintGpencilModifierData *)md;
@ -153,7 +153,7 @@ static void deformStroke(GpencilModifierData *md,
bool fill_done = false;
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
if (!fill_done) {
/* Apply to fill. */
@ -163,7 +163,7 @@ static void deformStroke(GpencilModifierData *md,
/* Use weighted factor. */
if (mmd->flag & GP_TINT_WEIGHT_FACTOR) {
/* Use first point for weight. */
MDeformVert *dvert_fill = (gps->dvert != NULL) ? &gps->dvert[0] : NULL;
MDeformVert *dvert_fill = (gps->dvert != nullptr) ? &gps->dvert[0] : nullptr;
float weight = get_modifier_point_weight(dvert_fill, is_inverted, def_nr);
if (weight >= 0.0f) {
fill_factor = ((mmd->flag & GP_TINT_INVERT_VGROUP) ? 1.0f - weight : weight);
@ -171,7 +171,7 @@ static void deformStroke(GpencilModifierData *md,
}
/* If not using Vertex Color, use the material color. */
if ((gp_style != NULL) && (gps->vert_color_fill[3] == 0.0f) &&
if ((gp_style != nullptr) && (gps->vert_color_fill[3] == 0.0f) &&
(gp_style->fill_rgba[3] > 0.0f)) {
copy_v4_v4(gps->vert_color_fill, gp_style->fill_rgba);
gps->vert_color_fill[3] = 1.0f;
@ -221,7 +221,8 @@ static void deformStroke(GpencilModifierData *md,
}
/* If not using Vertex Color, use the material color. */
if ((gp_style != NULL) && (pt->vert_color[3] == 0.0f) && (gp_style->stroke_rgba[3] > 0.0f)) {
if ((gp_style != nullptr) && (pt->vert_color[3] == 0.0f) &&
(gp_style->stroke_rgba[3] > 0.0f)) {
copy_v4_v4(pt->vert_color, gp_style->stroke_rgba);
pt->vert_color[3] = 1.0f;
}
@ -258,14 +259,14 @@ static void deformStroke(GpencilModifierData *md,
/* FIXME: Ideally we be doing this on a copy of the main depsgraph
* (i.e. one where we don't have to worry about restoring state)
*/
static void bakeModifier(Main *UNUSED(bmain),
static void bakeModifier(Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
{
TintGpencilModifierData *mmd = (TintGpencilModifierData *)md;
if ((mmd->type == GP_TINT_GRADIENT) && (mmd->object == NULL)) {
if ((mmd->type == GP_TINT_GRADIENT) && (mmd->object == nullptr)) {
return;
}
@ -281,7 +282,7 @@ static void freeData(GpencilModifierData *md)
}
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
TintGpencilModifierData *mmd = (TintGpencilModifierData *)md;
if (mmd->type == GP_TINT_UNIFORM) {
@ -293,10 +294,10 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
TintGpencilModifierData *lmd = (TintGpencilModifierData *)md;
if (lmd->object != NULL) {
if (lmd->object != nullptr) {
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Vertexcolor Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Vertexcolor Modifier");
}
@ -311,45 +312,45 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
int tint_type = RNA_enum_get(ptr, "tint_type");
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "vertex_mode", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "vertex_mode", 0, nullptr, ICON_NONE);
const bool is_weighted = !RNA_boolean_get(ptr, "use_weight_factor");
uiLayout *row = uiLayoutRow(layout, true);
uiLayoutSetActive(row, is_weighted);
uiItemR(row, ptr, "factor", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "factor", 0, nullptr, ICON_NONE);
uiLayout *sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, true);
uiItemR(row, ptr, "use_weight_factor", 0, "", ICON_MOD_VERTEX_WEIGHT);
uiItemR(layout, ptr, "tint_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "tint_type", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
if (tint_type == GP_TINT_UNIFORM) {
uiItemR(layout, ptr, "color", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "color", 0, nullptr, ICON_NONE);
}
else {
col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, false);
uiTemplateColorRamp(col, ptr, "colors", true);
uiItemS(layout);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "radius", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "radius", 0, nullptr, ICON_NONE);
}
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -359,7 +360,7 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Tint, panel_draw);
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"curve",
"",
@ -378,16 +379,16 @@ GpencilModifierTypeInfo modifierType_Gpencil_Tint = {
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ freeData,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -38,11 +38,11 @@
/**
* Poll function so these modifier panels only show for grease pencil objects.
*/
static bool gpencil_modifier_ui_poll(const bContext *C, PanelType *UNUSED(pt))
static bool gpencil_modifier_ui_poll(const bContext *C, PanelType * /*pt*/)
{
Object *ob = ED_object_active_context(C);
return (ob != NULL) && (ob->type == OB_GPENCIL_LEGACY);
return (ob != nullptr) && (ob->type == OB_GPENCIL_LEGACY);
}
/* -------------------------------------------------------------------- */
@ -62,18 +62,18 @@ static void gpencil_modifier_reorder(bContext *C, Panel *panel, int new_index)
WM_operator_properties_create_ptr(&props_ptr, ot);
RNA_string_set(&props_ptr, "modifier", md->name);
RNA_int_set(&props_ptr, "index", new_index);
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, NULL);
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, nullptr);
WM_operator_properties_free(&props_ptr);
}
static short get_gpencil_modifier_expand_flag(const bContext *UNUSED(C), Panel *panel)
static short get_gpencil_modifier_expand_flag(const bContext * /*C*/, Panel *panel)
{
PointerRNA *md_ptr = UI_panel_custom_data_get(panel);
GpencilModifierData *md = (GpencilModifierData *)md_ptr->data;
return md->ui_expand_flag;
}
static void set_gpencil_modifier_expand_flag(const bContext *UNUSED(C),
static void set_gpencil_modifier_expand_flag(const bContext * /*C*/,
Panel *panel,
short expand_flag)
{
@ -103,14 +103,14 @@ void gpencil_modifier_masking_panel_draw(Panel *panel, bool use_material, bool u
col = uiLayoutColumn(layout, true);
row = uiLayoutRow(col, true);
uiItemPointerR(row, ptr, "layer", &obj_data_ptr, "layers", NULL, ICON_GREASEPENCIL);
uiItemPointerR(row, ptr, "layer", &obj_data_ptr, "layers", nullptr, ICON_GREASEPENCIL);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_layer);
uiLayoutSetPropDecorate(sub, false);
uiItemR(sub, ptr, "invert_layers", 0, "", ICON_ARROW_LEFTRIGHT);
row = uiLayoutRow(col, true);
uiItemR(row, ptr, "layer_pass", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "layer_pass", 0, nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, RNA_int_get(ptr, "layer_pass") != 0);
uiLayoutSetPropDecorate(sub, false);
@ -128,8 +128,8 @@ void gpencil_modifier_masking_panel_draw(Panel *panel, bool use_material, bool u
valid = true;
}
else {
Material *current_material = material_ptr.data;
Object *ob = ob_ptr.data;
Material *current_material = static_cast<Material *>(material_ptr.data);
Object *ob = static_cast<Object *>(ob_ptr.data);
for (int i = 0; i <= ob->totcol; i++) {
Material *mat = BKE_object_material_get(ob, i);
if (mat == current_material) {
@ -148,7 +148,7 @@ void gpencil_modifier_masking_panel_draw(Panel *panel, bool use_material, bool u
"material",
&obj_data_ptr,
"materials",
NULL,
nullptr,
valid ? ICON_SHADING_TEXTURE : ICON_ERROR);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_material);
@ -156,7 +156,7 @@ void gpencil_modifier_masking_panel_draw(Panel *panel, bool use_material, bool u
uiItemR(sub, ptr, "invert_materials", 0, "", ICON_ARROW_LEFTRIGHT);
row = uiLayoutRow(col, true);
uiItemR(row, ptr, "pass_index", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "pass_index", 0, nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, RNA_int_get(ptr, "pass_index") != 0);
uiLayoutSetPropDecorate(sub, false);
@ -167,7 +167,7 @@ void gpencil_modifier_masking_panel_draw(Panel *panel, bool use_material, bool u
bool has_vertex_group = RNA_string_length(ptr, "vertex_group") != 0;
row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
uiItemPointerR(row, ptr, "vertex_group", &ob_ptr, "vertex_groups", nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
uiLayoutSetPropDecorate(sub, false);
@ -175,27 +175,27 @@ void gpencil_modifier_masking_panel_draw(Panel *panel, bool use_material, bool u
}
}
void gpencil_modifier_curve_header_draw(const bContext *UNUSED(C), Panel *panel)
void gpencil_modifier_curve_header_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiItemR(layout, ptr, "use_custom_curve", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_custom_curve", 0, nullptr, ICON_NONE);
}
void gpencil_modifier_curve_panel_draw(const bContext *UNUSED(C), Panel *panel)
void gpencil_modifier_curve_panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, nullptr);
uiTemplateCurveMapping(layout, ptr, "curve", 0, false, false, false, false);
}
void gpencil_modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
{
GpencilModifierData *md = ptr->data;
GpencilModifierData *md = static_cast<GpencilModifierData *>(ptr->data);
if (md->error) {
uiLayout *row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_(md->error), ICON_ERROR);
@ -211,7 +211,7 @@ PointerRNA *gpencil_modifier_panel_get_property_pointers(Panel *panel, PointerRN
PointerRNA *ptr = UI_panel_custom_data_get(panel);
BLI_assert(RNA_struct_is_a(ptr->type, &RNA_GpencilModifier));
if (r_ob_ptr != NULL) {
if (r_ob_ptr != nullptr) {
RNA_pointer_create(ptr->owner_id, &RNA_Object, ptr->owner_id, r_ob_ptr);
}
@ -229,7 +229,8 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void
PointerRNA op_ptr;
uiLayout *row;
GpencilModifierData *md = (GpencilModifierData *)md_v;
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(
GpencilModifierType(md->type));
PointerRNA ptr;
Object *ob = ED_object_active_context(C);
@ -266,7 +267,7 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void
"OBJECT_OT_gpencil_modifier_move_to_index",
IFACE_("Move to First"),
ICON_TRIA_UP,
NULL,
nullptr,
WM_OP_INVOKE_DEFAULT,
0,
&op_ptr);
@ -281,7 +282,7 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void
"OBJECT_OT_gpencil_modifier_move_to_index",
IFACE_("Move to Last"),
ICON_TRIA_DOWN,
NULL,
nullptr,
WM_OP_INVOKE_DEFAULT,
0,
&op_ptr);
@ -291,7 +292,7 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void
}
}
static void gpencil_modifier_panel_header(const bContext *UNUSED(C), Panel *panel)
static void gpencil_modifier_panel_header(const bContext * /*C*/, Panel *panel)
{
uiLayout *row, *sub;
uiLayout *layout = panel->layout;
@ -301,7 +302,8 @@ static void gpencil_modifier_panel_header(const bContext *UNUSED(C), Panel *pane
UI_panel_context_pointer_set(panel, "modifier", ptr);
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(
GpencilModifierType(md->type));
bool narrow_panel = (panel->sizex < UI_UNIT_X * 9 && panel->sizex != 0);
/* Modifier Icon. */
@ -351,7 +353,7 @@ PanelType *gpencil_modifier_panel_register(ARegionType *region_type,
GpencilModifierType type,
PanelDrawFn draw)
{
PanelType *panel_type = MEM_callocN(sizeof(PanelType), __func__);
PanelType *panel_type = static_cast<PanelType *>(MEM_callocN(sizeof(PanelType), __func__));
BKE_gpencil_modifierType_panel_id(type, panel_type->idname);
STRNCPY(panel_type->label, "");
@ -381,7 +383,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
PanelDrawFn draw,
PanelType *parent)
{
PanelType *panel_type = MEM_callocN(sizeof(PanelType), __func__);
PanelType *panel_type = static_cast<PanelType *>(MEM_callocN(sizeof(PanelType), __func__));
SNPRINTF(panel_type->idname, "%s_%s", parent->idname, name);
STRNCPY(panel_type->label, label);
@ -393,7 +395,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
panel_type->poll = gpencil_modifier_ui_poll;
panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED;
BLI_assert(parent != NULL);
BLI_assert(parent != nullptr);
STRNCPY(panel_type->parent_id, parent->idname);
panel_type->parent = parent;
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));

View File

@ -92,7 +92,7 @@ bool is_stroke_affected_by_modifier(Object *ob,
}
}
/* Omit if filter by material. */
if (material != NULL) {
if (material != nullptr) {
/* Requires to use the original material to compare the same pointer address. */
Material *ma_md_orig = (Material *)DEG_get_original_id(&material->id);
Material *ma_gps_orig = (Material *)DEG_get_original_id(&ma_gps->id);
@ -145,7 +145,7 @@ float get_modifier_point_weight(const MDeformVert *dvert, bool inverse, int def_
{
float weight = 1.0f;
if ((dvert != NULL) && (def_nr != -1)) {
if ((dvert != nullptr) && (def_nr != -1)) {
MDeformWeight *dw = BKE_defvert_find_index(dvert, def_nr);
weight = dw ? dw->weight : -1.0f;
if ((weight >= 0.0f) && (inverse)) {
@ -163,7 +163,7 @@ float get_modifier_point_weight(const MDeformVert *dvert, bool inverse, int def_
}
/* handle special empty groups */
if ((dvert == NULL) && (def_nr != -1)) {
if ((dvert == nullptr) && (def_nr != -1)) {
if (inverse == 1) {
return 1.0f;
}
@ -178,7 +178,7 @@ void generic_bake_deform_stroke(
Depsgraph *depsgraph, GpencilModifierData *md, Object *ob, const bool retime, gpBakeCb bake_cb)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
int oldframe = (int)DEG_get_ctime(depsgraph);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {

View File

@ -8,6 +8,10 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct Depsgraph;
struct GpencilModifierData;
struct MDeformVert;
@ -52,3 +56,7 @@ void generic_bake_deform_stroke(struct Depsgraph *depsgraph,
struct Object *ob,
bool retime,
gpBakeCb bake_cb);
#ifdef __cplusplus
}
#endif

View File

@ -57,10 +57,10 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
/* change stroke thickness */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
WeightAngleGpencilModifierData *mmd = (WeightAngleGpencilModifierData *)md;
@ -107,7 +107,7 @@ static void deformStroke(GpencilModifierData *md,
float weight_pt = 1.0f;
for (int i = 0; i < gps->totpoints; i++) {
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify point is part of vertex group. */
float weight = get_modifier_point_weight(
dvert, (mmd->flag & GP_WEIGHT_INVERT_VGROUP) != 0, def_nr);
@ -138,8 +138,8 @@ static void deformStroke(GpencilModifierData *md,
weight_pt = 1.0f - weight_pt;
}
/* Assign weight. */
dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
if (dvert != NULL) {
dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
if (dvert != nullptr) {
MDeformWeight *dw = BKE_defvert_ensure_index(dvert, target_def_nr);
if (dw) {
dw->weight = (mmd->flag & GP_WEIGHT_MULTIPLY_DATA) ? dw->weight * weight_pt : weight_pt;
@ -149,7 +149,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -164,14 +164,14 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
WeightAngleGpencilModifierData *mmd = (WeightAngleGpencilModifierData *)md;
return (mmd->target_vgname[0] == '\0');
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *row, *sub;
uiLayout *layout = panel->layout;
@ -181,24 +181,24 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, "target_vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
uiItemPointerR(row, ptr, "target_vertex_group", &ob_ptr, "vertex_groups", nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
bool has_output = RNA_string_length(ptr, "target_vertex_group") != 0;
uiLayoutSetPropDecorate(sub, false);
uiLayoutSetActive(sub, has_output);
uiItemR(sub, ptr, "use_invert_output", 0, "", ICON_ARROW_LEFTRIGHT);
uiItemR(layout, ptr, "angle", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "axis", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "space", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "angle", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "axis", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "space", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "minimum_weight", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_multiply", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "minimum_weight", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_multiply", 0, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -209,7 +209,7 @@ static void panelRegister(ARegionType *region_type)
region_type, eGpencilModifierType_WeightAngle, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_WeightAngle = {
@ -217,21 +217,21 @@ GpencilModifierTypeInfo modifierType_Gpencil_WeightAngle = {
/*structName*/ "WeightAngleGpencilModifierData",
/*structSize*/ sizeof(WeightAngleGpencilModifierData),
/*type*/ eGpencilModifierTypeType_Gpencil,
/*flags*/ 0,
/*flags*/ GpencilModifierTypeFlag(0),
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*updateDepsgraph*/ nullptr,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -83,10 +83,10 @@ static float calc_point_weight_by_distance(Object *ob,
/* change stroke thickness */
static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Depsgraph * /*depsgraph*/,
Object *ob,
bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDframe * /*gpf*/,
bGPDstroke *gps)
{
WeightProxGpencilModifierData *mmd = (WeightProxGpencilModifierData *)md;
@ -121,7 +121,7 @@ static void deformStroke(GpencilModifierData *md,
float weight_pt = 1.0f;
for (int i = 0; i < gps->totpoints; i++) {
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
MDeformVert *dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
/* Verify point is part of vertex group. */
float weight = get_modifier_point_weight(
dvert, (mmd->flag & GP_WEIGHT_INVERT_VGROUP) != 0, def_nr);
@ -139,8 +139,8 @@ static void deformStroke(GpencilModifierData *md,
weight_pt = 1.0f - weight_pt;
}
/* Assign weight. */
dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
if (dvert != NULL) {
dvert = gps->dvert != nullptr ? &gps->dvert[i] : nullptr;
if (dvert != nullptr) {
MDeformWeight *dw = BKE_defvert_ensure_index(dvert, target_def_nr);
if (dw) {
dw->weight = (mmd->flag & GP_WEIGHT_MULTIPLY_DATA) ? dw->weight * weight_pt : weight_pt;
@ -150,7 +150,7 @@ static void deformStroke(GpencilModifierData *md,
}
}
static void bakeModifier(struct Main *UNUSED(bmain),
static void bakeModifier(struct Main * /*bmain*/,
Depsgraph *depsgraph,
GpencilModifierData *md,
Object *ob)
@ -168,10 +168,10 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int UNUSED(mode))
const int /*mode*/)
{
WeightProxGpencilModifierData *mmd = (WeightProxGpencilModifierData *)md;
if (mmd->object != NULL) {
if (mmd->object != nullptr) {
DEG_add_object_relation(
ctx->node, mmd->object, DEG_OB_COMP_TRANSFORM, "GPencil Weight Modifier");
}
@ -179,14 +179,14 @@ static void updateDepsgraph(GpencilModifierData *md,
ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "GPencil Weight Modifier");
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
static bool isDisabled(GpencilModifierData *md, int /*userRenderParams*/)
{
WeightProxGpencilModifierData *mmd = (WeightProxGpencilModifierData *)md;
return ((mmd->target_vgname[0] == '\0') || (mmd->object == NULL));
return ((mmd->target_vgname[0] == '\0') || (mmd->object == nullptr));
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void panel_draw(const bContext * /*C*/, Panel *panel)
{
uiLayout *row, *sub;
uiLayout *layout = panel->layout;
@ -196,26 +196,26 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
row = uiLayoutRow(layout, true);
uiItemPointerR(row, ptr, "target_vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
uiItemPointerR(row, ptr, "target_vertex_group", &ob_ptr, "vertex_groups", nullptr, ICON_NONE);
sub = uiLayoutRow(row, true);
bool has_output = RNA_string_length(ptr, "target_vertex_group") != 0;
uiLayoutSetPropDecorate(sub, false);
uiLayoutSetActive(sub, has_output);
uiItemR(sub, ptr, "use_invert_output", 0, "", ICON_ARROW_LEFTRIGHT);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE);
sub = uiLayoutColumn(layout, true);
uiItemR(sub, ptr, "distance_start", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "distance_end", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "distance_start", 0, nullptr, ICON_NONE);
uiItemR(sub, ptr, "distance_end", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "minimum_weight", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_multiply", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "minimum_weight", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "use_multiply", 0, nullptr, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
static void mask_panel_draw(const bContext * /*C*/, Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, true);
}
@ -226,7 +226,7 @@ static void panelRegister(ARegionType *region_type)
region_type, eGpencilModifierType_WeightProximity, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
region_type, "mask", "Influence", nullptr, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_WeightProximity = {
@ -234,21 +234,21 @@ GpencilModifierTypeInfo modifierType_Gpencil_WeightProximity = {
/*structName*/ "WeightProxGpencilModifierData",
/*structSize*/ sizeof(WeightProxGpencilModifierData),
/*type*/ eGpencilModifierTypeType_Gpencil,
/*flags*/ 0,
/*flags*/ GpencilModifierTypeFlag(0),
/*copyData*/ copyData,
/*deformStroke*/ deformStroke,
/*generateStrokes*/ NULL,
/*generateStrokes*/ nullptr,
/*bakeModifier*/ bakeModifier,
/*remapTime*/ NULL,
/*remapTime*/ nullptr,
/*initData*/ initData,
/*freeData*/ NULL,
/*freeData*/ nullptr,
/*isDisabled*/ isDisabled,
/*updateDepsgraph*/ updateDepsgraph,
/*dependsOnTime*/ NULL,
/*dependsOnTime*/ nullptr,
/*foreachIDLink*/ foreachIDLink,
/*foreachTexLink*/ NULL,
/*foreachTexLink*/ nullptr,
/*panelRegister*/ panelRegister,
};

View File

@ -16,7 +16,7 @@
#include <math.h>
#define LRT_OTHER_VERT(e, vt) ((vt) == (e)->v1 ? (e)->v2 : ((vt) == (e)->v2 ? (e)->v1 : NULL))
#define LRT_OTHER_VERT(e, vt) ((vt) == (e)->v1 ? (e)->v2 : ((vt) == (e)->v2 ? (e)->v1 : nullptr))
struct Object;
@ -64,13 +64,14 @@ static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
}
}
return NULL;
return nullptr;
}
static LineartEdgeChain *lineart_chain_create(LineartData *ld)
{
LineartEdgeChain *ec;
ec = lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChain));
ec = static_cast<LineartEdgeChain *>(
lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChain)));
BLI_addtail(&ld->chains, ec);
@ -106,11 +107,13 @@ static LineartEdgeChainItem *lineart_chain_append_point(LineartData *ld,
{
LineartEdgeChainItem *eci;
if (lineart_point_overlapping(ec->chain.last, fbcoord[0], fbcoord[1], 1e-5)) {
if (lineart_point_overlapping(
static_cast<LineartEdgeChainItem *>(ec->chain.last), fbcoord[0], fbcoord[1], 1e-5))
{
/* Because the new chain point is overlapping, just replace the type and occlusion level of the
* current point. This makes it so that the line to the point after this one has the correct
* type and level. */
LineartEdgeChainItem *old_eci = ec->chain.last;
LineartEdgeChainItem *old_eci = static_cast<LineartEdgeChainItem *>(ec->chain.last);
old_eci->line_type = type;
old_eci->occlusion = level;
old_eci->material_mask_bits = material_mask_bits;
@ -118,7 +121,8 @@ static LineartEdgeChainItem *lineart_chain_append_point(LineartData *ld,
return old_eci;
}
eci = lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChainItem));
eci = static_cast<LineartEdgeChainItem *>(
lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChainItem)));
copy_v4_v4(eci->pos, fbcoord);
copy_v3_v3(eci->gpos, gpos);
@ -146,11 +150,14 @@ static LineartEdgeChainItem *lineart_chain_prepend_point(LineartData *ld,
{
LineartEdgeChainItem *eci;
if (lineart_point_overlapping(ec->chain.first, fbcoord[0], fbcoord[1], 1e-5)) {
return ec->chain.first;
if (lineart_point_overlapping(
static_cast<LineartEdgeChainItem *>(ec->chain.first), fbcoord[0], fbcoord[1], 1e-5))
{
return static_cast<LineartEdgeChainItem *>(ec->chain.first);
}
eci = lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChainItem));
eci = static_cast<LineartEdgeChainItem *>(
lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChainItem)));
copy_v4_v4(eci->pos, fbcoord);
copy_v3_v3(eci->gpos, gpos);
@ -223,7 +230,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
/* Step 1: grow left. */
ba = MOD_lineart_get_bounding_area(ld, e->v1->fbcoord[0], e->v1->fbcoord[1]);
new_vt = e->v1;
es = e->segments.first;
es = static_cast<LineartEdgeSegment *>(e->segments.first);
VERT_COORD_TO_FLOAT(new_vt);
lineart_chain_prepend_point(ld,
ec,
@ -256,7 +263,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
}
if (new_vt == new_e->v1) {
for (es = new_e->segments.last; es; es = es->prev) {
for (es = static_cast<LineartEdgeSegment *>(new_e->segments.last); es; es = es->prev) {
double gpos[3], lpos[3];
double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
double global_at = lfb[3] * es->ratio / (es->ratio * lfb[3] + (1 - es->ratio) * rfb[3]);
@ -280,7 +287,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
}
}
else if (new_vt == new_e->v2) {
es = new_e->segments.first;
es = static_cast<LineartEdgeSegment *>(new_e->segments.first);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
@ -339,7 +346,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
}
/* Step 2: Adding all cuts from the given line, so we can continue connecting the right side
* of the line. */
es = e->segments.first;
es = static_cast<LineartEdgeSegment *>(e->segments.first);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
@ -401,11 +408,11 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
}
/* Fix leading vertex type. */
eci = ec->chain.last;
eci = static_cast<LineartEdgeChainItem *>(ec->chain.last);
eci->line_type = new_e->flags & LRT_EDGE_FLAG_ALL_TYPE;
if (new_vt == new_e->v1) {
es = new_e->segments.last;
es = static_cast<LineartEdgeSegment *>(new_e->segments.last);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
@ -413,7 +420,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
eci->occlusion = last_occlusion;
eci->material_mask_bits = last_transparency;
eci->shadow_mask_bits = last_shadow;
for (es = new_e->segments.last; es; es = es->prev) {
for (es = static_cast<LineartEdgeSegment *>(new_e->segments.last); es; es = es->prev) {
double gpos[3], lpos[3];
double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
double global_at = lfb[3] * es->ratio / (es->ratio * lfb[3] + (1 - es->ratio) * rfb[3]);
@ -437,7 +444,7 @@ void MOD_lineart_chain_feature_lines(LineartData *ld)
}
}
else if (new_vt == new_e->v2) {
es = new_e->segments.first;
es = static_cast<LineartEdgeSegment *>(new_e->segments.first);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
@ -495,7 +502,7 @@ static LineartBoundingArea *lineart_bounding_area_get_eci_recursive(LineartData
LineartBoundingArea *root,
LineartEdgeChainItem *eci)
{
if (root->child == NULL) {
if (root->child == nullptr) {
return root;
}
@ -516,18 +523,18 @@ static LineartBoundingArea *lineart_bounding_area_get_eci_recursive(LineartData
return lineart_bounding_area_get_eci_recursive(ld, &ch[3], eci);
}
#undef IN_BOUND
return NULL;
return nullptr;
}
static LineartBoundingArea *lineart_bounding_area_get_end_point(LineartData *ld,
LineartEdgeChainItem *eci)
{
if (!eci) {
return NULL;
return nullptr;
}
LineartBoundingArea *root = MOD_lineart_get_parent_bounding_area(ld, eci->pos[0], eci->pos[1]);
if (root == NULL) {
return NULL;
if (root == nullptr) {
return nullptr;
}
return lineart_bounding_area_get_eci_recursive(ld, root, eci);
}
@ -543,9 +550,10 @@ static void lineart_bounding_area_link_point_recursive(LineartData *ld,
LineartEdgeChain *ec,
LineartEdgeChainItem *eci)
{
if (root->child == NULL) {
LineartChainRegisterEntry *cre = lineart_list_append_pointer_pool_sized(
&root->linked_chains, ld->chain_data_pool, ec, sizeof(LineartChainRegisterEntry));
if (root->child == nullptr) {
LineartChainRegisterEntry *cre = static_cast<LineartChainRegisterEntry *>(
lineart_list_append_pointer_pool_sized(
&root->linked_chains, ld->chain_data_pool, ec, sizeof(LineartChainRegisterEntry)));
cre->eci = eci;
@ -578,8 +586,8 @@ static void lineart_bounding_area_link_point_recursive(LineartData *ld,
static void lineart_bounding_area_link_chain(LineartData *ld, LineartEdgeChain *ec)
{
LineartEdgeChainItem *pl = ec->chain.first;
LineartEdgeChainItem *pr = ec->chain.last;
LineartEdgeChainItem *pl = static_cast<LineartEdgeChainItem *>(ec->chain.first);
LineartEdgeChainItem *pr = static_cast<LineartEdgeChainItem *>(ec->chain.last);
LineartBoundingArea *ba1 = MOD_lineart_get_parent_bounding_area(ld, pl->pos[0], pl->pos[1]);
LineartBoundingArea *ba2 = MOD_lineart_get_parent_bounding_area(ld, pr->pos[0], pr->pos[1]);
@ -603,7 +611,7 @@ static bool lineart_chain_fix_ambiguous_segments(LineartEdgeChain *ec,
uint8_t fixed_mask = last_matching_eci->material_mask_bits;
uint32_t fixed_shadow = last_matching_eci->shadow_mask_bits;
LineartEdgeChainItem *can_skip_to = NULL;
LineartEdgeChainItem *can_skip_to = nullptr;
LineartEdgeChainItem *last_eci = last_matching_eci;
for (LineartEdgeChainItem *eci = last_matching_eci->next; eci; eci = eci->next) {
dist_accum += len_v2v2(last_eci->pos, eci->pos);
@ -657,11 +665,11 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld)
swap.first = ld->chains.first;
swap.last = ld->chains.last;
ld->chains.last = ld->chains.first = NULL;
ld->chains.last = ld->chains.first = nullptr;
int loop_id = 0;
while ((ec = BLI_pophead(&swap)) != NULL) {
ec->next = ec->prev = NULL;
while ((ec = static_cast<LineartEdgeChain *>(BLI_pophead(&swap))) != nullptr) {
ec->next = ec->prev = nullptr;
BLI_addtail(&ld->chains, ec);
ec->loop_id = loop_id;
@ -744,7 +752,7 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld)
/**
* NOTE: segment type (crease/material/contour...) is ambiguous after this.
*/
static void lineart_chain_connect(LineartData *UNUSED(ld),
static void lineart_chain_connect(LineartData * /*ld*/,
LineartEdgeChain *onto,
LineartEdgeChain *sub,
int reverse_1,
@ -766,30 +774,38 @@ static void lineart_chain_connect(LineartData *UNUSED(ld),
if (reverse_2) { /* L--R R-L. */
BLI_listbase_reverse(&sub->chain);
}
eci = sub->chain.first;
if (lineart_point_overlapping(onto->chain.last, eci->pos[0], eci->pos[1], 1e-5)) {
eci = static_cast<LineartEdgeChainItem *>(sub->chain.first);
if (lineart_point_overlapping(
static_cast<LineartEdgeChainItem *>(onto->chain.last), eci->pos[0], eci->pos[1], 1e-5))
{
BLI_pophead(&sub->chain);
if (sub->chain.first == NULL) {
if (sub->chain.first == nullptr) {
return;
}
}
((LineartEdgeChainItem *)onto->chain.last)->next = sub->chain.first;
((LineartEdgeChainItem *)sub->chain.first)->prev = onto->chain.last;
((LineartEdgeChainItem *)onto->chain.last)->next = static_cast<LineartEdgeChainItem *>(
sub->chain.first);
((LineartEdgeChainItem *)sub->chain.first)->prev = static_cast<LineartEdgeChainItem *>(
onto->chain.last);
onto->chain.last = sub->chain.last;
}
else { /* L-R L--R. */
if (!reverse_2) { /* R-L L--R. */
BLI_listbase_reverse(&sub->chain);
}
eci = onto->chain.first;
if (lineart_point_overlapping(sub->chain.last, eci->pos[0], eci->pos[1], 1e-5)) {
eci = static_cast<LineartEdgeChainItem *>(onto->chain.first);
if (lineart_point_overlapping(
static_cast<LineartEdgeChainItem *>(sub->chain.last), eci->pos[0], eci->pos[1], 1e-5))
{
BLI_pophead(&onto->chain);
if (onto->chain.first == NULL) {
if (onto->chain.first == nullptr) {
return;
}
}
((LineartEdgeChainItem *)sub->chain.last)->next = onto->chain.first;
((LineartEdgeChainItem *)onto->chain.first)->prev = sub->chain.last;
((LineartEdgeChainItem *)sub->chain.last)->next = static_cast<LineartEdgeChainItem *>(
onto->chain.first);
((LineartEdgeChainItem *)onto->chain.first)->prev = static_cast<LineartEdgeChainItem *>(
sub->chain.last);
onto->chain.first = sub->chain.first;
}
}
@ -808,7 +824,7 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartData *ld,
LineartBoundingArea *caller_ba)
{
LineartChainRegisterEntry *closest_cre = NULL;
LineartChainRegisterEntry *closest_cre = nullptr;
/* Keep using for loop because `cre` could be removed from the iteration before getting to the
* next one. */
@ -924,10 +940,10 @@ void MOD_lineart_chain_connect(LineartData *ld)
swap.first = ld->chains.first;
swap.last = ld->chains.last;
ld->chains.last = ld->chains.first = NULL;
ld->chains.last = ld->chains.first = nullptr;
while ((ec = BLI_pophead(&swap)) != NULL) {
ec->next = ec->prev = NULL;
while ((ec = static_cast<LineartEdgeChain *>(BLI_pophead(&swap))) != nullptr) {
ec->next = ec->prev = nullptr;
if (ec->picked || ec->chain.first == ec->chain.last) {
continue;
}
@ -943,8 +959,8 @@ void MOD_lineart_chain_connect(LineartData *ld)
isec_mask = ec->intersection_mask;
shadow_mask = ec->shadow_mask_bits;
eci_l = ec->chain.first;
eci_r = ec->chain.last;
eci_l = static_cast<LineartEdgeChainItem *>(ec->chain.first);
eci_r = static_cast<LineartEdgeChainItem *>(ec->chain.last);
while ((ba_l = lineart_bounding_area_get_end_point(ld, eci_l)) &&
(ba_r = lineart_bounding_area_get_end_point(ld, eci_r)))
{
@ -959,7 +975,7 @@ void MOD_lineart_chain_connect(LineartData *ld)
loop_id,
dist,
&dist_l,
NULL);
nullptr);
closest_cre_r = lineart_chain_get_closest_cre(ld,
ba_r,
ec,
@ -971,7 +987,7 @@ void MOD_lineart_chain_connect(LineartData *ld)
loop_id,
dist,
&dist_r,
NULL);
nullptr);
if (closest_cre_l && closest_cre_r) {
if (dist_l < dist_r) {
closest_cre = closest_cre_l;
@ -1003,8 +1019,8 @@ void MOD_lineart_chain_connect(LineartData *ld)
lineart_chain_connect(ld, ec, closest_cre->ec, reverse_main, 1);
}
BLI_remlink(&swap, closest_cre->ec);
eci_l = ec->chain.first;
eci_r = ec->chain.last;
eci_l = static_cast<LineartEdgeChainItem *>(ec->chain.first);
eci_r = static_cast<LineartEdgeChainItem *>(ec->chain.last);
}
ec->picked = 1;
}
@ -1017,12 +1033,12 @@ float MOD_lineart_chain_compute_length(LineartEdgeChain *ec)
float dist;
float last_point[2];
eci = ec->chain.first;
eci = static_cast<LineartEdgeChainItem *>(ec->chain.first);
if (!eci) {
return 0;
}
copy_v2_v2(last_point, eci->pos);
for (eci = ec->chain.first; eci; eci = eci->next) {
for (eci = static_cast<LineartEdgeChainItem *>(ec->chain.first); eci; eci = eci->next) {
dist = len_v2v2(eci->pos, last_point);
offset_accum += dist;
copy_v2_v2(last_point, eci->pos);
@ -1035,7 +1051,7 @@ void MOD_lineart_chain_discard_unused(LineartData *ld,
uint8_t max_occlusion)
{
LineartEdgeChain *ec, *next_ec;
for (ec = ld->chains.first; ec; ec = next_ec) {
for (ec = static_cast<LineartEdgeChain *>(ld->chains.first); ec; ec = next_ec) {
next_ec = ec->next;
if (ec->level > max_occlusion || MOD_lineart_chain_compute_length(ec) < threshold) {
BLI_remlink(&ld->chains, ec);
@ -1054,7 +1070,7 @@ int MOD_lineart_chain_count(const LineartEdgeChain *ec)
void MOD_lineart_chain_clear_picked_flag(LineartCache *lc)
{
if (lc == NULL) {
if (lc == nullptr) {
return;
}
LISTBASE_FOREACH (LineartEdgeChain *, ec, &lc->chains) {
@ -1069,7 +1085,7 @@ LineartElementLinkNode *lineart_find_matching_eln_obj(ListBase *elns, struct Obj
return eln;
}
}
return NULL;
return nullptr;
}
void MOD_lineart_finalize_chains(LineartData *ld)
@ -1084,7 +1100,7 @@ void MOD_lineart_finalize_chains(LineartData *ld)
}
LineartElementLinkNode *eln = lineart_find_matching_eln_obj(&ld->geom.vertex_buffer_pointers,
ec->object_ref);
BLI_assert(eln != NULL);
BLI_assert(eln != nullptr);
if (LIKELY(eln)) {
LISTBASE_FOREACH (LineartEdgeChainItem *, eci, &ec->chain) {
if (eci->index > eln->global_index_offset) {
@ -1100,7 +1116,10 @@ void MOD_lineart_smooth_chains(LineartData *ld, float tolerance)
LISTBASE_FOREACH (LineartEdgeChain *, ec, &ld->chains) {
/* Go through the chain two times, once from each direction. */
for (int times = 0; times < 2; times++) {
for (LineartEdgeChainItem *eci = ec->chain.first, *next_eci = eci->next; eci; eci = next_eci)
for (LineartEdgeChainItem *eci = static_cast<LineartEdgeChainItem *>(ec->chain.first),
*next_eci = eci->next;
eci;
eci = next_eci)
{
LineartEdgeChainItem *eci2, *eci3, *eci4;
@ -1151,7 +1170,7 @@ void MOD_lineart_smooth_chains(LineartData *ld, float tolerance)
if (len_v2(vec2) > len_v2(vec3)) {
BLI_remlink(&ec->chain, eci3);
}
next_eci = NULL;
next_eci = nullptr;
continue;
}
}
@ -1187,7 +1206,7 @@ static LineartEdgeChainItem *lineart_chain_create_crossing_point(LineartData *ld
}
if (UNLIKELY(!found)) {
return NULL;
return nullptr;
}
float ratio = (fabs(eci2->pos[0] - eci1->pos[0]) > fabs(eci2->pos[1] - eci1->pos[1])) ?
@ -1195,13 +1214,13 @@ static LineartEdgeChainItem *lineart_chain_create_crossing_point(LineartData *ld
ratiof(eci1->pos[1], eci2->pos[1], isec[1]);
float gratio = eci1->pos[3] * ratio / (ratio * eci1->pos[3] + (1 - ratio) * eci2->pos[3]);
LineartEdgeChainItem *eci = lineart_mem_acquire(ld->chain_data_pool,
sizeof(LineartEdgeChainItem));
LineartEdgeChainItem *eci = static_cast<LineartEdgeChainItem *>(
lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChainItem)));
memcpy(eci, eci1, sizeof(LineartEdgeChainItem));
interp_v3_v3v3(eci->gpos, eci1->gpos, eci2->gpos, gratio);
interp_v3_v3v3(eci->pos, eci1->pos, eci2->pos, ratio);
eci->pos[3] = interpf(eci2->pos[3], eci1->pos[3], gratio);
eci->next = eci->prev = NULL;
eci->next = eci->prev = nullptr;
return eci;
}
@ -1218,8 +1237,8 @@ void MOD_lineart_chain_clip_at_border(LineartData *ld)
swap.first = ld->chains.first;
swap.last = ld->chains.last;
ld->chains.last = ld->chains.first = NULL;
while ((ec = BLI_pophead(&swap)) != NULL) {
ld->chains.last = ld->chains.first = nullptr;
while ((ec = static_cast<LineartEdgeChain *>(BLI_pophead(&swap))) != nullptr) {
bool ec_added = false;
LineartEdgeChainItem *first_eci = (LineartEdgeChainItem *)ec->chain.first;
is_inside = LRT_ECI_INSIDE(first_eci) ? true : false;
@ -1237,12 +1256,12 @@ void MOD_lineart_chain_clip_at_border(LineartData *ld)
/* Stroke goes out. */
new_eci = lineart_chain_create_crossing_point(ld, prev_eci, eci);
LineartEdgeChain *new_ec = lineart_mem_acquire(ld->chain_data_pool,
sizeof(LineartEdgeChain));
LineartEdgeChain *new_ec = static_cast<LineartEdgeChain *>(
lineart_mem_acquire(ld->chain_data_pool, sizeof(LineartEdgeChain)));
memcpy(new_ec, ec, sizeof(LineartEdgeChain));
new_ec->chain.first = next_eci;
eci->prev = NULL;
prev_eci->next = NULL;
eci->prev = nullptr;
prev_eci->next = nullptr;
ec->chain.last = prev_eci;
BLI_addtail(&ec->chain, new_eci);
BLI_addtail(&ld->chains, ec);
@ -1257,7 +1276,7 @@ void MOD_lineart_chain_clip_at_border(LineartData *ld)
new_eci = lineart_chain_create_crossing_point(ld, eci, prev_eci);
ec->chain.first = eci;
eci->prev = NULL;
eci->prev = nullptr;
BLI_addhead(&ec->chain, new_eci);
@ -1284,10 +1303,10 @@ void MOD_lineart_chain_split_angle(LineartData *ld, float angle_threshold_rad)
swap.first = ld->chains.first;
swap.last = ld->chains.last;
ld->chains.last = ld->chains.first = NULL;
ld->chains.last = ld->chains.first = nullptr;
while ((ec = BLI_pophead(&swap)) != NULL) {
ec->next = ec->prev = NULL;
while ((ec = static_cast<LineartEdgeChain *>(BLI_pophead(&swap))) != nullptr) {
ec->next = ec->prev = nullptr;
BLI_addtail(&ld->chains, ec);
LineartEdgeChainItem *first_eci = (LineartEdgeChainItem *)ec->chain.first;
for (eci = first_eci->next; eci; eci = next_eci) {
@ -1382,7 +1401,7 @@ void MOD_lineart_chain_find_silhouette_backdrop_objects(LineartData *ld)
if (!eln) {
continue;
}
ec->silhouette_backdrop = eln->object_ref;
ec->silhouette_backdrop = static_cast<Object *>(eln->object_ref);
}
}
}

View File

@ -37,7 +37,8 @@ static bool lineart_mod_is_disabled(GpencilModifierData *md)
{
BLI_assert(md->type == eGpencilModifierType_Lineart);
const GpencilModifierTypeInfo *info = BKE_gpencil_modifier_get_info(md->type);
const GpencilModifierTypeInfo *info = BKE_gpencil_modifier_get_info(
GpencilModifierType(md->type));
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
@ -57,7 +58,7 @@ static void clear_strokes(Object *ob, GpencilModifierData *md, int frame)
return;
}
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
if (!gpl) {
@ -86,7 +87,7 @@ static bool bake_strokes(Object *ob,
}
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
if (!gpl) {
@ -153,13 +154,13 @@ static bool bake_strokes(Object *ob,
return true;
}
typedef struct LineartBakeJob {
struct LineartBakeJob {
wmWindowManager *wm;
void *owner;
bool *stop, *do_update;
float *progress;
/* C or ob must have one != NULL. */
/* C or ob must have one != nullptr. */
bContext *C;
LinkNode *objects;
Scene *scene;
@ -170,7 +171,7 @@ typedef struct LineartBakeJob {
int frame_orig;
int frame_increment;
bool overwrite_frames;
} LineartBakeJob;
};
static bool lineart_gpencil_bake_single_target(LineartBakeJob *bj, Object *ob, int frame)
{
@ -189,7 +190,7 @@ static bool lineart_gpencil_bake_single_target(LineartBakeJob *bj, Object *ob, i
GpencilLineartLimitInfo info = BKE_gpencil_get_lineart_modifier_limits(ob);
LineartCache *lc = NULL;
LineartCache *lc = nullptr;
bool is_first = true;
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
if (md->type != eGpencilModifierType_Lineart) {
@ -209,7 +210,7 @@ static bool lineart_gpencil_bake_single_target(LineartBakeJob *bj, Object *ob, i
static void lineart_gpencil_guard_modifiers(LineartBakeJob *bj)
{
for (LinkNode *l = bj->objects; l; l = l->next) {
Object *ob = l->link;
Object *ob = static_cast<Object *>(l->link);
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
if (md->type == eGpencilModifierType_Lineart) {
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
@ -242,7 +243,7 @@ static void lineart_gpencil_bake_startjob(void *customdata,
BKE_scene_graph_update_for_newframe(bj->dg);
for (LinkNode *l = bj->objects; l; l = l->next) {
Object *ob = l->link;
Object *ob = static_cast<Object *>(l->link);
if (lineart_gpencil_bake_single_target(bj, ob, frame)) {
DEG_id_tag_update((ID *)ob->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(bj->C, NC_GPENCIL | ND_DATA | NA_EDITED, ob);
@ -264,7 +265,7 @@ static void lineart_gpencil_bake_startjob(void *customdata,
static void lineart_gpencil_bake_endjob(void *customdata)
{
LineartBakeJob *bj = customdata;
LineartBakeJob *bj = static_cast<LineartBakeJob *>(customdata);
WM_set_locked_interface(CTX_wm_manager(bj->C), false);
@ -274,7 +275,7 @@ static void lineart_gpencil_bake_endjob(void *customdata)
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, (Object *)l->link);
}
BLI_linklist_free(bj->objects, NULL);
BLI_linklist_free(bj->objects, nullptr);
}
static int lineart_gpencil_bake_common(bContext *C,
@ -282,7 +283,8 @@ static int lineart_gpencil_bake_common(bContext *C,
bool bake_all_targets,
bool do_background)
{
LineartBakeJob *bj = MEM_callocN(sizeof(LineartBakeJob), "LineartBakeJob");
LineartBakeJob *bj = static_cast<LineartBakeJob *>(
MEM_callocN(sizeof(LineartBakeJob), "LineartBakeJob"));
if (!bake_all_targets) {
Object *ob = CTX_data_active_object(C);
@ -327,7 +329,7 @@ static int lineart_gpencil_bake_common(bContext *C,
WM_jobs_customdata_set(wm_job, bj, MEM_freeN);
WM_jobs_timer(wm_job, 0.1, NC_GPENCIL | ND_DATA | NA_EDITED, NC_GPENCIL | ND_DATA | NA_EDITED);
WM_jobs_callbacks(
wm_job, lineart_gpencil_bake_startjob, NULL, NULL, lineart_gpencil_bake_endjob);
wm_job, lineart_gpencil_bake_startjob, nullptr, nullptr, lineart_gpencil_bake_endjob);
WM_set_locked_interface(CTX_wm_manager(C), true);
@ -340,9 +342,9 @@ static int lineart_gpencil_bake_common(bContext *C,
float pseduo_progress;
bool pseduo_do_update;
lineart_gpencil_bake_startjob(bj, NULL, &pseduo_do_update, &pseduo_progress);
lineart_gpencil_bake_startjob(bj, nullptr, &pseduo_do_update, &pseduo_progress);
BLI_linklist_free(bj->objects, NULL);
BLI_linklist_free(bj->objects, nullptr);
MEM_freeN(bj);
return OPERATOR_FINISHED;
@ -350,7 +352,7 @@ static int lineart_gpencil_bake_common(bContext *C,
static int lineart_gpencil_bake_strokes_all_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
const wmEvent * /*event*/)
{
return lineart_gpencil_bake_common(C, op, true, true);
}
@ -360,7 +362,7 @@ static int lineart_gpencil_bake_strokes_all_exec(bContext *C, wmOperator *op)
}
static int lineart_gpencil_bake_strokes_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
const wmEvent * /*event*/)
{
return lineart_gpencil_bake_common(C, op, false, true);
}
@ -370,7 +372,7 @@ static int lineart_gpencil_bake_strokes_exec(bContext *C, wmOperator *op)
}
static int lineart_gpencil_bake_strokes_common_modal(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
const wmEvent * /*event*/)
{
Scene *scene = (Scene *)op->customdata;
@ -385,7 +387,7 @@ static int lineart_gpencil_bake_strokes_common_modal(bContext *C,
static void lineart_gpencil_clear_strokes_exec_common(Object *ob)
{
/* TODO: move these checks to an operator poll function. */
if ((ob == NULL) || ob->type != OB_GPENCIL_LEGACY) {
if ((ob == nullptr) || ob->type != OB_GPENCIL_LEGACY) {
return;
}
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
@ -393,7 +395,7 @@ static void lineart_gpencil_clear_strokes_exec_common(Object *ob)
continue;
}
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
bGPdata *gpd = ob->data;
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
if (!gpl) {
@ -409,7 +411,7 @@ static void lineart_gpencil_clear_strokes_exec_common(Object *ob)
DEG_id_tag_update((ID *)ob->data, ID_RECALC_GEOMETRY);
}
static int lineart_gpencil_clear_strokes_exec(bContext *C, wmOperator *UNUSED(op))
static int lineart_gpencil_clear_strokes_exec(bContext *C, wmOperator * /*op*/)
{
Object *ob = CTX_data_active_object(C);

View File

@ -40,7 +40,7 @@ LineartElementLinkNode *lineart_find_matching_eln(ListBase *shadow_elns, int obi
return eln;
}
}
return NULL;
return nullptr;
}
LineartEdge *lineart_find_matching_edge(LineartElementLinkNode *shadow_eln,
@ -52,7 +52,7 @@ LineartEdge *lineart_find_matching_edge(LineartElementLinkNode *shadow_eln,
return &elist[i];
}
}
return NULL;
return nullptr;
}
static bool lineart_contour_viewed_from_dark_side(LineartData *ld, LineartEdge *e)
@ -127,8 +127,8 @@ void lineart_register_intersection_shadow_cuts(LineartData *ld, ListBase *shadow
return;
}
LineartElementLinkNode *eln_isect_shadow = NULL;
LineartElementLinkNode *eln_isect_original = NULL;
LineartElementLinkNode *eln_isect_shadow = nullptr;
LineartElementLinkNode *eln_isect_original = nullptr;
LISTBASE_FOREACH (LineartElementLinkNode *, eln, shadow_elns) {
if (eln->flags & LRT_ELEMENT_INTERSECTION_DATA) {
@ -297,7 +297,7 @@ static void lineart_shadow_create_shadow_edge_array(LineartData *ld,
bool transform_edge_cuts,
bool do_light_contour)
{
/* If the segment is short enough, we ignore them because it's not prominently visible anyway. */
/* If the segment is short enough, we ignore them because it's not prominently visible anyway. */
#define DISCARD_NONSENSE_SEGMENTS \
if (es->occlusion != 0 || \
(es->next && LRT_DOUBLE_CLOSE_ENOUGH(es->ratio, ((LineartEdgeSegment *)es->next)->ratio))) \
@ -358,10 +358,10 @@ static void lineart_shadow_create_shadow_edge_array(LineartData *ld,
}
LRT_ITER_ALL_LINES_END
LineartShadowEdge *sedge = lineart_mem_acquire(&ld->render_data_pool,
sizeof(LineartShadowEdge) * segment_count);
LineartShadowSegment *sseg = lineart_mem_acquire(
&ld->render_data_pool, sizeof(LineartShadowSegment) * segment_count * 2);
LineartShadowEdge *sedge = static_cast<LineartShadowEdge *>(
lineart_mem_acquire(&ld->render_data_pool, sizeof(LineartShadowEdge) * segment_count));
LineartShadowSegment *sseg = static_cast<LineartShadowSegment *>(lineart_mem_acquire(
&ld->render_data_pool, sizeof(LineartShadowSegment) * segment_count * 2));
ld->shadow_edges = sedge;
ld->shadow_edges_count = segment_count;
@ -496,9 +496,12 @@ static void lineart_shadow_edge_cut(LineartData *ld,
uint32_t target_reference)
{
LineartShadowSegment *seg, *i_seg;
LineartShadowSegment *cut_start_after = e->shadow_segments.first,
*cut_end_before = e->shadow_segments.last;
LineartShadowSegment *new_seg_1 = NULL, *new_seg_2 = NULL, *seg_1 = NULL, *seg_2 = NULL;
LineartShadowSegment *cut_start_after = static_cast<LineartShadowSegment *>(
e->shadow_segments.first),
*cut_end_before = static_cast<LineartShadowSegment *>(
e->shadow_segments.last);
LineartShadowSegment *new_seg_1 = nullptr, *new_seg_2 = nullptr, *seg_1 = nullptr,
*seg_2 = nullptr;
int untouched = 0;
/* If for some reason the occlusion function may give a result that has zero length, or
@ -525,13 +528,13 @@ static void lineart_shadow_edge_cut(LineartData *ld,
/* Begin looking for starting position of the segment. */
/* Not using a list iteration macro because of it more clear when using for loops to iterate
* through the segments. */
for (seg = e->shadow_segments.first; seg; seg = seg->next) {
for (seg = static_cast<LineartShadowSegment *>(e->shadow_segments.first); seg; seg = seg->next) {
if (LRT_DOUBLE_CLOSE_ENOUGH(seg->ratio, start)) {
cut_start_after = seg;
new_seg_1 = cut_start_after;
break;
}
if (seg->next == NULL) {
if (seg->next == nullptr) {
break;
}
i_seg = seg->next;
@ -569,10 +572,10 @@ static void lineart_shadow_edge_cut(LineartData *ld,
}
/* When we still can't find any existing cut in the line, we allocate new ones. */
if (new_seg_1 == NULL) {
if (new_seg_1 == nullptr) {
new_seg_1 = lineart_give_shadow_segment(ld);
}
if (new_seg_2 == NULL) {
if (new_seg_2 == nullptr) {
if (untouched) {
new_seg_2 = new_seg_1;
cut_end_before = new_seg_2;
@ -969,22 +972,22 @@ static bool lineart_shadow_cast_generate_edges(LineartData *ld,
if (!edge_alloc) {
return false;
}
LineartElementLinkNode *veln = lineart_mem_acquire(ld->shadow_data_pool,
sizeof(LineartElementLinkNode));
LineartElementLinkNode *eeln = lineart_mem_acquire(ld->shadow_data_pool,
sizeof(LineartElementLinkNode));
LineartElementLinkNode *veln = static_cast<LineartElementLinkNode *>(
lineart_mem_acquire(ld->shadow_data_pool, sizeof(LineartElementLinkNode)));
LineartElementLinkNode *eeln = static_cast<LineartElementLinkNode *>(
lineart_mem_acquire(ld->shadow_data_pool, sizeof(LineartElementLinkNode)));
veln->pointer = lineart_mem_acquire(ld->shadow_data_pool, sizeof(LineartVert) * edge_alloc * 2);
eeln->pointer = lineart_mem_acquire(ld->shadow_data_pool, sizeof(LineartEdge) * edge_alloc);
LineartEdgeSegment *es = lineart_mem_acquire(ld->shadow_data_pool,
sizeof(LineartEdgeSegment) * edge_alloc);
LineartEdgeSegment *es = static_cast<LineartEdgeSegment *>(
lineart_mem_acquire(ld->shadow_data_pool, sizeof(LineartEdgeSegment) * edge_alloc));
*r_veln = veln;
*r_eeln = eeln;
veln->element_count = edge_alloc * 2;
eeln->element_count = edge_alloc;
LineartVert *vlist = veln->pointer;
LineartEdge *elist = eeln->pointer;
LineartVert *vlist = static_cast<LineartVert *>(veln->pointer);
LineartEdge *elist = static_cast<LineartEdge *>(eeln->pointer);
int ei = 0;
for (int i = 0; i < ld->shadow_edges_count; i++) {
@ -1082,7 +1085,7 @@ static void lineart_shadow_register_enclosed_shapes(LineartData *ld, LineartData
if (e->min_occ > 0) {
continue;
}
for (es = e->segments.first; es; es = es->next) {
for (es = static_cast<LineartEdgeSegment *>(e->segments.first); es; es = es->next) {
if (es->occlusion > 0) {
continue;
}
@ -1157,7 +1160,8 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
}
}
LineartData *ld = MEM_callocN(sizeof(LineartData), "LineArt render buffer copied");
LineartData *ld = static_cast<LineartData *>(
MEM_callocN(sizeof(LineartData), "LineArt render buffer copied"));
memcpy(ld, original_ld, sizeof(LineartData));
BLI_spin_init(&ld->lock_task);
@ -1234,7 +1238,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
lineart_main_get_view_vector(ld);
lineart_main_load_geometries(
depsgraph, scene, NULL, ld, lmd->flags & LRT_ALLOW_DUPLI_OBJECTS, true, NULL);
depsgraph, scene, nullptr, ld, lmd->flags & LRT_ALLOW_DUPLI_OBJECTS, true, nullptr);
if (!ld->geom.vertex_buffer_pointers.first) {
/* No geometry loaded, return early. */
@ -1283,15 +1287,15 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
return any_generated;
}
typedef struct LineartShadowFinalizeData {
struct LineartShadowFinalizeData {
LineartData *ld;
LineartVert *v;
LineartEdge *e;
} LineartShadowFinalizeData;
};
static void lineart_shadow_transform_task(void *__restrict userdata,
const int element_index,
const TaskParallelTLS *__restrict UNUSED(tls))
const TaskParallelTLS *__restrict /*tls*/)
{
LineartShadowFinalizeData *data = (LineartShadowFinalizeData *)userdata;
LineartData *ld = data->ld;
@ -1299,8 +1303,9 @@ static void lineart_shadow_transform_task(void *__restrict userdata,
mul_v4_m4v3_db(v->fbcoord, ld->conf.view_projection, v->gloc);
}
static void lineart_shadow_finalize_shadow_edges_task(
void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
static void lineart_shadow_finalize_shadow_edges_task(void *__restrict userdata,
const int i,
const TaskParallelTLS *__restrict /*tls*/)
{
LineartShadowFinalizeData *data = (LineartShadowFinalizeData *)userdata;
LineartData *ld = data->ld;
@ -1382,7 +1387,7 @@ void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld)
if (shadow_ld->pending_edges.array) {
MEM_freeN(shadow_ld->pending_edges.array);
shadow_ld->pending_edges.array = NULL;
shadow_ld->pending_edges.array = nullptr;
shadow_ld->pending_edges.next = shadow_ld->pending_edges.max = 0;
}
@ -1394,7 +1399,7 @@ void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld)
return;
}
LineartVert *v = shadow_veln->pointer;
LineartVert *v = static_cast<LineartVert *>(shadow_veln->pointer);
for (int i = 0; i < shadow_veln->element_count; i++) {
mul_v4_m4v3_db(v[i].fbcoord, shadow_ld->conf.view_projection, v[i].gloc);
if (shadow_ld->conf.cam_is_persp) {
@ -1405,7 +1410,7 @@ void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld)
lineart_finalize_object_edge_array_reserve(&shadow_ld->pending_edges,
shadow_eeln->element_count);
LineartEdge *se = shadow_eeln->pointer;
LineartEdge *se = static_cast<LineartEdge *>(shadow_eeln->pointer);
for (int i = 0; i < shadow_eeln->element_count; i++) {
lineart_add_edge_to_array(&shadow_ld->pending_edges, &se[i]);
}

View File

@ -25,10 +25,10 @@
void *lineart_list_append_pointer_pool(ListBase *h, LineartStaticMemPool *smp, void *data)
{
LinkData *lip;
if (h == NULL) {
if (h == nullptr) {
return 0;
}
lip = lineart_mem_acquire(smp, sizeof(LinkData));
lip = static_cast<LinkData *>(lineart_mem_acquire(smp, sizeof(LinkData)));
lip->data = data;
BLI_addtail(h, lip);
return lip;
@ -39,10 +39,10 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h,
int size)
{
LinkData *lip;
if (h == NULL) {
if (h == nullptr) {
return 0;
}
lip = lineart_mem_acquire(smp, size);
lip = static_cast<LinkData *>(lineart_mem_acquire(smp, size));
lip->data = data;
BLI_addtail(h, lip);
return lip;
@ -50,10 +50,10 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h,
void *lineart_list_append_pointer_pool_thread(ListBase *h, LineartStaticMemPool *smp, void *data)
{
LinkData *lip;
if (h == NULL) {
if (h == nullptr) {
return 0;
}
lip = lineart_mem_acquire_thread(smp, sizeof(LinkData));
lip = static_cast<LinkData *>(lineart_mem_acquire_thread(smp, sizeof(LinkData)));
lip->data = data;
BLI_addtail(h, lip);
return lip;
@ -64,10 +64,10 @@ void *lineart_list_append_pointer_pool_sized_thread(ListBase *h,
int size)
{
LinkData *lip;
if (h == NULL) {
if (h == nullptr) {
return 0;
}
lip = lineart_mem_acquire_thread(smp, size);
lip = static_cast<LinkData *>(lineart_mem_acquire_thread(smp, size));
lip->data = data;
BLI_addtail(h, lip);
return lip;
@ -77,10 +77,10 @@ void *lineart_list_pop_pointer_no_free(ListBase *h)
{
LinkData *lip;
void *rev = 0;
if (h == NULL) {
if (h == nullptr) {
return 0;
}
lip = BLI_pophead(h);
lip = static_cast<LinkData *>(BLI_pophead(h));
rev = lip ? lip->data : 0;
return rev;
}
@ -96,7 +96,8 @@ LineartStaticMemPoolNode *lineart_mem_new_static_pool(LineartStaticMemPool *smp,
set_size = LRT_MEMORY_POOL_1MB; /* Prevent too many small allocations. */
}
size_t total_size = set_size + sizeof(LineartStaticMemPoolNode);
LineartStaticMemPoolNode *smpn = MEM_callocN(total_size, "mempool");
LineartStaticMemPoolNode *smpn = static_cast<LineartStaticMemPoolNode *>(
MEM_callocN(total_size, "mempool"));
smpn->size = total_size;
smpn->used_byte = sizeof(LineartStaticMemPoolNode);
BLI_addhead(&smp->pools, smpn);
@ -104,7 +105,7 @@ LineartStaticMemPoolNode *lineart_mem_new_static_pool(LineartStaticMemPool *smp,
}
void *lineart_mem_acquire(LineartStaticMemPool *smp, size_t size)
{
LineartStaticMemPoolNode *smpn = smp->pools.first;
LineartStaticMemPoolNode *smpn = static_cast<LineartStaticMemPoolNode *>(smp->pools.first);
void *ret;
if (!smpn || (smpn->used_byte + size) > smpn->size) {
@ -123,7 +124,7 @@ void *lineart_mem_acquire_thread(LineartStaticMemPool *smp, size_t size)
BLI_spin_lock(&smp->lock_mem);
LineartStaticMemPoolNode *smpn = smp->pools.first;
LineartStaticMemPoolNode *smpn = static_cast<LineartStaticMemPoolNode *>(smp->pools.first);
if (!smpn || (smpn->used_byte + size) > smpn->size) {
smpn = lineart_mem_new_static_pool(smp, size);
@ -140,14 +141,14 @@ void *lineart_mem_acquire_thread(LineartStaticMemPool *smp, size_t size)
void lineart_mem_destroy(LineartStaticMemPool *smp)
{
LineartStaticMemPoolNode *smpn;
while ((smpn = BLI_pophead(&smp->pools)) != NULL) {
while ((smpn = static_cast<LineartStaticMemPoolNode *>(BLI_pophead(&smp->pools))) != nullptr) {
MEM_freeN(smpn);
}
}
void lineart_prepend_pool(LinkNode **first, LineartStaticMemPool *smp, void *link)
{
LinkNode *ln = lineart_mem_acquire_thread(smp, sizeof(LinkNode));
LinkNode *ln = static_cast<LinkNode *>(lineart_mem_acquire_thread(smp, sizeof(LinkNode)));
ln->next = (*first);
ln->link = link;
(*first) = ln;

View File

@ -134,12 +134,17 @@ namespace blender::dna {
*
* From the implementation detail go via copy constructor/assign operator defined in the structure.
*/
template<class T>
template<typename T>
[[nodiscard]] inline internal::ShallowDataConstRef<T> shallow_copy(const T &other)
{
return internal::ShallowDataConstRef(other);
}
template<typename T> inline void shallow_copy_array(T *dst, const T *src, const int64_t size)
{
_DNA_internal_memcpy(dst, src, sizeof(T) * size_t(size));
}
/* DNA object initializer which leads to an object which underlying memory is filled with zeroes.
*/
[[nodiscard]] inline internal::ShallowZeroInitializeTag shallow_zero_initialize()