diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/armature/pose_lib.c | 34 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 5 |
5 files changed, 29 insertions, 18 deletions
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index d89b2fcfe84..54c40621a14 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -834,7 +834,6 @@ typedef struct tPoseLib_PreviewData { bAction *act; /* poselib to use */ TimeMarker *marker; /* 'active' pose */ - int selcount; /* number of selected elements to work on */ int totcount; /* total number of elements to work on */ short state; /* state of main loop */ @@ -867,7 +866,8 @@ enum { /* defines for tPoseLib_PreviewData->flag values */ enum { PL_PREVIEW_FIRSTTIME = (1 << 0), - PL_PREVIEW_SHOWORIGINAL = (1 << 1) + PL_PREVIEW_SHOWORIGINAL = (1 << 1), + PL_PREVIEW_ANY_BONE_SELECTED = (1 << 2), }; /* ---------------------------- */ @@ -887,7 +887,20 @@ static void poselib_backup_posecopy(tPoseLib_PreviewData *pld) { bActionGroup *agrp; bPoseChannel *pchan; - + bool selected = false; + + /* determine whether any bone is selected. */ + LISTBASE_FOREACH (bPoseChannel *, bchan, &pld->pose->chanbase) { + selected = bchan->bone != NULL && bchan->bone->flag & BONE_SELECTED; + if (selected) { + pld->flag |= PL_PREVIEW_ANY_BONE_SELECTED; + break; + } + } + if (!selected) { + pld->flag &= ~PL_PREVIEW_ANY_BONE_SELECTED; + } + /* for each posechannel that has an actionchannel in */ for (agrp = pld->act->groups.first; agrp; agrp = agrp->next) { /* try to find posechannel */ @@ -909,8 +922,6 @@ static void poselib_backup_posecopy(tPoseLib_PreviewData *pld) BLI_addtail(&pld->backups, plb); /* mark as being affected */ - if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) - pld->selcount++; pld->totcount++; } } @@ -971,6 +982,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) KeyframeEditData ked = {{NULL}}; KeyframeEditFunc group_ok_cb; int frame = 1; + const bool any_bone_selected = pld->flag & PL_PREVIEW_ANY_BONE_SELECTED; /* get the frame */ if (pld->marker) @@ -983,8 +995,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) group_ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE); ked.f1 = ((float)frame) - 0.5f; ked.f2 = ((float)frame) + 0.5f; - - + /* start applying - only those channels which have a key at this point in time! */ for (agrp = act->groups.first; agrp; agrp = agrp->next) { /* check if group has any keyframes */ @@ -996,7 +1007,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) bool ok = 0; /* check if this bone should get any animation applied */ - if (pld->selcount == 0) { + if (!any_bone_selected) { /* if no bones are selected, then any bone is ok */ ok = 1; } @@ -1009,7 +1020,7 @@ static void poselib_apply_pose(tPoseLib_PreviewData *pld) ok = 1; } } - + if (ok) animsys_evaluate_action_group(ptr, act, agrp, NULL, (float)frame); } @@ -1028,14 +1039,15 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID); ListBase dsources = {NULL, NULL}; bool autokey = autokeyframe_cfra_can_key(scene, &pld->ob->id); - + const bool any_bone_selected = pld->flag & PL_PREVIEW_ANY_BONE_SELECTED; + /* start tagging/keying */ for (agrp = act->groups.first; agrp; agrp = agrp->next) { /* only for selected bones unless there aren't any selected, in which case all are included */ pchan = BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { - if ((pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) { + if (!any_bone_selected || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) { if (autokey) { /* add datasource override for the PoseChannel, to be used later */ ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 02bfc70080a..bf0e3ca4d96 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -3229,7 +3229,7 @@ void node_attribute_volume_color(sampler3D tex, out vec4 outcol, out vec3 outvec vec4 value = texture(tex, cos).rgba; /* Density is premultiplied for interpolation, divide it out here. */ - if (value.a > 0.0) + if (value.a > 1e-8) value.rgb /= value.a; outvec = value.rgb; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 5472cae3ef2..a770b34ecc6 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -511,7 +511,7 @@ static int startffmpeg(struct anim *anim) return -1; } - frame_rate = av_get_r_frame_rate_compat(pFormatCtx->streams[videoStream]); + frame_rate = av_get_r_frame_rate_compat(pFormatCtx, pFormatCtx->streams[videoStream]); if (pFormatCtx->streams[videoStream]->nb_frames != 0) { anim->duration = pFormatCtx->streams[videoStream]->nb_frames; } @@ -989,7 +989,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, v_st = anim->pFormatCtx->streams[anim->videoStream]; - frame_rate = av_q2d(av_get_r_frame_rate_compat(v_st)); + frame_rate = av_q2d(av_get_r_frame_rate_compat(anim->pFormatCtx, v_st)); st_time = anim->pFormatCtx->start_time; pts_time_base = av_q2d(v_st->time_base); diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 009258079ee..eaf4dfd84b4 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -909,7 +909,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, stream_size = avio_size(context->iFormatCtx->pb); - context->frame_rate = av_q2d(av_get_r_frame_rate_compat(context->iStream)); + context->frame_rate = av_q2d(av_get_r_frame_rate_compat(context->iFormatCtx, context->iStream)); context->pts_time_base = av_q2d(context->iStream->time_base); while (av_read_frame(context->iFormatCtx, &next_packet) >= 0) { diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 4cb1c13a44a..4e85d70d382 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1621,14 +1621,13 @@ static bool exr_has_alpha(MultiPartInputFile& file) static bool imb_exr_is_multilayer_file(MultiPartInputFile& file) { - const StringAttribute *comments = file.header(0).findTypedAttribute<StringAttribute>("BlenderMultiChannel"); const ChannelList& channels = file.header(0).channels(); std::set <std::string> layerNames; /* will not include empty layer names */ channels.layers(layerNames); - if (comments || layerNames.size() > 1) + if (layerNames.size() > 1) return true; if (layerNames.size()) { @@ -1667,7 +1666,7 @@ static void imb_exr_type_by_channels(ChannelList& channels, StringVector& views, } else { *r_singlelayer = false; - *r_multilayer = true; + *r_multilayer = (layerNames.size() > 1); *r_multiview = false; return; } |