diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-05 18:14:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-05 18:14:46 +0300 |
commit | 84a154ac68d01583b318cca43d8d8bbded127700 (patch) | |
tree | 6414db1d253a5bbf0314a95b1cef47e2ef9da83c | |
parent | ae9beb1cead99ced03798f6acad8082408323991 (diff) | |
parent | df267bd4c48a3b73ad959951419161ae8f9ed126 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | build_files/cmake/macros.cmake | 4 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 9 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_time.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_movieclip.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 34 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MapRangeOperation.cpp | 5 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 59 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 21 |
11 files changed, 132 insertions, 24 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 09bc01fcae3..ab90a29e430 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1144,7 +1144,9 @@ endmacro() # External libs may need 'signed char' to be default. macro(remove_cc_flag_unsigned_char) - if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|Intel)$") + if(CMAKE_COMPILER_IS_GNUCC OR + (CMAKE_C_COMPILER_ID MATCHES "Clang") OR + (CMAKE_C_COMPILER_ID MATCHES "Intel")) remove_cc_flag("-funsigned-char") elseif(MSVC) remove_cc_flag("/J") diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index ca01e08afe9..534acab266a 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -31,6 +31,9 @@ endmacro() if(NOT DEFINED LIBDIR) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin) + # Prefer lib directory paths + file(GLOB LIB_SUBDIRS ${LIBDIR}/*) + set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS}) else() message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") endif() @@ -327,8 +330,8 @@ if(WITH_OPENVDB) endif() if(WITH_LLVM) - set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation") - set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use") + set(LLVM_ROOT_DIR ${LIBDIR}/llvm) + set(LLVM_VERSION 3.4) if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config") set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config") else() @@ -365,7 +368,7 @@ if(WITH_LLVM) endif() if(WITH_CYCLES_OSL) - set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation") + set(CYCLES_OSL ${LIBDIR}/osl) find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib) find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib) diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index d1202adfce6..9026a93aa99 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -119,7 +119,7 @@ class TIME_MT_marker(Menu): def draw(self, context): layout = self.layout - marker_menu_generic(layout, context) + marker_menu_generic(layout) class TIME_MT_view(Menu): diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index bd193b82b9e..818f79ad8ac 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -60,6 +60,7 @@ struct ImBuf *BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieCl void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height); void BKE_movieclip_get_size_fl(struct MovieClip *clip, struct MovieClipUser *user, float size[2]); int BKE_movieclip_get_duration(struct MovieClip *clip); +float BKE_movieclip_get_fps(struct MovieClip *clip); void BKE_movieclip_get_aspect(struct MovieClip *clip, float *aspx, float *aspy); bool BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user); void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 2264167eca1..62e09809dea 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -405,6 +405,8 @@ struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine); void BKE_sequence_alpha_mode_from_extension(struct Sequence *seq); void BKE_sequence_init_colorspace(struct Sequence *seq); +float BKE_sequence_get_fps(struct Scene *scene, struct Sequence *seq); + /* RNA enums, just to be more readable */ enum { SEQ_SIDE_NONE = 0, diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index f67560fe006..607307554da 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1202,6 +1202,23 @@ int BKE_movieclip_get_duration(MovieClip *clip) return clip->len; } +float BKE_movieclip_get_fps(MovieClip *clip) +{ + if (clip->source != MCLIP_SRC_MOVIE) { + return 0.0f; + } + movieclip_open_anim_file(clip); + if (clip->anim == NULL) { + return 0.0f; + } + short frs_sec; + float frs_sec_base; + if (IMB_anim_get_fps(clip->anim, &frs_sec, &frs_sec_base, true)) { + return (float)frs_sec / frs_sec_base; + } + return 0.0f; +} + void BKE_movieclip_get_aspect(MovieClip *clip, float *aspx, float *aspy) { *aspx = 1.0; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b11c1583236..66221dd470f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -5166,6 +5166,40 @@ void BKE_sequence_init_colorspace(Sequence *seq) } } +float BKE_sequence_get_fps(Scene *scene, Sequence *seq) +{ + switch (seq->type) { + case SEQ_TYPE_MOVIE: + { + seq_open_anim_file(scene, seq, true); + if (BLI_listbase_is_empty(&seq->anims)) { + return 0.0f; + } + StripAnim *strip_anim = seq->anims.first; + if (strip_anim->anim == NULL) { + return 0.0f; + } + short frs_sec; + float frs_sec_base; + if (IMB_anim_get_fps(strip_anim->anim, &frs_sec, &frs_sec_base, true)) { + return (float)frs_sec / frs_sec_base; + } + break; + } + case SEQ_TYPE_MOVIECLIP: + if (seq->clip != NULL) { + return BKE_movieclip_get_fps(seq->clip); + } + break; + case SEQ_TYPE_SCENE: + if (seq->scene != NULL) { + return (float)seq->scene->r.frs_sec / seq->scene->r.frs_sec_base; + } + break; + } + return 0.0f; +} + /* NOTE: this function doesn't fill in image names */ Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp index 7a89ba91b4c..7a38d066122 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp @@ -65,6 +65,11 @@ void MapRangeOperation::executePixelSampled(float output[4], float x, float y, P dest_min = inputs[3]; dest_max = inputs[4]; + if (fabsf(source_max - source_min) < 1e-6f) { + output[0] = 0.0f; + return; + } + if (value >= -BLENDER_ZMAX && value <= BLENDER_ZMAX) { value = (value - source_min) / (source_max - source_min); value = dest_min + value * (dest_max - dest_min); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 4ca2b54eaaf..f2bf817f502 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1859,7 +1859,7 @@ static bool is_track_clean(MovieTrackingTrack *track, int frames, int del) } } - if (count == 0) { + if (del && count == 0) { ok = 0; } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e1163fd3207..9a0578fe220 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -671,6 +671,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) Sequence *seqn = NULL; bool skip_dup = false; + /* Unlike soft-cut, it's important to use the same value for both strips. */ + const bool is_end_exact = ((seq->start + seq->len) == cutframe); + /* backup values */ ts.start = seq->start; ts.machine = seq->machine; @@ -683,7 +686,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) ts.anim_startofs = seq->anim_startofs; ts.anim_endofs = seq->anim_endofs; ts.len = seq->len; - + /* First Strip! */ /* strips with extended stillfames before */ @@ -695,6 +698,8 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) BKE_sequence_calc(scene, seq); } + /* Important to offset the start when 'cutframe == seq->start' + * because we need at least one frame of content after start/end still have clipped it. */ if ((seq->startstill) && (cutframe <= seq->start)) { /* don't do funny things with METAs ... */ if (seq->type == SEQ_TYPE_META) { @@ -709,13 +714,15 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) } } /* normal strip */ - else if ((cutframe >= seq->start) && (cutframe < (seq->start + seq->len))) { + else if ((is_end_exact == false) && + ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len)))) + { seq->endofs = 0; seq->endstill = 0; seq->anim_endofs += (seq->start + seq->len) - cutframe; } /* strips with extended stillframes after */ - else if (((seq->start + seq->len) == cutframe) || + else if ((is_end_exact == true) || (((seq->start + seq->len) < cutframe) && (seq->endstill))) { seq->endstill -= seq->enddisp - cutframe; @@ -735,7 +742,11 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) if (seqn) { seqn->flag |= SELECT; - + + /* Important not to re-assign this (unlike soft-cut) */ +#if 0 + is_end_exact = ((seqn->start + seqn->len) == cutframe); +#endif /* Second Strip! */ /* strips with extended stillframes before */ if ((seqn->startstill) && (cutframe == seqn->start + 1)) { @@ -744,9 +755,11 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } - + /* normal strip */ - else if ((cutframe >= seqn->start) && (cutframe < (seqn->start + seqn->len))) { + else if ((is_end_exact == false) && + ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len)))) + { seqn->start = cutframe; seqn->startstill = 0; seqn->startofs = 0; @@ -755,9 +768,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } - + /* strips with extended stillframes after */ - else if (((seqn->start + seqn->len) == cutframe) || + else if ((is_end_exact == true) || (((seqn->start + seqn->len) < cutframe) && (seqn->endstill))) { seqn->start = cutframe; @@ -766,7 +779,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->endstill = ts.enddisp - cutframe - 1; seqn->startstill = 0; } - + BKE_sequence_reload_new_file(scene, seqn, false); BKE_sequence_calc(scene, seqn); } @@ -779,6 +792,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) Sequence *seqn = NULL; bool skip_dup = false; + bool is_end_exact = ((seq->start + seq->len) == cutframe); + /* backup values */ ts.start = seq->start; ts.machine = seq->machine; @@ -791,10 +806,12 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) ts.anim_startofs = seq->anim_startofs; ts.anim_endofs = seq->anim_endofs; ts.len = seq->len; - + /* First Strip! */ /* strips with extended stillfames before */ - + + /* Important to offset the start when 'cutframe == seq->start' + * because we need at least one frame of content after start/end still have clipped it. */ if ((seq->startstill) && (cutframe <= seq->start)) { /* don't do funny things with METAs ... */ if (seq->type == SEQ_TYPE_META) { @@ -809,11 +826,13 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) } } /* normal strip */ - else if ((cutframe >= seq->start) && (cutframe < (seq->start + seq->len))) { + else if ((is_end_exact == false) && + (cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) + { seq->endofs = (seq->start + seq->len) - cutframe; } /* strips with extended stillframes after */ - else if (((seq->start + seq->len) == cutframe) || + else if ((is_end_exact == true) || (((seq->start + seq->len) < cutframe) && (seq->endstill))) { seq->endstill -= seq->enddisp - cutframe; @@ -832,7 +851,9 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) if (seqn) { seqn->flag |= SELECT; - + + is_end_exact = ((seqn->start + seqn->len) == cutframe); + /* Second Strip! */ /* strips with extended stillframes before */ if ((seqn->startstill) && (cutframe == seqn->start + 1)) { @@ -843,15 +864,17 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) } /* normal strip */ - if ((cutframe >= seqn->start) && (cutframe < (seqn->start + seqn->len))) { + else if ((is_end_exact == false) && + (cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) + { seqn->startstill = 0; seqn->startofs = cutframe - ts.start; seqn->endofs = ts.endofs; seqn->endstill = ts.endstill; } - + /* strips with extended stillframes after */ - else if (((seqn->start + seqn->len) == cutframe) || + else if ((is_end_exact == true) || (((seqn->start + seqn->len) < cutframe) && (seqn->endstill))) { seqn->start = cutframe - ts.len + 1; @@ -859,7 +882,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) seqn->endstill = ts.enddisp - cutframe - 1; seqn->startstill = 0; } - + BKE_sequence_calc(scene, seqn); } return seqn; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 1d0fa7a311c..cfd6d0c6db3 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -75,6 +75,7 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { #include "BKE_report.h" #include "BKE_idprop.h" +#include "BKE_movieclip.h" #include "WM_api.h" @@ -1085,6 +1086,13 @@ static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } +static float rna_Sequence_fps_get(PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->id.data; + Sequence *seq = (Sequence *)(ptr->data); + return BKE_sequence_get_fps(scene, seq); +} + #else static void rna_def_strip_element(BlenderRNA *brna) @@ -1840,6 +1848,16 @@ static void rna_def_color_management(StructRNA *srna) RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); } +static void rna_def_movie_types(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "fps", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "FPS", "Frames per second"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_funcs(prop, "rna_Sequence_fps_get", NULL, NULL); +} + static void rna_def_image(BlenderRNA *brna) { StructRNA *srna; @@ -1939,6 +1957,7 @@ static void rna_def_scene(BlenderRNA *brna) rna_def_filter_video(srna); rna_def_proxy(srna); rna_def_input(srna); + rna_def_movie_types(srna); } static void rna_def_movie(BlenderRNA *brna) @@ -1999,6 +2018,7 @@ static void rna_def_movie(BlenderRNA *brna) rna_def_proxy(srna); rna_def_input(srna); rna_def_color_management(srna); + rna_def_movie_types(srna); } static void rna_def_movieclip(BlenderRNA *brna) @@ -2024,6 +2044,7 @@ static void rna_def_movieclip(BlenderRNA *brna) rna_def_filter_video(srna); rna_def_input(srna); + rna_def_movie_types(srna); } static void rna_def_mask(BlenderRNA *brna) |