GPencil: Cleanup - replace loop with LISTBASE_FOREACH

This commit is contained in:
Antonio Vazquez 2020-06-28 17:13:10 +02:00
parent 3bdfd8c916
commit b21ba5e579
Notes: blender-bot 2023-02-13 22:07:44 +01:00
Referenced by issue #87351, Alembic Exports Particles Wrong?
Referenced by issue #86500, Cycles: tapering hair transparency fails in '3D Curves' mode [regression] (probably caused by embree)
Referenced by issue #86171, Cycles freeze on render and texture baking (with packed textures)
Referenced by issue #82483, Viewport Rendering and Texture Baking freezes Blender
Referenced by issue #78390, Assign Materials on Faces of an object
Referenced by issue #78384, Mantaflow - liquid sim - strange behaviour
Referenced by issue #77910, Sometimes the Viewport is damaged.
2 changed files with 6 additions and 29 deletions

View File

@ -278,8 +278,7 @@ void BKE_gpencil_stroke_simplify_fixed(bGPDstroke *gps)
/* init lattice deform data */
void BKE_gpencil_lattice_init(Object *ob)
{
GpencilModifierData *md;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
if (md->type == eGpencilModifierType_Lattice) {
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
Object *latob = NULL;
@ -301,8 +300,7 @@ void BKE_gpencil_lattice_init(Object *ob)
/* clear lattice deform data */
void BKE_gpencil_lattice_clear(Object *ob)
{
GpencilModifierData *md;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
if (md->type == eGpencilModifierType_Lattice) {
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
if ((mmd) && (mmd->cache_data)) {
@ -319,8 +317,7 @@ void BKE_gpencil_lattice_clear(Object *ob)
/* check if exist geometry modifiers */
bool BKE_gpencil_has_geometry_modifiers(Object *ob)
{
GpencilModifierData *md;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
if (mti && mti->generateStrokes) {
@ -333,8 +330,7 @@ bool BKE_gpencil_has_geometry_modifiers(Object *ob)
/* check if exist time modifiers */
bool BKE_gpencil_has_time_modifiers(Object *ob)
{
GpencilModifierData *md;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
if (mti && mti->remapTime) {
@ -347,8 +343,7 @@ bool BKE_gpencil_has_time_modifiers(Object *ob)
/* Check if exist transform stroke modifiers (to rotate sculpt or edit). */
bool BKE_gpencil_has_transform_modifiers(Object *ob)
{
GpencilModifierData *md;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
/* Only if enabled in edit mode. */
if (!GPENCIL_MODIFIER_EDIT(md, true) && GPENCIL_MODIFIER_ACTIVE(md, false)) {
if ((md->type == eGpencilModifierType_Armature) || (md->type == eGpencilModifierType_Hook) ||
@ -365,12 +360,11 @@ bool BKE_gpencil_has_transform_modifiers(Object *ob)
static int gpencil_time_modifier(
Depsgraph *depsgraph, Scene *scene, Object *ob, bGPDlayer *gpl, int cfra, bool is_render)
{
GpencilModifierData *md;
bGPdata *gpd = ob->data;
const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd);
int nfra = cfra;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);

View File

@ -105,23 +105,6 @@ GpencilModifierData *ED_object_gpencil_modifier_add(
return new_md;
}
/* Return true if the object has a modifier of type 'type' other than
* the modifier pointed to be 'exclude', otherwise returns false. */
static bool UNUSED_FUNCTION(gpencil_object_has_modifier)(const Object *ob,
const GpencilModifierData *exclude,
GpencilModifierType type)
{
GpencilModifierData *md;
for (md = ob->greasepencil_modifiers.first; md; md = md->next) {
if ((md != exclude) && (md->type == type)) {
return true;
}
}
return false;
}
static bool gpencil_object_modifier_remove(Main *bmain,
Object *ob,
GpencilModifierData *md,