diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-14 13:36:56 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-14 13:39:54 +0300 |
commit | 95b36321126fd6f9563b309930ac9ae6cf422a81 (patch) | |
tree | 0722b78d4ffc69d49926d34d7ac0a9816c30dacd /source | |
parent | 6cda217a82078d7bdf61caec458154a507a58947 (diff) | |
parent | 0b55b8cc6a37fa4e74c55c9ccb54950c5f546bd6 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/alembic/intern/abc_exporter.cc
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/alembic/intern/abc_exporter.cc | 84 | ||||
-rw-r--r-- | source/blender/alembic/intern/alembic_capi.cc | 4 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/task.c | 14 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sound/sound_ops.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_surfacedeform.c | 9 |
8 files changed, 85 insertions, 33 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index 1b218b98f21..ddbbf27392d 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -124,14 +124,32 @@ static bool object_is_shape(Object *ob) } } -static bool export_object(const ExportSettings * const settings, const Base * const ob_base) + +/** + * Returns whether this object should be exported into the Alembic file. + * + * @param settings export settings, used for options like 'selected only'. + * @param ob the object's base in question. + * @param is_duplicated normally false; true when the object is instanced + * into the scene by a dupli-object (e.g. part of a + * dupligroup). This ignores selection and layer + * visibility, and assumes that the dupli-object itself + * (e.g. the group-instantiating empty) is exported. + */ +static bool export_object(const ExportSettings * const settings, const Base * const ob_base, + bool is_duplicated) { - if (settings->selected_only && !object_selected(ob_base)) { - return false; - } - // FIXME Sybren: handle these cleanly (maybe just remove code), now using active scene layer instead. - if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLED) == 0) { - return false; + if (!is_duplicated) { + /* These two tests only make sense when the object isn't being instanced + * into the scene. When it is, its exportability is determined by + * its dupli-object and the DupliObject::no_draw property. */ + if (settings->selected_only && !object_selected(ob_base)) { + return false; + } + // FIXME Sybren: handle these cleanly (maybe just remove code), now using active scene layer instead. + if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLED) == 0) { + return false; + } } // if (settings->renderable_only && (ob->restrictflag & OB_RESTRICT_RENDER)) { @@ -347,7 +365,7 @@ void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx) for (Base *base = static_cast<Base *>(m_settings.sl->object_bases.first); base; base = base->next) { Object *ob = base->object; - if (export_object(&m_settings, base)) { + if (export_object(&m_settings, base, false)) { switch (ob->type) { case OB_LAMP: case OB_LATTICE: @@ -368,7 +386,7 @@ void AbcExporter::createTransformWritersFlat() for (Base *base = static_cast<Base *>(m_settings.sl->object_bases.first); base; base = base->next) { Object *ob = base->object; - if (!export_object(&m_settings, base)) { + if (export_object(&m_settings, base, false) && object_is_shape(ob)) { std::string name = get_id_name(ob); m_xforms[name] = new AbcTransformWriter( ob, m_writer->archive().getTop(), NULL, @@ -381,7 +399,13 @@ void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, O { Object *ob = ob_base->object; - if (export_object(&m_settings, ob_base) && object_is_shape(ob)) { + /* If an object isn't exported itself, its duplilist shouldn't be + * exported either. */ + if (!export_object(&m_settings, ob_base, dupliObParent != NULL)) { + return; + } + + if (object_is_shape(ob)) { createTransformWriter(ob, parent, dupliObParent); } @@ -391,9 +415,15 @@ void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, O Base fake_base = *ob_base; // copy flags (like selection state) from the real object. fake_base.next = fake_base.prev = NULL; - for (DupliObject *link = static_cast<DupliObject *>(lb->first); link; link = link->next) { - Object *dupli_ob = NULL; - Object *dupli_parent = NULL; + DupliObject *link = static_cast<DupliObject *>(lb->first); + Object *dupli_ob = NULL; + Object *dupli_parent = NULL; + + for (; link; link = link->next) { + /* This skips things like custom bone shapes. */ + if (m_settings.renderable_only && link->no_draw) { + continue; + } if (link->type == OB_DUPLIGROUP) { dupli_ob = link->ob; @@ -469,18 +499,30 @@ void AbcExporter::createShapeWriters(EvaluationContext *eval_ctx) void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Base *ob_base, Object *dupliObParent) { - Object *ob = ob_base->object; - ListBase *lb = object_duplilist(eval_ctx, m_scene, ob); - + /* If an object isn't exported itself, its duplilist shouldn't be + * exported either. */ + if (!export_object(&m_settings, ob_base, dupliObParent != NULL)) { + return; + } + createShapeWriter(ob_base, dupliObParent); + Object *ob = ob_base->object; + ListBase *lb = object_duplilist(eval_ctx, m_scene, ob); + if (lb) { Base fake_base = *ob_base; // copy flags (like selection state) from the real object. fake_base.next = fake_base.prev = NULL; - for (DupliObject *dupliob = static_cast<DupliObject *>(lb->first); dupliob; dupliob = dupliob->next) { - if (dupliob->type == OB_DUPLIGROUP) { - fake_base.object = dupliob->ob; + DupliObject *link = static_cast<DupliObject *>(lb->first); + + for (; link; link = link->next) { + /* This skips things like custom bone shapes. */ + if (m_settings.renderable_only && link->no_draw) { + continue; + } + if (link->type == OB_DUPLIGROUP) { + fake_base.object = link->ob; exploreObject(eval_ctx, &fake_base, ob); } } @@ -497,10 +539,6 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent) return; } - if (!export_object(&m_settings, ob_base)) { - return; - } - std::string name; if (m_settings.flatten_hierarchy) { diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index b457b38b9fd..cee571b9e41 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -734,8 +734,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa CFRA = SFRA; } else if (min_time < max_time) { - SFRA = static_cast<int>(min_time * FPS); - EFRA = static_cast<int>(max_time * FPS); + SFRA = static_cast<int>(round(min_time * FPS)); + EFRA = static_cast<int>(round(max_time * FPS)); CFRA = SFRA; } } diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index b4d29b5d61e..f99f1bf0d6d 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -135,6 +135,7 @@ void blf_glyph_cache_clear(FontBLF *font) while ((gc = BLI_pophead(&font->cache))) { blf_glyph_cache_free(gc); } + font->glyph_cache = NULL; } void blf_glyph_cache_free(GlyphCacheBLF *gc) diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index c92881bb741..eb4e6e91aee 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -168,6 +168,9 @@ struct TaskPool { */ bool use_local_tls; TaskThreadLocalStorage local_tls; +#ifndef NDEBUG + pthread_t creator_thread_id; +#endif #ifdef DEBUG_STATS TaskMemPoolStats *mempool_stats; @@ -220,11 +223,14 @@ BLI_INLINE TaskThreadLocalStorage *get_task_tls(TaskPool *pool, TaskScheduler *scheduler = pool->scheduler; BLI_assert(thread_id >= 0); BLI_assert(thread_id <= scheduler->num_threads); - if (pool->use_local_tls) { + if (pool->use_local_tls && thread_id == 0) { BLI_assert(pool->thread_id == 0); + BLI_assert(!BLI_thread_is_main()); + BLI_assert(pthread_equal(pthread_self(), pool->creator_thread_id)); return &pool->local_tls; } if (thread_id == 0) { + BLI_assert(BLI_thread_is_main()); return &scheduler->task_threads[pool->thread_id].tls; } return &scheduler->task_threads[thread_id].tls; @@ -268,6 +274,9 @@ static void task_free(TaskPool *pool, Task *task, const int thread_id) task_data_free(task, thread_id); BLI_assert(thread_id >= 0); BLI_assert(thread_id <= pool->scheduler->num_threads); + if (thread_id == 0) { + BLI_assert(pool->use_local_tls || BLI_thread_is_main()); + } TaskThreadLocalStorage *tls = get_task_tls(pool, thread_id); TaskMemPool *task_mempool = &tls->task_mempool; if (task_mempool->num_tasks < MEMPOOL_SIZE - 1) { @@ -613,6 +622,9 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler, */ pool->thread_id = 0; pool->use_local_tls = true; +#ifndef NDEBUG + pool->creator_thread_id = pthread_self(); +#endif initialize_task_tls(&pool->local_tls); } else { diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index fb309dc979b..d614be175f2 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -793,7 +793,7 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Modifier"; - ot->description = "Add a modifier to the active object"; + ot->description = "Add a procedural operation/effect to the active object"; ot->idname = "OBJECT_OT_modifier_add"; /* api callbacks */ diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index b58bd43a35e..e031e9a641c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -612,7 +612,7 @@ void WORLD_OT_new(wmOperatorType *ot) /* identifiers */ ot->name = "New World"; ot->idname = "WORLD_OT_new"; - ot->description = "Add a new world"; + ot->description = "Create a new world Data-Block"; /* api callbacks */ ot->exec = new_world_exec; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 8eaa0039756..d103530fa81 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -670,7 +670,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot) /* identifiers */ ot->name = "Mixdown"; - ot->description = "Mixes the scene's audio to a sound file"; + ot->description = "Mix the scene's audio to a sound file"; ot->idname = "SOUND_OT_mixdown"; /* api callbacks */ diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 4f5814b7ad8..bf6a0bdd234 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -1103,6 +1103,11 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un tdm = smd->target->derivedFinal; } + if (!tdm) { + modifier_setError(md, "No valid target mesh"); + return; + } + tnumverts = tdm->getNumVerts(tdm); tnumpoly = tdm->getNumPolys(tdm); @@ -1122,12 +1127,10 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un /* Poly count checks */ if (smd->numverts != numverts) { modifier_setError(md, "Verts changed from %u to %u", smd->numverts, numverts); - tdm->release(tdm); return; } else if (smd->numpoly != tnumpoly) { modifier_setError(md, "Target polygons changed from %u to %u", smd->numpoly, tnumpoly); - tdm->release(tdm); return; } @@ -1153,8 +1156,6 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un MEM_freeN(data.targetCos); } - - tdm->release(tdm); } static void deformVerts(ModifierData *md, Object *ob, |