Commit: 60e387f5e3ae41c4b1e507f5aa4d8673a9f8765f Author: Bastien Montagne Date: Tue Jan 31 09:47:59 2017 +0100 Branches: master https://developer.blender.org/rB60e387f5e3ae41c4b1e507f5aa4d8673a9f8765f
Cleanup: Rename callback flags from library_query to `IDWALK_CB_...` Better to have clear way to tell whether flag is parameter for BKE_library_foreach_ID_link(), parameter for its callback function, or return value from this callback function. =================================================================== M source/blender/blenkernel/BKE_library_query.h M source/blender/blenkernel/intern/library.c M source/blender/blenkernel/intern/library_query.c M source/blender/blenkernel/intern/library_remap.c M source/blender/blenkernel/intern/particle_system.c M source/blender/blenkernel/intern/rigidbody.c M source/blender/blenkernel/intern/sca.c M source/blender/blenloader/intern/readfile.c M source/blender/modifiers/intern/MOD_armature.c M source/blender/modifiers/intern/MOD_array.c M source/blender/modifiers/intern/MOD_boolean.c M source/blender/modifiers/intern/MOD_cast.c M source/blender/modifiers/intern/MOD_cloth.c M source/blender/modifiers/intern/MOD_curve.c M source/blender/modifiers/intern/MOD_datatransfer.c M source/blender/modifiers/intern/MOD_displace.c M source/blender/modifiers/intern/MOD_dynamicpaint.c M source/blender/modifiers/intern/MOD_hook.c M source/blender/modifiers/intern/MOD_lattice.c M source/blender/modifiers/intern/MOD_mask.c M source/blender/modifiers/intern/MOD_meshdeform.c M source/blender/modifiers/intern/MOD_meshsequencecache.c M source/blender/modifiers/intern/MOD_mirror.c M source/blender/modifiers/intern/MOD_normal_edit.c M source/blender/modifiers/intern/MOD_particleinstance.c M source/blender/modifiers/intern/MOD_screw.c M source/blender/modifiers/intern/MOD_shrinkwrap.c M source/blender/modifiers/intern/MOD_simpledeform.c M source/blender/modifiers/intern/MOD_smoke.c M source/blender/modifiers/intern/MOD_uvproject.c M source/blender/modifiers/intern/MOD_uvwarp.c M source/blender/modifiers/intern/MOD_warp.c M source/blender/modifiers/intern/MOD_wave.c M source/blender/modifiers/intern/MOD_weightvgedit.c M source/blender/modifiers/intern/MOD_weightvgmix.c M source/blender/modifiers/intern/MOD_weightvgproximity.c M source/blender/python/intern/bpy_rna_id_collection.c M source/blender/windowmanager/intern/wm_operators.c =================================================================== diff --git a/source/blender/blenkernel/BKE_library_query.h b/source/blender/blenkernel/BKE_library_query.h index 693d5e9a28..59b38aec34 100644 --- a/source/blender/blenkernel/BKE_library_query.h +++ b/source/blender/blenkernel/BKE_library_query.h @@ -36,28 +36,28 @@ struct Main; /* Tips for the callback for cases it's gonna to modify the pointer. */ enum { - IDWALK_NOP = 0, - IDWALK_NEVER_NULL = (1 << 0), - IDWALK_NEVER_SELF = (1 << 1), + IDWALK_CB_NOP = 0, + IDWALK_CB_NEVER_NULL = (1 << 0), + IDWALK_CB_NEVER_SELF = (1 << 1), /** * Indicates whether this is direct (i.e. by local data) or indirect (i.e. by linked data) usage. * \note Object proxies are half-local, half-linked... */ - IDWALK_INDIRECT_USAGE = (1 << 2), + IDWALK_CB_INDIRECT_USAGE = (1 << 2), /** That ID is used as mere sub-data by its owner * (only case currently: those f***ing nodetrees in materials etc.). * This means callback shall not *do* anything, only use this as informative data if it needs it. */ - IDWALK_PRIVATE = (1 << 3), + IDWALK_CB_PRIVATE = (1 << 3), /** * Adjusts #ID.us reference-count. * \note keep in sync with 'newlibadr_us' use in readfile.c */ - IDWALK_USER = (1 << 8), + IDWALK_CB_USER = (1 << 8), /** Ensure #ID.us is at least 1 on use. */ - IDWALK_USER_ONE = (1 << 9), + IDWALK_CB_USER_ONE = (1 << 9), }; enum { @@ -75,6 +75,7 @@ typedef int (*LibraryIDLinkCallback) (void *user_data, struct ID *id_self, struc /* Flags for the foreach function itself. */ enum { + IDWALK_NOP = 0, IDWALK_READONLY = (1 << 0), IDWALK_RECURSE = (1 << 1), /* Also implies IDWALK_READONLY. */ }; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index daa8c6f5e5..7350e014d4 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -276,7 +276,7 @@ void BKE_id_clear_newpoin(ID *id) static int id_expand_local_callback( void *UNUSED(user_data), struct ID *id_self, struct ID **id_pointer, int cd_flag) { - if (cd_flag & IDWALK_PRIVATE) { + if (cd_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 03c4b80335..9aaf2b24c5 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -162,7 +162,7 @@ static void library_foreach_constraintObjectLooper(bConstraint *UNUSED(con), ID bool is_reference, void *user_data) { LibraryForeachIDData *data = (LibraryForeachIDData *) user_data; - const int cd_flag = is_reference ? IDWALK_USER : IDWALK_NOP; + const int cd_flag = is_reference ? IDWALK_CB_USER : IDWALK_CB_NOP; FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pointer, cd_flag); FOREACH_FINALIZE_VOID; @@ -208,7 +208,7 @@ static void library_foreach_nla_strip(LibraryForeachIDData *data, NlaStrip *stri { NlaStrip *substrip; - FOREACH_CALLBACK_INVOKE(data, strip->act, IDWALK_USER); + FOREACH_CALLBACK_INVOKE(data, strip->act, IDWALK_CB_USER); for (substrip = strip->strips.first; substrip; substrip = substrip->next) { library_foreach_nla_strip(data, substrip); @@ -231,14 +231,14 @@ static void library_foreach_animationData(LibraryForeachIDData *data, AnimData * /* only used targets */ DRIVER_TARGETS_USED_LOOPER(dvar) { - FOREACH_CALLBACK_INVOKE_ID(data, dtar->id, IDWALK_NOP); + FOREACH_CALLBACK_INVOKE_ID(data, dtar->id, IDWALK_CB_NOP); } DRIVER_TARGETS_LOOPER_END } } - FOREACH_CALLBACK_INVOKE(data, adt->action, IDWALK_USER); - FOREACH_CALLBACK_INVOKE(data, adt->tmpact, IDWALK_USER); + FOREACH_CALLBACK_INVOKE(data, adt->action, IDWALK_CB_USER); + FOREACH_CALLBACK_INVOKE(data, adt->tmpact, IDWALK_CB_USER); for (nla_track = adt->nla_tracks.first; nla_track; nla_track = nla_track->next) { for (nla_strip = nla_track->strips.first; nla_strip; nla_strip = nla_strip->next) { @@ -251,16 +251,16 @@ static void library_foreach_animationData(LibraryForeachIDData *data, AnimData * static void library_foreach_mtex(LibraryForeachIDData *data, MTex *mtex) { - FOREACH_CALLBACK_INVOKE(data, mtex->object, IDWALK_NOP); - FOREACH_CALLBACK_INVOKE(data, mtex->tex, IDWALK_USER); + FOREACH_CALLBACK_INVOKE(data, mtex->object, IDWALK_CB_NOP); + FOREACH_CALLBACK_INVOKE(data, mtex->tex, IDWALK_CB_USER); FOREACH_FINALIZE_VOID; } static void library_foreach_paint(LibraryForeachIDData *data, Paint *paint) { - FOREACH_CALLBACK_INVOKE(data, paint->brush, IDWALK_USER); - FOREACH_CALLBACK_INVOKE(data, paint->palette, IDWALK_USER); + FOREACH_CALLBACK_INVOKE(data, paint->brush, IDWALK_CB_USER); + FOREACH_CALLBACK_INVOKE(data, paint->palette, IDWALK_CB_USER); FOREACH_FINALIZE_VOID; } @@ -270,7 +270,7 @@ static void library_foreach_ID_as_subdata_link( { /* Needed e.g. for callbacks handling relationships... This call shall be absolutely readonly. */ ID *id = *id_pp; - FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pp, IDWALK_PRIVATE); + FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pp, IDWALK_CB_PRIVATE); BLI_assert(id == *id_pp); if (flag & IDWALK_RECURSE) { @@ -323,7 +323,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call for (; id != NULL; id = (flag & IDWALK_RECURSE) ? BLI_LINKSTACK_POP(data.ids_todo) : NULL) { data.self_id = id; - data.cd_flag = ID_IS_LINKED_DATABLOCK(id) ? IDWALK_INDIRECT_USAGE : 0; + data.cd_flag = ID_IS_LINKED_DATABLOCK(id) ? IDWALK_CB_INDIRECT_USAGE : 0; if (bmain != NULL && bmain->relations != NULL && (flag & IDWALK_READONLY)) { /* Note that this is minor optimization, even in worst cases (like id being an object with lots of @@ -346,7 +346,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call case ID_LI: { Library *lib = (Library *) id; - CALLBACK_INVOKE(lib->parent, IDWALK_NOP); + CALLBACK_INVOKE(lib->parent, IDWALK_CB_NOP); break; } case ID_SCE: @@ -356,39 +356,39 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call SceneRenderLayer *srl; Base *base; - CALLBACK_INVOKE(scene->camera, IDWALK_NOP); - CALLBACK_INVOKE(scene->world, IDWALK_USER); - CALLBACK_INVOKE(scene->set, IDWALK_NOP); - CALLBACK_INVOKE(scene->clip, IDWALK_USER); + CALLBACK_INVOKE(scene->camera, IDWALK_CB_NOP); + CALLBACK_INVOKE(scene->world, IDWALK_CB_USER); + CALLBACK_INVOKE(scene->set, IDWALK_CB_NOP); + CALLBACK_INVOKE(scene->clip, IDWALK_CB_USER); if (scene->nodetree) { /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */ library_foreach_ID_as_subdata_link((ID **)&scene->nodetree, callback, user_data, flag, &data); } /* DO NOT handle scene->basact here, it's doubling with the loop over whole scene->base later, * since basact is just a pointer to one of those items. */ - CALLBACK_INVOKE(scene->obedit, IDWALK_NOP); + CALLBACK_INVOKE(scene->obedit, IDWALK_CB_NOP); for (srl = scene->r.layers.first; srl; srl = srl->next) { FreestyleModuleConfig *fmc; FreestyleLineSet *fls; if (srl->mat_override) { - CALLBACK_INVOKE(srl->mat_override, IDWALK_USER); + CALLBACK_INVOKE(srl->mat_override, IDWALK_CB_USER); } if (srl->light_override) { - CALLBACK_INVOKE(srl->light_override, IDWALK_USER); + CALLBACK_INVOKE(srl->light_override, IDWALK_CB_USER); } for (fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) { if (fmc->script) { - CALLBACK_INVOKE(fmc->script, IDWALK_NOP); + CALLBACK_INVOKE(fmc->script, IDWALK_CB_NOP); } } for (fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) { if (fls->group) { - CALLBACK_INVOKE(fls->group, IDWALK_USER); + CALLBACK_INVOKE(fls->group, IDWALK_CB_USER); } if (fls->linestyle) { - CALLBACK_INVOKE(fls->linestyle, IDWALK_USER); + CALLBACK_INVOKE(fls->linestyle, IDWALK_CB_USER); } } } @@ -397,39 +397,39 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call Sequence *seq; SEQP_BEGIN(scene->ed, seq) { - CALLBACK_INVOKE(seq->scene, IDWALK_NOP); - CALLBACK_INVOKE(seq->scene_camera, IDWALK_NOP); - CALLBACK_INVOKE(seq->clip, IDWALK_USER); - CALLBACK_INVOKE(seq->mask, IDWALK_USER); - CALLBACK_INVOKE(seq->sound, IDWALK_USER); + CALLBACK_INVOKE(seq->scene, IDWALK_CB_NOP); + CALLBACK_INVOKE(seq->scene_camera, IDWALK_CB_NOP); + CALLBACK_INVOKE(seq->clip, IDWALK_CB_USER); + CALLBACK_INVOKE(seq->mask, IDWALK_CB_USER); + CALLBACK_INVOKE(seq->sound, IDWALK_CB_USER); for (SequenceModifierData *smd = seq->modifiers.first; smd; smd = smd->next) { - CALLBACK_INVOKE(smd->mask_id, IDWALK_USER); + CALLBACK_INVOKE(smd->mask_id, IDWALK_CB_USER); } } SEQ_END } - CALLBACK_INVOKE(scene->gpd, IDWALK_USER); + CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER); for (base = scene->base.first; base; base = base->next) { - CALLBACK_INVOKE(base->object, IDWALK_USER); + CALLBACK_INVOKE(base->object, IDWALK_CB_USER); } for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) { - CALLBACK_INVOKE(marker->camera, IDWALK_NOP); + CALLBACK_INVOKE(marker->camera, IDWALK_CB_NOP); } if (toolsett) { - CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_NOP); + CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_CB_NOP); - CALLBACK_INVOKE(toolsett->particle.scene, IDWALK_NOP); - CALLBACK_INVOKE(toolsett->particle.object, IDWALK_NOP); - CALLBACK_INVOKE(toolsett->particle.shape_object, IDWALK_NOP); + CALLBACK_INVOKE(toolsett->particle.scene, IDWALK_CB_NOP); + CALLBACK_INVOKE(toolsett->particle.object, IDWALK_CB_NOP); + CALLBACK_INVOKE(toolsett->particle.shape_object, IDWALK_CB_NOP); library_foreach_paint(&data, &toolsett->imapaint.paint); - CALLBACK_INVOKE(toolsett->imapaint.stencil, IDWALK_USER); - CALLBACK_INVOKE(toolsett->imap @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs