Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/modifiers/intern/MOD_meshsequencecache.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/modifiers/intern/MOD_meshsequencecache.c')
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.c228
1 files changed, 109 insertions, 119 deletions
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 3b092bc7a76..7710082150b 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -42,168 +42,158 @@
static void initData(ModifierData *md)
{
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
- mcmd->cache_file = NULL;
- mcmd->object_path[0] = '\0';
- mcmd->read_flag = MOD_MESHSEQ_READ_ALL;
+ mcmd->cache_file = NULL;
+ mcmd->object_path[0] = '\0';
+ mcmd->read_flag = MOD_MESHSEQ_READ_ALL;
}
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
{
#if 0
- const MeshSeqCacheModifierData *mcmd = (const MeshSeqCacheModifierData *)md;
+ const MeshSeqCacheModifierData *mcmd = (const MeshSeqCacheModifierData *)md;
#endif
- MeshSeqCacheModifierData *tmcmd = (MeshSeqCacheModifierData *)target;
+ MeshSeqCacheModifierData *tmcmd = (MeshSeqCacheModifierData *)target;
- modifier_copyData_generic(md, target, flag);
+ modifier_copyData_generic(md, target, flag);
- tmcmd->reader = NULL;
+ tmcmd->reader = NULL;
}
static void freeData(ModifierData *md)
{
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
- if (mcmd->reader) {
+ if (mcmd->reader) {
#ifdef WITH_ALEMBIC
- CacheReader_free(mcmd->reader);
+ CacheReader_free(mcmd->reader);
#endif
- mcmd->reader = NULL;
- }
+ mcmd->reader = NULL;
+ }
}
-static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene),
+ ModifierData *md,
+ bool UNUSED(useRenderParams))
{
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
- /* leave it up to the modifier to check the file is valid on calculation */
- return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0');
+ /* leave it up to the modifier to check the file is valid on calculation */
+ return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0');
}
-static Mesh *applyModifier(
- ModifierData *md, const ModifierEvalContext *ctx,
- Mesh *mesh)
+static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
#ifdef WITH_ALEMBIC
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
-
- /* Only used to check whether we are operating on org data or not... */
- Mesh *me = (ctx->object->type == OB_MESH) ? ctx->object->data : NULL;
- Mesh *org_mesh = mesh;
-
- Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
- const float frame = DEG_get_ctime(ctx->depsgraph);
- const float time = BKE_cachefile_time_offset(mcmd->cache_file, frame, FPS);
- const char *err_str = NULL;
-
- CacheFile *cache_file = (CacheFile *)DEG_get_original_id(&mcmd->cache_file->id);
-
- BKE_cachefile_ensure_handle(G.main, cache_file);
-
- if (!mcmd->reader) {
- mcmd->reader = CacheReader_open_alembic_object(cache_file->handle,
- NULL,
- ctx->object,
- mcmd->object_path);
- if (!mcmd->reader) {
- modifier_setError(md, "Could not create Alembic reader for file %s", cache_file->filepath);
- return mesh;
- }
- }
-
- if (me != NULL) {
- MVert *mvert = mesh->mvert;
- MEdge *medge = mesh->medge;
- MPoly *mpoly = mesh->mpoly;
- if ((me->mvert == mvert) || (me->medge == medge) || (me->mpoly == mpoly)) {
- /* We need to duplicate data here, otherwise we'll modify org mesh, see T51701. */
- BKE_id_copy_ex(NULL, &mesh->id, (ID **)&mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW);
- }
- }
-
- Mesh *result = ABC_read_mesh(mcmd->reader,
- ctx->object,
- mesh,
- time,
- &err_str,
- mcmd->read_flag);
-
- if (err_str) {
- modifier_setError(md, "%s", err_str);
- }
-
- if (!ELEM(result, NULL, mesh) && (mesh != org_mesh)) {
- BKE_id_free(NULL, mesh);
- mesh = org_mesh;
- }
-
- return result ? result : mesh;
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
+
+ /* Only used to check whether we are operating on org data or not... */
+ Mesh *me = (ctx->object->type == OB_MESH) ? ctx->object->data : NULL;
+ Mesh *org_mesh = mesh;
+
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ const float frame = DEG_get_ctime(ctx->depsgraph);
+ const float time = BKE_cachefile_time_offset(mcmd->cache_file, frame, FPS);
+ const char *err_str = NULL;
+
+ CacheFile *cache_file = (CacheFile *)DEG_get_original_id(&mcmd->cache_file->id);
+
+ BKE_cachefile_ensure_handle(G.main, cache_file);
+
+ if (!mcmd->reader) {
+ mcmd->reader = CacheReader_open_alembic_object(
+ cache_file->handle, NULL, ctx->object, mcmd->object_path);
+ if (!mcmd->reader) {
+ modifier_setError(md, "Could not create Alembic reader for file %s", cache_file->filepath);
+ return mesh;
+ }
+ }
+
+ if (me != NULL) {
+ MVert *mvert = mesh->mvert;
+ MEdge *medge = mesh->medge;
+ MPoly *mpoly = mesh->mpoly;
+ if ((me->mvert == mvert) || (me->medge == medge) || (me->mpoly == mpoly)) {
+ /* We need to duplicate data here, otherwise we'll modify org mesh, see T51701. */
+ BKE_id_copy_ex(NULL,
+ &mesh->id,
+ (ID **)&mesh,
+ LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT |
+ LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW);
+ }
+ }
+
+ Mesh *result = ABC_read_mesh(mcmd->reader, ctx->object, mesh, time, &err_str, mcmd->read_flag);
+
+ if (err_str) {
+ modifier_setError(md, "%s", err_str);
+ }
+
+ if (!ELEM(result, NULL, mesh) && (mesh != org_mesh)) {
+ BKE_id_free(NULL, mesh);
+ mesh = org_mesh;
+ }
+
+ return result ? result : mesh;
#else
- UNUSED_VARS(ctx, md);
- return mesh;
+ UNUSED_VARS(ctx, md);
+ return mesh;
#endif
}
static bool dependsOnTime(ModifierData *md)
{
#ifdef WITH_ALEMBIC
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
- return (mcmd->cache_file != NULL);
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
+ return (mcmd->cache_file != NULL);
#else
- UNUSED_VARS(md);
- return false;
+ UNUSED_VARS(md);
+ return false;
#endif
}
-static void foreachIDLink(
- ModifierData *md, Object *ob,
- IDWalkFunc walk, void *userData)
+static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
{
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
- walk(userData, ob, (ID **)&mcmd->cache_file, IDWALK_CB_USER);
+ walk(userData, ob, (ID **)&mcmd->cache_file, IDWALK_CB_USER);
}
-
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
- if (mcmd->cache_file != NULL) {
- DEG_add_object_cache_relation(ctx->node, mcmd->cache_file, DEG_OB_COMP_CACHE, "Mesh Cache File");
- }
+ if (mcmd->cache_file != NULL) {
+ DEG_add_object_cache_relation(
+ ctx->node, mcmd->cache_file, DEG_OB_COMP_CACHE, "Mesh Cache File");
+ }
}
ModifierTypeInfo modifierType_MeshSequenceCache = {
- /* name */ "Mesh Sequence Cache",
- /* structName */ "MeshSeqCacheModifierData",
- /* structSize */ sizeof(MeshSeqCacheModifierData),
- /* type */ eModifierTypeType_Constructive,
- /* flags */ eModifierTypeFlag_AcceptsMesh |
- eModifierTypeFlag_AcceptsCVs,
-
- /* copyData */ copyData,
-
- /* deformVerts */ NULL,
- /* deformMatrices */ NULL,
- /* deformVertsEM */ NULL,
- /* deformMatricesEM */ NULL,
- /* applyModifier */ applyModifier,
-
- /* initData */ initData,
- /* requiredDataMask */ NULL,
- /* freeData */ freeData,
- /* isDisabled */ isDisabled,
- /* updateDepsgraph */ updateDepsgraph,
- /* dependsOnTime */ dependsOnTime,
- /* dependsOnNormals */ NULL,
- /* foreachObjectLink */ NULL,
- /* foreachIDLink */ foreachIDLink,
- /* foreachTexLink */ NULL,
- /* freeRuntimeData */ NULL,
+ /* name */ "Mesh Sequence Cache",
+ /* structName */ "MeshSeqCacheModifierData",
+ /* structSize */ sizeof(MeshSeqCacheModifierData),
+ /* type */ eModifierTypeType_Constructive,
+ /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_AcceptsCVs,
+
+ /* copyData */ copyData,
+
+ /* deformVerts */ NULL,
+ /* deformMatrices */ NULL,
+ /* deformVertsEM */ NULL,
+ /* deformMatricesEM */ NULL,
+ /* applyModifier */ applyModifier,
+
+ /* initData */ initData,
+ /* requiredDataMask */ NULL,
+ /* freeData */ freeData,
+ /* isDisabled */ isDisabled,
+ /* updateDepsgraph */ updateDepsgraph,
+ /* dependsOnTime */ dependsOnTime,
+ /* dependsOnNormals */ NULL,
+ /* foreachObjectLink */ NULL,
+ /* foreachIDLink */ foreachIDLink,
+ /* foreachTexLink */ NULL,
+ /* freeRuntimeData */ NULL,
};